text stringlengths 454 608k | url stringlengths 17 896 | dump stringclasses 91 values | source stringclasses 1 value | word_count int64 101 114k | flesch_reading_ease float64 50 104 |
|---|---|---|---|---|---|
A paired samples t-test is used to compare the means of two samples when each observation in one sample can be paired with an observation in the other sample.
This tutorial explains how to conduct a paired samples t-test in Python.
Example: Paired Samples T-Test in Python
Suppose we want to know whether a certain study program significantly impacts student performance on a particular exam. To test this, we have 15.
Perform the following steps to conduct a paired samples t-test in Python.
Step 1: Create the data.
First, we’ll create two arrays to hold the pre and post-test scores:
pre = [88, 82, 84, 93, 75, 78, 84, 87, 95, 91, 83, 89, 77, 68, 91] post = [91, 84, 88, 90, 79, 80, 88, 90, 90, 96, 88, 89, 81, 74, 92]
Step 2: Conduct a Paired Samples T-Test.
Next, we’ll use the ttest_rel() function from the scipy.stats library to conduct a paired samples t-test, which uses the following syntax:
ttest_rel(a, b)
where:
- a: an array of sample observations from group 1
- b: an array of sample observations from group 2
Here’s how to use this function in our specific example:
import scipy.stats as stats #perform the paired samples t-test stats.ttest_rel(pre, post) (statistic=-2.9732, pvalue=0.0101)
The test statistic is -2.9732 and the corresponding two-sided p-value is 0.0101.
Step 3: Interpret the results.
In this example, the paired samples t-test uses the following null and alternative hypotheses:
H0: The mean pre-test and post-test scores are equal
HA:The mean pre-test and post-test scores are not equal
Since the p-value (0.0101) is less than 0.05, we reject the null hypothesis. We have sufficient evidence to say that the true mean test score is different for students before and after participating in the study program. | https://www.statology.org/paired-samples-t-test-python/ | CC-MAIN-2022-21 | refinedweb | 323 | 72.05 |
16.2.
Conventional Ignition Systems
The jump-spark system used today in the internal combustion engine has been gradually developed through the stages of hot wire, break spark trembler coil, with each step showing a
definite improvement over its predecessor. The two jump-spark ignition generator systems in use today are the battery-coil and the magneto, the latter is confined mainly to the small engines used on motor cycles and lawn mowers.
16.2.1.
Coil-ignition System
In 1908 the battery-inductive ignition system was introduced by C.F. Kettering of Delco, but only in the mid 1920s it could achieve its commercial status as a successor to the magneto. Up to that time very few vehicles used a battery, hence the magneto was common being a self-contained ignition generator. With the introduction of electric lighting, use of a battery becomes necessary. Because of this as well as the difficulty in starting of the magneto-ignited engine, the battery inductive system commonly known as coil ignition was introduced.
Conventional Coil-ignition Circuits.
The circuit shown in Fig. 16.1 is for a coil-ignition system with main components. The heart of the system is the ignition coil, which transforms the low-tension (LT), 12 V supply given by the battery to the high-tension (HT) with voltage needed to produce a spark at the spark plug.
Fig. 16.1. Coil ignition system.
The coil has primary and secondary windings forming two complete circuits that make up the complete system. Primary, the LT circuit, is supplied by the battery and secondary, the HT circuit incorporates the distributor and spark plugs. The end of the secondary winding in the coil is earthed, which is achieved by connecting the winding either to the LT coil terminal (normally the negative) or to an additional coil terminal that is linked by an external cable to earth. The latter arrangement of coil is called an insulated return (IR) coil to distinguish it from the common earth return (ER) type and is needed on a vehicle using IR system.
The contact breaker interrupts the primary DC current to induce the HT voltage into the secondary winding at the instant the spark is required. To obtain the precise timing of the spark the break in the primary circuit is required to be sudden, and to avoid arcing at this critical stage a capacitor is installed ‘across’ the contact breaker.
The operation of a coil-ignition system is based on the principles of mutual induction and the transformer action. When both the ignition switch and contact breaker are closed, a current of about 3 A flows through the primary winding of the coil creating a strong magnetic flux around
the winding. The contact breaker is opened at the appropriate time by a cam driven at the speed of the engine camshaft, i.e. half crankshaft speed. This breakage of the primary circuit causes a sudden collapse of the magnetic flux in the coil and induces an emf into the secondary winding, which has about 60 times as many turns as the primary winding. The transformer action, combined with the effect of the self-induced voltage in the primary, steps-up the voltage to that required to produce a spark at the plug. However, with the increase in the secondary voltage there is a proportional decrease in the current.
The secondary winding is connected to the negative LT coil terminal, due to which the primary and secondary windings are arranged in series. This connection is called the auto-transformer connection, which adds the self-induced emf in the primary to the mutually induced emf in the secondary providing a higher output.
In a single-cylinder engine, a highly insulated lead is used to convey the HT current directly to the spark plug. But, a distributor is necessary in a multi-cylinder engine to allocate the HT current to the appropriate spark plug. The distributor is a HT rotary switch comprising of a distributor and a rotor arm, rotating at camshaft speed. The plug leads are connected to brass electrodes in the cap maintaining the firing order of the cylinders. A lead from the coil tower makes contact with a carbon brush that rubs on a brass blade forming part of the rotor arm. An automatic advance mechanism, installed adjacent to the contactor breaker, alters the timing of the spark to suit the engine speed and load. It alters the spark timing by moving both the cam and the base plate on which the contact breaker is mounted. The unit, called ignition distributor incorporates the distributor, contact breaker and automatic advance mechanism.
16.2.2.
Components of Coil-ignition Ignition Coil.
The ignition coil (Fig. 16.2) is termed a pulse generator as it delivers an HT output only when a spark is required. The coil contains at the centre a laminated iron core around which a secondary winding of about 20,000 turns of thin enameled wire of 0.06 mm diameter is wound. Over this winding is placed the primary winding, which is separated from it by layers of varnished paper. For a 12 V system the primary winding is consisted of about 350 turns of enamel-covered wire of diameter 0.5 mm. The varnished paper is placed between each layer of wire to improve the insulation.
To localise the magnetic flux a slotted iron sheath is placed inside the aluminium case and the winding assembly is separated from the case by a porcelain insulator support and a plastics-moulded, air-sealed cover. LT terminals in the cover are connected to the
ends of the primary winding. The secondary winding is connected to the coil tower which is placed remotely from the LT terminals. This minimizes the risk of the HT current flashing-over to earth or tracking across the cover during presence of moisture.
Fig. 16.2. Coil construction.
Flash-over is caused when the voltage required for the HT current to jump-to-earth outside the cylinder is lower than the voltage needed to produce a spark in the cylinder. Tracking occurs when the HT current takes an alternative path to earth over the surface of an insulator instead of sparking at the plug. Tracking burns the surface and leaves a deposit, which acts as a conductor. The insulator surfaces should be nonporous to avoid tracking.
Normally the windings of the coils are immersed in oil. This improves insulation, overcomes the corona effect (faint glow of light around the coil) and reduces moisture problems. Also, the presence of oil improves cooling of the primary winding.
Fig. 16.3. Contact breaker assembly.
Contact Breaker.
The contact breaker is a cam-actuated switch, which triggers the signal when an HT impulse is required for the spark plug. Since the cam revolves at half crankshaft speed, all cylinders are fired in one revolution of the cam. For 4-stroke engine, the numbers of lobes on the cam are same as the number of cylinders. The layout of a contact breaker assembly for a 4-cylinder, 4-stroke engine is shown in Fig. 16.3. The two contacts, or points, are made of tungsten-steel alloy to resist the electrical burning action. One of the contacts is attached to the base plate and the other is fixed to a plastics block that rubs on the cam face. A strip spring of stainless steel pushes the heel of the block firmly on to the cam, holds the contacts closed when the heel is free from the cam lobe and also acts as a conductor for the flow of current.
The cam in the figure is positioned at a point where the contacts are just opening representing the instant when the spark occurs. Further rotation of the cam opens the contacts wider making the gap the greatest; a typical gap is 0.38 mm, which can be checked with a feeler gauge. An alteration to the contact gap changes the sparking timing. A smaller gap causes the cam to strike the contact heel later so the spark is retarded.
After a long service of a contact breaker it is observed that the metal from one contact has vaporised and been transferred to the other contact as shown in Fig. 16.4. The crater normally occurs on the positive side, which is reversed when a smaller capacitor has been used. Electrical burning blackens the contact face forming an oxide, which is resistant to current. When the contacts reach this stage they require replacement.
Various methods are incorporated to overcome the crater and burning problems. One method uses a contact on the positive side, having a hold formed in the centre. Another method uses a sliding contact (Fig. 16.5) where the operational movement of the base plate makes smaller contact to move across the other contact. This wiping action has cleaning effect. This design reduces the pitting of the contact and increases its life to 40,000 Km.
Fig. 16.4. Pitting and piling of contacts.
Fig. 16.5. Sliding contact type contact breaker.
Dwell.
The angle formed during the closed-open period is called the phase angle or firing angle and is given by 360/ (number of cylinders). Therefore for a 4-cylinder engine this angle is 90 degrees (Fig. 16.6), a 6-cylider engine has an angle of 60 degrees, and an 8-cylinder 45 degrees.
The dwell angle (or cam angle) is the angle moved by the cam during the contact-closed period. A dwell meter is used to measure the angle more accurately as this method takes the reading during running of the engine. For obtaining correct dwell angle, the contact gap measurement (in mm) should be within the specified limits. However, this does not hold well when the unit
is worn. The increase in contact gap decreases the dwell angle which advances the ignition by a similar amount. For example reducing the dwell angle, from 54 degrees to 51 degrees advances the ignition by 3 degrees. A typical dwell angle for a 4-cylinder engine is 54±5 degrees, i.e. 49-59 degrees. The duel angle depends on the type of distributor and the number of engine cylinders. The affect of dwell on the ignition timing requires that the dwell on each cam lobe should be equal, otherwise due to the timing variation between cylinders the engine runs erratically. The dwell is also stated as percentage dwell where the dwell angle is related to the phase angle and is calculated as:
Percentage dwell = (dwell angle /phase angle) x 100
A dwell angle of 54 degrees for a 4-cylinder engine has a percentage dwell of (54/90 x 100 = ) 60%. This means that the contacts are closed for 60 % and open for 40% during the phase in which the spark for one cylinder is being produced. Contact gap and dwell are interrelated. A larger gap causes the contacts to open earlier, thereby producing a shorter dwell. Therefore, dwell-angle alteration changes the spark timing. A dwell angle change from 54 to 59 degrees causes the spark to occur 5 degrees later.
Capacitor.
The capacitor minimizes arcing and hence speeds up the collapse of the magnetic flux. As the cam is rotated with capacitor disconnected severe arcing takes places at the contacts. If the contacts are opened, an induced emf of over 400 V is generated in the primary circuit, which causes a spark to jump across the contacts as they initially part. Due to the passage of this induced current, in the form of a spark across the contacts, a gradual fall in the primary current takes place instead of a sudden fall. This arcing affects the speed of collapse of the magnetic
flux, and quickly destroys the surface of the contacts.
A capacitor acts as a buffer device in an ignition circuit. The capacitor provides an alternative path for the surge current when the contacts have just parted. Instead of jumping the small contact gap, the current flows into the capacitor charging it up. After a fraction of a second the capacitor discharges, but by this time the contact gap is too wide for the spark to jump across.
The capacitor connected in parallel with the contact breaker and is placed close to the breaker to minimize inductance and resistance of the lead. A cylindrical type
Fig. 16.6. Dwell angle.
Fig. 16.7. Capacitor.
capacitor is commonly used with a coil-ignition system (Fig. 16.7) and has a typical capacity of about 0.2u F. It uses two rolled up sheets of metallized paper separated from each other by a dielectric insulator. One sheet is joined to the earthed aluminium alloy container and the other to an insulated terminal, attached to a ‘pig tail’.
Automatic Advance Mechanism.
Precise timing of the spark provides maximum power and economy. Incorrect timing of the spark in relation to the piston position gives rise to problems like overheating, pinking, piston damage and exhaust pollution. To overcome these problems the spark timing should allow the maximum cylinder pressure to always occur about 12 degrees after TDC. A certain time elapses between the production of the spark and maximum cylinder pressure. For the particular engine this time depends on the air-fuel ratio and the compression pressure, the latter however is governed by the throttle opening.
Timing the Spark to Suit the Speed. Even if it is possible to time the spark to give the required pressure at the correct instant considering only the pressure and mixture quality, but this timing is only suitable for one particular speed. At a faster speed, the crankshaft moves through a larger angle during the burn time, requiring the spark to occur earlier, that means the ignition has to be advanced.
For the spark advance requirement of the engine in Fig. 16.8A the burn-time is 0.004 second, and hence at 1000 rpm the spark timing is 10 degrees before TDC and maximum pressure is at 12 degrees after TDC. After this speed the total burning period is 22 degrees. Figure 16.8B represents the spark timing for a speed of 2000 rpm. Assuming the burn-time is constant at 0.004 second, the angle moved by the crankshaft and the spark advance is as follows :
In practice the burn-time does not remain constant, and taking the variation into account, a spark advance requirement is shown in Fig. 16.8C.
One type of speed sensitive-centrifugal advance mechanism is presented in Fig. 16.9. The basic principle of operation is the same for all other types of construction. The rolling contact type of arrangement shown in the figure uses two flyweights, pivoted to a base plate, which is driven by the distributor spindle. A contoured face on the driving side of each flyweight acts against the cam plate on to which the contact breaker cam is secured. This cam only bears on the drive spindle and is driven through the flyweights. Two tension springs are located between the base plate and the cam plate, which hold the cam plate firmly against the flyweights. The strength of the springs controls the movement of the flyweights relative to the centrifugal force developed at a given speed.
Fig. 16.8. Ignition advance. A. 1000 rpm. B. 2000 rpm. C. Ignition advance requirement.
Fig. 16.9. Speed-sensitive centrifugal advance mechanism.
As the flyweights move outwards with the increase of engine speed, the cam plate is also moved forward in relation to the base plate causing the cam to open the points earlier. This action gives a progressive advance to match the increase in speed until the full travel of the flyweight is reached. Alteration of either the spring strength or the contour of the flyweight changes the angle of advance for a given speed. Figure 16.10 represents the relationship between advance and speed. For a typical mechanical advance mechanism the maximum advance is about 46 crankshaft degrees.
Some advance mechanisms use unequal strength springs as shown in Fig. 16.11. The strong spring is slack on its post while the weaker spring is under tension. The weaker spring only resists outward movement of the flyweights up to an engine speed of about 1000 rpm. Above
this speed both springs work together. This type of construction provides a large rate of advance up to 1000 rpm and a smaller rate of advance beyond this speed.
Fig. 16.10. Typical advance provided by centrifugal advance mechanism.
Fig. 16.11. Centrifugal advance unit with springs of unequal strength.
Timing the Spark to Suit the Load. To improve economy some carburettors supply a slightly weak mixture to the engine under light load operation, when the vehicle is ‘cruising1. To compensate for the slow burning of a weak mixture, extra advance of the spark is needed. The depression in the induction manifold varies with the load on the engine. At light load the depression is high and under heavy load, the depression is very low so that the pressure is just below atmospheric. Therefore, the manifold depression is used by the advance mechanism and carburettor to sense the cruise condition. Manifold depression, or the common term ‘vacuum’ (but technically incorrect) operates a spring loaded diaphragm to control the timing of the spark.
A typical vacuum advance unit, capable of giving an advance of about 13 crankshaft degrees, is shown in Fig. 16.12. The diaphragm chamber of this unit is installed on the side of the distributor unit and is connected with the induction manifold through a rubber hose. A small vent of the non-vacuum side of the diaphragm is open to the atmosphere. The diaphragm is connected to the contact-breaker base plate through a linkage. To advance the spark the base plate is moved in a direction opposite to cam rotation, so that the contact breaker heel is moved towards the cam lobe.
Fig. 16.12. Operation of vacuum control.
The vacuum advance unit should not provide advance during engine idling even though the manifold depression is very high. To achieve this vacuum pipe is connected to the carburettor in the vicinity of the throttle. At idling the throttle is nearly closed, so the manifold depression cannot act on the advance unit (Fig. 16.13).
Fig. 16.13. Vacuum pipe connection. A. Cruising (light load) condition. B. Slow running condition.
At small throttle openings, maximum depression acts on the diaphragm, causing a pressure difference on the diaphragm that moves it against the resistance of the spring and advances the ignition. At other throttle openings, the reduced depression provides an advance to suit the cylinder conditions. At cruising speed, a sudden opening of the throttle immediately destroys the manifold depression. This is desirable because the vacuum advance retards the ignition and counteracts the tendency for the engine to pink under these heavy load conditions. Figure 16.14 shows the advance provided by the vacuum advance unit. The spark delay / sustain valve and the dual-diaphragm unit are the two additions out of the many, introduced on a basic vacuum advance system to meet the exhaust emission regulations.
Fig. 16.14. Typical advance given by vacuum advance unit.
Spark Delay/Sustain Valve.
This dual-purpose valve can be installed in one of two ways of suit a given engine. Figure 16.15 diagrammatically shows a oneway valve and a by-pass bleed orifice. The unit is fitted in the rubber pipe between the vacuum advance unit and the carburettor.
When pipe A, shown in the diagram, is joined to the carburettor the device works as a spark delay valve, which improves driveability and reduces emissions by delaying the full ignition advance until the air-fuel mixture has stabilized. On some cars the
Fig. 16.15. Spark delay valve.
device is called a spark control system. When pipe B is connected to the carburettor the device acts as spark sustain valve, which maintains vacuum advance for a short time after the throttle has been operated. Although the valve has little effect on the performance of a warm engine, but it provides a considerable improvement in driveability when the engine is cold. Thus the valve is fitted to perform in the desired manner.
Duel-diaphragm Vacuum Control.
This control system provides an improvement in exhaust emission as it causes extra retardation during engine deceleration with a closed throttle and also during idling. Emission at the idling speed is improved by setting the throttle to open wider than normal and then dual diaphragm retards the ignition in order to offset the increase in speed. The unit (Fig. 16.16A) uses a second diaphragm to control the stop, which limits the retardation movement of the first diaphragm. Manifold pressure is used to sense the idling condition and for this purpose rubber pipe connects a point, far away from the carburettor throttle in the manifold, with the second diaphragm chamber.
During engine idling, the high depression acting on the second diaphragm moves the top to the left (Fig. 16.16B). In this position manifold depression does not act on the main diaphragm and hence the primary return spring holds the primary diaphragm against the movable stop, which is set to obtain extra retardation of the spark. Figure 16.16C represents the diaphragm position indicating the throttle opening more than one quarter. In this position, the primary diaphragm provides maximum advance.
Fig. 16.16. Duel diaphragm vacuum control. A. The control system. B. Engine idling.
C. Part load. D. Full load.
Figure 16.16D shows the throttle in full open condition and a low depression acts in both chambers where both diaphragms are in the returned position. A strong secondary spring pushes the movable stop to the right. If this position is maintained the primary diaphragm advances the spark compared with the idling-timing. However, the centrifugal advance system provides the main control as the engine speed is high.
Rotor and Distributor Cap.
When the cylinder is set for firing, the spark plugs of a multi-cylinder engine are connected to the secondary winding of the coil. The distributor performs this job through a revolving rotor arm, which transmits the HT impulse to the appropriate fixed electrodes in the cap. Once the rotor arm tip is adjacent to the cap electrode, a spark jumps across the small air gap caused by the HT voltage. To convey the current to the spark plugs each electrode is connected to a highly-insulated cable.
A plan view of the distributor layout is shown in Fig. 16.17. The rotor arm is a press fit on a boss formed on the contact breaker cam. A positive drive is achieved at half crankshaft speed by engaging a projection of the rotor with a slot in the driving boss. A spring-loaded carbon brush or a strip spring fixed to the rotor arm makes the electrical contact between the centre king-lead terminal and the brass blade.
On some designs of rotor arms, the electrode end of the blade is projected towards the next electrode in the direction of rotation. This arrangement reduces the risk of the
engine running backwards. If the crankshaft starts to move backwards, the rotor provides the HT current to a plug of a cylinder whose piston is situated in the region of BDC instead of the firing position.
The distributor cap is made of a brittle, anti-tracking, phenolic material, moulded around the fixed electrodes and cable connections. The cap is normally secured with the help of quick-action spring clips with a provision to prevent entry of dust and water. Since the corrosive gases nitric oxide and ozone are produced during sparking, some form of ventilation or shielding is incorporated to prevent the damage to metal surfaces by the gases.
Ignition Distributor.
A distributor (Fig. 16.18A) houses the contact breaker, mechanical and vacuum advance mechanisms and the actual HT distributor. The shaft is supported in two sintered-iron bearings and the drive from the camshaft, at half crankshaft speed, is transmitted by a helical skew gear or by an offset male dog (Fig. 16.18B). The distributor is fixed to the engine by a plate and clamp, clamp bolt or body flange. The distributor has a provision to rotate its body partly for adjusting timing and the rotation against the direction of rotation advances the ignition.
Fig. 16.17. Distributor in plan view.
Fig. 16.18. Distributor and drives. A. Distributor. B. Drives.
High-tension Cable.
In the past, a rubber covered, multi-strand, copper lead was commonly used as HT cable. In recent time PVC is used in place of rubber, as this provides better protection from oil and water but is less effective than rubber for high temperatures operation. Whatever material is used, care is taken to prevent the shorting of HT current to earth.
Each lead should be kept clear of all low voltage cables and other HT leads to prevent problems due to mutual induction. Any leakage path reduces the voltage applied to the spark plug, which may produce cold-starting difficulties. Also moisture can create troubles if the leads are porous or when water comes into contact with the coil, distributor cap or spark plugs. In these cases an aerosol-applied silicon is sprayed for dispersing moisture as well as for sealing against moisture.
Radio-frequency energy, produced from a metallic HT cable of an ignition system, causes serious interferences to television and radio receivers even when they are placed at a considerable distance from the vehicle: Legislation limits this interference, and this is met by increasing the electrical resistance of the HT circuit at the cost of reduction of the capacity current that discharges each time a plug fires. This high resistance is obtained by using a special suppression cable for all HT leads. This special cable contains a core of graphite-impregnated, stranded and woven rayon or silk, which is insulated by a PVC, or Neoprene covering. Special connectors join the non-metallic cable core to the terminal of the component. The resistance of a typical cable is about 13000 – 26000 Q per metre. The cable resistance is maintained within the limits recommended to eliminate its effect on engine performance. Also by limiting the discharge current, the chance of burning of the distributor and spark plug electrode is reduced.
Ballast Resistor.
A ballast resistor fitted in the primary circuit improves cold starting and reduces the variation in coil output with respect to speed.
Cold-start Ballast Resistor.
The drop in a battery p.d., which occurs when an engine is cranked on a cold morning, lowers the coil voltage below that needed to produce a spark at the plug. A low voltage applied to a coil during operation of the starting motor is felt in a number of ways. In one case the engine does not start while the starting motor is operating, but it starts easily when it is bump started. Similarly, some engines do not start until the starter switch is released where the momentum of the crankshaft gives sufficient movement for the engine to fire. These situations however are not frequent nowadays. Beyond a period of about 5 seconds, the voltage output from many batteries falls considerably. On the other hand if the starter switch is released after a short time and is not re-applied for a few seconds, the battery then has a chance to recover.
Many cold starting problems have been overcome by using a ballast resistor, or a resistive cable between the battery and the ignition coil. In Fig. 16.19 a ballast resistor of 2 Q is connected in series with the ignition switch and a 7.5 V coil. With a 2.25 A current flow in the circuit the voltage drop across the resistor is 4.5 V. By designing a coil to suit the voltage of the ballast resistor used, the secondary output is kept within the limits required by the engine.
The cold starting of the engine is further improved by using an extra cable in parallel with the ballast resistor. The ends of this cable are connected to an additional terminal on the starter solenoid switch and the ignition coil. With the operation of the starter, solenoid coil receives the current, which by-passes the ballast resistor, so that full battery voltage, even though it may be only 10 V at this time, is applied to the coil.
Fig. 16.19. Cold start ballast resistor.
Fig. 16.20. Growth time for primary circuit.
Output Control Ballast Resistor.
Comparatively longer time is required for the primary current to build up to its maximum after the contact breaker has closed. Figure 16.20 presents the growth time for a typical ignition coil. A time of about 0.01 second is required, in this case, before the maximum primary current is attained.
When the contact breaker closes the current flow starts which continues to build up during the dwell period. Although the dwell angle is required to remain constant with speed, the dwell
time in seconds shortens. When the dwell time is less than about 0.01 second for this coil, the primary current is no longer capable of reaching its maximum; as a result the output from the coil gradually falls with increase in speed beyond this point.
Figure 16.21 presents the variation in dwell time for 4-and 6-cylinder engines. Once the dwell time for a particular speed and engine is obtained from this graph, it is possible to determine the primary current at that speed using Fig. 16.20. These graphs indicate that with increase in speed, an engine with 6 or more cylinders suffers a gradual fall-off in coil output. An output control ballast resistor, if installed in series with the primary circuit, compensates for this variation in output.
Due to a high temperature coefficient of the iron-wire resistor, the hot resistance is about three times of the cold resistance. Since the temperature of the resistor depends on the current passing through it, the long dwell time causes the resistor to run hot when the engine is running at a low speed. As a result, the average current in the primary decreases so that the coil runs cooler and also the spark erosion due to high voltage is reduced. Also, the normal drop in primary current as the engine speed is increased permits the ballast resistor to run cooler. This causes reduction in its resistance value and as a result increases the primary current to offset the fall-off due to speed. This type ballast resistor has a cold value of about 0.25 Q.. The resistor can be installed either internally in the coil or externally in the circuit.
Low Inductance Ignition Coil.
The coil’s self-inductance limits the current growth in the primary winding of a coil. As the primary current gradually increases, self-inductance in the winding produces back emf which opposes any change in the current. This opposition to current growth also increases with the increase in the number of turns on the primary winding.
Engines with a large number of cylinders, especially 8-cylinder unit, need a coil capable of producing a quicker growth than conventional coil. Therefore, these engines use a high output coil, called a low inductance coil. As the primary winding of a low inductance coil has fewer turns, the wire is shorter in length due to which the current of about three times as great flows when the engine is stalled. Consequently the erosion wear, on a conventional contact breaker is high. As a result high current and hence the low inductance coil is often used in a transistorized breaker system.
Twin Contact Breaker.
Twin compact breakers are used to improve the short dwell time associated with high speed operation of 8-cylinder engines. This system reduces the breaking time of the primary circuit
ENGINE SPEED. RPM
Fig. 16.21. Variation in dwell time.
because it provides one set of contacts to make the circuit immediately after the spark has occurred.
Figure 16.22 illustrates a twin contact arrangement where the contact set A is connected in parallel with contact set B. Therefore, the circuit is interrupted only when both contacts are opened simultaneously. Once the contact set A opens to provide a spark at the plug, the other set closes to build up of the primary current. The twin contact arrangement has become obsolete due to the introduction of transistorized system.
16.2.3.
Magneto Ignition
A magneto is a self-contained unit capable of generating its own electricity and steps up the voltage to provide a spark at the plug at the correct time. It does not use a battery. The voltage output improves with the rise of the engine speed. These are two advantages of a magneto over a coil ignition system. The main disadvantage of this system is its low performance at cranking speed due to which the coil ignition system has become universal for cars. The magneto, however, is still in use with small engines such as motor cycles, mowers etc.
Rotating Magnet Magneto.
Small engines have incorporated this type of magneto due to the availability of permanent magnets with improved magnetic materials. A flywheel magneto uses the magnet, cast into a non-ferrous flywheel, and is classified as a rotating magnet type, the basic construction of which is shown in Fig. 16.23. In this design a laminated soft-iron armature contains the coil windings, and is stationary. A cam formed on the flywheel hub operates a contact breaker.
During the rotation of the magnet with the flywheel, an alternating magnetic flux passes through the armature. Since the primary coil is wound on this armature, a current is induced into the coil every time a change occurs in the magnetic flux. Movement of the magnet across the complete armature provides a full reversal of the flux, which gives rise to an alternating current that peaks every time the flux reversal occurs.
After the generation of its own primary current, the magneto transforms the low voltage to a voltage sufficient to produce a spark at the plug. For achieving this the circuit (Fig. 16.24) contains a contact breaker and two windings, a primary and a secondary, interconnected similar to that used in a coil ignition circuit but without battery. A capacitor in the circuit speeds up the collapse of the magnetic flux by reducing arcing at the contacts. The contact breaker is kept closed during the building up of the primary current to its maximum. The contact breaker is opened just before the primary starts to fall in order to build up in the other direction. This interruption mutually induces a high voltage into the secondary winding, which is connected to the spark plug.
Fig. 16.22. Twin contact breakers.
Fig. 16.23. Rotating magnet magneto.
Many magnetos incorporate a safety spark-gap to protect the insulation of the magneto coil when either a plug lead becomes disconnected or the HT is open-circuited.
Fig. 16.24. Circuit of magneto.
| http://what-when-how.com/automobile/conventional-ignition-systems-automobile/ | CC-MAIN-2014-15 | refinedweb | 5,863 | 61.97 |
Ctrl+P
vscode-ts-tex is a vs code plugin for ts-tex. It acts as the intermediary layer between the ts-tex language service and vscode.
ts-tex is a thin layer over the typescript compiler api that provides you with the ability to execute typescript functions out of your latex (or actually any) document and receive language services (intellisense) during writing.
PLEASE NOTE: to activate ts-tex syntax highlighting for your .{tex,latex} files, you might have to choose tex (.tex) from the list of languages on the bottom right pane in vscode or configure the file-association permanently in settings.json.
I also maintain a repository for useful ts-tex modules. If you find any of them useful, feel free to use them or you can use them as a learning resource for ts-tex.
Currently the target group for ts-tex would be developers who like to write LaTeX but are fed up with it's lack of language services and it's complex and inconsistent interface or people who like to write typesafe macros. In the long run (iff anybody uses this) there could be a lot of ts-tex modules and ts-tex could be an easier interface to learn than LaTeX.
This extension is in early developement stage so please look at section Limitations to review current issues and not supported use-cases. vscode-ts-tex can also be used together with LaTeX-Workshop to get additional language services for the normal LaTeX part of your documents.
Syntax highlighting
i.e. latex highlighting combined with typescript highlighting in your .tex documents. In order for syntax highlighting to work you have to have an extension like LaTeX-Workshop that already defines a .tex grammar. The additions are then injected into the existing grammar.
Diagnostics
Full typescript diagnostics for typescript function calls are provided in the document. ts-tex uses the typescript compiler api internally, so the diagnostics are no different from writing a normal typescript file.
Completion items
Completion items are provided on characters [."]
Signature helps
Signature helps are provided for typescript function calls.
Hovers
Hovering on a typescript function call in your tex document will evaluate the call and display it's result
Definition provider
Upon pressing F12 on typescript function calls in your document, you can jump to the file where your function is defined.
Commands
Commands can be accessed by pressing ctrl+shift+p
Updates
All .{tex,latex} file indices are updated during editing and diagnostics are updated on the fly. TS Code files (tstex_modules/**/*.ts) are currently more expensive to update, so they are only updated on save. The extension will also keep track of newly created or deleted document or code files.
Configurations
Please look at the Contributes page to find descriptions of the configuration parameters.
To activate the extension open a folder in vscode and navigate to a *.{tex,latex} file. Please note that atm workspaces with multiple folders are not supported.
All *.{tex,latex} files in this directory and it's subdirectories are loaded. A special directory tstex_modules will be created (if non-existant). In it you can add .ts files, that will be transpiled and added to your scope on each save. Also a _api.ts file will be created. This file should not be edited by the user, as it specifies the api you can use to add functionality that you can access from your document.
In any tstex_modules/**/*.ts file you can create a class that implements IModule defined in _api.ts. Classes that implement IModule will be instantiated and added as a property to your scope. Example:
// ./tstex_modules/mymodule.ts
import { IModule } from "./_api.ts";
export class MyModule implements IModule
{
*createTable(table: string[][])
{
//... do some stuff
yield result;
}
}
Now from your document you can access the functionality of this module by
// ./myLatexDoc.tex
\this.myModule.createTable([["asd"],
["test"]]
);
ts-tex has a custom parser that will differentiate between typescript code and non-typescript code. Just like in latex all function-calls into the typescript domain have to start with "\". Your statement will be executed in the context of a scope class, so you will have to write "this." to access functions of your scope.
To fit with javascript property naming style the property name of your module instance on your scope object wll be camel-cased if necessary. Note that only special classes that extend _api.ts interfaces such as IModule will be transpiled and instantiated. Other code such as defined functions or classes won't be transpiled or executed at any time and are therefore not callable from your document or your module code. Please look at the api for more Details.
The result of your function call will be converted to string in a recursive manner and in the built document the function call will be replaced by this string. String conversion happens with these rules:
Note that by default when building e.g. a file test.tstex will result in a built file .build.test.tstex file. This is due to filenames with a leading . being ignored by vscode-ts-tex's updates. This makes sense, because we don't want to add the build result to the AST as it is not a ts-tex file.
If a function call takes up more than one line in your document but the evaluation results in less lines, ts-tex will add newlines to the result until it matches the line count of the function call. This is useful when compiling your built document with LaTeX the error lines of the built document will match the lines of your document. Because of this I recommend the convention to always yield single line strings out of function calls. This makes sure that your function calls and function results in the built document and working document are always aligned!
When implementing IModule from your custom module class you can implement the following functions:
_init(resolver: IResolver)
_finalize()
_prebuild()
_postbuild()
For more Details on how ts-tex works and more advanced operations (e.g. extensible CompletionProvider api) please refer to ts-tex.
For extension output you can check the ts-tex output channel in vscode
Known Bugs
ts-tex runs code from your document. Currently no security concept (like vms) has been implemented. Be cautious when running 3rd party modules, as they are programs and have access to your filesystem! If I see that a lot of people use ts-tex maybe I will look into implementing a sandboxing mechanism of modules.
I'm currently writing this software alone and it's in early developement stage so it will still have bugs.
The following libraries were really helpful for implementing this project | https://marketplace.visualstudio.com/items?itemName=b4ckup.vscode-ts-tex | CC-MAIN-2021-25 | refinedweb | 1,118 | 56.25 |
PROBLEM LINK:
Author: Abhishek Ghosh
Editorialist: Arkita Aggarwal, Shruti Arya
DIFFICULTY
Simple
PREREQUISITES
Basic observation, GCD
PROBLEM
Given an array A consisting of N elements, you need to find the largest number that divides all of them. Minimum outstanding shares will be the sum of this array divided by this maximal number.
QUICK EXPLANATION
- The highest common factor of the values is found and that is the amount to which share prices can be safely increased.
- The number of shares is then divided by the highest common factor and new number of shares owned is found. The sum of the new values found is the value of minimum outstanding shares.
EXPLANATION
Each value of the array is taken and divided by incrementing integers one by one till they reach a minimum value. The highest integer will be the greatest common divisor(GCD). This GCD will be the new stock price to which the share price can be increased safely.
All the values of the array are divided by this GCD and those values will be the new number of stocks each investor now owns.
The new values of this array are added to find the minimum outstanding shares.
Example
Consider the three values in the array as 2, 4 \;and \;6
In this case the total number of boxes is equal to 12 \;(2+4+6)
The greatest common divisor will be 2 so we can merge two boxes to be considered as 1. This merging of 2 boxes into 1, represents the increase in stock price, and consolidation of shares.
Now, the total number of boxes is equal to 6 \;(1+2+3)
TIME COMPLEXITY
GCD of 2 numbers is computed in O(log(max(A_{i}))) time. This is done for N elements of the array, so the complexity is O(N \cdot log(max(A_{i})).
SOLUTIONS
Setter's Solution
#include <bits/stdc++.h> using namespace std; typedef long long ll; int32_t main() { #ifndef ONLINE_JUDGE freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #endif ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int T = 1; cin >> T; while(T--) { int n; cin >> n; vector<int> arr(n); for(int &x : arr) cin >> x; int g = arr[0]; for(int i = 1; i < n; i++) { g = __gcd(g, arr[i]); } ll sum = 0; for(int x : arr) { sum += x/g; } cout << sum << "\n"; } return 0; } | https://discuss.codechef.com/t/revsplit-editorial/102182 | CC-MAIN-2022-33 | refinedweb | 400 | 60.45 |
robert burrell donkin wrote:
> #12997 Call the method as soon as last parameter is encountered
> ---------------------------------------------------------------
> maybe someone (craig did some work on this before) might like to
> evaluate the new patch.
The new patch is just an update to work against the head of the CVS
repository, it still breaks Tomcat 4.1. I'm digging in tomcat's code to
understand what happens here.
>
Emmanuel BOURG ! not Berg ;)
For this bug i think it might work like the innerHTML function in
Javascript (that's the option 3 i exposed), that's a convenient way to
use HTML-like or XML structures as string parameters. Of course a
workaround is to use a <![CDATA[ .. ]]> section or maybe a different
namespace.
Emmanuel
--
To unsubscribe, e-mail: <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org> | http://mail-archives.apache.org/mod_mbox/commons-dev/200211.mbox/%3C3DC6A967.8080106@cross-systems.fr%3E | CC-MAIN-2014-23 | refinedweb | 144 | 64.2 |
Remove build time option to disable svg
RESOLVED FIXED in mozilla2.0b8
Status
People
(Reporter: mounir, Assigned: mounir)
Tracking
Firefox Tracking Flags
(blocking2.0 -)
Details
Attachments
(2 attachments, 2 obsolete attachments)
According to David Baron, tests should not pass if SVG isn't enabled in gecko [1]. So, I think we should consider removing this compilation option considering disabling svg is considered as 'invalid' and having svg enabled should not hurt the user. [1] bug 579351 comment 7
I think this should be raised on mozilla.dev.platform to warn folks this is coming.
Summary: Remove svg compilation option → Remove build time option to disable svg
Assignee: nobody → wesongathedeveloper
Status: NEW → ASSIGNED
Attachment #463983 - Flags: review?(dbaron)
wasn't sure if the #ifdefs all over the place are still needed for other purposes?
In dom/Makefile.in, @@ -61,19 +61,17 @@ DIRS = \ interfaces/xul \ interfaces/storage \ interfaces/json \ interfaces/offline \ interfaces/geolocation \ interfaces/threads \ $(NULL) -ifdef MOZ_SVG DIRS += interfaces/svg -endif could be interfaces/xul \ interfaces/storage \ interfaces/json \ interfaces/offline \ interfaces/geolocation \ interfaces/threads \ + interfaces/svg \ $(NULL) -ifdef MOZ_SVG -DIRS += interfaces/svg -endif (Also, should we kill --disable-mathml as well?)
I think mathml would be a different bug.
(In reply to comment #5) > I think mathml would be a different bug. Yes, certainly. Also, looks like some new ifdefs were added:
Comment on attachment 463983 [details] [diff] [review] Patch >-#if defined(MOZ_SVG) || defined(MOZ_MATHML) >+#if defined(MOZ_MATHML) > GK_ATOM(xor_, "xor") > #endif You should just remove this #ifdef and #endif; otherwise you'll break mathml-disabled builds since SVG code needs this. In layout/build/Makefile.in, could you sort the added line properly within LOCAL_INCLUDES? In layout/build/nsContentDLF.h, could you just put the SVG item into CONTENTDLF_CATEGORIES and remove CONTENTDLF_SVG_CATEGORIES. In nsFrame.cpp: >- * parent. This function is used so that if MOZ_SVG is not defined, we still >- * have unified control paths in the InvalidateInternal chain. >+ * parent. This function is used so that we have unified control paths >+ * in the InvalidateInternal chain for both SVG and regular content. Leave the comment instead, and file a followup bug on removing the function? Same in nsIFrame.h In toolkit-makefiles.sh, could you just add the items to the appropriate layout/content/dom lists rather than making MAKEFILES_svg? r=dbaron with that (It might make sense to land everything except configure.in and autoconf.mk.in first, and then remove those after double-checking that no new MOZ_SVG checks slipped in. But don't leave too long between landing the two either. Then again, landing it all at once is probably fine too.)
Attachment #463983 - Flags: review?(dbaron) → review+
Can we get an updated patch here? Would be nice to get this into 2.0. Shipping broken configure options isn't ideal.
Saint Wesonga, any updates here? (Do you think you'll get a chance to finish this off, or should someone else pick this up? As khuey said, it'd be great to see this make it into Gecko 2.0 / Firefox 4.0!)
Updated patch coming in the next day or two...
khuey: <humor type="wry">That wasn't very nice of you, duping my bug while I was finding out who broke compiling with --disable-svg (bz, bug 584293).</humor>
blocking2.0: --- → ?
> > Leave the comment instead, and file a followup bug on removing the function? > Filed bug 597882.
Attachment #463983 - Attachment is obsolete: true
Attachment #476667 - Flags: review?(dbaron)
Attachment #476667 - Flags: approval2.0?
blocking2.0: ? → -
Comment on attachment 476667 [details] [diff] [review] Patch r=dbaron, although the sorting in layout/build/Makefile.in was better before. I must have meant to comment on a different file.
Attachment #476667 - Flags: review?(dbaron) → review+
At least we should remove the option in the configure.in, shouldn't we? There are no risks and it will prevent users to try building Gecko without SVG support.
This patch is only removing the build option (and keep MOZ_SVG defined and defaulted to 1) so we prevent users to build Gecko with --disable-svg because it will not work but we don't take the risk of taking a huge patch so late in the beta process. The dead code could be removed after branching.
Attachment #490560 - Flags: review?(khuey)
Attachment #490560 - Flags: approval2.0?
Comment on attachment 490560 [details] [diff] [review] Remove the build option only Hardcode MOZ_SVG=1 in autoconf.mk.in too.
Attachment #490560 - Flags: review?(khuey) → review+
Oups, I forgot to refresh the patch. I didn't meant to remove MOZ_SVG from configure.in. In addition, I've added AC_DEFINE(MOZ_SVG) too in case of something depend on it as requested by khuey on IRC. r=khuey
Attachment #490560 - Attachment is obsolete: true
Attachment #490560 - Flags: approval2.0?
Benjamin, I think this patch might be much safer than the previous one: it's only removing the build option and keep MOZ_SVG set to 1. We will be able to remove the dead code after branching.
Pushed: Please use bug 614515 for removing the dead code and the useless conditions.
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla2.0b8
Assignee: wesongathedeveloper → mounir.lamouri
Attachment #490567 - Attachment description: Remove the build option only → Remove the build option only [Checked in: See comment 20]
Product: Core → Firefox Build System | https://bugzilla.mozilla.org/show_bug.cgi?id=585020 | CC-MAIN-2019-26 | refinedweb | 883 | 58.48 |
Money Python: Florida Contest Offers Rewards In 2013 Everglades Python Hunt
samzenpus posted about a year ago | from the badger-badger-badger-badger-mushroom dept.
(1)
Anonymous Coward | about a year ago | (#42236065)
Looks like they're off to meet their makes.
Re:Ex-python (2)
flyneye (84093) | about a year ago | (#42236245)
They're making a flying circus of the whole affair.
Perhaps it would be wise to involve some mens footwear companies both for recycling and my affinity for gaudy expensive boots.
ob Simpson whacking day (0)
Anonymous Coward | about a year ago | (#42236079)
how many Simpsons snake references will there be?!
Re:ob Simpson whacking day (0)
Anonymous Coward | about a year ago | (#42236097)
What's whacking day?
Re:ob Simpson whacking day (1)
craigminah (1885846) | about a year ago | (#42236425)
Re:ob Simpson whacking day (0)
Anonymous Coward | about a year ago | (#42236167)
Re:ob Simpson whacking day (2)
jhoegl (638955) | about a year ago | (#42236235)
I feel dirty already.
Re:ob Simpson whacking day (1)
Dahamma (304068) | about a year ago | (#42236353)
Won't work, the Everglades are too warm. They'd have to find something else to take care of the snake-eating gorillas.
Re:ob Simpson whacking day (0)
Anonymous Coward | about a year ago | (#42236949)
how many Simpsons snake references will there be?!
The snakes will be hunted and eaten by gorillas, and when the winter comes the gorillas will freeze to death.
No one expects the Serpent Expedition! (1)
Anonymous Coward | about a year ago | (#42236155)
Amongst our weaponry are such diverse elements as: fear, surprise, ruthless efficiency, an almost fanatical devotion to the Pope, and nice red uniforms - Oh damn!
Cobra effect (5, Informative)
andy1307 (656570) | about a year ago | (#42236157)
Re:Cobra effect (1)
Ginger Unicorn (952287) | about a year ago | (#42236391):Cobra effect (1)
icebike (68054) | about a year ago | (#42236937) figure out how to deal with your new "indigenous species".
Historically, attempts to control or eradicate invasive populations intentionally or accidentally introduced to areas has met with only marginal success. Introducing predators of Cobras is probably out of the question, The mongoose being the most common predator, but is also a banned species.
Re:Cobra effect (1)
meerling (1487879) | about a year ago | (#42237295)
Re:Cobra effect (0)
Anonymous Coward | about a year ago | (#42236459)
WTF is this news? Was it in the 'What Hicks do in their spare time' section?
Re:Cobra effect (4, Funny)
ColdWetDog (752185) | about a year ago | (#42236745)
WTF is this news? Was it in the 'What Hicks do in their spare time' section?
What are you about? Python is an important, widely used computer language. Of course discussion of it belongs on Slashdot.
Oh. Wait.
Re:Cobra effect (0)
Anonymous Coward | about a year ago | (#42238795)
Wait to the average temperature starts going up along with the sea level. All of a 'sudden' the Everglades will be Miamian's backyard, and pythons will be able to slither up into to Georgia. The only people that will be happy about this will be the Pentecostals. They'll have easier access to bigger snakes, and their, "I told you so's" will take on the ring of truth.
Can't wait.
Re:Cobra effect (3, Informative)
Anonymous Coward | about a year ago | (#42236825).
Re:Cobra effect (1)
rickkw (920898) | about a year ago | (#42236991)
Re:Cobra effect (2)
Chris Mattern (191822) | about a year ago | (#42237339)
Is that where you can't hit anything if you're firing the red lasers?
Re:Cobra effect (0)
Anonymous Coward | about a year ago | (#42237831)
hahahahahaha. how is this not +5 funny.........
I remember one episode where they actually hit something and I was like "OH MY GOD" but they turned out to be dummies and I was like "awww"
Re:Cobra effect (1)
EdIII (1114411) | about a year ago | (#42237375):Cobra effect (1)
thomasw_lrd (1203850) | about a year ago | (#42238227)
I think they eat pythons in foreign countries, and I've heard that rattlesnakes taste pretty good. But it's like everything else. Tastes like chicken.
Re:Cobra effect (1)
zippthorne (748122) | about a year ago | (#42238831)
Everything only tastes like chicken because everyone used to smoke, so no one knew what anything tasted like.
Re:Cobra effect (2)
dreamchaser (49529) | about a year ago | (#42238669):Cobra effect (1)
i.r.id10t (595143) | about a year ago | (#42239057).
Bounty on snake heads is the solution. (2, Interesting)
Anonymous Coward | about a year ago | (#42236165). (4, Informative)
PolygamousRanchKid (1290638) | about a year ago | (#42236343):Bounty on snake heads is the solution. (3, Insightful)
michelcolman (1208008) | about a year ago | (#42236361)
Yeah, introduce a bounty so that people can start breeding them for profit...
Re:Bounty on snake heads is the solution. (2)
khasim (1285) | about a year ago | (#42236603)
And then tax the python farms. You're a genius!
Re:Bounty on snake heads is the solution. (1)
RogL (608926) | about a year ago | (#42236629)
Yeah, introduce a bounty so that people can start breeding them for profit...
Set a bounty low enough it's not worth breeding snakes to collect it.
But it's enough to cover your ammo / lunch / beer costs for a day in the swamp shooting.
Re:Bounty on snake heads is the solution. (1)
Anonymous Coward | about a year ago | (#42236377)
Nope, won't work. People will start breeding them instead because that is more profitable than hunting.
Also those people will have an incentive NOT to solve the problem to keep the money flowing. Guess what the result of that will be.
Re:Bounty on snake heads is the solution. (1)
mikael (484) | about a year ago | (#42236499) (1)
fantomas (94850) | about a year ago | (#42237003):Read the parent (1)
publiclurker (952615) | about a year ago | (#42238801)
Re:Bounty on snake heads is the solution. (1)
Nefarious Wheel (628136) | about a year ago | (#42237809)
"Tax the rat farms."
- Vetinari
The OTHER Python Challenge (2, Interesting)
sorensenbill (1931240) | about a year ago | (#42236171)
Pythons are so incredibly awesome. (5, Informative)
mirix (1649853) | about a year ago | (#42236213). (3, Informative)
Grayhand (2610049) | about a year ago | (#42236519)
Re:Pythons are so incredibly awesome. (1)
Kittenman (971447) | about a year ago | (#42237733):Pythons are so incredibly awesome. (0)
Anonymous Coward | about a year ago | (#42239585)
I feel I should inform you that we have Possums in New Zealand, not Opossums. While they are similar marsupials, they belong to different families. From Wikipedia: "Opossums (colloquially possums) (Didelphimorphia,
/dadlfmrfi/) analogy between species is a good one. There have been multiple bounties offered here over the years, and attempts to establish both fur and meat industries. Due to the colder climate, possums here have started growing thicker coats, and the fur is of good quality. Unfortunately hunters tend to kill possums mostly at forest edges and easy to access locations, meaning they never really make a dent in the population. The only real solution that has been found until this point is [sadly] to drop poisons - principally 1080 (Sodium fluoroacetate) - from the air over many hectares of native bush at a time. This is understandably an unpopular policy, but is largely effective. I think Florida will eventually have to look at taking a similar route if they really want to deal to the pythons.
Re:Pythons are so incredibly awesome. (3, Funny)
turkeydance (1266624) | about a year ago | (#42237247)
Not worth the time and effort (1)
TheNastyInThePasty (2382648) | about a year ago | (#42236243)
Re:Not worth the time and effort (-1)
Anonymous Coward | about a year ago | (#42236309)
Re:Not worth the time and effort (1)
rickkw (920898) | about a year ago | (#42237021)
Re:Not worth the time and effort (0)
Anonymous Coward | about a year ago | (#42237413)
Only if it's your full-time job. Someone could still nab the longest one for $1000, if they hunt more often then it increases the odds. Like gambling with better odds.
Why the fuck is this on slashdot? (0)
Anonymous Coward | about a year ago | (#42236247)
Who the fuck cares anymore.
Must humanely kill them? (0)
Anonymous Coward | about a year ago | (#42236265)
So who is going to determine what this is? Greenpeace? The Animal Rights Coalition? The head has to be attached. I was thinking of blowing it head off at 50 feet.
Re:Must humanely kill them? (0)
Anonymous Coward | about a year ago | (#42237333)
I found their nest.... (4, Funny)
mseeger (40923) | about a year ago | (#42236307) [python.org]
Also very long python there
....
News for nerds? (1)
viperidaenz (2515578) | about a year ago | (#42236321)
Re:News for nerds? (0)
Anonymous Coward | about a year ago | (#42236533)
I thought "Money Python" was a pun on "Monty Python". Of course, that show was partly named after your first reference, and your second is named after the show. But I must admit I had a bug hunt contest in mind when clicking on the story...
Slashdot Challenge (1)
Required Snark (1702878) | about a year ago | (#42236327)
Extra Points for "Profit!"
Re:Slashdot Challenge (0)
Anonymous Coward | about a year ago | (#42236583)
1) Money Python + (Language) Python + Monty Python = A tangled nest of Python sex.
2) More Pythons -> You win the contest.
3) Profit!
I found five dead ones (0)
Anonymous Coward | about a year ago | (#42236333)
#!/usr/bin/python
def main():
raise RuntimeError( 'the python' );
return 0
if __name__ == '__main__':
main()
#!/usr/bin/python
def main():
raise RuntimeError( 'on top of' );
return 0
if __name__ == '__main__':
main()
#!/usr/bin/python
def main():
raise RuntimeError( 'your monitor' );
return 0
if __name__ == '__main__':
main()
#!/usr/bin/python
def main():
raise RuntimeError( 'will explode' );
return 0
if __name__ == '__main__':
main()
#!/usr/bin/python
def main():
raise RuntimeError( 'in five seconds' );
return 0
if __name__ == '__main__':
main()
MF'n Snakes on the MF'n Grassy Plain! (2)
trout007 (975317) | about a year ago | (#42236351)
Said no one.
Re:MF'n Snakes on the MF'n Grassy Plain! (0)
Anonymous Coward | about a year ago | (#42236623)
The everglades is an interesting place. It isn't a swamp in the traditional sense. It even has salt water underneath the fresh water on the surface. Think of a very large and shallow lake. There are sand bars and grasses everywhere, and most of it can be walked through. The shallowness is why we in Florida have Airboat rides. They skim over the surface well, even if they are noisy as hell. Everyone in should go on an Airboat ride once.
Double rewards! (1)
alexgieg (948359) | about a year ago | (#42236365)
And they get double rewards for convincing the captured programmer to start developing in PHP!
Python (1)
todrules (882424) | about a year ago | (#42236371)
My thought exactly (1)
bdwoolman (561635) | about a year ago | (#42236579)
Re:Python (1)
dudpixel (1429789) | about a year ago | (#42238709)
Yep, I started reading the summary and thought "oh goody, a python contest! and there's a prize!....oh wait".
What's wrong with a goldfish? (3, Interesting)
SternisheFan (2529412) | about a year ago | (#42236407)
:What's wrong with a goldfish? (1)
Intrepid imaginaut (1970940) | about a year ago | (#42236427)
Why is it always alligators and never kangaroos or something, it what I want to know.
Re:What's wrong with a goldfish? (1)
MaskedSlacker (911878) | about a year ago | (#42236451)
Good question, since Kangaroos would probably make just as a good a guard animal.
Re:What's wrong with a goldfish? (0)
Anonymous Coward | about a year ago | (#42236559)
There's no point in reporting a story on a kangaroo, it's not interesting.
Re:What's wrong with a goldfish? (0)
Anonymous Coward | about a year ago | (#42236843)
One issue with Kangaroos, assuming you could get one, is that Australia does not have any native cats. So, any animal from there can get sick from bacteria carried in cat feces. Things like that.
Re:What's wrong with a goldfish? (0)
Anonymous Coward | about a year ago | (#42236965)
There's a loose kangaroo in the Oklahoma City area right now.
Re:What's wrong with a goldfish? (1)
Amouth (879122) | about a year ago | (#42237845) [kfor.com]
that's awsome
Re:What's wrong with a goldfish? (1)
kingturkey (930819) | about a year ago | (#42238597):What's wrong with a goldfish? (1)
TapeCutter (624760) | about a year ago | (#42239199)
Re:What's wrong with a goldfish? (1)
Anonymous Coward | about a year ago | (#42236523)
Of the dozen or so people I've met with exotic pets all of them had an IQ a standard deviation or two below the mean.
Re:What's wrong with a goldfish? (1)
ColdWetDog (752185) | about a year ago | (#42236905)
Of the dozen or so people I've met with exotic pets all of them had an IQ a standard deviation or two below the mean.
The pet or the pet owner? A python with an IQ of 66 or so could be pretty impressive.
Whacking Day! (1)
afgam28 (48611) | about a year ago | (#42236497):Whacking Day! (2)
Chewbacon (797801) | about a year ago | (#42237233)
wacking season (simpsons) (0)
Anonymous Coward | about a year ago | (#42236505)
Life imitates art.
How to catch a python? (1)
sugarmotor (621907) | about a year ago | (#42236549)
Re:How to catch a python? (1)
Kittenman (971447) | about a year ago | (#42237737)
mod doWn (-1)
Anonymous Coward | about a year ago | (#42236621)
exotics (1)
kqc7011 (525426) | about a year ago | (#42236659)
Why the hell is a permit needed? (1)
John Hasler (414242) | about a year ago | (#42236675)
Put a bounty on them, or at least let people kill as many as they wish. Requiring a permit to kill something you want to exterminate is stupid. Do you need a license to kill rats in Florida?
Re:Why the hell is a permit needed? (2)
PolygamousRanchKid (1290638) | about a year ago | (#42236841) popular sport in Florida but a useful tool in man's attempt."
I used to think of Florida as a boring Disneyland vacation place. Now it is sounding like an exciting shoot-the-varmints vacation place.
Re:Why the hell is a permit needed? (1)
John Hasler (414242) | about a year ago | (#42238437)? (1)
Monoman (8745) | about a year ago | (#42237665).
...
Tasty! (0)
Anonymous Coward | about a year ago | (#42236777)
I grew up eating rattlers at the county fair, which taste like chicken and aren't bad with Shake and Bake and ketchup. Pythons? Test 'em for mercury. If they pass, they're dinner.
Python hunting (0)
Anonymous Coward | about a year ago | (#42236821)
I had a friend who was a National Park Service Law Enforcement Ranger. He spent about 9 months down in the Everglades a few years back and was issued two shotguns. One was the typical duty shotgun for a cop, the other was set up for "snake hunting" and they were given the orders to KILL all snakes they found. If it was a python/boa constrictor/etc. it was to be shot 2x to make sure it was DEAD.
He told me that the estimates were way off, and that every day he could have gone out doing nothing but killing snakes all day. The snakes breed like crazy there, and can and will destroy the local habitat if not checked. These snakes should surely have a proper disposal plan once people are tired of them, and should not be released into the wild. I say we start a bounty program like what Louisiana has on the Nutria rat. You buy a permit and get x amount per kill. There will always be those that will cheat the system and breed them, in addition to those who will try to game the system as a way to make a living. We just need to plan on that and work around it.
Next up: lion fish! (5, Interesting)
Chewbacon (797801) | about a year ago | (#42237219)
Re:Next up: lion fish! (1)
Monoman (8745) | about a year ago | (#42237679)
Yeah we are even seeing them in brackish waters. I took a speargun shot at some last year but missed. They are definitely gonna keep booming before we get them under control.
Wow (1)
EdIII (1114411) | about a year ago | (#42237403)
I guess I'm the only one who read that as, "Monty Python" Florida Contest Offers Rewards...."
Re:Wow (0)
Anonymous Coward | about a year ago | (#42239627)
You are NOT alone. I thought the same too.
I thought it was something about monty python, and the python language.
Bloodthirsty, fucked up sociopaths of Slashdot... (-1)
Anonymous Coward | about a year ago | (#42237457)
What a bunch of fucked up, emotionally stunted assholes you all are...
"Yearr, kill everything, kill, kill, kill!"
Aren't you just manly and strong, killing animals who can't fight back against your weapons. What a bunch of retarded, gutless cowards you all are.
I wonder how brave you'll be when somebody kills you?
Tell me - when did you CHOOSE to be born a human, and not an animal?
Re:Bloodthirsty, fucked up sociopaths of Slashdot. (2)
youngatheart (1922394) | about a year ago | (#422385, then nobody is going to be blaming the lions, calling them gutless cowards, asking them how brave they're going to be when somebody kills them. They're lions, that's what they do and we're perfectly fine with that.
If anything, it's human hunters that are on the highroad here. We have rules about when and how we're allowed to kill other animals (and each other.) We're at the top of a food chain, and rather than just killing whatever we can, we restrict ourselves. I can't think of any other predator that does that. That's kind of an intelligent thing and telling a bunch of gun toting predators that they have to do things your way kind of takes guts.
So yeah, pretty much the opposite of everything you said. Wait, were you being deliberately ironic? It'd be funny if you'd included something that actually had
... well humor in it.
Interesting plan ... (1)
divec (48748) | about a year ago | (#42237563)
1. Spark a hunting spree that has no hope of eradicating them.
2. Apply selective pressure to breed unhuntable pythons.
3. ???
4. Profit!
Or am I missing something?
Re:Interesting plan ... (1)
John Hasler (414242) | about a year ago | (#42238473)
>:Interesting plan ... (1)
PPH (736903) | about a year ago | (#42238977)
Want a Mega Python? (1)
Culture20 (968837) | about a year ago | (#42237935)
news for nerds? (0)
Anonymous Coward | about a year ago | (#42238903)
China (1)
PPH (736903) | about a year ago | (#42239015)
Spread a rumor that python meat is an aphrodisiac. They'll be extinct in no time.
Why do I need a license to hunt non-native animals (0)
Anonymous Coward | about a year ago | (#42239331)
You don't need a license to set rat traps. Or to throw lampreys you pry off onto the beach. Or to scrub zebra mussels off your docks. It really ought to be open season on any pest species that is disrupting the ecosystem. Pythons and pigs, we ought to cull them as much and as often we can. We may never eradicate them, but we can at least try to keep their populations low. In fact I would argue that a bounty should be offered rather than charging for permits. Might help offset the cost of lead-free bullets when pig hunting.
reply (-1)
Anonymous Coward | about a year ago | (#42239387).
Well you will know when they are serious (0)
Anonymous Coward | about a year ago | (#42239991)
About the python problem when there is a 10.00 dollar reward for each one. and then you will see some real action. | http://beta.slashdot.org/story/178987 | CC-MAIN-2014-15 | refinedweb | 3,283 | 73.47 |
I recently had to work with the WSDL metamodel from Eclipse WTP.
I thought it may be useful to compare it with other WSDL parsing solutions. Notice that I will focus on Java solutions here.
A quick introduction to WSDL
WSDL stands for Web Services Description Language.
It is a W3C specification to describe the interface / contract of a service. A WSDL contract is defined in a *.wsdl file. This file describes the service operations, their input and output parameters, the declaration of services, their reach location and the communication protocol to use to interact with them. A *.wsdl file may import other WSDL and also XML schemas (they contain the type definition of operation parameters).
There are two versions of WSDL that may be worked with: WSDL 1.1 and WSDL 2.0.
Although WSDL 2.0 is conceptually better (in particular because of MEP – Message Exchange Patterns), WSDL 1.1 is the most used. There are very few tools and libraries libraries which support it (Axis 2 supports it, CXF does not, JAX-WS did not plan its support). And it must be said that the two versions are different in the approach and some concepts do not match at all.
And in WSDL 1.1, there are some distinctions, such as the style (document / wrapped, xml-rpc…).
Information about this can be found on the internet.
Parsing solutions
For WSDL 1.1, the most famous solution is WSDL4j.
This library provides an easy (and light!) solution to parse WSDL definitions. Its only limitation in my opinion, is that it is not easy to introspect XML schemas with it.
For WSDL 2.0, there is Apache Woden.
This library allows to parse WSDL (2.0) definitions and to convert WSDL (1.1) definitions to WSDL 2.0 (again, both versions are very different).
Then, there is a more recent project called EasyWSDL.
The versions 1.x and 2.x aimed at providing a single API to parse and edit WSDL 1.1 and WSDL 2.0 definitions. Unfortunately, this API makes an important use of Java generics. However, it is easy to navigate in XML schema with it. The version 3.x is still in incubation but took a very different turn. To simplify the API, and because it was ambiguous, it was decided to separate the API for the various versions of the specification. For the moment, EasyWSDL 3.x only supports WSDL 1.1. The API is much more simple and it is still easy to navigate in XML schemas. Besides, it can execute XPath queries on a macro document (the main document and all the import as a single virtual document). However, it misses some helpers to work with imports (writing XPath queries is not very user-friendly).
Eventually, there is the EMF metamodel for WSDL.
The metamodel is provided by the WTP project at Eclipse. It can only parse WSDL 1.1. In fact, I found out that it relies on and extends WSDL4j. One of the main improvements is that it can introspect XML schemas. To use it, you have to put the EMF libraries and some WTP libraries in your dependencies:
- org.eclipse.xsd: the metamodel for XML schemas.
- org.eclipse.wst.wsdl: the metamodel for WSDL.
- javax.wsdl: a wrapper for WSDL4j.
Reading a WSDL with the WSDL metamodel
/** * Finds all the port types declared in the WSDL or in its imported documents. * @param emfUri an EMF URI pointing to a WSDL definition */ List<PortType> findAllPortTypes( URI emfUri ) { // // None here // Load the main document Resource resource = resourceSet.getResource( emfUri, true ); Definition def = (Definition) resource.getContents().iterator().next(); // Add the initial definition Set<Definition> definitions = new HashSet<Definition> (); definitions.add( alreadyLoadedDefinition ); // Process the imports processImports( alreadyLoadedDefinition.getImports(), definitions ); // Get all the port types List<PortType> portTypes = new ArrayList<PortType> (); for( Definition def : definitions ) { for( Object o : def.getPortTypes().values()) portTypes.add((PortType) o ); } return portTypes; } /** * Finds the definitions from imports and processes them recursively. * @param imports a map of imports (see {@link Definition#getImports()}) * @param definitions a list of definitions, found from import declarations */ private static void processImports( Map<?,?> imports, Collection<Definition> definitions ) { for( Object o : imports.values()) { // Case "java.util.list" if( o instanceof List<?> ) { for( Object oo : ((List<?>) o)) { Definition d = ((Import) oo).getEDefinition(); if( d != null && ! definitions.contains( d )) { definitions.add( d ); processImports( d.getImports(), definitions ); } } } // Case "org.eclipse.wst.Definition" else if( o instanceof Definition ) { Definition d = (Definition) o;; if( ! definitions.contains( d )) { definitions.add( d ); processImports( d.getImports(), definitions ); } } } }
XML schema can be accessed with this solution.
This is possible thanks to the metamodel for XML schemas.
As an example, here is how to parse a XML schema with this metamodel. Note that this metamodel is not only an EMF library, it is also bridged with a DOM model. In fact, this is also true for the WSDL metamodel (generally, this is not the case with EMF metamodels).
/** * Loads a XML schema. * @param emfUri an EMF URI * @return an instance of {@link XSDSchema} * <p> * This object already supports inclusions, which means there is no need to * get the imports and parse them. * </p> */ public static XSDSchema loadXmlSchema( URI emfUri ) { // Register the basic elementsPackageRegistry().put( XSDPackage.eNS_URI, XSDPackage.eINSTANCE ); // Load the resource Resource resource = resourceSet.getResource( emfUri, true ); return (XSDSchema) resource.getContents().iterator().next(); }
Creating a WSDL with the WSDL metamodel
Like most of standards, WSDL supports extensions.
In this sample, I use an extension for BPEL.
Definition createWsdlArtifact( String newWsdlUrl ) { // Initial data we got from another WSDL definition PortType portType = this.portTypePage.getPortType(); Definition businessDefinition = (Definition) portType.eContainer(); // The new definition to create Definition artifactsDefinition = WSDLFactory.eINSTANCE.createDefinition(); artifactsDefinition.setTargetNamespace( businessDefinition.getTargetNamespace() + "Artifacts" ); // Hack for the role: we need to define manually the name space prefix for the TNS of the business WSDL artifactsDefinition.getNamespaces().put( "tns", businessDefinition.getTargetNamespace()); // WSDL import Import wsdlImport = WSDLFactory.eINSTANCE.createImport(); wsdlImport.setLocationURI( newWsdlUrl ); wsdlImport.setNamespaceURI( businessDefinition.getTargetNamespace()); artifactsDefinition.addImport( wsdlImport ); // Partner Link Type PartnerLinkType plType = PartnerlinktypeFactory.eINSTANCE.createPartnerLinkType(); plType.setName( portType.getQName().getLocalPart() + "PLT" ); Role plRole = PartnerlinktypeFactory.eINSTANCE.createRole(); plRole.setName( portType.getQName().getLocalPart() + "Role" ); plRole.setPortType( portType ); plType.getRole().add( plRole ); plType.setEnclosingDefinition( artifactsDefinition ); // This is an extension, here is how to add it artifactsDefinition.getEExtensibilityElements().add( plType ); return artifactsDefinition; }
And here is how to write it.
void writeDefinition( Definition def, File targetFile ) { // resourceSet.getPackageRegistry().put( PartnerlinktypePackage.eNS_URI, PartnerlinktypePackage.eINSTANCE ); // Create a resource... URI emfUri = URI.createFileURI( targetFile.getAbsolutePath()); Resource resource = resourceSet.createResource( emfUri ); resource.getContents().add( def ); // ... and save it // See @link{org.eclipse.emf.ecore.xmi.XMLResource} for examples of SAVE options Map<Object,Object> saveOptions = new HashMap<Object,Object> (); resource.save( saveOptions ); }
Conclusion
I have been working with WSDL for several years. And to be honest, I had never thought about using the WSDL metamodel outside Eclipse. I knew it was there, I knew how to work with EMF. But for me, it was more a tool than a real library. And somehow, this is true. But the fact is that it is not complicated to use. And it can also work in standalone applications, not only in Eclipse.
So, this may be a solution to consider, depending on your needs.
17 thoughts on “WSDL Parsing with Eclipse’s metamodel for WSDL”
I have previously created my own WSDL and XSD metamodels from their XSD schemas and recently discovered WTP’s WSDL (and XSD) metamodels by accident (when WTP’s resource class loaded the wsdl files and not my own). In general, using EMF instead of XML is a lot cleaner (if you know EMF, of course), and WTP’s metamodels are easy to work with (and better than duplicating their work). This is one of many hidden gems within the Eclipse ecosystem!
I want to load or transform an existing WSDL file to an instance of an ecore WSDL metamodel
Please, some one can help me?
Hi,
I think the first code sample in this article (about reading a WSDL) answers your question.
The ecore is only used to generate code. When a load a WSDL file with the EMF meta-model for WSDL, it is compliant with the ecore model. The loaded WSDL is an instance of the WSDL meta-model. Or maybe you meant something else?
Hi,
The first code sample of this article (about reading a WSDL) do not work for me. Definitions or portTypes returned are not instances of the wsdl ecore metamodel.
What i want is to transform a WSDL file (Myfile.wsdl) which is an instance of the WSDL xsd schema (WSDL.xsd) to a wsdl file (Myfile.xmi) which is an instance of an WSDL ecore Schema (WSDL.ecore).
Please, can you provide me some guidelines on how to do that?
Thanks in advance
Hi,
I have published a code sample to do what you want.
See
It generates a XMI representation of the WSDL.
However, I cannot guarantee it is completely valid. I rely on, and I trust EMF here.
You may also customize the save options to improve the serialization.
Hi,
The code you have published generates a XMI representation of the WSDL.
However, when I try to open the XMI file with Sample Reflective Ecore Model Editor, I get the following exception;
org.eclipse.emf.ecore.xmi.PackageNotFoundException: Package with uri ‘’ not found. (platform:/resource/XMLtransf/src/Datasource/Myfile.xmi, 2, 264)
at org.eclipse.emf.ecore.xmi.impl.XMLHandler.getPackageForURI(XMLHandler.java:2599)
at org.eclipse.emf.ecore.xmi.impl.XMLHandler.getFactoryForPrefix(XMLHandler.java:2429)
Does anyone have any ideas why I get this error?
Thanks
Quick question: Have you tried using the WTP library for creating SOAP messages, with both the envelope and request/response?
Hi,
No, I have not yet tested it. I guess it works somehow like SoapUI.
But I will probably try it. I am not really interested in the SOAP envelop itself, but in its content (the XML payload which matches the XML schema associated with the invoked operation).
Yes, that’s actually what I meant: Create the SOAP response message, based on the result of the invoked operation. How do you create the response XML message, can the Ecore model of the SOAP structure and SOAPFactory be used?
I think it would be easier using the XML schema metamodel.
I don’t know if there are existing methods for this. But it should be quite easy to implement. Simple types are processed by hand. And complex types are processed recursively. And then, you can add the SOAP envelop. I will try to impement it later.
HI,
I found this article very helpful. Thanks !!!
EMF wsdl metamodel is cleaner approach for parsing the valid WSDL. I ‘m exploring this metamodel and utilities to make best out of it.
Could it be possible to direct me to achieve one more goal ( to find the probable xpaths from the underneath schema of the wsdl) .I could achieve it using the DOM API after I introspect the XSDTypeDefinition from the schema using the metamodel API, but would like to avoid it and want to achieve the same directly using the API of the metamodel . Help here would be appreciated.
Hi,
I do not have a ready-to-use solution.
However, I used to work with XPath and EMF models. Maybe you can take this as a hint.
See
And
Like we have getImports(), do we any way to get all the includes resources in a wsdl file.
Dear sir,
Can you please provide some Guidelines on How to configure EasyWsdl in NetBeans,
as adding in Libraries does not working for me.
Hello,
I have not worked with EasyWSDL for a very long time. And unfortunately, I think the project is dead. It could have been a very nice project, but it remained confined into a little space.
If you want to use it anyway, you should rather add it through a Maven dependency. EasyWSDL depends on several libraries. So, only adding EasyWSDL to your project classpath will not be enough.
Hi Vincent,
Thanks for showing how to use the EMF metamodel for WSDL. I’ve managed to get as far as parsing the top-level WSDL structure with this approach. But there’s one thing puzzling me. Suppose I have something like
…
…
I can navigate from the top-level down to the message and part. And from there I can access the element. But how do I get from there to the type itself? You mentioned that XML schemas can be accessed with this solution, but it wasn’t clear to me whether these links were automatically resolved and navigable in some way.
Thanks for any hints,
Kevin
Ah, ignore my previous comment/question. I hadn’t noticed there was a getElementDeclaration method in addition to the getElement method 😦 | https://vzurczak.wordpress.com/2011/11/07/parsing-wsdl-with-eclipses-metamodel-for-wsdl/ | CC-MAIN-2018-13 | refinedweb | 2,126 | 52.05 |
class OEDirectoryScan
This class represents OEDirectoryScan.
The OEDirectoryScan class provides a portable way of retrieving the names of all the files and subdirectories in a given directory.
OEDirectoryScan(const char *dname)
The constructor for OEDirectoryScan specifies the name of the directory to scan. A NULL pointer, (char*)0, is taken to mean the current directory and is equivalent to ".".
operator bool() const
Checks whether the OEDirectoryScan has been successfully opened and is still valid. A return value of true does not guarantee that the next call to the Next method will not return (const char*)0.
void Close()
Closes the OEDirectoryScan and frees any system resources. This method is invoked automatically by the classes’ destructor. Following a call to Close, operator bool will always return false.
const char *Next()
Returns the next file name sequentially in the directory scan. This function automatically advances the directory pointer. The returned value is a pointer to the local filename, i.e. without its directory prefix. Upon reaching the end of the directory, this function returns (const char*)0, and the OEDirectoryScan is closed. | https://docs.eyesopen.com/toolkits/python/oechemtk/OEPlatformClasses/OEDirectoryScan.html | CC-MAIN-2017-39 | refinedweb | 180 | 50.33 |
Extras/SteeringCommittee/Meeting-20060817
From FedoraProject
2006 August 17 FESCo
Meeting Summaries are posted on the wiki at:
Attending
- warren
- thl
- bpepple
- c4chris
- rdieter
- tibbs
- abadger1999
- dgilmore
Summary
Mass Rebuild
-
- Packagers get 3 weeks to rebuild just like AWOL policy.
- Packages that haven't been rebuilt get orphaned and the packages won't ship in the FC6 repository.
- AWOL package process started for ignacio as he has a bunch of packages that others might have to pick up as dependencies.
comps.xml
- c4chris sent out nagmails. Many people have updated their packaged in comps.xml.in.
- There are preliminary plans by the Packaging Committee to remove the group tag in the spec file and only have the information in comps.xml.
- c4chris thinks the only way to make 100% accurate nagmails is to record a group for all packages, which could be an invisible group for some packages. This information might be appropriate for the Package Database.
- c4chris and bpepple will start a comps SIG.
- Even command-line tools should be in comps.
Legacy in buildroots
- Waiting on legacy being able to access the buildsystem so they can build ppc updates.
Ctrl-C Problem
- Infrastructure says figuring out a solution before the new VCS is probably too much work.
- New VCS prototyping is waiting on two new servers to be installed at the end of August. Hoping to have something ready for Extras people to test by FC7t1.
Packaging Committee Report
- Started discussing deprecating and removing Group tag. No timeline yet but definitely a post-FC6 change.
- ldconfig wording change to clarify the meaning.
- Talked about changing the meeting day/time so there's time to send the committee report to FESCo via email.
Sponsorship Nominations
- dgilmore and c4chris accepted as sponsors.
- New rule, nominate new FESCo members for sponsorship if they are not already; debate about upgrading them will be per normal.
- Qualifications to be a sponsor needs to be discussed.
Misc
- New Package Review template approved:
- wiki user setup to send changes to FESCo list when /Extras/Schedule* is changed.
- kmod discussion
- Packaging Committee will discuss the technical aspects, whether to allow them in Fedora Extras/Core at all is being passed up to FAB.
Free discussion
- Maintainer Responsibility:
- tibbs solicits input on the draft policy. There are several open questions that need answering therein.
Log
(09:55:23) ***warren here. (09:55:32) warren: mdomsch, you there? (09:55:48) mdomsch: warren, yes (09:57:40) ***jima pops some popcorn for the show (09:59:05) ***cweyl settles in to lurk... silly people at work who presume to schedule their meetings during FESCo! (10:00:16) thl has changed the topic to: FESCo meeting in progress (10:00:22) thl: hy everyone (10:00:26) thl: who's around? (10:00:36) ***bpepple is here. (10:00:36) ***c4chris_ is here (10:00:55) c4chris_ is now known as c4chris (10:01:28) rdieter: here (10:01:35) tibbs: I'm here. (10:01:38) ***cweyl is lurking (rabble) (10:01:41) thl: okay, so let's start slowly (10:01:56) thl has changed the topic to: FESCo meeting in progress -- M{ae}ss-Rebuild (10:01:57) ***abadger1999 here (10:02:16) thl: scop not around (10:02:26) thl: do we want to discuss this further (10:02:37) thl: open issues: How much time need people to rebuild their stuff? What happens with packages that haven't been rebuilt or marked as not needing a rebuild by deadline X? (10:03:04) c4chris: what's the delay in the AWOL policy? (10:03:15) ***dgilmore is here (10:03:29) c4chris: I think we should use the same delay (10:03:35) dgilmore: thl: no need for discussion Lets just do it (10:03:59) tibbs: The delay is three weeks and three days, BTW. (10:04:00) thl: c4chris, I don#t know the exact delay from AWOL (10:04:27) c4chris: tibbs, sounds about right (10:04:32) thl: let's say: give people three weeks to rebuild their stuff? (10:04:39) c4chris: thl, +1 (10:04:40) bpepple: thl: +1 (10:04:46) thl: that leaves some time to fix the remaining stuff before FC6 ships (10:04:47) tibbs: +1 (10:04:50) warren: +1 (10:05:02) dgilmore: +1 (10:05:05) rdieter: +1 (10:05:11) thl: okay, three weeks (10:05:27) thl: What happens with packages that haven't been rebuilt or marked as not needing a rebuild by deadline X? (10:05:39) tibbs: Orphaned? (10:05:47) c4chris: Let's deal with the not rebuilt package when we have an idea how many there are (10:06:11) tibbs: We should know in advance so that people won't just expect the current package to rull into FC6. (10:06:23) tibbs: s/rull/roll/ (10:06:27) c4chris: mmh (10:06:31) c4chris: ok (10:06:37) dgilmore: im kindof scared if ignacio doesnt step up he has alot of packages (10:06:43) thl: dgilmore, +1 (10:06:43) c4chris: orphaned sounds about right (10:06:55) thl: jwb, you wanted to contact ignacio iirc (10:07:07) bpepple: dgilmore: Should other people be brought in to help him? (10:07:10) jwb: thl, i sent him an email. no repsonse (10:07:19) thl: jwb, thx (10:07:39) tibbs: Packages not rebuilt certainly shouldn't get autobranched to FC6, but I don't think they should be deleted. (10:07:50) dgilmore: i sent him one about 6-8 weeks ago asked how things were going got nothing (10:07:55) c4chris: we never delete packages (10:08:00) c4chris: just orphan them (10:08:10) thl: tibbs, well, that would mean that someone had to maintain them through the entry lifecicle of FC6 (10:08:15) thl: we need to delete them (10:08:46) dgilmore: delete binaries but not cvs (10:08:55) c4chris: dgilmore, oh right (10:09:35) tibbs: The binaries should not get out to FC6 unless they've been rebuilt. (10:09:57) thl: okay (10:10:02) c4chris: so the threat is: they won't ship in FC6 until rebuilt (or a short explanation why they are not rebuilt...) (10:10:16) jwb: that seems reasonable (10:10:19) rdieter: yup (10:10:26) thl: so just to be sure: +1 for "delete all packages that are not rebuild in time" please (10:10:27) tibbs: +1 (10:10:34) jwb: +1 (10:10:34) c4chris: +1 (10:10:36) abadger1999: +1 (10:10:38) rdieter: +1 (10:10:42) dgilmore: +1 (10:10:51) tibbs: +1 (10:10:58) abadger1999: For ignacio specifically, has the AWOL packagers process been started? (10:11:26) dgilmore: abadger1999: no but it really needs to (10:11:32) jwb: agreed (10:11:41) bpepple: dgilmore: +1 (10:11:48) warren: Want me to attempt to use non-email to contact him? (10:11:52) BobJensen: dgilmore: +1 (10:11:57) warren: Ask him what he wants us to do with his packages. (10:12:00) abadger1999: warren: +1 (10:12:05) thl: warren, maybe that would be a good idea (10:12:08) c4chris: warren, +1 (10:12:09) Daveman: :o (10:12:15) tibbs: If someone has his phone number, it would certainly be a good idea to try it. (10:12:21) BobJensen: I tried calling all I got was VM (10:12:36) Daveman: FC6? (10:12:36) dgilmore: warren: +1 (10:12:42) warren: I'll give it a try. (10:12:58) thl: k -- lets ignore the question "remove pacakges from cvs or only orphan them later" (10:13:09) thl: maybe we could use a scheme like this: (10:13:25) thl: remove all packages that were not rebuild three weeks before FC6 (10:13:53) thl: and remove all those from cvs when the branch for FC6 happens, that don#t have a new maintainer yet (10:14:37) thl: so let's move on (10:14:47) dgilmore: thl: they stay in cvs but get flagged so they wont build (10:15:08) thl: dgilmore, could work, too (10:15:24) thl: how hard it restoring of deleted things? (10:15:43) thl: (in cvs) (10:15:48) c4chris: easy (10:15:50) dgilmore: harder than fixing a spec file set to not build (10:16:04) thl: let's stop here (10:16:13) thl: we can discuss this later (10:16:16) thl has changed the topic to: FESCo meeting in progress -- Use comps.xml properly (10:16:22) thl: c4chris, the nag mails worked great (10:16:29) c4chris: thl, yup (10:16:33) jwb: yes, they do (10:16:45) thl: dgilmore: automate comps file during push or via cron (10:16:49) c4chris: Now I have a few questions... (10:16:51) thl: dgilmore, did you look into this? (10:16:53) abadger1999: c4chris: I don't think I received any though (and I should have) (10:17:07) thl: ohh, shoot (dgilmore, we'll discuss this later) (10:17:08) c4chris: abadger1999, I'll check (10:17:12) dgilmore: thl: i was going to help who was but i cant rember who that was. (10:17:36) thl: dgilmore, probably scop -- he knows a lot of the push-script details (10:17:39) c4chris: Is there a plan to remove the group tag in spec files? (10:17:56) dgilmore: c4chris: not that i know of (10:18:02) abadger1999: c4chris: Packaging Committee talked about it today. (10:18:03) tibbs: Yes. (10:18:05) bpepple: c4chris: I think it's only be discussed so far. (10:18:29) c4chris: So it's on the PC agenda? (10:18:46) abadger1999: Won't happen for FC6 but we're coming up with a timeline to make it optional and then dropped. (10:19:03) c4chris: abadger1999, ok. Great. (10:19:35) c4chris: Another one is: can we have a hidden group in comps? (10:20:01) c4chris: I think it'd be way easier to tell people: add all your packages in comps (10:20:19) thl: that was my stupid idea -- I think there were hidden groups possible in the past (10:20:22) c4chris: (until the day we have a shiny package database, that is... :-) ) (10:21:00) abadger1999: Would be even better to have a hidden attribute. (10:21:15) c4chris: I'm afraid there's no automated way to decide which packages should appear in comps, no matter how hard we try (10:21:54) abadger1999: So if Fedora policy is not to have commandline tools generally, you can still put your application in and properly categorized but flagged to be hidden. (10:21:56) jima: all my packages are non-gui; only one (dnsmasq) seemed common enough for me to bother putting it in comps. (10:22:41) thl: jima, maybe a "command line tools" group would be a good idea (10:22:44) c4chris: IMHO, comps is a way to make some publicity for your package (10:22:56) rdieter: just put 'em all in there then (at least for now until a better solution magically appears) (10:23:02) jima: c4chris: if there's a category your package fits in. (10:23:03) c4chris: you went to the trouble of packaging it: why not advertise it somehow (10:23:17) thl: c4chris, +1 (10:23:35) thl: c4chris, we IMHO really need a real comps SIG (10:23:37) jima: (admittedly i only have one package that didn't fit perfectly into a category) (10:23:46) thl: or at least some people that really take care of it (10:23:57) thl: there were so many questions on f-e-l in the past days (10:24:02) c4chris: thl, yea probably (10:24:02) abadger1999: c4chris: Is there a plan to have groups in the package database? (Or a desire?) (10:24:09) thl: or should the PC handle comps? (10:24:28) c4chris: thl, it affects core too... (10:24:50) thl: yes and no (10:24:53) c4chris: abadger1999, not completely sure (10:25:11) thl: we IMHO need agroup that handles the comps stuff for extras and watches it over (10:25:11) abadger1999: It's not listed on the pages yet -- os if it's a desire, it needs to get listed. (10:25:22) bpepple: thl: +1 (10:25:22) abadger1999: s/os/so/ (10:25:22) c4chris: but the package database would be a nice place to put such attributes I think (10:25:39) rdieter: SIG++, it needs/deserves extra tlc (10:25:51) rdieter: it = comps (10:25:58) c4chris: tlc? (10:26:07) rdieter: tender loving care. (10:26:14) c4chris: Oh :-) (10:26:22) c4chris: yes! (10:26:25) thl: c4chris, well, seems you have a new job (10:26:39) thl: c4chris, can you find one or two more poeple for the sig? (10:26:46) c4chris: thl, k (10:26:49) ***bpepple would be willing to help/ (10:26:53) c4chris: Yup, I'll need help (10:26:59) c4chris: bpepple, thanks (10:27:17) bpepple: no prob. (10:27:17) thl: c4chris, anything else regarding comps we should discuss? (10:27:31) c4chris: thl, no I'm fine (10:27:40) c4chris: I'll start a wiki page soon(ish) (10:28:11) thl: k, so let's move on (10:28:23) thl: c4chris, can you update the status page on the schedule please? (10:28:33) thl: to reflect the recent discusssions? (10:28:35) c4chris: thl, will do (10:29:00) thl has changed the topic to: FESCo meeting in progress -- Activate legacy in buildroots (10:29:12) thl: dgilmore told me that it's not activated yet (10:29:20) thl: so I think we can skip this today (10:29:22) dgilmore: not yet (10:30:01) dgilmore: hopefully this week we can get everything in place. i need to setup legacy to use the buildsys first or they wont have fc4 ppc updates (10:30:13) thl has changed the topic to: FESCo meeting in progress -- CTRL-C problem (10:30:17) thl: skipping as well (10:30:20) thl: ohh (10:30:25) thl: or, no (10:30:38) thl: warren, did you bring it up in the last infrasctructure meeting? (10:30:51) warren: bad news (10:31:13) warren: It is the judgement of the infrastructure team that this simply is not a priority. (10:31:26) warren: If someone has ideas they're willing to try it. (10:31:35) warren: that is all. (10:31:52) thl: warren, not nice, but life sucks sometimes (10:32:02) thl: warren, related to this (10:32:14) thl: how is the schedule for the new VCS? (10:32:25) thl: are there detailsed plans yet? (10:32:30) warren: Infrastructure rather focus efforts on making VCS happen sooner than to improve the existing one. (10:32:43) thl: otherwise it'll be FC( until it's in place... (10:32:50) warren: late August two new servers will be installed, and we will simultaneously test mercurial and bazaar-ng (10:33:35) tibbs: That's great news. (10:33:59) warren: we're ordering a pretty sweet beefy box today (10:34:03) thl: warren, yeah, great (10:34:09) dgilmore: thl: from memory we hopped to have something ready for testing when FC7 test1 hits the streets (10:34:11) abadger1999: I've got the backend for a bzr implementation but we also need work done on the packaging database to work on a finished front end. (10:34:27) warren: 2x2 xeon, 8GB RAM, big SCSI drives. It should host a few xen guests comfortably for greater infrastructure flexibility. (10:34:41) jima: nice! (10:34:53) thl: k, let's stop here now and move on (10:35:06) thl has changed the topic to: FESCo meeting in progress -- Packaging Committee Report (10:35:34) abadger1999: We started discussion of removing the Group tag today. (10:35:54) abadger1999: Approved trying to get a patch into rpm to make the tag optional for FC6. (10:36:20) abadger1999: We'll look at the timeline for changing the guidelines based on when that makes it into rpm. (10:36:47) jima: if it's in by the time we're supposed to do the final mass-rebuild, i wouldn't have any qualms with removing the tag from my specs while i'm incrementing. (10:37:03) abadger1999: ldconfig wording on the Guidelines page was clarified but with the same meaning (10:37:08) c4chris: sounds cool (10:37:11) tibbs: jima: We're not targeting FC6 for this. (10:37:46) abadger1999: That's all for changes. (10:37:54) thl: abadger1999, thx (10:38:01) abadger1999: Oh -- we're talking about changing meeting date/time (10:38:10) abadger1999: But we're continuing that on the mailing list. (10:38:22) thl: I saw it roughly (10:38:29) thl: there was the problem with DST (10:38:50) thl: weco meets at 18:00 UTC during winters IIRC (10:38:57) thl: and 17:00 during summers (10:39:10) thl: so the effective meeting time stays the same (10:39:28) thl: s/weco/FESCo/ (10:39:43) thl: is that scheme fine for all the new FESCo members, too? (10:39:49) bpepple: Yup. (10:39:56) abadger1999: Yes. (10:40:00) c4chris: it's ok (10:40:03) tibbs: Yes. (10:40:14) rdieter: ok (10:40:16) thl: k (10:40:36) thl has changed the topic to: FESCo meeting in progress -- Sponsorship nominations (10:40:41) thl: any new nominations? (10:41:02) jwb: are we supposed to send them to FESCo list first? (10:41:06) thl: btw, someone really should send Nodoid a summary why we didn#t apporve him last time (10:41:18) c4chris: I don't get mails from the sponsor list (10:41:21) thl: does anyone still have the mails that were send around when we discussed it? (10:41:39) tibbs: I probably do. (10:41:46) thl: I'd like to porpose that we send it to both lists (10:41:56) thl: e.g. FESCo and sponsors (10:42:05) bpepple: thl: +1 (10:42:07) c4chris: thl, yup, that's be useful (10:42:08) thl: or we need to create a special mailinglist (10:42:16) thl: but that's probaly overkill (10:42:24) warren: any self-nominations? (10:42:39) thl: I'm wonering if we should make c4chris a sponsor (10:42:48) thl: FESCo members IMHO should also be sponsors (10:42:51) tibbs: I have everything sent to cvsextras-sponsors@fedoraproject.org since the beginning of May, BTW. (10:43:25) thl: tibbs, can you send me the discussions around upgrading nodoid? then I'l send him a summary why we didn't approve him (10:43:35) tibbs: Going by the top reviewiers, Patrice Dumas would up for sponsorship. (10:44:36) dgilmore: thl: honestly you could make me a sponser. but i dont know if i would be a good one (10:44:41) thl: tibbs, can you send a mail to the list to start the discussions (10:44:51) dgilmore: tibbs: thats bad not all of fesco get that (10:45:11) thl: dgilmore, you don't have to use your powers if you don't feel compfortable with it (10:45:33) thl: who else from FESCo isn't a sponsor? Currently c4chris and dgilmore afaics (10:46:09) thl: a lot of silence here (10:46:18) c4chris: I guess we are the only 2... (10:46:24) thl: seems poeple don't like the iea to make all FESCo members sponsors... (10:46:28) dgilmore: thl: i guess its just me and c4chris (10:46:52) thl: s/iea/iea/ (10:46:53) c4chris: the thing is I don't do that many reviews (10:46:56) thl: s/iea/idea/ (10:46:57) abadger1999: It's overloading the sponsorship role... (10:47:13) jima: i don't see the justification, personally. (10:47:27) thl: abadger1999, okay, so let's just drop that idea of mine (10:47:33) jima: sponsors become sponsors based on merit, don't they? (10:47:55) c4chris: yup, that's the idea (10:48:03) thl: jima, yes, but that merit doesn't always mean "reviews" (10:48:06) rdieter: Hopefully, FESCo implies merit... (: (10:48:12) c4chris: and a deep knowledge of the packaging rules... (10:48:13) thl: I didn't do to much reviews (10:48:15) dgilmore: i guess being in Fesco means your trusted by the community (10:48:20) thl: but I'm here and a sponsor, too (10:48:23) BobJensen is now known as BobJensen-Away (10:48:25) warren: I'm for giving them sponsorship, I trust that they would do the right thing. (10:48:34) rdieter: +1 (10:48:38) thl: +1 (10:48:41) bpepple: warren: +1 (10:48:54) abadger1999: I would give them sponsorship too -- but that's separate from making all FESCo members sponsors. (10:49:21) abadger1999: So c4chris, dgilmore sponsorship +1 (10:49:23) thl: abadger1999, yeah, your right (10:49:25) thl: abadger1999, +1 (10:49:37) c4chris: So you need to simple rule to always nominate DESCo members to sponsorship, and then simply debate it like usual... (10:50:02) jima: c4chris: that sounds better to me than just automatically upgrading them. (10:50:03) c4chris: s/D/F/ doh (10:50:15) tibbs: But the debate wouldn't necessarily be based on the number and quality of reviews. (10:50:20) jima: if they have merit, that's fine, imo. (10:50:38) thl: I'm counting 5 votes to make c4chris and dgilmore sponsors currently (four indirect) (10:50:49) thl: so I think they are accepted (10:50:58) thl: please yell now if you disagree (10:51:02) jima: otherwise sponsorship can be attained by winning a popularity contest (the fesco election) :) (10:51:03) tibbs: I don't have any problem with having more sponsors, but I am curious that we seem to have changed the qualifications. (10:51:38) thl: tibbs, as I said -- I also didn't do to much reviews (10:52:11) tibbs: Perhaps we can consider the qualifications at a future meeting. Because honestly we do need more active sponsors. (10:52:27) thl: tibbs, yeah (10:52:35) c4chris: tibbs, wouldn't be a bad idea (10:52:47) tibbs: In any case, +1 for both folks. (10:52:57) c4chris: that reminds me we need to discuss responsibilities at some point... (10:52:58) thl: I consider them accepted them (10:53:11) thl: s/them/then/ (10:53:23) thl: there must be something wrong with my keyboard today ;-) (10:53:23) tibbs: Do remember that you have to review in order to actually sponsor someone. (10:53:28) thl: so let's move on now (10:53:50) thl has changed the topic to: FESCo meeting in progress -- approve kmod's (10:54:01) thl: I didn#t get new request for approvals (10:54:13) c4chris: no wonder... (10:54:14) thl: and I didn#t find time to forward the zaptel issue to FAB (10:54:31) tibbs: Wasn't new kmod approval put on hold? (10:54:41) thl: let's get the other stuff around kmods sorted out first before we bring that on hte table again (10:55:03) c4chris: yea, my inbox needs a break... (10:55:12) bpepple: no doubt. (10:55:14) thl: :) (10:55:17) thl: so let's move on (10:55:30) thl has changed the topic to: FESCo meeting in progress -- MISC from schedule (10:55:41) thl has changed the topic to: FESCo meeting in progress -- MISC from schedule -- Proposal for (FC and) FE Package Review Request template (10:55:47) thl: (10:55:50) thl: do we like the idea? (10:56:04) c4chris: yes (10:56:15) tibbs: Yes, the summary would be nice to have. (10:56:22) abadger1999: Makes sense to me. (10:56:27) tibbs: It would also be nice if people knew to remove the angle brackets. (10:56:44) c4chris: tibbs, yes (10:56:45) ***bpepple doesn't have a problem with it. (10:56:47) tibbs: I've found that it's not nearly as obvious to some folks as you'd think. (10:57:07) c4chris: maybe remove them from the template? (10:57:27) thl: c4chris, +1 (10:57:47) thl: so we consider this accepted? (10:57:49) bpepple: c4chris: +1 (10:57:57) c4chris: thl, +1 (10:58:03) rdieter: +1 (10:58:03) tibbs: +1 (10:58:06) bpepple: thl: +1 (10:58:14) thl: k, moving on (10:58:21) thl has changed the topic to: FESCo meeting in progress -- MISC from schedule -- create a FESCO user in the wiki that sends mails to the FESCo list and subscribe it to /Extras/Schedul.* in the wiki (10:58:29) thl: I send this to the fesco list (10:58:30) c4chris: who can update the template? (10:58:41) bpepple: thl: +1, this sounds like a good idea. (10:58:56) tibbs: Yes, this is definitely good. +1 (10:59:06) thl: c4chris, djb (or what was his nick?); I'll take care of it (10:59:07) c4chris: why not. I'm subscribed, but that would give us a log of things (10:59:17) c4chris: thl, k thx (10:59:18) abadger1999: +1 (10:59:26) rdieter: sounds good to me, +1 (10:59:34) c4chris: (for the next time the wiki crashes... :-P) (10:59:40) warren: Just do it (10:59:47) thl: k (11:00:06) thl has changed the topic to: FESCo meeting in progress -- MISC from schedule -- jwb suggested in #fedora-extras that we discuss the current kmod discusions (11:00:06) warren: would that user's e-mail address be the fesco list ? (11:00:16) thl: warren, yes (11:00:32) thl: I'd like to stay mostly quiet on the kmod stuff (11:00:34) thl: jwb, ? (11:00:49) jwb: actually (11:00:55) warren: The kmod issue.... is big and complicated. For this reason we scheduled tomorrow's meeting. But even then I don't think we will be successful. (11:01:16) warren: I am uncertain what to do at this point. (11:01:20) dgilmore: warren: ? toomorrows meeting (11:01:32) jwb: warren, yeah... what dgilmore said (11:01:47) tibbs: There's some sort of telephone conference scheduled. (11:01:57) warren: thinking to do it on IRC instead (11:01:57) jwb: with who? (11:01:59) warren: haven't decided yet (11:02:06) warren: see fedora-packaging for details (11:02:18) jwb: kmod is bigger than just packaging (11:02:25) warren: yes it is (11:02:50) jwb: we've got davej and dwmw2 saying they should die in Extras and Core all together (11:03:00) jwb: among others (11:03:02) dgilmore: I think that kmods are important for testing and proving things. but that perhaps it should have its own repo fedora-kmods make the user have a clear decission to make knowing that core kernel developers wont support them (11:03:28) jwb: dgilmore, that's what 3rd party repos are for (11:03:49) jwb: dgilmore, IMHO, an "unsupported" repo by the kernel devs cannot be part of the fedora project officially (11:03:54) warren: Those kinds of decisions are FPB's to make. (11:04:13) jwb: warren, that doesn't mean we don't get to make suggestions (11:04:41) abadger1999: If the guidelines are just for other repos, then the whole landscape of what's a good guideline changes. (11:04:55) jwb: agreed (11:05:23) jwb: i think this is a case where we either care enough to allow it in fedora repos, or we get off the pot and let 3rd party repos decide what they want to do (11:05:28) warren: If you truly care about the kmod issues, then please seriously participate in the fedora-packaging list discussions. (11:05:32) dgilmore: i think we could have a repo within fedora thats disablled by default where they can live (11:05:39) warren: Right now it is a big mess. (11:06:06) jwb: warren, i care more about having/not having modules in fedora to begin with (11:06:20) jwb: warren, i think that needs to be settled before any kind of packaging standard comes about (11:06:50) warren: OK, then that is defnitely something you need to bring to FAB (11:06:52) warren: are you on FAB? (11:07:06) jwb: which i realize is confusing because kmods already exist... where were davej and dwmw2 when kmods originated? (11:07:10) jwb: warren, yes. i can email FAB (11:07:30) warren: jwb, package committee and fesco decides mainly on technical details, you are asking about quasi-political policy (11:07:36) thl: jwb, davej was asked by jeremy for permission of the kmod stuff iirc (11:07:44) jwb: thl, that's what i thought (11:07:49) rdieter: gotta run, another meeting (fun). (11:07:52) jwb: ok, i'd like to take a vote really quick (11:07:59) rdieter: (ok, I'll wait) (11:08:02) jwb: who in FESCo thinks we should have kmods? (11:08:12) rdieter: have, vs. not have? (11:08:17) dgilmore: jwb: my vote is for a kmod repository (11:08:18) jwb: rdieter, right (11:08:22) rdieter: have +1. (11:08:27) tibbs: I'm undecided, sorry. (11:08:50) thl: from the political standpoint: not have (11:08:57) c4chris: I think we can have modules in Extras (11:08:59) ***rdieter runs... (11:09:04) rdieter is now known as rdieter_away (11:09:10) skvidal: rdieter_away: come back here (11:09:13) thl: but we compete with ubuntu and suse: and they have all the stuff, so we should have it, too (11:09:25) bpepple: have +1 (11:09:36) rdieter_away: skvidal: huh? (11:09:41) warren: I think the current kmod standard with its strict restrictions is a generally good thing. (11:09:53) dgilmore: i think we can but if its in its own repository then users will be more aware of what support they can expect (11:09:56) jwb: so in general, FESCo feels kmods should remain (11:10:01) warren: It isn't a "free ride" into Fedora with any kmod. it must satisfy requirements, and pressure is put to push things upstream. (11:10:02) thl: warren, maybe we shopuld put the "time restiction" back on the table, too (11:10:16) thl: e.g. allow each kmod in extras only for a certain time (11:10:20) rdieter_away is now known as rdieter (11:10:21) ***cweyl scrolls back and reads (11:10:24) tibbs: I think that from a user's standpoint having access under the Fedora umbrella to every module which does not violate the law is a good thing. (11:10:24) thl: three releases (11:10:45) thl: tibbs, we should work towards modules that get merged upstream (11:10:59) dgilmore: warren: which can only be done in a fedora project controlled repo. 3rd party repos == "no input from us" (11:11:00) tibbs: But maintenance is paramount and the argument of the kernel devs atainst having to deal with bug reports arising from external modules is compelling. (11:11:11) thl: It's really important that they get merged into the vanilla kernel (11:11:16) tibbs: thl: I disagree; I don't think it's our business to push any code author towards anything they don't want to do. (11:11:56) thl: tibbs, : To do as much of the development work as possible directly in the upstream packages. (11:12:12) bpepple: thl: +1 (11:12:16) tibbs: I don't see how that applies. (11:12:28) tibbs: A kernel module's upstream isn't necessarily the kernel. (11:12:32) dgilmore: thl: yes but a kmod upstream is different to kernel upstream (11:12:40) abadger1999: tibbs: +1 (11:12:48) tibbs: That objective just says we shouldn't carry around fedora-specific patches in fedora packages. (11:13:06) cweyl: tibbs: +1 on "...is a good thing" (11:13:08) dgilmore: thl: if we patch a kmod we should get it upstream whereever that is (11:13:16) warren: The way spot describes it, the restrictions set by packaging committee on what qualifies for kmod is strict. (11:13:34) jwb: thl, i'll email FAB asking for a political decision (11:13:42) thl: jwb, thx (11:13:49) ***jwb steps away for a second (11:13:51) thl: so let's stop here for today (11:14:02) warren: The time requirement is not exactly important to decide now, it is closer to a political decision. The bigger problem is the technical issues for the near-term. (11:14:03) thl has changed the topic to: FESCo meeting in progress -- free discussion (11:14:16) tibbs: I started on (11:14:16) thl: anything else we should discuss? (11:14:40) tibbs: A nice rat's nest there which will require a good bit of spirited discussion. (11:14:56) tibbs: I'd like to see anyone interested contribute to that document. (11:15:34) thl: tibbs, can you move that over to the FESCo namespace please (11:15:36) tibbs: Unfortunately my wiki-fu is still crap and I can't get the list indentation right. (11:15:44) thl: then I'll create a entry on the schedule (11:15:50) rdieter is now known as rdieter_away (11:16:00) tibbs: Where would you like it to live? (11:16:08) tibbs: Under Schedule? (11:16:45) thl: tibbs, let me handle the moving (11:16:55) thl: I can also look at the list indentation (11:17:16) cweyl: tibbs: I assume rabble contributions are good as well? (11:17:24) tibbs: I was trying to get too fancy with boxed bits within a list. (11:17:36) tibbs: cweyl: I want to see as much input on this kind of thing as is possible. (11:17:42) cweyl: cool. (11:17:42) c4chris: cweyl, sure (11:18:13) cweyl: not that I've ever asked before.... ;) (11:18:29) c4chris: FYI I won't be here next week (vacations, yay! :-) ) (11:18:37) jima: err, can rabble edit things under FESCo namespace? (11:18:47) thl: jima, yes (11:19:02) jima: ok, wasn't sure if it was locked down like Packaging (11:19:09) cweyl: yah. same here (11:19:20) tibbs: Packaging is an anomaly, I think. (11:19:32) jima: ok (11:19:40) tibbs: You just need to be in EditGroup. (11:20:25) thl: k, anything else? (11:20:31) ***thl needs to leave soon (11:20:41) thl: abadger1999, btw, many thx for writing the summaries (11:20:48) tibbs: Nothing else from me. (11:20:53) ***thl will close the meeting in 60 (11:21:17) abadger1999: jima: BTW: PackagingDrafts shouldn't be locked down, just the actual Packaging hierarchy. (11:21:21) ***thl will close the meeting in 30 (11:21:28) abadger1999: thl: np. (11:21:41) ***thl will close the meeting in 10 (11:21:53) thl: -- MARK -- Meeting end (11:21:57) thl: thx everyone! (11:22:03) c4chris: thl, thx. | http://fedoraproject.org/wiki/Extras/SteeringCommittee/Meeting-20060817 | CC-MAIN-2015-06 | refinedweb | 6,036 | 74.42 |
[Monday Dev Heaven] Unleash Nuxeo Shell
Today I bring you the Nuxeo Shell. This is a wonderful toolbox for developers and administrators and I think it deserves more recognition.
Playing with the Shell
Using the Shell is quite easy when you have Nuxeo IDE. You need to be in the Nuxeo perspective and click on the little shell icon on the bottom left of the screen.
You can now type tab to see a list of the available commands. These commands are sorted by namespaces. Namespaces are command registries that you can register in the shell. A command registry helps bring inside the shell a new set of commands for a specific context without having name clash problems with already existing commands. It is also very useful because you have a different type of completion for each namespace. For instance, if you have selected the local namespace, hitting tab after ls will show you the list of files from your file system. If you have selected the remote namespace, it will display the list of documents on the Nuxeo server you are connected to.
So let’s start with the connect command:
[bash]connect -u Administrator[/bash]
This command will prompt you for the password of the adminstrator user on the localhost:8080/nuxeo server.
If you type tab again, you’ll see that the command list has changed. There are a lot more of them. If you are a Unix shell user, it should feel like home. You’ll recognize some of them: cat, ls, mkdir, mv, cp, rm. They will of course apply to the server’s documents since you have selected the remote namespace. Let’s try the ls and then cat /default-domain command.
Do you need more information than what cat just gave you? Try help cat. Here is the description of the cat command, its syntax, options and arguments. This works with every command (you can also type cmds or commands to get the list of available commands). Try cat -all /default-domain, you’ll see much more information. Keep on playing with the commands, you’ll see you can do some pretty wicked things. Don’t hesitate to browse the index of all command sorted by namespace on our wiki.
Content Automation
So all the commands you typed in the remote namespace are using the Content Automation API. That’s right, you are using an http shell. This means I have two pieces of good news for you. The first is that you can call any existing operation or chain on the server. Just type use automation and you’ll get in the right namespace. If you type tab for completion, you’ll get the list of Operations and Operation Chains available on the server. If you don’t know hos to use them, here’s a quick trick. You can generate a help file for any name space using the following command: help -export [file] -ns [namespace]? This will give you the parameter name for each operation, for example. Then you’ll know how to run Document.Query:
[bash]
Administrator@localhost:/> use automation
remote -> automation
> Document.Query -query "Select * From File"
…
[/bash]
The second piece of good news is that those operations are really easy to deploy on your server using NuxeoIDE. I’ve created a CountWords operation that counts the number of words contained in a document. You can check this out on a previous blog. It makes it quick and easy to test your operation directly from the IDE.
Groovy or MVEL script?
If you don’t have the IDE, you can still use the shell. It’s available from our nexus repository and has the exact same functionality as the one in the IDE. You’ll probably miss being able to quickly execute an operation and reload it on the server. Well, there is an alternative to this workflow. You can execute Groovy or MVEL script. Those of you who are familiar with NuxeoStudio probably already know MVEL. For those who don’t :
“MVEL is a powerful expression language for Java-based applications. It provides a plethora of features and is suited for everything from the smallest property binding and extraction, to full blown scripts.”
Here are two small example of what you can do:
This is a complete example of a script used by the perms command to get the ACLs available on a document:
[groovy]
import org.nuxeo.ecm.core.api.PathRef;
import org.nuxeo.ecm.core.api.IdRef;
import org.nuxeo.ecm.core.api.security.ACP;
import org.nuxeo.ecm.core.api.security.ACE;
import org.nuxeo.ecm.core.api.security.ACL;
def doc = null;
def aclname = Context["acl"];
def ref = Context["ref"];
if (ref.startsWith("/")) {
doc = Session.getDocument(new PathRef(ref));
} else {
doc = Session.getDocument(new IdRef(ref));
}
def acp = doc.getACP();
def result = null;
if (aclname != null) {
def acl = acp.getACL(aclname);
if (acl == null) {
result = "No Such ACL: ${aclname}. Available ACLS: ";
for (a in acp.getACLs()) {
result+=a.getName()+" ";
}
return result;
}
result = "{bold}${aclname}{bold}n";
for (ace in acl) {
result += "t${ace}n";
}
} else {
result = "";
for (acl in acp.getACLs()) {
result += "{bold}${acl.name}{bold}n";
for (ace in acl) {
result += "t${ace}n";
}
}
}
return result;
[/groovy]
And here is the MVEL example:
[groovy]
org.nuxeo.ecm.core.api.Blob myBlob=Document.getProperty("file:content");
Context["extension"]="none";
Context["filename"] = myBlob.getFilename();
String[] splitedFilename=Context["filename"].split(".");
Context["extension"]="none";
if (splitedFilename.length>=2){
Context["extension"]=splitedFilename[splitedFilename.length-1]
};
[/groovy]
The different variables available in Nuxeo are explained on the wiki. If you already know NuxeoStudio, it’s exactly the same.
Pretty cool, huh?
Now batch that script!
Some of the scripts we do sometimes need to be ran at a particular time. So instead of using the shell in an interactive mode, we use the batch mode. There are three different batch modes:
1. Run commands from a file
2. Run commands from standard input
3. Run commands specified on the command line – this is a convenient way to run a short list of commands
Here’s how you do it:
[bash]java -cp nuxeo-shell.jar org.nuxeo.shell.Main -f my_batch_file[/bash]
my_batch_file contains the different commands you need to run. Here’s a sample from the documentation:
[bash]
# connect to local server using the Administrator account.
connect -u Administrator -p Administrator
# we are now in the repository root. Go to /default-domain/workspaces
cd /default-domain/workspaces
# list the content of the workspaces root – as document UIDs
ls -uid
[/bash]
You’ll find examples for the two other modes on the wiki. Now you can use cron to execute your script at any time you want
Still not enough? Extend the shell.
If you have enjoyed what you read, and want to dive further in the shell, you need to read the Extending the Shell page on the wiki. And if you need examples, you can always check out the sources on GitHub. We love pull requests so don’t hesitate
| http://www.nuxeo.com/blog/unleash-nuxeo-shell/ | CC-MAIN-2015-32 | refinedweb | 1,174 | 67.65 |
I have a homework assignment due this week and am fairly new to C++. Don't have a book so I can't really go on anything other than the video material and power point slides my teacher provides. I have 98% of the assignment done, however I'm encountering logic problems. I'm not a new programmer so I do have programming knowledge, mainly just C# though. I'm 99% sure that I'm over analyzing my problem, but this is the way I want to do it so just bare with me here. My problem is with determining the average miles per gallon. The assignment requires me to use a while loop to continuously receive information from the user until they wish to quit. The problem with determining the average is that it's not presenting the correct average after the 1st entry. Any help is appreciated.
Please note I'm not wanting a code snippet that will work better or work period, I just wish to know what I'm doing wrong so I can correct it.
#include<iostream> using namespace std; float MPG(float MilesTraveled, float GasUsed) { return MilesTraveled / GasUsed; } float AVG(float NewMPG, float OldMPG, int loop) { if (loop == 1) return NewMPG; else return NewMPG + OldMPG / loop; } int main() { float MilesTraveled = 1; float GasUsed = 1; float CurrentMPG = 0; float AvgMPG = 0; int loop = 1; while (MilesTraveled > 0) { cout << "Enter the miles you traveled (enter -1 to exit): "; cin >> MilesTraveled; if (MilesTraveled == -1) break; cout << "Enter how many gallons of gas you used: "; cin >> GasUsed; CurrentMPG = MPG(MilesTraveled, GasUsed); AvgMPG = AVG(CurrentMPG, AvgMPG, loop); cout << CurrentMPG << " Miles Per Gallon this tank.\n" << AvgMPG << " Miles Per Gallon on average.\n"; loop++; } }
Thank you in advance,
Jamie
Edited by lxXTaCoXxl: n/a | https://www.daniweb.com/programming/software-development/threads/410637/average-mpg-needing-help | CC-MAIN-2017-26 | refinedweb | 294 | 66.78 |
I was making some code changes today and thought this was interesting to share. As you know, the WeakReference class has a getter and a setter method to get and set the Target which is what the weakref points to. See Using GC Efficiently – Part 3 for more details on WeakReference.
Note that the code below is only for illustration purposes – it is not necessarily what’s in the production code.
So let’s say the code used to look like this in the WeakReference class:
internal IntPtr m_handle;
public Object Target
{
get
{
IntPtr h = m_handle;
if (IntPtr.Zero == h)
return false;
Object o = GCHandle.InternalGet(h);
h = Thread.VolatileRead(ref m_handle);
GC.KeepAlive (this);
return (h == IntPtr.Zero) ? null : o;
}
...
}
m_handle is the weak GCHandle that we create to implemente the weakref funtionality. It’s a weak handle that points to the object that you want your weakref object to point to.
The problem is Thread.VolatileRead kind of a heavy weight thing - not very performant (there was a reason why we used this API in the first place…not necessarily a good one but it’s what we ended up with).
First of all let’s take a look at the old code. Notice that we have a GC.KeepAlive in there. Why would we do that? I mean if during the call of Thread.VolatileRead, the weakref object is dead and its finalizer sets m_handle to 0, we’d just read 0. That’s fine right?
But imagine this code:
Object o = new Object();
while (true)
WeakReference wr = new WeakReference (o);
if (wr.Target == null)
...
o.GetHashCode();
We know that o is live during the while loop which means it would be really nice if wr.Target is null (some would consider it a bug if wr.Target was ever null in this case). If we didn’t have the KeepAlive, object wr could be considered dead as soon as its address is passed in to the Thread.VolatileRead call as the argument. So then h could be 0 and we’d return null. So we want to make sure that if the object the weakref points to is guaranteed to be live during the getter call, you will always get back that object instead of null.
Wouldn’t that achieve the same effect since m_handle is an instance data member and if it’s used, the *this* object should be kept alive where the last statement is?
Well, actually since m_handle is not a volatile, jit could generate some code that stores the value of m_handle in a register so it will not need to read the value of m_handle again when it’s at that last statement.
Another interesting thing about this code is that it does the IntPtr.Zero check after it first read the value of m_handle. But how can m_handle be 0? m_handle is only set to 0 in the WeakReference class’s finalizer code. If we are already KeepAlive-ing the weakref object, it means the object should be live therefore by definition the finalizer should have not been run, right?
Well, unfortunately there is a case where m_handle can be 0 while we are in the getter which is when the getter is called in an object’s finalizer. Imagine you have this object hireachy:
public class ObjectA
WeakReference wr;
public ObjectA(WeakReference wr0)
wr = wr0;
public ~ObjectA()
if (wr.Target == null)
{
...
}
ObjectA a = new ObjectA();
When a is not used anymore, at some point both a’s and wr0’s finalizer (assuming a is the only object that contains a reference to wr0) will be put on the finalize queue.
Now if a’s finalizer gets to run first, we are fine ‘cause when we are in wr0’s getter, m_handle is still valid. But if wr0’s finalizer gets to run first, then when a’s finalizer is run, m_handle is already set to 0. Of course as we’ve been saying that a finalizer should do no more than releasing native resources, this shouldn’t be a common scenario.
So, the idea is to change m_handle to volatile and eliminate the need for calling Thread.VolatileRead. The resulting code looks like this:
internal volatile IntPtr m_handle;
return null;
return (m_handle == IntPtr.Zero) ? null : o;
Notice that KeepAlive is gone because we are reading a volatile value which means the weakref object will be kept alive though out the getter. We still need to check if h is IntPtr.Zero at the beginning because we are still subject to be called from another object’s finalizer.
Some people don’t use volatile’s in fear of losing performance ‘cause volatile’s can’t be optimzed by the compiler. In reality though, if you read the volatile into a local when you need to access it frequently and that you are fine with the cached value, no reason to be afraid of using volatile’s. | http://blogs.msdn.com/b/maoni/archive/2007/03/20/he-s-live-he-s-live-not-he-s-live.aspx | CC-MAIN-2015-32 | refinedweb | 826 | 72.05 |
pig tutorial - apache pig tutorial - Apache Pig - User Defined Functions - pig latin - apache pig - pig hadoop
What is User Defined Functions in Apache Pig ?
- In addition to the built-in functions, Apache Pig provides extensive support for User Defined Functions (UDF’s).
- Using these UDF’s, you can define your own functions and use them.
Learn apache pig - apache pig tutorial - apache pig user defined functions - apache pig examples - apache pig programs
Supporting languages:
- The UDF support is provided in six programming languages, namely, Java, Jython, Python, JavaScript, Ruby and Groovy.
- For writing UDF’s, complete support is provided in Java and limited support is provided in all the remaining languages.
- Using Java, we can write UDF’s involving all parts of the processing like data load/store, column transformation, and aggregation.
- Apache Pig has been written in Java, the UDF’s written using Java language work efficiently compared to other languages.
- In Apache Pig, you also have a Java repository for UDF’s named Piggybank. Using Piggybank, you can access Java UDF’s written with other users, and contribute your own UDF’s.
Types of UDF’s in Java
Writing UDF’s using Java, you can create and use the following three types of functions −
- Filter Functions − The filter functions are used as conditions in filter statements. These functions accept a Pig value as input and return a Boolean value.
- Eval Functions − The Eval functions are used in FOREACH-GENERATE statements. These functions accept a Pig value as input and return a Pig result.
- Algebraic Functions − The Algebraic functions act on inner bags in a FOREACHGENERATE statement. These functions are used to perform full MapReduce operations on an inner bag.
Writing UDF’s using Java:
- To write a UDF using Java, we have to integrate the jar file Pig-0.15.0.jar. In this section, we discuss how to write a sample UDF using Eclipse. Before proceeding further, make sure you have installed Eclipse and Maven in your system.
Follow the steps given below to write a UDF function,
Step 1
- Open Eclipse and create a new project (say myproject).
Step 2
- Convert the newly created project into a Maven project.
Step 3
- Copy the following content in the pom.xml.
- This file contains the Maven dependencies for Apache Pig and Hadoop-core jar files.
<project xmlns = "" xmlns: <modelVersion>4.0.0</modelVersion> <groupId>Pig_Udf</groupId> <artifactId>Pig_Udf</artifactId> <version>0.0.1-SNAPSHOT</version> <build> <sourceDirectory>src</sourceDirectory> <plugins> <plugin> <artifactId>maven-compiler-plugin</artifactId> <version>3.3</version> <configuration> <source>1.7</source> <target>1.7</target> </configuration> </plugin> </plugins> </build> <dependencies> <dependency> <groupId>org.apache.pig</groupId> <artifactId>pig</artifactId> <version>0.15.0</version> </dependency> <dependency> <groupId>org.apache.hadoop</groupId> <artifactId>hadoop-core</artifactId> <version>0.20.2</version> </dependency> </dependencies> </project>
Step 4
- Save the file and refresh it. In the Maven Dependencies section, we can find the downloaded jar files.
Step 5
- Create a new class file with name Sample_Eval and copy the following content in it.
import java.io.IOException; import org.apache.pig.EvalFunc; import org.apache.pig.data.Tuple; import java.io.IOException; import org.apache.pig.EvalFunc; import org.apache.pig.data.Tuple; public class Sample_Eval extends EvalFunc<String>{ public String exec(Tuple input) throws IOException { if (input == null || input.size() == 0) return null; String str = (String)input.get(0); return str.toUpperCase(); } }
While Writing UDF’s, it is set to inherit the EvalFunc class and provide operation to exec() function. With in this function, the code required for the UDF is written.
- The above example, we have return the code to convert the contents of the specified column to uppercase.
- After compiling the class without errors, right-click on the Sample_Eval.java file. It gives you a menu. Select export as shown in the following screenshot.
Learn apache pig - apache pig tutorial - apache pig user defined-functions2 - apache pig examples - apache pig programs
- On click export, you will get the following window. Click on JAR file.
Learn apache pig - apache pig tutorial - apache pig user defined-functions3 - apache pig examples - apache pig programs
- Proceed further by clicking Next> button. You will get another window where you need to enter the path in the local file system, where you need to store the jar file.
Learn apache pig - apache pig tutorial - apache pig user defined-functions4 - apache pig examples - apache pig programs
- Finally click the Finish button. In the specified folder, a Jar file sample_udf.jar is created. This jar file contains the UDF written in Java.
Using the UDF:
- Once writing the UDF and generating the Jar file, follow the steps given below
Step 1:
Registering the Jar file
- After writing UDF (in Java) you have to register the Jar file that contain the UDF using the Register operator.
- By registering the Jar file, users can intimate the location of the UDF to Apache Pig.
Syntax:
The Register operator syntax is given below.
REGISTER path;
Example:
- As an example let us register the sample_udf.jar created previously in this chapter.
- Start Apache Pig in local mode and register the jar file sample_udf.jar as given below.
$cd PIG_HOME/bin $./pig -x local REGISTER '/$PIG_HOME/sample_udf.jar'
Note
− imagine the Jar file in the path − /$PIG_HOME/sample_udf.jar
Step 2:
Defining Alias
- After registering the UDF you can define an alias to it using the Define operator.
Syntax:
The syntax of the Define operator is shown below.
DEFINE alias {function | [`command` [input] [output] [ship] [cache] [stderr] ] };
Example:
Define the alias for sample_eval as shown below.
DEFINE sample_eval sample_eval();
Step 3:
Using the UDF
- Once defining the alias you can use the UDF same as the built-in functions. Assume there is a file named wikitechy_emp_data in the HDFS /Pig_Data/ directory with the following content.
11,Kevin,22,newyork 12,BOB,23,Kolkata 13,Oviya,23,Tokyo 14,Jack,25,London 15,David,23,Bhuwaneshwar 16,Maggy,22,Chennai 17,Anto,22,newyork 18,Syam,23,Kolkata 19,Mary,25,Tokyo 20,Saran,25,London 21,Stacy,25,Bhuwaneshwar 22,Kelly,22,Chennai
Ensure you have loaded this file into Pig as given below.
grunt> wikitechy_emp_data = LOAD 'hdfs://localhost:9000/pig_data/emp1.txt' USING PigStorage(',') as (id:int, name:chararray, age:int, city:chararray);
- we convert the names of the employees in to upper case using the UDF sample_eval.
grunt> Upper_case = FOREACH wikitechy_emp_data GENERATE sample_eval(name);
Verification:
- we are verify the contents of the relative Upper_case as given below.
grunt> Dump Upper_case; (KEVIN) (BOB) (OVIYA) (JACK) (DAVID) (MAGGY) (ANTO) (SYAM) (MARY) (SARAN) (STACY) (KELLY)
More functions: Datafu Pig
- Stats: variance, quantiles, median, etc.
- Bags: concat, append, preped, etc.
- Sampling
- Page rank
- Session estimation
How to use UDF libraries
pig scripting
Calling a script
| https://www.wikitechy.com/tutorials/apache-pig/apache-pig-user-defined-functions | CC-MAIN-2021-43 | refinedweb | 1,125 | 50.02 |
On May 29, 2006, at 9:32 AM, Lemmih wrote: > On 5/29/06, Robert Dockins <robdockins at fastmail.fm> wrote: >> Hello all, >> >> I've got a problem with a package I maintain. I have a Cabal package >> which contains one module which uses GADTs. This module is hidden. >> Now, Haddock barfs if you try to generate Haddock docs from a module >> containing GADTs. With Cabal 1.1.3, hidden modules (apparently...) >> are not parsed by Haddock at all, so it has no opportunity to barf on >> my GADTs, and I could get useable docs out. However, with 1.1.4, >> Cabal now tells Haddock to parse this file, but also gives it the -- >> hide option. Haddock subsequently refuses to generate any >> documentation. I can remove the hidden modules from the "other >> modules" section, but then the object code doesn't end up in the >> libraries and programs won't build. Aggh! >> >> Is there any way to fix this problem? > > #ifndef __HADDOCK__ > [GADTs here] > #endif Ahh! A simple solution! This is better than I dared hope. Many thanks. *crawls back into his cave, embarrassed by the simplicity of the solution...* > -- > Friendly, > Lemmih Rob Dockins Speak softly and drive a Sherman tank. Laugh hard; it's a long way to the bank. -- TMBG | http://www.haskell.org/pipermail/libraries/2006-May/005424.html | CC-MAIN-2014-42 | refinedweb | 212 | 77.74 |
{-# LANGUAGE CPP #-} {-# LANGUAGE BangPatterns #-} #if __GLASGOW_HASKELL__ >= 701 {-# LANGUAGE Trustworthy #-} #endif ----------------------------------------------------------------------------- -- | Copyright : (c) 2010 Jasper Van der Jeugt -- (c) 2010-2011 Simon Meier -- License : BSD3-style (see LICENSE) -- -- Maintainer : Simon Meier <iridcode@gmail.com> -- Portability : GHC -- -- Extra functions for creating and executing 'Builder's. They are intended -- for application-specific fine-tuning the performance of 'Builder's. -- ----------------------------------------------------------------------------- module Data.ByteString.Builder.Extra ( -- * Execution strategies toLazyByteStringWith , AllocationStrategy , safeStrategy , untrimmedStrategy , smallChunkSize , defaultChunkSize -- * Controlling chunk boundaries , byteStringCopy , byteStringInsert , byteStringThreshold , lazyByteStringCopy , lazyByteStringInsert , lazyByteStringThreshold , flush -- * Low level execution , BufferWriter , Next(..) , runBuilder -- * Host-specific binary encodings , intHost , int16Host , int32Host , int64Host , wordHost , word16Host , word32Host , word64Host , floatHost , doubleHost ) where import Data.ByteString.Builder.Internal ( Builder, toLazyByteStringWith , AllocationStrategy, safeStrategy, untrimmedStrategy , smallChunkSize, defaultChunkSize, flush , byteStringCopy, byteStringInsert, byteStringThreshold , lazyByteStringCopy, lazyByteStringInsert, lazyByteStringThreshold ) import qualified Data.ByteString.Builder.Internal as I import qualified Data.ByteString.Builder.Prim as P import qualified Data.ByteString.Internal as S import Foreign ------------------------------------------------------------------------------ -- Builder execution public API ------------------------------------------------------------------------------ -- |. -- type BufferWriter = Ptr Word8 -> Int -> IO (Int, Next) -- | After running a 'BufferWriter' action there are three possibilities for -- what comes next: -- data Next = -- | This means we're all done. All the builder data has now been written. Done -- | This indicates that there may be more data to write. It -- gives you the next 'BufferWriter' action. You should call that action -- with an appropriate buffer. The int indicates the /minimum/ buffer size -- required by the next 'BufferWriter' action. That is, if you call the next -- action you /must/ supply it with a buffer length of at least this size. | More !Int BufferWriter -- | In addition to the data that has just been written into your buffer -- by the 'BufferWriter' action, it gives you a pre-existing chunk -- of data as a 'S.ByteString'. It also gives you the following 'BufferWriter' -- action. It is safe to run this following action using a buffer with as -- much free space as was left by the previous run action. | Chunk !S.ByteString BufferWriter -- | Turn a 'Builder' into its initial 'BufferWriter' action. -- runBuilder :: Builder -> BufferWriter runBuilder = run . I.runBuilder where bytesWritten startPtr endPtr = endPtr `minusPtr` startPtr run :: I.BuildStep () -> BufferWriter run step = \buf len -> let doneH endPtr () = let !wc = bytesWritten buf endPtr next = Done in return (wc, next) bufferFullH endPtr minReq step' = let !wc = bytesWritten buf endPtr next = More minReq (run step') in return (wc, next) insertChunkH endPtr bs step' = let !wc = bytesWritten buf endPtr next = Chunk bs (run step') in return (wc, next) br = I.BufferRange buf (buf `plusPtr` len) in I.fillWithBuildStep step doneH bufferFullH insertChunkH br ------------------------------------------------------------------------------ -- Host-specific encodings ------------------------------------------------------------------------------ -- | Encode a single native machine 'Int'. The 'Int' is encoded in host order, -- host endian form, for the machine you're on. On a 64 bit machine the 'Int' -- is an 8 byte value, on a 32 bit machine, 4 bytes. Values encoded this way -- are not portable to different endian or int sized machines, without -- conversion. -- {-# INLINE intHost #-} intHost :: Int -> Builder intHost = P.primFixed P.intHost -- | Encode a 'Int16' in native host order and host endianness. {-# INLINE int16Host #-} int16Host :: Int16 -> Builder int16Host = P.primFixed P.int16Host -- | Encode a 'Int32' in native host order and host endianness. {-# INLINE int32Host #-} int32Host :: Int32 -> Builder int32Host = P.primFixed P.int32Host -- | Encode a 'Int64' in native host order and host endianness. {-# INLINE int64Host #-} int64Host :: Int64 -> Builder int64Host = P.primFixed P.int64Host -- |. -- {-# INLINE wordHost #-} wordHost :: Word -> Builder wordHost = P.primFixed P.wordHost -- | Encode a 'Word16' in native host order and host endianness. {-# INLINE word16Host #-} word16Host :: Word16 -> Builder word16Host = P.primFixed P.word16Host -- | Encode a 'Word32' in native host order and host endianness. {-# INLINE word32Host #-} word32Host :: Word32 -> Builder word32Host = P.primFixed P.word32Host -- | Encode a 'Word64' in native host order and host endianness. {-# INLINE word64Host #-} word64Host :: Word64 -> Builder word64Host = P.primFixed P.word64Host -- | Encode a 'Float' in native host order. Values encoded this way are not -- portable to different endian machines, without conversion. {-# INLINE floatHost #-} floatHost :: Float -> Builder floatHost = P.primFixed P.floatHost -- | Encode a 'Double' in native host order. {-# INLINE doubleHost #-} doubleHost :: Double -> Builder doubleHost = P.primFixed P.doubleHost | http://hackage.haskell.org/package/bytestring-0.10.4.0/docs/src/Data-ByteString-Builder-Extra.html | CC-MAIN-2014-15 | refinedweb | 657 | 50.73 |
Let's Go to the Tape: Q & A with a Microsoft XML Guru
Charles Heinemann
Program Manager, XML
Microsoft Corporation
May 11, 1998
Many of you have written me since this column debuted in March, asking for the scoop on just what we're up to here at Microsoft concerning XML. How would I know? I just work here. So I took a stroll down the hall asking if anyone would be willing to come to my office and give me the scoop -- on tape.
Adam Denning, the group program manager for XML and, incidentally, my boss, agreed not only to come to my office, but also to come clean. Now, for those of you who think that I chose this format for this month's column just to lessen my workload, let me tell you that getting this interview was no cakewalk.
First, I discovered that Mr. Denning, a native of the biggest of the British Isles, dislikes Marmite sandwiches, making for a very uncomfortable moment when the Microsoft Catering cart arrived. (How was I to know? I thought they all loved that stuff.) Second, he is often difficult to understand. (They told me he would be speaking English, but that sure ain't the kinda' English they speak where I'm from.) Third, he kept making obscure references to some show called Beyond the Fringe. (He later told me it was some comedy show with that short guy from Arthur -- who, just between you and me, I never thought was all that funny. Now, Benny Hill -- he's funny.)
All my troubles aside, enjoy:
Q. How did Microsoft get involved in XML?
Adam Denning: We were in the vanguard, so to speak. There were a few visionaries at this company who, along with a number of other people outside this company, believed XML to be far more than simply a document markup language. So we fostered it and supported it as a language for data. We firmly believe that XML as a universal text-based language for structured data will fundamentally change the Web, and our involvement in it from the beginning has reflected this.
Q. What role do you see XML playing on the World Wide Web?
Adam Denning: The primary role would be moving information from one place to another. Right now, the average work server provides that information as pages, which means that what you get is basically a visual rendition of information that you might actually want to process. What you really want to do is receive the information in such a way that you can understand it computationally, do things with it, and maybe then ultimately display it. Presentation will be merely a facet of the Web, rather than the whole thing.
Q. How does the average user fit into this vision?
Adam Denning: "User" being the key word here. Home shopping. Imagine you want to go and buy tape recorders to do interviews. How do you do that now? You go to a number of sites, look at the things available on those sites, find out prices, products, and then purchase the item, or maybe even go to a physical location to buy the product. But let's say you wanted to look at different tape recorders, made by different manufacturers, side by side so that you could compare their features and prices. You could then choose the best one at the best price and purchase it. XML will make this possible because information will be available and accessible, as well as more easily searched.
Q. What role do you see XML playing in terms of future desktop applications?
Adam Denning: The thing about XML is that it is totally broad. So you could use it for virtually anything. For instance, it could be used to describe documents produced by a word processor, components within a spreadsheet, or other structured information.
As an aside, I do believe that over time, and I'm not sure when, Microsoft Office will become one of the main tools you will be able to use to create marked-up information: data, documents, or whatever you want to call it.
Q. Besides Internet Explorer, what other groups at Microsoft are supporting XML?
Adam Denning: I think it's more a question of which groups aren't. Literally, everyone that we speak with has some interest in XML, and for a variety of different purposes.
Q. What groups are not just supporting XML but actually using XML?
Adam Denning: Internet Explorer is already using it for various purposes, such as Channel Definition Format, OSD, and so forth. Commerce Server is using it as the data-transfer format within the Commerce Interchange Pipeline. Microsoft Office is using XML within documents to hold information about the document. These, and a host of other groups. Within the next year, you'll see XML being utilized just about everywhere.
Q. Why would these groups choose XML over some other format?
Adam Denning: If the system is totally closed, then it's a good question. Why use XML when you could use a potentially more efficient format? But in the case of most of the groups that I speak with here at Microsoft and elsewhere, in fact, the system is not entirely closed. Therefore, you need a universal format that doesn't require that you communicate only with certain systems.
Q. Why not use existing standard formats, such as EDI?
Adam Denning: The problem with EDI is that it takes a long time for people to agree on a standard, because everybody wants their individual customizations, and so forth. And it's a format that is not particularly human readable. So XML can, in many instances, replace EDI, because it allows for extensibility without requiring any underlying changes in the format.
Q. Are you concerned at all about the compatibility of Microsoft's XML technology with, for instance, the XML support in other browsers?
Adam Denning: I'm concerned because we have to make sure that it happens. But I believe that there's enough industry momentum behind it to ensure that, at least at the macro level, compatibility exists.
Q. How important do you see such compatibility as being?
Adam Denning: Critical.
Q. Why critical?
Adam Denning: Because if people want to use information from a wide variety of sources, there will be no guarantee that others will be using a specific browser. There's no guarantee that anything will be constant, apart from the information being transferred. Therefore, to allow for the broadest reach of applications using XML, you need to ensure that browsers have the same support.
Q. Why won't we have the same problem with XML that we did and do with HTML?
Adam Denning: The problem with HTML is that HTML is a defined standard where not only the syntax is defined, but the tags within the syntax are defined. There are a definitive number of tags within the syntax that can be used. Each of those tags has a defined behavior. So therefore, if you want to extend HTML in any meaningful way -- for example, add data binding capability or enhance it to use ActiveX controls or other objects, or if you want to use Dynamic HTML -- you essentially have to change HTML. You either have to add new tags or extend the behavior of existing tags. Doing so, in both cases, means that what you've now created is proprietary.
With XML, the syntax is defined, but not one single tag is defined. Consequently, any semantics that a tag has are entirely up to the author. There is no predefined tag saying, "Display me in a paragraph," or "Put me in bold," or anything else. All tags are open, and therefore you can't have the same problem as with HTML, because the standard is deliberately open. Now, you may argue that that situation therefore introduces a different problem -- and that is that we may both define <TITLE> tags, but have different meanings associated with those tags. But this is solved through the use of namespaces. With namespaces, both <TITLE> tags can be used at the same time, because they are both made unique.
Q. What is Microsoft's main focus, in terms of XML and XML support, over the next six months?
Adam Denning: For the short term, our plan is to provide the functionality that we've been evangelizing for so long, and to make sure that people can actually fulfill our vision and their vision using XML.
Q. What about over the next couple years?
Adam Denning: Over the next year or two years, we see people across the Web universe beginning to understand how XML can be leveraged by their customers. Therefore, we see people beginning to expose the types of services we spoke about earlier. So you will begin to see booksellers exposing information, their list of books if you like, in such a way that you could query it, that you could find the best price among them. We'll see search engines that can understand XML tags, and can therefore not only find documents that contain the words Jane Smith, but contain information about the "author" Jane Smith.
Q. What, in your opinion, is the key to XML becoming widely adopted, to it enjoying the success that HTML currently enjoys?
Adam Denning: In fact, there are three keys. First, we have to see that it has value. People have to understand why, exactly, XML is interesting to them and why it is valuable. They won't simply adopt it because it's a new wave of technology; they have to see that it has value. Second, we have to provide them with the capability to utilize that value. So that means having browsers that support XML, some standard parsing and rendering, but also all the other bits: querying, transactioning, updating. Third, industry bodies have to decide that they can agree upon XML vocabularies, that booksellers can come together to agree upon a vocabulary for books. So that everyone knows that if you want to speak books, there's a vocabulary for doing so.
Q. Why would two booksellers want to cooperate like that?
Adam Denning: Well, inevitably consumers are going to demand that they have access to data marked up in XML.
Q. What you're saying, then, is if people are going to get involved with business on the Web, they're going to have to get on board with XML, because that's going to be . . .
Adam Denning: The lingua franca of commerce.
Q. So in a certain sense, XML will enable the customer, the quite-average customer, to actually have access to not only the products, but also the data that surrounds the products?
Adam Denning: Oh, yeah.
And with that, the Englishman checked his watch, apologized in a most gracious fashion for having to go, and headed off down the hall, no doubt to find some "real food" to eat.
Charles Heinemann is a program manager for Microsoft's Weblications team. Coming from Texas, he knows how to think big.
Extreme Mail
Dear Charles:
I'd basically like to display a virtual comics page so I don't have to chase down each site every day. However, this seems like it would violate their copyright to the strips. Is XML mostly for use with non-proprietary type info, like stock quotes, or would it be okay to use it for comic strips?
Thanks.
Charles answers:
XML is a data format intended for universal use and access. This means that in building XML support into Internet Explorer, it was assumed that XML would be used to describe both proprietary and non-proprietary information. We do, however, understand that the transfer of information, regardless of the format, gives rise to copyright and security concerns, and we are working very hard to ensure that these concerns are dealt with in an appropriate manner. | https://msdn.microsoft.com/en-us/library/ms950775.aspx | CC-MAIN-2015-22 | refinedweb | 1,996 | 70.33 |
io_fd_flags man page
io_fd_flags — prepare descriptor for io_wait
Syntax
#include <io.h>
int io_fd(int64 fd);
#ifdef HAVE_IO_FD_FLAGS
int io_fd_flags(int64 fd);
Description
io_fd_flags behaves just like io_fd, but certain flags can be bitwise-ORed to it to alter its behavior:
- IO_FD_CANWRITE
tell io_fd that the descriptor is writable. This is useful so io_wantwrite can queue the descriptor immediately and there is no need to query the operating system event reporting mechanism.
- IO_FD_BLOCK
tell io_fd that the descriptor is blocking.
- IO_FD_NONBLOCK
tell io_fd that the descriptor is non-blocking.
Normally, io_fd calls fcntl to ask the operating system whether the descriptor is blocking or not. The frameworks needs to know because it alters how io_tryread and io_trywrite handle the socket. Never pass both IO_FD_BLOCK and IO_FD_NONBLOCK at the same time.
Newly connected stream sockets are always writable if the connection is established, so it is usually safe to pass IO_FD_CANWRITE. The main exception case where IO_FD_CANWRITE should not be passed is on a non-blocking socket where a connect() is pending. Then you need to poll for writability to get notified when the connection is established.
Return Value
io_fd_flags returns 1 on success, 0 on error.
See Also
io_fd(3), io_fd_canwrite(3) | https://www.mankier.com/3/io_fd_flags | CC-MAIN-2018-43 | refinedweb | 202 | 64.81 |
Included in version 2.0 of the .NET framework is a Ping class (System.Net.NetworkInformation namespace) that can be used to monitor the up/down status of a network connection to a server. We recently realized that we had a minor bug in the class that can present itself as a major problem - a memory leak. Fortunately there is an easy workaround to this problem. I thought I would take this as an oportunity to demonstrate how to use the windbg debugger as I explain how we figured out what was going wrong.
Lets consider this simple console ping application that sends a series of ping requests to a server using the SendAsync method.
using System;using System.Threading;using System.Net.NetworkInformation;
class program { static int PingsOutstanding;
static void Main(string[] args) { string targetServer = ""; for (int i = 0; i < 1000; i++) { PingServer(targetServer); }
int currentcount = PingsOutstanding; while (currentcount > 0) { Console.WriteLine("waiting for {0} ping requests to complete", currentcount); Thread.Sleep(1000); currentcount = PingsOutstanding; }
//the calls to the GC are just for debugging purposes Console.WriteLine("Calling GC.Collect()"); GC.Collect(); GC.WaitForPendingFinalizers();
Console.WriteLine("Press <enter> to exit application"); Console.ReadLine(); }
static void PingServer(string hostnameoraddress) { try { Ping pingsender = new Ping(); pingsender.PingCompleted += new PingCompletedEventHandler(OnPingCompleted); pingsender.SendAsync(hostnameoraddress, null); Interlocked.Increment(ref PingsOutstanding); } catch (Exception ex) { Console.WriteLine(ex); } }
static void OnPingCompleted(object sender, PingCompletedEventArgs e) { Interlocked.Decrement(ref PingsOutstanding);
try { Ping pingsender = (Ping)sender;
pingsender.Dispose(); } catch (Exception ex) { Console.WriteLine(ex); } }}
This application will not consume a ton of memory under normal operation but if you increase the number of ping requests that are sent, you will see that memory consumption also climbs. Given that the .Net framework uses a garbage collection approach to memory allocation and cleanup, you would expect that the memory would be cleaned up properly within a reasonable amount of time. You should also notice that I am calling pingSender.Dispose() which we would hope would release the resources being held by this object.
For demonstration purposes I have added a Console.ReadLine() call at the end of the application so that it won't exit. I have also added a call to GC.Collect() and GC.WaitForPendingFinalizers() to make sure that when I go to debug this I am certain that the GC has recently run and cleaned up any objects that are available for cleanup. It is not usually advisable to force GC collections except for debugging purposes. See Maoni's blog for great information on how the GC works and how to use it effectively.
Using Windbg.exe
I chose to use Windbg because I have found it to be the best debugger for memory leaks. It is a very powerful GUI debugger that is used very frequently inside of Microsoft for debugging everything from application bugs to OS bugs. You can download it from here:.
A couple of quick notes before I begin:
Now, Windbg is a native windows debugger and doesn't really know much about the .Net framework, so you have to load an extension to the debugger that understands managed applications. SOS.dll is the debugger extension we are looking for. In the command window this will load the sos extension:
.loadby sos mscorwks
This command tells the debugger to load the sos dll by looking in the same directory as the mscorwks dll, which is a core dll that is always loaded in a managed application. Note that Windbg breaks into the debugger immediately upon loading the application, so mscorwks will not be loaded at this point. You will have to run the application long enough for the .NET framework code to be loaded. You can actually tell the debugger to break when mscorwks is loaded by running this in the command window:
sxe ld:mscorwks
There are two ways that you can run commands from the sos this extension dll:
!<command> or !sos.<command>
Here are examples for the help function found in sos (it prints usage information):
!help !sos.help
The second one is useful when you have multiple extensions that share common function names.
When debugging this leak, I actually let the app run until it blocked on the call to Console.ReadLine() so that GC should have cleaned up. The first thing I do when dealing with a managed memory leak is to look at all the objects that have been created by the runtime and see if I see any that jump out at me. Lets look at the heap and see what it contains.
!dumpheap -stattotal 20600 objectsStatistics: MT Count TotalSize Class Name7a76eb14 1 12 System.Net.DnsPermission7a755834 1 12 System.Diagnostics.PerformanceCounterCategoryType7a753394 1 12 System.Diagnostics.TraceOptions7a71a710 1 12 System.Net.TimeoutValidator7912b908 1 12 System.Collections.Generic.GenericEqualityComparer`1[[System.String, mscorlib]]79112c90 1 12 System.Collections.Comparer7910db30 1 12 System.Threading.SynchronizationContext7910a718 1 12 System.DefaultBinder79107f40 1 12 System.RuntimeTypeHandle79107ac4 1 12 System.Reflection.__Filters79102f48 1 12 System.__Filters79102ef8 1 12 System.Reflection.Missing79101ca8 1 12 System.RuntimeType+TypeCacheQueue79100800 1 12 System.Text.DecoderExceptionFallback...(output trimmed)0105a514 77 4004 System.Configuration.FactoryRecord791242ec 47 8136 System.Collections.Hashtable+bucket[]79160a3c 1000 16000 System.Threading.RegisteredWaitHandle79124228 58 19216 System.Object[]7a779154 1000 20000 System.Net.SafeLocalFree7a778ec0 1000 20000 System.Net.SafeCloseHandle7a761bb0 1000 20000 System.ComponentModel.AsyncOperation79160b84 1000 20000 System.Threading._ThreadPoolWaitOrTimerCallback7910cf3c 1001 20020 Microsoft.Win32.SafeHandles.SafeWaitHandle791609c8 1000 24000 System.Threading.RegisteredWaitHandleSafe79115d0c 1000 24000 System.Threading.ManualResetEvent7a7811f4 1000 32000 System.Net.NetworkInformation.PingCompletedEventHandler79160aa8 1000 32000 System.Threading.WaitOrTimerCallback7915ff38 1000 32000 System.Threading.SendOrPostCallback7910d2f4 1001 36036 System.Threading.ExecutionContext79124418 1004 44820 System.Byte[]7a7812e0 1000 88000 System.Net.NetworkInformation.Ping00150c90 421 108132 Free790fa3e0 5262 304552 System.StringTotal 20600 objects
Looking at the columns in the output, MT stands for Method Table and is basically a pointer to the table that describes that type of object. Count is the number of objects that exist in the heap of the given type. TotalSize is the amount of memory that is being consumed by any one type of object. The last column is obviously the fully typed name of the object.
The first thing that jumps out at me in this case is the fact that we still have a large number of ping objects in the heap even though we aren't holding onto any references in our code. We also called dispose on these objects, so this is a huge red light telling me that something went wrong. Also, the fact that we sent exacly 1000 ping requests and there are exactly 1000 ping objects still hanging around calls my attention. Lets take a look at these ping objects and see why they aren't getting cleaned up (Below I show two ways of doing this, you really only need to do one of them).
!dumpheap -type Ping
This does a substring match on any object with Ping in it. In this case it will list both System.Net.NetworkInformation.Ping objects and System.Net.NetworkInformation.PingCompletedEventHandler objects. I really wanted just the Ping objects, so we could have run this command (using the MT for the ping object - obtained above)
!dumpheap -mt 7a7812e0
Address MT Size01271ff0 7a7812e0 88 012720f8 7a7812e0 88 012721d0 7a7812e0 88 012722a8 7a7812e0 88 01272380 7a7812e0 88 01272458 7a7812e0 88 01272530 7a7812e0 88 01272608 7a7812e0 88 012726e0 7a7812e0 88 012727b8 7a7812e0 88 01272890 7a7812e0 88 01272968 7a7812e0 88 ...(output trimmed) 012fada0 7a7812e0 88 012faeec 7a7812e0 88 012fb038 7a7812e0 88 012fb184 7a7812e0 88 012fb2d0 7a7812e0 88 012fb41c 7a7812e0 88 012fb568 7a7812e0 88 012fb6b4 7a7812e0 88 012fb800 7a7812e0 88 012fb94c 7a7812e0 88 012fba98 7a7812e0 88 012fbbe4 7a7812e0 88 012fbd30 7a7812e0 88 012fbe7c 7a7812e0 88 total 1000 objectsStatistics: MT Count TotalSize Class Name7a7812e0 1000 88000 System.Net.NetworkInformation.PingTotal 1000 objects
Notice that the MT for all of the above objects matches that for the ping object. The left hand column is the memory address where the object resides. We can use this address to examine the actual ping object. To take a look at the first object in the above list we would use this command:
!dumpobject 01271ff0
I am not going to go into details at this point because this won't lead us where the problem lies. I thought I would list the dumpobject command just to point it out to you. The problem in this case is that objects that we think should be cleaned up are not cleaned up as expected. This means that there must be a reference to the object somewhere. The following command will help you to see what objects hold references to an object in question. We will use the same object address we used in the dumpobject example:
!gcroot 01271ff0
Note: Roots found on stacks may be false positives. Run "!help gcroot" formore info.Scan Thread 0 OSTHread 2f8Scan Thread 2 OSTHread fccScan Thread 3 OSTHread de8Scan Thread 4 OSTHread eb8Scan Thread 8 OSTHread c8cScan Thread 12 OSTHread 464Scan Thread 13 OSTHread 1e0DOMAIN(0014BF60):HANDLE(Strong):8f15b8:Root:0128d2c0(System.Threading._ThreadPoolWaitOrTimerCallback)->01271ff0(System.Net.NetworkInformation.Ping)
This tool scans the threads to find any object that holds a reference to the given memory address. We can see that some threadpool object is holding onto us. If we go back to the objects on the heap we can see that there are these _ThreadPoolWaitOrTimerCallback objects on the heap also. Now, I don't know a ton about the thread pool, but I would not expect those callback objects to still be on the heap either because they are most likely specific to a single usage of a threadpool thread. We could dump all of the _ThreadPoolWaitOrTimerCallback objects and check their roots (the objects holding onto them), but why dump the more objects from the heap? The output from !gcroot gave us a pointer to an instance that we can quickly examine.
!gcroot 0128d2c0
We would have hoped that the Dispose() function would have cleaned these objects up, but it didn't. So, what about the GC? Why didn't GC take care of them when dispose didn't? Notice how this gave us the same exact output from the gcroot of the ping class. This must mean that we have a circular reference (ping has a reference to this thread pool object and visa versa) and that is why the GC didn't clean it up.
Workaround (and reason why calling Dispose didn't clean this up)
The simple workaround to this problem is to cast the object to the IDisposable interface and then call Dispose on that casted object.
((IDisposable)pingSender).Dispose();
Why does this solve the problem? Take a look at the declaration of the class:
public class Ping:Component,IDisposable
Notice that it inherits from Component and it also implementes the IDisposable interface. Now lets look at the function declaration for Dispose on the Ping class:
void IDisposable.Dispose ()
In the implementation, the Dispose function was defined as part of the IDisposable interface but the fact that the base class Component also implements a Dispose function was missed. The Ping class doesn't override the Component.Dispose method and so if you call Dispose directly on the Ping object without casting it to an IDisposable Interface, the runtime calls the base class implementation of Dispose instead of the one that was intended (the one for IDisposable).
Note: There is another great blog on debugging managed memory leaks here: | http://blogs.msdn.com/b/joncole/archive/2005/12/15/debugging-a-memory-leak-in-managed-code_3a00_-ping-_2d00_-sendasync.aspx | CC-MAIN-2015-32 | refinedweb | 1,894 | 57.87 |
In this tutorial, we will learn to use the UART communication module of TM4C123GH6PM microcontroller by using TM4C123G Tiva LaunchPad. This tutorial will help you understand how TM4C123G MCUs communicate with external devices or with each other over UART based serial communication protocol. First, we will discuss the UART module of TM4C123GH6PM microcontroller and its memory-mapped registers. These memory-mapped registers that are used to configure the UART module as a transmitter and receiver. After that we will see examples to transmit and receive data by using TM4C123G Tiva LaunchPad.
Preliminary Concepts
Before starting this tutorial, there are some basic background you need to cover. We will be using TM4C123G Tiva C launchpad, you can read these getting started tutorials:
- Introduction to Tiva Series TM4C123G LaunchPad
- How to use GPIO pins of TM4C123G Tiva launchPad
- Use Push Button to Control LED with TM4C123G Tiva LaunchPad
We will be using Keil IDE for programming of TM4C123G. But, if you did not setup Keil IDE on your computer, you can read these tutorials for installation and beginners level guide:
UART Communication Introduction
UART stands for a universal asynchronous receiver and transmitter. It is one of the simplest wired serial communication protocol used to transfer data serially between two devices in embedded systems applications. As its name suggests, it is an asynchronous communication protocol. Therefore, no clock signal is required for synchronization between two devices.
UART Port Pins
Only two pins are used to transfer and receive data such as a transmit pin (Tx) and a receiver pin (Rx). Other two pins are just power supply pins such as ground and Vcc ( usually a power source of the device). But one important point to consider here is that the ground terminal or reference point of both devices should be common.
For example, we want to communicate with two TM4C123G MCUs over UART communication, the hardware connection between two microcontrollers will be according to the block diagram as shown below:
Hardware Connections
Transmission line of one device connects with the receiver line of other device and vice versa. For example, in the above diagram, one UART device is a TM4C123G Tiva launchPad and the other device is a GPS module. We want to receive location coordinates from the GPS module. TM4C123G Tiva C development board will send data requests to the GPS module through Tx pin and GPS module will receive it through Rx pin. Similarly, the GPS module will transmit data through its Tx pin and TM4C123G microcontroller will receive this data through its Rx pin.
It is beyond the scope of this tutorial, to provide in-depth detail of UART communication protocol. But if you want to explore further, you can read this article:
UART Communication Protocol
Many hardware modules such as GSM, GPS, Bluetooth, Xbee communicate with other devices or microcontrollers through UART communication. Hence, if we want to use one of these modules in your embedded systems project, we can easily interface these wireless communication modules with TM4C123G using the UART interface.
TM4C123GH6PM Microcontrollers UART Ports
As we mentioned earlier, Tiva C launchpad has TM4C123GH6PM Microcontroller. This TI microcontroller supports 8 UART ports, starting from UART0 to UART7. On top of that each module has a separate 4 bytes transmit and receive FIFO storage that reduces the CPU interrupt service load. The following table provides the pinout of each UART port:
As you can depict from the above table, each UART port pin of TM4C123 has alternate shared functions with GPIO pins. But each pin can be used for only one function at a time. For instance, TX0/PA0 and RX0/PA1, PA0 and PA1 once configured to be used as a Tx and Rx pins of the UART0 module, they cannot be used as GPIO pins unless we configure them again as GPIO pins.
UART Module Configuration Registers
In this section, we are going to discuss the various registers that are associated with UART modules. These registers perform various functions such as baud rate setting, configuration, data receiver and transmitter registers and flag registers. Now let’s discuss each register one by one.
UART Clock Control Register
RCGCUART register is used to enable or disable clock for each UART module. In order to save power, enable the clock for only those modules which you want to use. First 8-bits of this register enables or disables the clock for each UART module. For example, bit 0 to bit 7 of RCGCUART register are associated with UART0 to UART7 modules respectively.
For example, writing 1 to 0th bit of RCGCUART will enable the clock for UART0 and writing 0 will disable the clock.
SYSCTL->RCGCUART |= 1; // enable clock for UART0 SYSCTL->RCGCUART |= 2; // enable clock for UART1
UART GPIO Pins Configuration
As we mentioned earlier, each GPIO pin has multiple functions or multiplexed with different peripherals such as UART, ADC, SPI and I2C etc. In order to use these GPIO pins for a specific peripheral, we must first configure them using corresponding configuration registers.
For example, if you want to use the UART0 module, then PA0 and PA1 pins of PORTA are used as Rx and Tx pins. Firstly, you should configure PA0 and PA1 as digital pins using GPIO->DEN register.
GPIOA->DEN = 0x03; /* Make PA0 and PA1 as digital */
Furthermore, both PA0 and PA1 pins are used as alternate functions with built-in ADC channels of TM4C123 microcontroller. Hence, you should also disable the ADC alternate function for PA0 and PA1 by setting 0th and 1st bit of GPIOA->AFSEL register to one.
GPIOA->AFSEL = 0x03;/* Use PA0,PA1 alternate function */
One last register is a port control register that is PCTL which is used to select alternate functions of each GPIO pin for different peripherals of TM4C123 microcontroller. PCTL is a 32-bit register and four bits are used to select alternate functions of each GPIO pin. For example, if you want to use UART0, then PA0 and PA1 should be configured for UART0. We can easily configure it by writing 1 in the PCTL register of GPIOA for each pin.
GPIOA->PCTL |= 0x00000011 // PA0 and PA1 configure for UART module
If you want to use UART2, then PD6 and PD7 are used Rx and Tx pins of UART2 module respectively. Similarly, we can enable the alternate function of PD6 and PD7 pins for UART2 by using the PCTL register of GPIOD.
GPIOD->PCTL |= 0x11000000 // PD6 and PD7 configure for UART2
For more information on alternate functions of each pin and setting respective bits of PCTL register see page 1351 TM4C123GH6PM microcontroller datasheet.
Baud Rate Configuration Register
As you know that in a universal asynchronous receiver and transmitter communication, baud rate is an important concept. It is the only way to synchronize data transfer between two UART devices. In UART, the required to transfer one bit is called the bit time and the inverse of bit time is known as the baud rate. Hence, baud rate is the number of bits transferred in one second.
Note: The baud rate of both devices ( sender or receiver) should be the same.
In TM4C123 MCU two registers are used to set baud rates such as UART Integer Baud-Rate Divisor (UARTIBRD) and UART Fractional Baud-Rate Divisor (UARTFBRD).
Before we discuss these registers, let’s first define the formula of baud rate calculation. This formula is used to calculate baud rate:
UART Baud Rate = ( f / 16 x baud divisor)
Where f is the clock frequency of the UART module which is known and equal to system frequency. The TM4C123 Tiva C launchpad has an onboard 16MHz crystal. Hence f = 16MHz.
Baud divisor is the value that will be loaded to baud control registers such as UARTIBRD and UARTFBRD.
For example, if we want a baud rate of 9600 that is we want to transfer 9600 bits per second. We can calculate baud divisor value by using above equation:
9600 = (16MHz / 16 x baud divisor) Baud divisor = 1000000/9600 = 104.1667
The integer value of the baud divisor will go into the integer baud register UARTIBRD.
UART0->IBRD = 104;/* 16MHz/16=1MHz, 1MHz/104=9600 baud rate */
Value for the fractional baud rate register can be calculated by multiplying fraction value with 64 and adding 0.5.
0.166 x 64 + 0.5 = 11
UART0->FBRD = 11; /* fraction part of baud generator register*/
TM4C123 UART Control Register
UARTCTL is a UART module configuration control register. Besides various other functions, its main function is to enable or disable UART module. For this tutorial, we will be using only three bits of UARTCTL register which are used to enable UART(UARTEN), enable transmitter (TXE) and receiver (RXE).
For example, you can to enable UART2 module of TM4C123 MCU, you can enable UART2 by setting UARTEN, RXE and TXE bits of UARTCTL register like this:
UART02->CTL = 0x301; /* enable UART2, TXE, RXE */
TM4C123 UART Line Control (UARTLCRH)
This register is used to define the format of UART data frame such as number of bits data, data length (bits 5 and 6) , parity bit and stop bits implementation, FIFO enable.disable and break conditions, etc.
For example, this line sets the data length of UART2 format to 8-bit, no-parity bit, disable FIFO and one stop bit,
UART2->LCRH = 0x60; /* 8-bit, no parity, 1-stop bit, no FIFO */
Data Register ( UARTDR )
This register for both transmitter and receiver modules. This is also a 32-bit register. First, 0 to 7 bits contain the data that we want to transmit or data that is received on an Rx pin of TM4C123G microcontroller. Bits 8-11 provides error information such as framing error, parity error, break error, and overrun error. computer.
Steps to Configure Transmitter
Following these steps to configure UART serial ports registers:
- Enable clock signal to the selected UART module using related enable bit of RCGCUART register.
- After that enable clock signal to GPIO pins of Rx and Tx pins by using the RCGCGPIO register.
- Before configuring the selected UART port, disable it by writing zero to the UARTCTL register.
- Calculate baud divisor value by using the required baud rate and clock frequency and write integer and fractional part of baud divisor to UARTIBRD and UARTFBRG registers respectively.
- Select the system clock for UART by writing 1 to UARTCC register.
- Configure the line control register by enabling or disabling different bits such as stop bit, parity, data length, interrupt, and FIFO.
- Enable TxE and RxE bits of UARTCTL to enable transmitter and receiver.
- Enable UART port by setting UARTEN bit of UARTCTL register.
- In the end, configure the alternate function of GPIO pins using the port control register (UARTPCTL).
TM4C123 Tiva C UART Transmitter Code
This program transmits “HELLO” through the UART5 module of TM4C123GH6PM microcontroller. PE5 pin of Tiva C is used as a TX5 pin.
If you want to see the output of this code, you can connect the TX5 pin of the launchpad with the computer using an FTDI ( USB to serial converter) and use a hyper terminal or putty to see the output.
#include "TM4C123.h" void Delay(unsigned long counter); char UART5_Receiver(void); void UART5_Transmitter(char data);); while(1) { UART5_Transmitter('H'); UART5_Transmitter('E'); UART5_Transmitter('L'); UART5_Transmitter('L'); UART5_Transmitter('O'); UART5_Transmitter('\n'); } } void UART5_Transmitter(char data) { while((UART5->FR & 0x20) != 0); /* wait until Tx buffer not full */ UART5->DR = data; /* before giving it another byte */ } void Delay(unsigned long counter) { unsigned long i = 0; for(i=0; i< counter; i++); }
TM4C123 Tiva C UART Receiver Programming
In the last section, we have learned to configure the receiver module of UART5. The steps to configure the receiver part of UART5 are exactly the same except the RXFE flag of the UART flag register.
RXFE bit becomes low when the receive buffer is not empty. In other words, when data is available to read. Therefore, in UART5_Receive() function, we monitor the RXFE bit of the UARTFR register, whenever it goes low, we read the data from UARTDATA register.
Tiva C UART Receiver Code
This code reads data from RX5 pin whenever data is available and echo back data through TX5 pin.
#include "TM4C123.h" #include <stdint.h> #include <stdlib.h> void Delay(unsigned long counter); char UART5_Receiver(void); void UART5_Transmitter(unsigned char data); void printstring(char *str);); printstring("Hello World \n"); Delay(10); while(1) { char c = UART5_Receiver(); /* get a character from UART5 */ UART5_Transmitter(c); } } char UART5_Receiver(void) { char data; while((UART5->FR & (1<<4)) != 0); /* wait until Rx buffer is not full */ data = UART5->DR ; /* before giving it another byte */ return (unsigned char) data; } void UART5_Transmitter(unsigned char data) { while((UART5->FR & (1<<5)) != 0); /* wait until Tx buffer not full */ UART5->DR = data; /* before giving it another byte */ } void printstring(char *str) { while(*str) { UART5_Transmitter(*(str++)); } } void Delay(unsigned long counter) { unsigned long i = 0; for(i=0; i< counter; i++); } void SystemInit(void) { __disable_irq(); /* disable all IRQs */ /* Grant coprocessor access */ /* This is required since TM4C123G has a floating point coprocessor */ SCB->CPACR |= 0x00F00000; }
Keil uvision v5 Instructions
Note: If you are using Keil uvision v5, you should remove the void
SystemInit(void) function from the above code. Because the startup file in Keil v5 already contains the function SystemInit().
After that follow these steps to build above code with Keil uvision 5:
The other issue with the SystemInit() function in the new system_TM4C123.c is that it configures the clock generation which results in a different system clock rate than the default 16 MHz frequency. But the above sample code works on the default 16 MHz system clock. Therefore, the above program creates timing issues with Keil v5. You may retain the default system clock rate in Keil v5, by the following steps:
- Expand the Project->Device to show system_TM4C123.c (startup)
- Double click to open the file in the editor window
- Find the line “#define CLOCK_SETUP 1” as the figure below
- Comment out the line
- Rebuild the project
UART Communication between PC and Tiva C
Now let’s see the demo of the above code. In order to see the output of the above program, you will need an FTDI cable that is serial to USB converter. You will need an FTDI cable like this:
This table shows the pin connection of FTDI cable:
When you connect this USB to serial converter cable with your computer, it will automatically install its drivers. But if your computer is not able to install drives automatically, you can download drivers from this link.
You will also need a serial terminal on your computer such as hyper terminal or putty. Go to this link and download Putty. After downloading, install it on your personal computer.
Now upload the above code to TM4C123 Tiva LaunchPad. After that make connections with TM4C123 and FTDI cable according to this table:
After that open putty terminal. Enter baud rate of 9600 and write COM pin to which your FTDI cable is connected with computer. In order to find COM pin number, you can go to device manager and note down COM pin number as shown below:
Now open the putty terminal and make settings according to this figure and click on open.
Now clock on reset button of TM4C123 tiva c, you will get “Hello World” string output on putty terminal and also whatever, you will type on the terminal will echo back to the terminal.
Other UART Tutorials:
4 thoughts on “UART Communication TM4C123 Tiva C LaunchPad with Example Codes”
i don’t Understand which code did we put in the video and tried The transmission or the receiver code or both . i can’t understand it well for example if i have a gps and a tiva c do i need a transmission code or not ? and if i need why would i need it ? i don’t think the gps would need anydata from the tiva c
If you only want to receive data from GPS, you will need to need to connect the Tx pin of GPS with the Rx pin of TM4C123. But if your GPS requires an configuration settings to be sent from TM4C123 then you will need to connect transmission pin also.
UART1 can be PB0 and PB1 too. There are multiple I/O choices for some of the UARTs. Just for the record.
Yes, you are right and we have not mentioned that in the table to keep the tutorial simple and not to confuse beginners. | https://microcontrollerslab.com/uart-communication-tm4c123-tiva-c-launchpad/ | CC-MAIN-2021-39 | refinedweb | 2,740 | 58.52 |
Apache's Jakarta project offers all kinds of great open source resources to Java developers. One of Jakarta's less well-known but extremely useful subprojects is. Among other uses, these modules give developers the ability to add WebDAV client functionality to their Java applications.
This article gives an introduction to using the Slide WebDAV client functionality in Java applications. The article will start with an overview of the WebDAV protocol, followed by an overview of the Slide project. Finally, we will get our hands dirty with some examples of using the Slide WebDAV client libraries in your applications.
WebDAV stands for "Web-based Distributed Authoring and Versioning." WebDAV is a set of extensions to the HTTP protocol that allows users to collaboratively edit and manage files on remote servers. While the protocol extensions themselves are simple and easy to use, the power that they add to an HTTP server is incredible. In effect, WebDAV makes an HTTP server an advanced remote file system. While protocols such as FTP have provided similar capabilities for years, WebDAV's features go beyond those that are in the standard FTP protocol, and therefore allow developers to use WebDAV to create more powerful applications.
While the implementations of various WebDAV servers offer different levels of protocol support, the following features are generally available and are what set WebDAV apart from protocols such as FTP:
put: The ability to upload resources to a server.
lock: The ability to set/unset connection-independent, long-duration exclusive and shared locks on resources.
These features allow the development of all sorts of interesting applications, including distributed web-page authoring/editing applications, version control applications, mail servers, and distributed calendaring applications, just to name a few. When developers combine WebDAV with the "Write Once, Run Anywhere" capabilities of Java, writing multiplatform distributed client applications becomes very simple.
Like HTTP, WebDAV requires both client and server components. In addition to the Slide project, which provides binaries and libraries for both clients and servers, there are plenty of WebDAV components available:
mod_davApache module adds WebDAV capabilities to Apache (included in Apache 2).
More information on WebDAV (including information on
mod_dav) is available from The WebDAV Resources Page.
As we said earlier, the Slide project's home page describes Slide as "a project composed of multiple modules tied together using WebDAV." These "multiple modules" include:
Like all Jakarta projects, Slide is available in both binary and source distributions. The binary distribution includes all of the classes needed to implement the WebDAV client examples in this article, and is available at Jakarta's binary download page. The binary distribution also includes the binaries for the server, the documentation for Slide, and the JavaDoc for the WebDAV client and server classes. While the binary distribution includes everything that you need for the examples in this article, the source distribution includes the Java source for the Slide's WebDAV command-line client. This file offers insight into coding WebDAV clients with Slide and may be worth checking out. The source distribution is available at Jakarta's source download page.
Once you have the binary distribution downloaded and unzipped, check out client/lib. This directory contains all .jar files needed for the examples in this article, including the Slide WebDAV client libraries and the .jars for several additional libraries that the WebDAV client uses. (The additional libraries are all either distributed by Apache via their Apache license, or are distributed by Sun as part of the Java distribution.) The JavaDoc for the WebDAV client libraries is available in doc/clientjavadoc.
Now down to business: using the Slide WebDAV client libraries to connect to WebDAV servers. The Slide client library encapsulates almost all of the functionality we need to access a WebDAV server in the
WebdavResource class. Accessing a WebDAV server involves three basic steps:
Opening the connection to a WebDAV server is handled via the
WebdavResource's constructor. There are several ways to handle this; the most straightforward is to give the constructor an
org.apache.util.HttpURL object that contains the URL for the server and user information.
Once the connection is established, we can issue protocol requests across the connection. These protocol request's are handled by a number of methods in
WebdavResource, specifically:
aclfindMethod: Used to find Access Control Lists; not implemented in many WebDAV servers.
aclMethod: Used to set Access Control Lists; not implemented in many WebDAV servers.
copyMethod: Copies a resource from one location to another on the server.
deleteMethod: Deletes a resource from the server.
getMethod: Gets a resource from the server (the same as the HTTP
GETcommand).
headMethod: Gets the header of a resource from the server (the same as the HTTP
HEADcommand).
list: Lists the resources in the current directory of the server.
lockMethod: Locks a resource on the server.
mkcolMethod: Makes a collection (i.e., a folder or directory) on the server.
moveMethod: Moves a resource from one location to another on the server.
optionsMethod: Retrieves the options that this server supports (the
getDavCapabilities()and
getAllowedMethods()methods also handle this functionality).
postMethod: Gets a resource from the server via an HTTP post (the same as the HTTP
POSTcommand).
propFindMethod: Retrieves a resource's properties.
propPatchMethod: Sets and edits a resource's properties.
putMethod: Puts a resource onto the server (similar to the FTP
PUTcommand).
setPath: Sets the current path of the remote server.
unlockMethod: Unlocks a resource on the server.
Note: Some of Slide's documentation is weak. While this article will cover some of these methods, we will not go over all of them. Some of those we do not cover are especially poorly documented; the best source of information on these methods is the WebDAV protocol documents and plain old-fashioned experimentation.
WebdavResource has a number of other methods that perform a variety tasks; for full details, check out the online version of the WebDAV Client JavaDoc for more details.
Once you are done issuing your protocol requests, then you need to close the WebDAV connection. This is handled by
WebdavResource's
close() method.
The simplest Slide WebDAV client program that you can write would do the following:
Really, this example is almost too simple, since this can be handled using classes from the
java.net package. What this example gives us, though, is an overview of using the
WebdavResource class and a structure for later examples.
Here is the code:
// Slide Simple WebDAV client example import java.io.File; import java.io.IOException; import java.net.MalformedURLException; import org.apache.commons.httpclient.HttpException; import org.apache.util.HttpURL; import org.apache.webdav.lib.WebdavResource; public class SlideTest { public static void main (String args[]) { try { HttpURL hrl = new HttpURL(""); hrl.setUserInfo("user","pass"); WebdavResource wdr = new WebdavResource(hrl); File fn = new File("remote-file"); wdr.getMethod(fn); wdr.close(); } catch(MalformedURLException mue) { } catch(HttpException he) { } catch(IOException ioe) { } } }
As you probably guessed, the real work of this example happens in the
try-
catch block. The first two lines set up the
HttpURL object, which contains all of the connection information. Then we create a
WebdavResource from the
HttpURL, which connects to the server. After this, we create a
File object to represent where we want the downloaded file to go. The
getMethod() gets the file, and
close() closes the connection. (Keep in mind that this is only an example, and the exception handling in this code is naive and can leave connections open.)
As you can see using
WebdavResource is very straightforward and elegantly handles the various portions of the protocol. Changing this example to handle uploading a file is straightforward, as well. All we need to change are a few lines, as follows:
File fn = new File("local-file"); wdr.putMethod(fn);
Admittedly, changing the file name is superficial, but it is important to note that this line now needs to point to a local file as opposed to a remote file.
These examples are simplistic, but they illustrate how to use
WebdavResource to access WebDAV servers. In the next section, we will explore a more complex example that will show how to use WebDAV's locking and unlocking features.
Let's say that we have a web site that is maintained by two teams of developers, separated by several time zones. Both teams have responsibility for editing HTML sources on a fairly static web site, and the site administrator wants to prevent them from simultaneously updating files and overwriting each other's changes (remember, this is an example; of course it would be better to use a version control system for this sort of application). In other words, we want to be able to upload, download, lock, and unlock files. We also want our locks to work between connections, in case we log out or are disconnected for whatever reason.
To facilitate this process, we want a class that handles:
We already know how to open a connection, close a connection, upload a file, and download a file, so what we need is code to handle the locking, unlocking, and listing of files. We will assume that the class has an instance variable called
wdr that is a
WebdavResource and an instance variable
path that is a
String.
First, we want to be able to lock a file. We will do this with the
lockMethod, as well as some other methods for error checking. You will also notice that we are setting the path of the
WebdavResource to the file, which we did not have to do with the
get and
put methods. This is because certain methods, including
isCollection,
getPath, and
setPath, are only supported if the current path is the file we want to work with. Others, like
getMethod (but not
getMethodData and
getMethodDataAsString), do not support this interface. Yes, it is confusing at times.
Here is the code for locking a file:
public boolean lockFile(String filename) throws Exception { // check to make sure current path is a // directory not a file make sure your initial // path contains a trailing "/" or else it is // considered a file!! if (!wdr.isCollection()) throw new Exception("Path is currently a file"); String currentPath = wdr.getPath(); wdr.setPath(currentPath + "/" + filename); if (wdr.isLocked()) { return false; } boolean returnVal = wdr.lockMethod(); wdr.setPath(currentPath); return returnVal; }
The
unlockFile() method is identical, except that we call
unlockMethod() on the
WebdavResource.
Listing the files in the current directory is handled by the
listFiles() method. Note in this example that again we check to make sure that we have the correct type of path.
public String[] listFiles () throws Exception { if(!wdr.isCollection()) throw new Exception ("Path is currently a file"); return wdr.list(); }
Using these three methods as a base, adding methods that implement
put,
get, and/or
post, we would have a fairly comprehensive class for interactively editing documents. Throw some Swing components on top of it, and you've got an interactive editing program.
Jakarta's Slide project makes adding WebDAV client functionality to Java applications a cinch. The libraries are open source, easy to use, and easy to integrate into all sorts of applications. While Slide's documentation leaves something to be desired, overall, Slide is a winner and makes adding WebDAV client capabilities to a Java programs a reality.
Andrew Anderson is a software developer and consultant in Chicago who's been using and programming on the Mac as long as he can remember.
Return to ONJava.com. | http://archive.oreilly.com/lpt/a/4387 | CC-MAIN-2014-52 | refinedweb | 1,902 | 54.83 |
This is part of a series I started in March 2008 - you may want to go back and look at older parts if you're new to this series.
The C way handles variable length arguments is to let the caller push as much as they'd like onto the stack. It's then up to the callee to make sure they don't access too much, and there's really no way for the C function to know how many arguments have been pushed other than through inspection of the arguments themselves. Not a very pleasant situation. It works because the arguments are pushed right to left, so that the leftmost argument is always at the top of the stack.
This makes variadic functions like printf() reasonably easy to write, but it is also a never-ending source of bugs, since the printf() format string can indicate there are more arguments on the stack than is really the case (most modern C compilers as a result warn about mismatches between printf() format strings and arguments, but this doesn't help you if you write your own. Not great.
Of course, so far we've not really care about safety much, but that doesn't mean I don't want to get there, and in this case it makes it easier to write code too. There are relatively few ways out of this that are not horribly inefficient: A marker that indicate you're at the end of the argument list; a pointer indicating the last position; a count.
None of them are particularly pleasing, but they do the work. Then there's the issue of how to access the extra arguments.
In Ruby it's done by adding a final argument prepended with "*". This works like the "splat" operator in expressions in that it turns anything from then on into an array. In some ways it simplifies matters in that the compiler or interpreter "only" need to know how to stuff the remaining arguments into an array and push a pointer to the array itself onto the stack instead.
We're not quite so lucky as to have a fully formed object system to help us yet. What are the alternatives?
We're going to go with a halfway solution that is pleasing because it allows us to keep interoperability with C:
movl %ebx, %eax subl %ebp, %eax shrl $2, %eax
Before I start going through the code: since I now have a repository at Github, you can see the commit for this code and download the the full code from here:
You can also <"watch" the repository to keep track of whenever I update it.
The biggest change this time is getting the infrastructure in place to handle modifiers to the arguments. The "Arg" class will take care of the arguments from now on:
class Arg attr_reader :name,:rest def initialize name, *modifiers @name = name modifiers.each do |m| @rest = true if m == :rest end end def rest?; @rest; end def type rest? ? :argaddr : :arg end end
The next change we have to make is updating the Function class to instantiate
Arg's, and it's
#get_arg method to handle
:numargs so you can get access to the number of arguments:
class Function attr_reader :args,:body def initialize args,body @body = body @rest = false @args = args.collect do |a| arg = Arg.new(*[a].flatten) @rest = true if arg.rest? arg end end def rest?; @rest; end def get_arg(a) if a == :numargs return [:int,args.size] if !rest? return [:numargs] end args.each_with_index do |arg,i| return [arg.type,i] if arg.name == a end return nil end end
Note that we return a constant :int if :rest isn't used, as a tiny little optimization.
If you look through the rest of the commit on Github you'll see mostly changes to thread the rest? method and `get_arg` changes up into the scope handling. The next interesting bit is this change to LocalVarScope's get_arg:
def get_arg a a = a.to_sym - return [:lvar,@locals[a]] if @locals.include?(a) + return [:lvar,@locals[a] + (rest? ? 1 : 0)] if @locals.include?(a) return @next.get_arg(a) if @next return [:addr,a] # Shouldn't get here normally end
We add one to the offset because we'll later change the emitter to copy
:numargs from
%ebx and onto the stack when inside the function so that it's accessible as a local variable. We don't strictly speaking need to push it on the stack unless we need the register AND actually use
:numargs, but we'll leave avoiding that as an optimization for later.
The next interesting bit is this cleaned up
#compile_eval_arg (I really need to find more meaningful names for these methods... sigh):
def compile_eval_arg scope,arg atype, aparam = get_arg(scope,arg) return aparam if atype == :int return @e.addr_value(aparam) if atype == :strconst case atype when :numargs @e.movl("-4(%ebp)",@e.result_value) when :argaddr: @e.load_arg_address(aparam) ...
(I've omitted the end, as the rest were just cleanups - see the commit).
The new thing here is supporting accessing :numargs, and having a way to get the address of an argument. This is used to get the start of the array of the remaining arguments.
The changes in the emitter are minor:
def load_arg_address(aparam) leal(local_arg(aparam),:eax) end
In a separate commit I decided to do this change to Function#get_arg:
return rest? ? [:lvar,-1],[:int,args.size]
.. combined with stripping the asm for :numargs out of #compile_eval_arg. This change was made for the purpose of removing the asm, but also to treat :numargs more like a variable than a language keyword, though that distinction isn't particularly strong.
Here's a program that demonstrates the new functionality:
require 'compiler' prog = prog = [:do, [:defun, :f, [:test,[:arr, :rest]],[:let,[:i], [:assign, :i, 0], [:while, [:lt,:i,[:sub,:numargs,1]], [:do, [:printf, "test=%ld, i=%ld, numargs=%ld, arr[i]=%ld\n",:test,:i,:numargs,[:index, :arr, :i]], [:assign, :i, [:add, :i, 1]], ] ] ] ], [:defun,:g,[:i,:j],[:let,[:k], [:assign,:k,42], [:printf,"numargs=%ld, i=%ld,j=%ld,k=%ld\n",:numargs,:i,:j,:k] ] ], [:f,123, 42,43,45], [:g,23,67] ] Compiler.new.compile(prog)
... and the expected output:
[[email protected] writing-a-compiler-in-ruby]$ make testargs ruby testargs.rb >testargs.s as -o testargs.o testargs.s testargs.s: Assembler messages: testargs.s:156: Warning: unterminated string; newline inserted cc -c -o runtime.o runtime.c cc testargs.o runtime.o -o testargs [[email protected] writing-a-compiler-in-ruby]$ ./testargs test=123, i=0, numargs=4, arr[i]=42 test=123, i=1, numargs=4, arr[i]=43 test=123, i=2, numargs=4, arr[i]=45 numargs=2, i=23,j=67,k=42 [[email protected] writing-a-compiler-in-ruby]$
To reiterate, the full source is available in this Github repository. To get the source at the state as of the endo f this article, pull or download from this commit | https://hokstad.com/writing-a-compiler-in-ruby-bottom-up-step-14 | CC-MAIN-2021-21 | refinedweb | 1,174 | 61.97 |
I wasn't 100% familiar with JSON strings, or working with events and attaching a groovy script, but after a bit of research I was able to put something together that should work. The challenge was as follows:
Unescape JSON Strings
Create a Groovy script, which unescapes JSON strings in the body of a REST API response before the response in shown in the response editor:
Example of original response body:
{
"employee": "{\"name\":\"John\", \"age\":30, \"city\":\"New York\"}"
}
Example of the corresponding modified response body:
{
"employee": {
"name": "John",
"age": 30,
"city": "New York"
}
}
Here, for the request that has a response that needs to be escaped, we have to add an Event to the project. That event should be of type "RequestFilter.afterRequest" and should contain the following groovy script:
def responseContent = context.httpResponse.responseContent;
context.httpResponse.responseContent = responseContent.replaceAll("\\\\", "");
I believe this should solve the problem presented in the script challenge. I learned something new, too! I'd be eager to see how other people solve it, or if I am even on the right track. It appears to work for me, though.
Solved!
Go to Solution.
@TanyaYatskovska, there's definitely a world of possibilities that I am just now beginning to understand by hooking into events with groovy scripts. I am going to have to do some more exploring myself though to get a feel for further functionality!
View solution in original post
Great example Matthew! Thanks for your contribution in API Summer.
I'm sure your script will help many community members. Do you think it's possible to extend its functionality somehow more?
Awesome! I knew you would like this challenge 🙂
@msiadak @TanyaYatskovska hey how to add an Event to the project in soap UI(not in soap UI pro)? I am using open socure soap UI
@siva90144: You may want to consider starting your own thread instead of piggy-backing on an unrelated post. That being said, you may also want to consider posting in the Open Source SoapUI forum, since that might get you answers from a knowledgebase more applicable to your problem/question. | https://community.smartbear.com/t5/API-Functional-Security-Testing/Script-Challenge-Unescape-Json-Strings/td-p/168127 | CC-MAIN-2021-31 | refinedweb | 351 | 61.06 |
Introducing: SafeURL - A set of SSRF Protection Libraries
Code by IncludeSec team, with contributions by our Intern Mohammad Al Amin protecting against these sorts of security issues. So we're releasing a new set of language specific libraries to help developers effectively protect against SSRF issues. In this blog post, we'll introduce the concept of SafeURL; with details about how it works, as well as how developers can use it, and our plans for rewarding those who find vulnerabilities in it!
Overview
- Preface: Server Side Request Forgery
- Our Proposed Solution
- Installation
- Usage
- Demo and Bug Bounty Contest
Preface: Server Side Request Forgery
Server Side Request Forgery (SSRF) is a vulnerability that gives an attacker the ability to create requests from a vulnerable server. SSRF attacks are commonly used to target not only the host server itself, but also hosts on the internal network that would normally be inaccessible due to firewalls.
When those kinds of inputs are not validated, attackers are able to access internal resources that are not intended to be public.
Our Proposed Solution
Safe
methods in PHP and Python as well as
java.net.URLConnection
in Scala.
The source for the libraries are available on our Github:
- SafeURL for PHP - Primarily developed by @fin1te
- SafeURL for Python - Ported by @nicolasrod
- SafeURL for Scala - Ported by @saelo
Other Mitigation Techniques
Our
PHP
SafeURL can be included in any PHP project by cloning the repository on our Github and importing it into your project.
Python
SafeURL can be used in Python apps by cloning the repository on our Github and importing it like this:
from safeurl import safeurl
Scala
To use SafeURL in Scala applications, clone the repository
and store in the
app/
folder of your Play
application and import it.
import com.includesecurity.safeurl._
Usage
PHP
Safe);
Python
SafeURL serves as a replacement for PyCurl in Python.
try: su = safeurl.SafeURL() res = su.execute("";) except: print "Unexpected error:", sys.exc_info()
Example of modifying options:
try: sc = safeurl.SafeURL() opt = safeurl.Options() opt.clearList("whitelist") opt.clearList("blacklist") opt.setList("whitelist", [ "google.com" , "youtube.com"], "domain") su.setOptions(opt) res = su.execute("") except: print "Unexpected error:", sys.exc_info()
Scala
SafeURL replaces the JVM Class
URLConnection
that is normally used in Scala.
try { val resp = SafeURL.fetch("") val r = Await.result(resp, 500 millis) } catch { //URL wasnt safe }
Options:
SafeURL.defaultConfiguration.lists.ip.blacklist ::= "12.34.0.0/16" SafeURL.defaultConfiguration.lists.domain.blacklist ::= "example.com"
Demo, Bug Bounty Contest, and Further Contributions
An important question to ask is: Is SafeURL really safe? Don't take our word for it. Try to hack it yourself! We're hosting live demo apps in each language for anyone to try and bypass SafeURL and perform a successful SSRF attack. On each site there is a file called
key.txt
on the server's local filesystem with the following
.htaccess
policy:
<Files key.txt> Order deny,allow Deny from allow Allow from 127.0.0.1 ErrorDocument 403 /oops.html </Files>
If you can read the contents of the file through a flaw in SafeURL and tell us how you did it (patch plz?), we will contact you about your reward. As a thank you to the community, we're going to reward up to one Bitcoin for any security issues. If you find a non-security bug in the source of any of our libraries, please contact us as well you'll have our thanks and a shout-out.! | http://126kr.com/article/53imu248pyq | CC-MAIN-2017-17 | refinedweb | 579 | 56.66 |
Your browser does not seem to support JavaScript. As a result, your viewing experience will be diminished, and you have been placed in read-only mode.
Please download a browser that supports JavaScript, or enable it if it's disabled (i.e. NoScript).
Hello! I have a situation where I'm adding a Random Effector to scene on a button press. That's working correctly, but when I save the scene and reopen it the Field interface and it seems to have reverted to the pre-R20 interface. I'm working in C++ but I managed to recreate the issue in Python for simplicity.
Before I save and load the Falloff tab looks like this.
After I save and load it looks like this.
The code I'm using is here:
import c4d
from c4d import gui
def main():
randomEffector = c4d.BaseObject(1018643)#Random Effector ID
doc.InsertObject(randomEffector)
c4d.EventAdd()
if __name__=='__main__':
main()
Is there a flag or something I'm missing?
Thanks for any help,
Dan
hi
you have to send the following message to the object so it will switch internally from regular falloff to fields.
randomEffector.Message(c4d.MSG_MENUPREPARE, doc)
Cheers,
Manuel
@m_magalhaes
Thank you! Works perfectly.
Dan | https://plugincafe.maxon.net/topic/13261/fields-and-adding-an-effector | CC-MAIN-2021-49 | refinedweb | 203 | 65.52 |
In my last post, ESP8266/Arduino IDE: Communicating with TCP, I successfully sent a single packet and received it back from the echo server properly.
I then proceeded to modify the sketch to transmit a stream of packets, reading each one. From that point, I descended into ESP8266 hell. The ESP-01 I’ve been using would inevitably hang after transmitting/receiving about 40 packets. Sometimes I’d get lucky and do around 200, but that was as good as it got.
I spent hours trying to figure out the issue. No luck, and no similar reports on the dev web site. It seemed the problem was mine, yet my program was so simple there was little chance I had some kind of totally brain-dead bug that was filling the heap or stack or otherwise corrupting memory .
I slept on the problem and this morning whipped out my Node MCU (version 0.9) board and downloaded the exact same program. Works just fine. In fact I greatly increased the packet size, reduced all possible delays, even went to a PC based echo server to get the max throughput and the Node MCU works fine.
I don’t know what the issue is with the ESP-01. It is an early one, I’m sure. Irregardless, it just isn’t worth any more of my time since this project is just meant to be a learning experience.
Hardware
So I’m starting over with new hardware. The Node MCU is much easier to use, in general, anyway. My only complaint is there is no reset button. I remedied that myself.
Here is the schematic:
- D3 is GPIO0 which is accessed as pin 0 in the software.
- The pushbutton allows you to reset the device to restart it.
- I tried using baud rates faster than 115.2KB on this board. Sometimes they work, some times they don’t. So I just stick with 115.2KB.
Since I changed the hardware, I also needed to change the IDE’s settings:
Software Objective
I’ve got new hardware and I know it works solid because I pushed a lot of TCP packets through it. I can finally move on to what I really want to do.
My long term goal is to turn the LED on the ESP8266 on/off using commands on a PC. Right now, I can successfully talk to an Echo server. So my next incremental step is to transmit on/off commands to the echo server, and when I receive the echos I will act upon them.
My reason for doing it this way is I want to get as much code working on the ESP8266 before I ever start working on the PC side. I can settle on, and test, my own protocol this way before I ever have to touch the PC.
The Protocol
In order to talk between the PC and the ESP8266, I’m going to need to settle upon some kind of protocol. Any communications between devices requires one or more (often many) protocols.
IP is a protocol, as is TCP, as is FTP and Telnet. My protocol is going to be super simple since I just want to turn an LED on/off and get an acknowledgement.
The client will transmit a request code of “on” or “off” followed by carriage return (<CR> or \r) and linefeed (<LF> or \n).
Since I’m not using a packet length, there must be some type of indication that I’ve hit the end of the packet. <LF> is that indication. I am using <CR><LF> because if I want to use telnet to test the server, it is going to generate that sequence, so I may as well make use of it.
When the ESP8266 server processes a command it will respond with either “ok” or “bad” followed by a <CR><LF>. Once the response is transmitted, the server will disconnect the TCP connection. I’m sure the ESP8266 can’t support more than a couple of TCP sessions, so letting one sit open isn’t the best idea.
So here is what I expect to see across the comm line:
client >>> on<cr><lf> >>> server server >>> ok<cr><lf> >>> client server >>> <disconnect> >>> client client >>> off<cr><lf> >>> server server >>> ok<cr><lf> >>> client server >>> <disconnect> >>> client client >>> test<cr><lf> >>> server server >>> error<cr><lf> >>> client server >>> <disconnect> >>> client
As I said, this is an easy protocol and I could easily keep it in my head; however, it doesn’t hurt to formalize it a bit, especially as comments in your code as a memory job if/when you need to look at the code in the future.
Program Highlights
To make reading data coming in from the network easier, I created the getstr function which reads characters until the <LF> character is encountered and returns the preceding string.
One thing I discovered while writing this program is that you MUST NOT put the program in a lengthy NOOP wait loop. The code to manage the WiFi connection must be able to execute.
Until I figured that problem out, I was getting WDT timeouts. To prevent this from happening, you just need to call delay occasionally. So any place I might have wrote
while (test) {}
I now write
while (test) { delay(10UL); }
Here is the full program:
#include <ESP8266WiFi.h> const int ledPin = 0; WiFiClient client; // --------------------------------------------------------------------------- char * getstr( char * s, int maxlen ) { int i = 0; strcpy(s, ""); while (true) { while (client.available() == 0) { // No infinite null loops allowed! Delay needs to be used which // yields control to ESP routines as necessary. delay(10UL); } // while client.available s[i] = client.read(); if (s[i] == '\n') { s[i] = '\0'; break; // while } else if (s[i] == '\r') ; // do nothing additional on return character - it will be overwritten by next char else { if (i == maxlen) { Serial.println("buffer overflow"); while (true) {} }()); if (!client.connect("rpi", 7)) { Serial.println("Connection to echo server failed"); while (true) { delay(10UL); } } } // setup // --------------------------------------------------------------------------- void loop() { int k; char s[100]; for (k = 0; k <= 5; k = k + 1) { // transmit cmd to echo server if (k == 5) { // force an error on last iteration client.println("zippy"); } else if (k % 2 == 0) { // alternate xmitting on/off client.println("on"); digitalWrite(ledPin, HIGH); } else { client.println("off"); digitalWrite(ledPin, LOW); } delay(10UL); // give the packet a bit of time // get cmd from echo server getstr(s, sizeof(s)); Serial.print("Received cmd: "); Serial.println(s); // process cmd and send result to echo server if (strcmp("on", s) == 0) { digitalWrite(ledPin, HIGH); client.println("ok"); delay(500); } else if (strcmp("off", s) == 0) { digitalWrite(ledPin, LOW); client.println("ok"); delay(500); } else { client.println("error"); } // get result from echo server Serial.print("Result: "); Serial.println(getstr(s, sizeof(s))); } // for WiFi.disconnect(true); while (true) { delay(100UL); } // while }
The LED blinks on and off properly and the Serial monitor looks good:
Trying to connect to Chameleon Connected. IP Addr: 192.8.50.250 Received cmd: on Result: ok Received cmd: off Result: ok Received cmd: on Result: ok Received cmd: off Result: ok Received cmd: on Result: ok Received cmd: zippy Result: error
Looking at the Network Packets
I could call the program good at this point, but I want to be 100% sure I’m following my protocol correctly, so I capture the packets with Wireshark to have a look. Here is the first “on” packet being transmitted to the echo server:
No. Time Source Destination Protocol Length Info 4 0.002133000 192.8.50.250 192.8.50.101 ECHO 60 Request 0000 f8 b1 56 a2 07 fc 18 fe 34 a0 52 62 08 00 45 00 ..V.....4.Rb..E. 0010 00 2a 00 05 00 00 ff 06 d6 58 c0 08 32 fa c0 08 .*.......X..2... 0020 32 65 10 01 00 07 00 00 19 7e 5d ef 8f e4 50 18 2e.......~]...P. 0030 16 d0 2c c2 00 00 6f 6e 00 00 00 00 ..,...on....
Wait a minute “on” is there, where is the <cr><lf>? They’re in the next packet transmitted:
No. Time Source Destination Protocol Length Info 6 0.005539000 192.8.50.250 192.8.50.101 ECHO 60 Request 0000 f8 b1 56 a2 07 fc 18 fe 34 a0 52 62 08 00 45 00 ..V.....4.Rb..E. 0010 00 2a 00 06 00 00 ff 06 d6 57 c0 08 32 fa c0 08 .*.......W..2... 0020 32 65 10 01 00 07 00 00 19 80 5d ef 8f e6 50 18 2e........]...P. 0030 16 ce 8f 24 00 00 0d 0a 00 00 00 00 ...$........
Now let’s make sure the response is what I expect:
No. Time Source Destination Protocol Length Info 8 0.018371000 192.8.50.250 192.8.50.101 ECHO 60 Request 0000 f8 b1 56 a2 07 fc 18 fe 34 a0 52 62 08 00 45 00 ..V.....4.Rb..E. 0010 00 2a 00 07 00 00 ff 06 d6 56 c0 08 32 fa c0 08 .*.......V..2... 0020 32 65 10 01 00 07 00 00 19 82 5d ef 8f e8 50 18 2e........]...P. 0030 16 cc 2c c1 00 00 6f 6b 00 00 00 00 ..,...ok.... No. Time Source Destination Protocol Length Info 10 0.019921000 192.8.50.250 192.8.50.101 ECHO 60 Request 0000 f8 b1 56 a2 07 fc 18 fe 34 a0 52 62 08 00 45 00 ..V.....4.Rb..E. 0010 00 2a 00 08 00 00 ff 06 d6 55 c0 08 32 fa c0 08 .*.......U..2... 0020 32 65 10 01 00 07 00 00 19 84 5d ef 8f ea 50 18 2e........]...P. 0030 16 ca 8f 20 00 00 0d 0a 00 00 00 00 ... ........
This looks good. Tomorrow I setup the ESP8266 to be a real server.
Pingback: ESP8266/Arduino IDE: Building an LED Blink Server | Big Dan the Blogging Man | https://bigdanzblog.wordpress.com/2016/02/09/esp8266arduino-ide-further-tcp-exploration/ | CC-MAIN-2017-39 | refinedweb | 1,676 | 81.12 |
I don’t know how to mark this occasion. I looked around Target, but they didn’t have any greeting cards for this sort of thing.
Also, the discussion for this post might get a bit hot. Before anyone gets pissed off I’d just like to remind you to be cool and don’t post mad. Everyone agrees kids should be educated, we just differ on the details.
Looking back on my school career, I see that the vast majority of the hours I spent in school were squandered. Most classes washed over me with no effect. I listened to the lecture, took the test, passed, and then never thought about the material again. For many classes, I have no memory of the lessons and it’s as if I never set foot in the classroom. I still retain some learning in a few subjects, although these were things that captured my interest at the time. I likely could have learned them without attending school, and perhaps bought the lessons with less pain.
The point is, I could have dropped out of school after sixth grade and it would not have impaired my abilities with regards to my career in the slightest. I suspect this is true for a lot of other people as well.
This is not to say that education is bad or that people shouldn’t get a diploma, only that getting a diploma is not for everyone, and that we should not have a narrow view on what education is and how it should work. A large portion of my grandparent’s generation dropped out long before graduation, and those folks did fine. They went on to hold down careers, start businesses, and even invent things without the benefit of a diploma. You might say, “Those were different times, and people didn’t need as much education back then.” Okay then, how do we explain my situation, where I was pretty much on the cutting edge of technology?
A great deal of my story has revolved around public education, and if you’ve read this far then perhaps you’re curious what my thoughts are on the matter. Here it is:
Homeschooling works. People should be allowed to do it.
For some strange reason, this is a controversial opinion. Perhaps even inflammatory. It shouldn’t be. I’m not advocating abolishing public schools, or altering them. In fact, I’m offering to take my own children out of the system and educate them at my own expense, leaving more for everyone else.
Allow me to field a few common objections:
The school isn’t as bad as you make it sound. I went to public school and I got a great education!
In my thirteen years of public education, it did not escape my notice that I was abnormally ill-suited to school. I sat in numerous classrooms where I was surrounded by people who were quite happy to memorize and regurgitate any information presented to them, and do any task to maintain a grade, no matter how mundane, boring, or pointless. I realized that I was afflicted with severe handicaps like:
- I won’t work for arbitrary rewards.
- I won’t do work that is clearly pointless or counter-productive.
- I’m keen on finding ways to accomplish tasks efficiently, without a lot of wasted time and effort.
- I am highly motivated and interested in a small number of subjects, and apathetic to other topics.
Of course, these faults are often virtues in the real world, the one we are ostensibly priming children to inhabit during their years of schooling. In school there was no reward for being able to memorize things by hearing instead of needing to take notes. There was no bonus for students who could learn faster, or with less repetition. Everyone moves at the same pace, and everyone is expected to do all the work.
Saying that school works for “most people” sort of misses the point. It’s like a midget or a bodybuilder complaining that they can’t find clothes in their size, and a person of average size replying that they must be bad at shopping because suitable clothes are easy to find.
Some schools are bad. Some kids are ill-suited to schooling. Allowing people to homeschool provides a safety valve for kids in either situation.
But, how can kids learn without doing schoolwork?
Well, how do you learn? If you want to learn something, do you fill out worksheets and administer tests to yourself? Probably not. Adults have this strange idea that children learn best in a rigorously structured environment and that you can’t learn on your own until you’re an adult. The opposite is true. Kids usually have difficulty coping with the rigidity of school, and adults are the ones capable of sitting still and listening to lectures.
Keep in mind that worksheets, quizzes, essays, curriculum, answering questions in class, graded notes, and tests are not learning. Here, let me put that in a paragraph all by itself for emphasis:
Schoolwork is not learning.
Schoolwork is not learning in the same way that sitting around in a restaurant is not eating. Sure, learning takes place at school, but it’s entirely possible that you can accomplish the same thing elsewhere with less time, effort, and expense. Schoolwork is given so that the teacher can measure learning. Some schoolwork is given as part of “classroom management” – the discipline of keeping kids busy so that they don’t misbehave or disrupt one another. You do not need these trappings if you’re simply trying to learn something you already want to know. In that case all you need is access to information. Between public libraries and the internet, most of us have access to all of the information we could ever want.
You make a big deal about bullying, but sometimes adversity builds character!
“Building character”? Are we talking about a generalized ability to endure and accept hardship? If so, then you can use this to excuse any suffering or abuse. Sexually abused? Physically abused? Poor? Disabled? Homeless? Robbed? They all “build character”, but it would be pretty monstrous to use that as a justification for ignoring these problems.
Maybe years of discouragement and injustice will teach a kid to fight back and try to make the world better. Or maybe they will teach a kid that life sucks, there is no justice, and mercy is for fools. It might make them more idealistic and passionate, or it might make them bitter and cynical. It might make them fight harder. It might make the kid give up. It depends on the abuse. It depends on who performs it. It depends on the kid.
Even if we accept this awful notion that we should allow children to run little kingdoms of cruelty, sustained by violence and ruled by the alpha males in order to “build character” among the gentle, what about the bullies themselves? A lot of those kids who bullied me were doing it simply out of peer pressure. At school they rallied around the leader and picked on me to win the approval of the group. Outside of school they ignored me. Two were even nice to me on the odd occasions when I encountered them away from the pack. Even if we entertain the notion that the bullying was of benefit to me, it was poisonous to their hearts.
What about socialization?
Looking back on my school experience, I can’t say there was anything positive or affirming about my “socialization”. Bullying, cliques, rumors, and other petty cruelties were the norm.
This is one issue where I believe homeschooling has an unambiguous advantage. Whatever you may think of it, putting kids into groups of same-age peers does little to teach them how to relate to others in a mature way.
I’ve tutored some homeschooled kids, I’ve met others, and of course my own kids are homeschooled. Without exception, these kids have been far more socially capable than their public-schooled peers. They don’t hold slightly older kids in awe. They don’t scorn and sneer at kids who are slightly younger. They’re less concerned (or even aware of) matters of class and pecking order. When they relate to adults, they don’t suffer from the mumbling, shoulder-shrugging, eye-rolling awkwardness for which teenagers are notorious.
In my experience, homeschooled kids do not suffer from peer pressure to the extent that public school kids do, because they don’t see themselves as part of a herd. This will make them less likely to bully others and less likely to make foolish choices with regards to sex and drugs.
You were an abnormal kid with a bad home life, so it’s not fair to blame the school system for your failures.
It’s true that I didn’t have a “regular” home life. But is growing up under the care of a single mother really some exotic fate? Is being medicated all that rare? (I’d suggest it’s actually a lot more common today than in was in the late 1970’s.) If public schools can’t handle kids from broken homes, or kids with odd behavior, or socially awkward kids, then what should be done with those kids, if not give them over to some other form of education?
Don’t kids need proper schooling to get a well-rounded education?
We’ve all seen those “man on the street” interviews or surveys where we find out that an alarming portion of the population thinks that Abraham Lincoln was the first president of the United States. Or that most people can’t solve for X in 5 = X + 2. How many people wrote a book report at 16 years old and can’t remember anything of substance about the book ten years after graduation?
I think having a “well rounded” education has more to do with the student and less to do with the curriculum. Some people have a love for learning and an interest in many diverse subjects. Some people will only learn as much as they need in order to pass, and forget it as soon as the test is over.
The point is, the traditional school system is obviously failing to “round” people in a lot of cases. Rather than force people to memorize things they won’t remember or care about in two years, it might be better to let them follow their passions.
You’ve been successful in more than one career. You may not have liked it, but school actually worked for you!
I was a smart, highly motivated kid with focused interests. It wasn’t just that school didn’t help me to reach my goals, school was actively in my way. It was an impediment to my education.
Yes, lots of kids learn in school. The question isn’t “Did this kid get a diploma?” If that’s all we care about then we have set the bar of success very low indeed. The questions should be, “Did?”
What about parents who want to keep their kids home to indoctrinate them with strange beliefs?
Parents are always free to teach their kids whatever they like. So what you’re really asking is, “What if parents don’t send their kids to school to be counter-indoctrinated to MY beliefs?”
If your beliefs are worth anything, then you should be happy to let them compete for mindshare with everyone else’s beliefs by persuading other adults to your way of thinking. If you can’t persuade adults to embrace your way of thinking, then it’s pretty tyrannical to attempt to impose your ideas on their children.
There are crazy people in the world. Some of them will have kids. Public schooling cannot correct this, nor was it designed to do so.
Okay, if you know so much: What do you think they should change?
Nothing.
Oh, I’m sure there are many, many things that could be done to improve schools, and you can hardly hear yourself think over the roar of people shouting for different (and often mutually exclusive) education reforms. I’m not going to leap into the debate and demand everyone else alter schools to suit my tastes at everyone else’s expense. This is the problem with the educational debate. We’re not allowed to try anything new until we can all agree on it. Our education system is a doctor that insists on leeching and bloodletting patients because these are traditions that have stood the test of time and nobody else can agree on what we should be doing instead. If you want to try something new, you have to lobby the government and enter the highly politicized and emotionally charged arena of education reform.
I remember there was a debate in the 1990’s when Outcome-Based Education was proposed. I followed the discussion, trying to get a sense of what this new thing was and what school would look like. Everyone seemed to have a different idea of what OBE would be. Some said that grades would be replaced with simple pass / fail. Others said that all grades would be abolished in favor or self-esteem building. Or was it an attempt to change the textbooks to be more “liberal”? No, it was about more standardized testing! Mandatory school prayer! Cuts for music and sports programs! Gay activism! Creationism as science! Sex education for kindergartners! Sensitivity training! Free condoms at the nurse’s office!
It didn’t make any sense. Most of the things I was hearing were contradictory. Eventually I realized that none of this had anything to do with “Outcome-Based Education”, whatever it was. Someone had proposed reform, and then a million activists and special interests seized on this moment of brief malleability to try and enact their own pet projects.
I don’t think there is a simple answer that will fix everything. Human beings are all different. We have different interests and skill levels, different approaches to learning, different social needs, respond to different forms of motivation, and develop at different speeds. Sorting kids by age and jamming a broad spectrum of learning into their ears is probably the most obvious, clumsy, and ham-fisted technique for imparting knowledge. It works tolerably enough for a broad selection of the population, but fails people occupying the high and low areas of the performance curve, and people with unusual skill sets.
Babies learn to walk between 9 and 18 months. That’s a really large window. Most learn at about a year, but a few occupy those fringe positions. Imagine if we sent babies to school to teach them to walk. Imagine the hassle of of trying to make kids learn to walk before they were ready, and the hand-wringing over all of the “under-performing” babies. All of that time and effort would be spent to get kids to walk just a couple of months sooner. Just picture how wasteful this would be, since by two years you can’t tell the difference between the early walkers and the late walkers. This is public education.
In the kindergarten portion of my story I talked about how I couldn’t replicate numerals, so I was sent to a special class. In ninth grade, I scored in the top two percent nationally on the portion of the standardized test that asked you to match shapes that had been mirrored or rotated in convoluted ways. Like a late-walking baby, I wasn’t keeping up with the other kids, and no degree of remedial education was going to correct it, because that part of my brain was still developing. Years later that slight lag in development had been erased not through education, but through maturity. I simply developed differently from other students, and that was only a problem because I was in a classroom designed around the idea that all children develop identically.
So my “solution” for education is simple: Be tolerant of others. Let people take chances. Let people homeschool. Let people go to private school. Allow people to enact experimental programs, particularly if they’re voluntary. Don’t reflexively defend the status quo just because it “worked” for you. You don’t know what it was like for the people who struggled, and you don’t know how much better you might have performed in other circumstances. If you’ve got an idea or an agenda, try it out on your own kids instead of foisting it on everyone else. If it works for them, maybe they will lead the change a generation from now.
If you’re hiring people, break out of the mindset of looking at grades and sorting applicants by the stature of the university they attended. Look at people and figure out which ones are smart, motivated, knowledgeable, and personable. That’s what your managers and human resources people are paid to do. If all they do is sort people by grade transcripts, you might as well fire them and give their job to a computer.
Learning is a wonderful thing. It begins long before preschool, and it continues long after your schooling ends. It’s the process of observing the world, comparing new information with what we already understand, and using that data to draw new conclusions. The only important difference between a modern-day pediatrician and a stone-age hunter / gatherer is the learning between their ears. Learning makes us powerful and capable. It guides us and enriches our lives. The process itself can be deeply satisfying, and when applied the gained knowledge can give us a better future. All of this is crucial to our existence as human beings, and all of it has very little to do with sitting at desks and filling out worksheets.
A lot of people thought they were helping me in school, even though their efforts did me harm. Even Mrs. Grossman. Don’t be like them. Don’t assume you know what’s best for everyone. Let people seek out education as it suits them, and judge them by what they do, not by how they were taught.
Thanks for reading,
Shamus Young
Bad and Wrong Music Lessons
A music lesson for people who know nothing about music, from someone who barely knows anything about music.
Spec Ops: The Line
A videogame that judges its audience, criticizes its genre, and hates its premise. How did this thing get made?
What is Vulkan?
There's a new graphics API in town. What does that mean, and why do we need it?
Overthinking Zombies
Let's ruin everyone's fun by listing all the ways in which zombies can't work, couldn't happen, and don't make sense.
Zenimax vs. Facebook
This series explores the troubled history of VR and the strange lawsuit between Zenimax publishing and Facebook.
636 thoughts on “Autoblography Part 40: A Word On Education”
In my personal limited experience, apart from the ones who actively participated in the bullying, “adversity builds character!” quote always came from the normal people who ignored the act of bullying that happened around them.
I was mercilessly bullied in school. I think I am a better person because of it. Bullying taught me the evils of moving with the crowd, the harm that can result, and made me more independent as a thinker. It gave me invaluable insight into human nature.
It was miserable, and I had no friends, but I still wouldn’t replace it.
I don’t want to offend you but please reconsider what you are saying. Do you really believe that bullying make you a better person and you couldn’t be that better person without those bullies? That’s sad
He brings good out of evil. How is that sad?
I’m not saying that bullying isn’t a bad thing that should be prevented, but there is no instructor quite like pain. Rather we should be grateful that whatever lessons he got were learned early in life at the relatively low cost of a few years of unhappiness in school as a child.
I think you misunderstood me. What I was saying is a person doesn’t need to be bullied to learn about evils of peer pressure. It’s akin to getting hit by a car to learn about evils of drunk driving.
I accept all the positive thinking and glass full mentality. But a person should not need to be the victim to learn the hard lessons of life.
I don’t disagree with that. I just don’t see that it’s sad to believe that a bit of hardship can be good for you.
I think the crux of the argument here is that there is a difference between drawing something good out of a bad situation, and saying that a bad situation will necessarily lead to enough good to justify the existence of the situation. The first is laudable, the latter morally and logically shakey at best.
teaching you how to deal with bullies is about one of the most valuable lessons that schools have. specially cuz a lot of the stuff you learn remains true in the real world later on. i was bullied, i bullied too, it wasnt peer pressure or any of that crap, its just how life is sometimes.
people can deal with it right then or they cant, but they have to learn how to deal with it eventually.
Rubbish. When a gang of people beats on you, you don’t learn anything worthwhile. You learn hate and cynicism.
When you fight back, and are in more trouble because of it, you have only learned that people suck and that systems don’t work.
I used to be a nice person. I’m not anymore. Bullying just shows you one simple thing: Systems do not work. People are scummy, rude and savage, and when you let a bunch of kids make their own decisions, those are the ones that are made.
There’s nothing good which can come out of bullying. Pain is an instructor, sure. I learned not to fall of my bicycle, or not to touch flames. But do you know what you learn after being attacked for being passive and non-aggressive: That violence is the answer, and that the only way to control what happens to you is to control the environment through violence. That’s such stupid logic I can’t imagine it. It’s the qualities which should be prized which are present in, and removed from, the victims.
On your post Shamus, I agree, the concept of homeschooling is one that makes sense. But I think your situation, where your wife is a qualified teacher, is a rarity, and I’d suggest that most people who are to be homeschooled would need to have a similar quality of education available. I’d totally agree that the education system doesn’t work: It sets mandatory arbitrary goals, and sets you up to do pointless work for pointless gain. It’s tailored to an imaginary average, like the “Ideal Store” mentioned in another post. It’s an interesting issue, and I’m not sure how mainstream education could be fixed at this point.
“used to be a nice person” see, you’re letting the actions of some douchebags completely define who you are, that’s the issue. Also yeah, violence is an answer to literally all problems. That doesn’t mean its the best answer… but it is a valid answer. it solves things. not necessarily well, not necessarily quickly, but its there.
For a while, bullying taught me how to fight with my fists. I got remarkable apt at it for a kid my size. I was, hm, “active” against bullying, which basically means that I bullied bullies. It got me expelled from more than one school, and I actually lost a year for it.
Even if that happened long time ago, I think it would have been better if I hadn’t had to get through that.
ok? i dont get if you’re agreeing or refuting. sounds like you’re agreeing cuz i did say violence wasnt the best answer
I’m not offended, but I want to stress that this isn’t a statement I make without serious introspective thought.
There are qualities about myself that I find admirable. For example, my ability to come to my own conclusion despite my colleagues–colleagues who are older and more experience–disagreeing (not that I don’t listen, I just still contribute). There’s also my ability to persevere when things suck–an ability I really appreciate right now. And the ability to work with people who annoy the ever-loving crap out of me.
I like these things about myself. They most certainly come from factors in my youth including both being bullied and factors that don’t involve bullying or even school. But I definitely got practice with them as I struggled to learn how to deal with bullies.
Being bullied is precisely what made me realise ” holy crap, I AM the better person here”. From that point on, it never hurt me anymore.
I don’t need to hurt people to feel better, I don’t have to be mean or nasty to feel happy, and my miseries can NOT be cured by offloading them on some poor sap who doesn’t want or need them.
Being bullied helped me build the confidence and maturity I have today. It was tough, worse than hell, and I wouldn’t wish it on anyone, but I don’t know how I would’ve learned that lesson otherwise.
So bullying did help me build character, if only as defense mechanism to prevent being consumed by the dark times in my life.
When you spend your time alternately wishing that you or someone else was dead, and consider making it so, that’s not character building. The person I was in High School was one weapon away from a tragedy. I think this nonsense stems from crap like “What doesn’t kill me, only makes me stronger.” To continue the analogy, Rubbish. If you lose your arms and legs, you’re not better off, you’re weaker.
If you lose your faith in humanity, your ability to communicate, and your only will to live is to get even, you haven’t gained anything, apart from a potentially homicidal tendency.
That’s the thing: I didn’t lose faith in humanity as much as I gained faith in myself. Their actions made me see that I was the lucky one whom they actually envied, and I pitied them.
It never was as clear as this, in the chaos and the sadness of the time, but the day I figured out that they probably had lives worse than mine somehow, was the day I became immune to them.
From the way you talk you certainly had it way worse than me and I don’t think my experience relates to yours in any way, but ANY act of bullying is terrible to the victim. I don’t wish to imply that the severe cases can have any good outcomes, but the milder (not-physically-endangering-your-life) ones just may bring out the good in you. It’s all in how much you (can muster the courage to ) choose to let it affect you.
My point was that I don’t know how or when (or IF) I would’ve learned that lesson without bullies.
I was mercilessly bullied both by other students and by faculty. I learned a lot, and I would move hell and earth to make what I learned about other people not true.
What I learned from being bullied:
People are rotten
Adults are stupid
Nobody cares about me but me
If you don’t talk for nearly a year your voice will sound really, really weird when you finally say something
Slash UP the arm, not across
Five bottles of Tylenol and a couple of dozen bottles of assorted prescription pain killers and sedatives will not kill you but it will make you wish it had
No matter how much you offer others, they will happily take it all, use you up, and still make your life a living hell afterward without a second thought
No matter what you do, people will mock you for it
There are no people on earth quite as awesome as crazy people
Needles aren’t nearly as scary as they seem. After a couple of weeks of morning blood draws you won’t even wake up when they shove the needle in your arm any more.
If you build it, they will come (Friday night movie night at the nut hut – Field of Dreams, One Flew Over the Cuckoos Nest, and The Dream Team)
The best education is when an adult hands you your textbooks and a list of work for the week then wanders out for a smoke break that lasts all morning
Christmas in the booby hatch is lonely. Try to avoid it.
Sickle cell anemia might make you weak but you’ve still got enough strength to beat people up and break their belongings
In certain circles, being poor and of a non-Caucasian race excuses anything you choose to do. Adults will literally turn down another hall to avoid watching you do things that they would otherwise have to intervene in or report to authorities.
Remarkably similar to some of my own learned lessons. Also a clear reason why “bullying builds character” is absolutely rubbish. It’s the same “logic” used in basic training in some armies and in boot camp and whatever. Breaking someone’s spirit to make them “stronger” doesn’t work. Some will become bullies, some will die inside (or in reality!), some will be strong enough to come through…
Regarding boot camp style bullying, that’s a case of them missing the mark. The point is to create an immensely stressful environment, so the trainees learn to cope under stress. If there are bombs going off around you and you panic, it won’t end well; if you can’t handle harsh words, you won’t cope in a battlefield.
There are plenty who get it wrong, of course. Overdoing it can have horrible effects, absolutely, but going through all that hardship toughens them up for what they face in battle.
Really not the same thing as bullying in schools.
No, it’s exactly the same thing. The stress of having someone trying to kill you is not the same qualitative kind of stress as that of someone you respect and/or fear trying to make you cry. Boot camp is about the tradition of boot camp, and develops little except the bond of common hardship between graduates.
As bad as it may be, it is the same kind of thing.
Apparently, I need to check this more, but from what I’ve read recent studies say, basically, our reaction to social threats, like insults, is not only as strong as our reaction to physical threats, it's the same.
Dealing with fear and crushing emotional trauma means you can stay calm while you’re being shot, apparently.
Dunno if it’s true, but it seems to be a widely accepted theory.
I was slightly bullied and shied away from deep social interaction as a self protection mechanism, never taking risks and always being afraid. I did not have a date until I was 18. At 30 years old I am still breaking down barriers that I created to SURVIVE school.
This was a hindrance to me. Not a help.
Same here – I created strong emotional barriers to protect myself from the little ^&%#s in school. I’m still suffering at 28 from what they did. Sure, I grew a tough, thick skin – at the cost of my ability to be sufficiently vulnerable to have a relationship. There’s no way I’m going to let my baby go through that if I can avoid it.
This is strikingly similar to my experiences in grade school. Although I won’t say I didn’t benefit from the experience, I wouldn’t wish it on anyone. I still struggle with confrontations and similar.
I think this is just choice-supportive bias (I found the term on wikipedia, hope it’s the correct one). Noone likes to think that all those years were lost, so you find what’s good about it (and there’s always something good about anything if you look hard enough), and there you go.
I was bullied a lot during primary school, it taught me a lot, and it also was crap, and horrible, and while it gave me good resistance to peer pressure, it also reduced my expectations of future classmates so far that I was unable to have proper friends or participate in “society” for about ten years after. It sucked, and noone should ever have to endure such a thing. Ever.
That said, I also do know people who were whomeschooled and have been removed from the rest of the world for so long they’re unable to find a place in society. They’re pretty much chained to their parent’s wonky religious community because they can’t relate to anything outside of it. Noone should have to endure that, either. Even if they might never know what has been done to them.
I love the sadistic irony of the argument that suffering builds character. If you suffer enough, then you will become more opposed to injustice and cruelty, having experienced it yourself. Thus, if you are advocating that bullying builds character, you clearly have not suffered enough, and someone should remedy this situation.
Anything can be used as a tool for growth, and with the right perspective every part of life can be seen as beautiful because it’s all part of the tapestry of human experience. On a practical day to day level, though, it doesn’t work out that way. It’s one thing if you’re saying people should be able to say some not so nice things about someone’s work or character-that they should be allowed to be critical-it’s something else entirely if you’re arguing that kids who are essentially criminals should be allowed to get off scott free and bully kids that are smaller than them. Some adversity is more constructive than destructive and vice versa; conflict and competition are good. Being scared to go to school, a place you are legally required to go at least two-thirds of each year, is very, very bad. It’s like being locked in a cage with rabid wolves eight hours every day.
And bullies, they need help. I’m not for the return of corporal punishment in schools but I would be all for hiring therapists to put on school staffs to counsel them. I wouldn’t want to leave them out to dry-up to a certain point you’re almost entirely the product of your environment and it’s not until you’re entering adolescence that you’re really able to individuate, so if they could get help right around that point (or even drop out of the system-the behavior may be a product of rebelling against a monolith they have no control over) it would give them the best shot of turning into worthwhile adults.
The fact that some kids are literally scared to go to school is appalling, and that more things aren’t being done about it is even worse. This shouldn’t happen in a place where adults are always present. That is what we’re here for. If we can’t protect them from things that leave lasting physical or psychological scars we’ve failed them. We can’t put foam padding on the world because taking a few lumps now and again is good for you but being bullied to the point you’d commit suicide, as with a couple of recent cases, is not something to shrug off. This is serious. Those kids weren’t weak, they were different, and without anyone to turn to, without any support, it’s nearly impossible for someone to hold up under that kind of pressure.
Ah. Suicide. The.ultimate selfish act.
Don’t diss someone simply because they decided to take their own way out. They could have been truly selfish and taken out their emotion on the entire school, a la Columbine or Virginia Tech. The problem is that people are affected by what happens to them. Some are driven to better themselves, some are crushed. Some are repressed, and others explode in vengeance. But none of these outcomes should be likely, and I doubt that many are unproventeable.
It’s even worse to call it selfish. “I feel so bad I want to kill myself and now you’re trying to guilt me into staying alive!?” There’s no way you can win. Nobody wants to end their lives prematurely, they do it because they feel trapped and helpless. Not every tragedy can be prevented but we should go to any reasonable length to do so. Putting metal detectors in schools isn’t the answer, putting an emphasis on mental health, hiring staff therapists, and keeping violent kids away from the everyone else is. (It’s part of it at least.)
Penultimate. Right after trolling people with suicidal ideation. With all due respect, you are no longer due any respect. If this were my forum, your IP address and email would be verified and then cross-posted to /b/.
Dad: A bloody nose builds character!
Calvin: All by garagder iz leagig oud by doze.
Everything you need to know about life can be learned from Calvin & Hobbes
The problem with this is that it is still mandatory to PAY for public education. This is a huge chunk of parents’ financial resources that is going to be spent on public school regardless, which means that there are a lot of people who COULD homeschool or use private schools if only they didn’t have to finance this broken, overfunded system.
This is a pretty understandable policy though.
Imagine if this was not mandatory but you got to choose if you want to pay for public school or keep the money and homeschool your kids. I can’t even imagine a level of regulation that would come close to prevent abuse of such a system and thus it would lock kids with very poor or unjust parents out of any kind of education.
Neither of those things are prevented by the existing system. There are plenty of people (for instance, the Amish) against whom we already enforce no standards, and the condition of poor schools tells me that there is hardly a single student that would not be made better off, both today and in their adult life, if the entire institution were inelegantly abolished.
Ouch. Just ouch. You need to look at the way things were before public schools.
Hardly a fair comparison, since the US was much poorer a hundred years ago.
And presumably the US being much poorer a hundred years ago had nothing to do with the fact that basic education was not widely available. (Also, the US was not much poorer. I point you to the Gilded Age.)
By all means, let’s look at how things were before mandatory attendance laws. Over the past century, with mandatory attendance increasing from none, to elementary grades, to high school, how have literacy rates fared? Check the stats from the military entrance exams: WWI 20-25% illiteracy, WWII 15-20% illiteracy, Korean War 18% illiteracy, Vietnam 17%. It hasn’t changed things for the bottom tier of students.
How have top tier students fared?
In 1962, 19099 students scored 700 or above on verbal, 40644 on math.
In 1983, 9392 students scored 700 or above on verbal, 32469 on math.
In 1962, 2673 scored 750 or above on verbal, 8628 on math.
In 1983, 1588 scored 750 or above on verbal, 7002 on math.
By 1988, only 986 achieved a 750 verbal score.
So literacy rates have not increased, and scores for top students have decreased. You do the math. Read more:
The SATs are many times harder now than they were in 1962. Average IQ levels haven’t risen either because they define 100 as “average” and up the requirements as people were smarter on average. More students today are getting high-level math and science education than ever before.
just what i was going to point out. seconded.
Yeah, SAT tests have deliberately been made substantially harder over the years. Same for IQ tests–they have to keep adjusting them to keep 100 as average, and it’s very likely that a person from the early 1900s would do quite poorly on a modern IQ test as opposed to how they’d do on one from their era. (I should point out, though, that this doesn’t mean that people today are smarter than people in the past. It simply means that thinking and the way people view the world evolve.)
So… those aren’t really good markers. Literacy tests are a slightly better indicator, but I still question that. Military entrance exams are hardly representative of the entire population, after all. For starters, it really only represents men.
I have a amazingly harsh view of the public school system, and even I wouldn’t go THAT far.
As a society, we all benefit from a high literacy or numeracy rate (or we would, if numeracy were anywhere near as high as literacy). Publicly funding SOME kind of system that is free to use/attend is really the only way that a large chunk of the lower class (and especially poor ESL immigrants) children will become literate in English (our common language in this country).
That’d be nice if it could be made to work.
However, public schools are underfunded as they are even in relatively affluent areas. Public school is funded by property taxes in my state, a portion of this money is then pooled and redistributed around the state. Reasonably affluent and populous areas have more money and generally better schools. The mining towns up north that dried up with the mines have woefully inadequate funding and schooling — even with money being diverted from the other side of the state.
How do you think any of these schools could operate if you took away a significant portion of their funding (property tax revenue from people with no children, property tax revenue from people with grown children, home-schooled children and private-schooled children)?
They might actually have to work harder and earn their funds. If people had to personally pay for the education of their children then the majority would take their dollars to the schools which do a better job of educating the children that are taught there.
Last I checked, we as a nation spend more money per child than any other nation in the world and yet we do not rank in even the top 25 nations for Reading, Scientific and Mathematical Literacy.
Throwing more money at the problem is not the solution. Shamus addresses the real heart of the problem in this article. Not all children learn in the same way or at the same speeds however we try to shoehorn all of them into the same schedule. When you add on government imposed standards testing it gets even worse as schools begin abandoning actual education in favor of “teaching the test” in order to avoid loss of funding.
Right now we have a system which relies more on rote memorization than real education. Real education encourages children to want to learn, to actually engage their brains and observe the world around them and wonder “Why?” Rote memorization gives us high school graduates who can’t calculate change on their own and require a cash register to tell them what amount to return.
If they were doing a decent job then I wouldn’t mind but as it stands right now I can’t see the US Public Education System as anything other than a failure. The first question that should be addressed when it comes to public school funding is how effectively the dollars are being spent right now.
The countries that do better on the types of tests you bring up are ones with even more of a focus on centralized standards, government provided education, and such than the U.S. does.
Not to mention, the areas that do worse are usually the areas that are getting less funding already, despite some unusual districts that people like to bring up, so the argument that cutting money will somehow improve the worse schools is very unlikely to actually work.
It may be that corruption/patronage and such soaks up money from some districts, which is something I’ve heard about Washington DC, it may be that the schools have to perform more services for people in lower income areas, or it may be outside factors that reduce the ability of those schools to do well. These factors, and possibly others, would require solutions outside of changing school funding, but reducing funding would still be quite harmful.
In the US this is a bit of a non-issue, since school is paid for through property taxes and federal monies – it’s not collected specifically from parents. If a couple had no kids, they’d still be taxed, but if they had one kid and pulled the kid out of school, they’d get the taxes back? It would be… strange.
Anyway, I agree with the notion that we could spend the money FAR more efficiently than the school. (For the cost of just ONE of my kids in public school for a year, we could buy new computers for everyone, weekly outings to museums and the science center, kindles for everyone, and STILL have money left over.) Having said that, I prefer to not make this a fight over money. I’ll be happy if we can just keep enough freedom to school as we please. Lobbying for money would likely be an impossible fight.
Well, my own solution is abolition of the public school system. Probably also impossible, but times do change.
In any case, the debate is already about money. Specifically, the ever growing demand of public education to receive ever more of it, despite its poor performance with the highest spending per student in the industrial world. School spending, like many forms of government spending, is always more politically feasible to raise than to lower.
We should perhaps consider it fortunate that education is primarily funded by states rather than at the federal level, because states cannot issue currency and so are more readily subject to financial realities.
The whole US school system seems far more politicised than in England. I’m really not sure how it would work over there, but abolishing public schools here?
(Public schools in the American sense, not the “I’m from Eton” sense)
Madness, as far as I can see it. Are you talking getting rid of them outright? What about children of poverty? Are you suggesting that smart kids would get scholarships to better schools?
I was very lucky for school – My primary school had fewer than 60 pupils, ages 4-11. My secondary school had fewer than 600, ages 11-18.
It meant smaller classrooms, and less emphasis on standardised tests / milestones. The teachers could, on the whole, get on with teaching.
I met several people at University who went to Private schools, and the practice in some of those places is to actually expel kids who don’t get good grades, so as not to ruin the school record.
What about children of poverty?
What about children of poverty right now? They are not being served by the system and in many ways are being actively harmed by it. Letting them out of it would be immediately beneficial.
In what way would children of poverty be benefited by public schools getting shut down? The children of single-parent households, or households where both parents work, are the ones who would not have the option of being homeschooled. Homeschooled by whom? The parents aren’t home during the day, they can’t be; school is, at the very worst, a very effective babysitter for the work hours of the day. (Actually, it’s worth pointing out to Shamus that his mother really didn’t have the option to homeschool him, considering she fit the bill of the single working mother I just described.)
This is also completely ignoring the fact that not all parents are educated and motivated enough to be able to homeschool their children properly; like Shamus said, the average adult can’t do math beyond basic arithmetic. How are the children of these poor parents ever supposed to have a chance to break out of the status of their birth if they never have access to an education? No public education, no money for private education, no time for homeschooling (and, possibly, no ability). It’s the rare child who has an innate desire to learn so powerful that they would spend their days at home alone bettering themself over, say, watching TV. Do these kids deserve to have the burden of the rest of their lives foisted on their shoulders before they can comprehend what that means?
Most kids need to be forced into learning that which they don’t want to learn because they don’t know that it will help them later. My fiancee teaches 6th grade math right now in a public school system that tries its damnedest to implement as many non-traditional learning systems as it can to get the most from the students, but when you boil it all down she’s still having trouble teaching the whole class how to properly evaluate expressions using the order of operations. This is not a niche skill, this is something that anyone who ever uses math in any professional capability will need to know, and yet the kids would not be learning it on their own if they were given that choice. Should we just throw our hands in the air? Hell no, because a 6th grader shouldn’t be indirectly making decisions about what he or she is going to do for the rest of their life. They may not end up using math at all (completely ignoring the idea, which I agree with, that learning math improves logical reasoning and cognition), but if they don’t learn it now and they realize when they’re 16 that they really like the idea of being a scientist, they’ll hit a wall when they realize they have a ton of math to catch up on. Some might do what Shamus did, and teach themselves Trig because they need it, but how many would get discouraged and give up? In my experience watching my SO teach, the answer is “most”.
We teach a broad spectrum of fields to these kids so that by the time they get to a point where they _can_ make those decisions, they’ll have _some_ kind of basis to work from. There are so many kids who don’t even know what they want to do with their lives in college, the notion that we should be expecting them to know what areas of school they should and shouldn’t be taught when they’re in grade school or even high school is absurd. Individualized attention will of course always work out better for the student than broad-spectrum learning, but like I said before, that’s simply not an option for a lot of families.
Blanket statements like “There is hardly a single student that would not be made better off, both today and in their adult life, if the entire institution were inelegantly abolished,” are not just provably wrong, they’re actively harmful to the debate. They’re needlessly inflammatory, ignorant to the point of willfulness, and woefully egotistical in the sense that you seem to think that such a simple solution would be a universal good.
In short: get over yourself. Your “simple” idea is a solution to nothing, and would do much more harm than good. If public schools were shut down tomorrow, the only people who would directly benefit would be the kids who already possess a love of learning, or whose parents have the money or time to dedicate to their education. Public schools weren’t necessary in a world where unskilled or semiskilled laborers (like farmers) made up the vast majority of the workforce, but that time has passed. A minimum amount of education is going to be needed for almost any decent job now, and no one has any right to decide a kid’s future when the kid is unable to make that decision for themself.
Shamus advocated for choice. You’re advocating for the universal abolishment of the system. You couldn’t be further from his point if you tried.
A very good post indeed. Thank you, sir
Agreed, this is excellent.
I must, respectfully, disagree with you on almost all fronts. You see what is, but perhaps not what could be in its absence. Please allow me a (relatively brief) fanciful interlude.
The poor are those most affected by rent, which is artificially raised by the very taxes which support public education. In the absence of these taxes the poorest of the poor would be able to spend more time with their families. Loving attention from parents (in Shamus’ story as well as others) is the most potent force for self betterment. Much more powerful than state sponsored education. The net result is beneficial.
Even without abolishing public school, universal attendance laws do more harm than good. There will always be people (even as children) who are unwilling to learn and disinterested in self improvement. These children are currently brought into daily contact with other children, to the effect of further spreading their misery. Any educator can tell you that their most daunting task is to dissuade the disruption of those who are forced to attend school against their will. Without mandatory universal attendance laws, these troublemakers could stay home and watch TV, allowing those who wish to learn to do so. Teachers would be better able to do their jobs, and bullies could easily expelled.
Of course, as I said, this is a fantasy. For the time being mandatory universal public education is here to stay. I see it as an evil, but we may disagree. I pay my taxes honestly, so (for now at least) you and those who think like you have won.
Really? You’re seriously saying that if we remove public education then the savings the poor make on their taxes will be enough that they don’t have to work a full time job? People still have to eat. Pay the heating bills, etc. The saving would be minimal, and it certianly wouldn’t be enough to make people stop working eight or nine hour days.
Also at least in America there are no universal attendance laws. If you don’t want your kids to go to school than you can homeschool. And the troublemakers should just stay home and watch tv? So if you’re not the most focused child then you don’t deserve an education?
Let me respond with a single anecdote: the town in which I live recently passed a daytime curfew. This is a law that requires that persons between the ages of 5 and 18 not be in public (stores, parks, walking down the street, outside in their own front yard) without a parent between the hours of 8 AM and 3:30 PM (school hours). According to the school superintendent who proposed the curfew and the city council members who approved it, this law was passed to discourage students in the local public school from deliberately getting themselves suspended (repeatedly seriously misbehaving with the express intent of being “kicked out of school” for a period of time) so that they could wander around with their friends during the day instead of being in school. According to the educators in our town this is a serious and persistent problem in the local school. I’ve heard from local educators about kids bringing weapons to school and TURNING THEMSELVES IN to get kicked out for a week or two. If these kids are that disinterested in acquiring an education, who are we to force them to sit there with the other kids who want to learn? What good does it serve? We’re still not educating the ones that don’t want to be there and their deliberate misbehavior disrupts the educational process for others.
This anecdote raises a lot of questions (especially about the local school district) but I think it amply illustrates the point that if kids want to be at home watching TV, they’ll find a way to do it whether we have compulsory attendance laws or not. In fact, the daytime curfew simply reinforces it.
This is simply not true. The neighborhood school down the street from me is populated primarily with students from impoverished families. 95% of the population are on free or reduced lunch. From my experiences of eating lunch in the cafeteria, around 20% of the students save half of their lunch in order to take it home to younger siblings because they are hungry. 50% of the students take home a backpack provided by the local food bank on Fridays, so that they have something to eat over the weekend.
How do I know so much about this school? Because my daughter just started Kindergarten. It is tragic how woefully far behind most of the kids are in her class. Seriously, it brought tears to my eyes on parent night, where I was able to compare my daughters work to those of her peers.
This school is not a model. In fact, it is bad. So bad that the district offered every family the opportunity to pull their kid out and send them to a very successful school. Guess how many student’s (or to be more exact, parents) took advantage of this opportunity out of a population of 639? 3. It was a difficult choice for us, because I hated abandoning the neighborhood school and not doing everything in my power to help make it better, but in the end I had to do what was best for my daughter.
There is no doubt in my mind that if the public school system didn’t exist, these kids would be FAR worse off. The parents simply would not take the initiative to make sure their kids were educated. Hell, 99.5% of them couldn’t take the trouble of filling out one application to send their child to one of the best schools in the state.
This is not a good school. It is tragic that the students that are the most in need are provided with the worst school, but the alternative would be a nightmare.
Wow, thanks Skyy_High and Strangeite, much better rebuttals than I can put together.
Strangeite – it’s always sad to hear of schools that are in that much trouble, but I’m glad your daughter got out.
Skyy_High – on unskilled labour, I’ve often thought that it’d be beneficial to allow some student an out earlier than the age of 16. I know a lot of people who would have been better off with an old fashioned apprenticeship, at the age of 14. By that age, you’ve done the basics and you’re starting to specialise in subjects that interest you.
Similarly, I knew several people at that age who knew that they were going to work on the family farm, and school was just an annoyance. They were right; for them it was. For the other 99%, they were the annoyance.
I would concur. Abolishing public school would probably be taking it a bit far in this day and age, but I would definitely be in favor of, essentially, encouraging a younger age of maturity. Have mandatory education only go from 1st to 8th or so (ideally also only have public money pay for education up to that point), lower the drinking age to the voting age, make it easier for “children,” those we now call teenagers, to work younger (which would probably require lowering minimum wage, or at least not increasing it for a very long time, lowering the age at which you can get a license, etc., even besides just loosening up on some of the direct restrictions), that kind of thing.
This is straying a bit far now, but it would probably also be a good idea to start unromanticizing higher education; if elementary education is overrated, college at least as much so. Not that it isn’t good for some people, but it should not either have to compensate for the failings of modern high schools or be view as a magical gateway to some nebulous “good job.” It’s already getting a little competition from apprenticeship programs and tech schools anyway; no reason an engineer has to be familiar with 15th century French Lit, and no reason for an Art major to have to take Chemistry.
Well-rounded’s nice if you can get it, but society has been thriving on increased specialization for centuries. Why fight it?
You know what happened when education up to Grade 12 wasn’t mandatory? Parents yanked their kids out of school to work on the farm. Or to get a job. Or to work on the fishing boat. Or to work in the factory. Etc. Etc.
There’s also the fact that, y’know. Maybe fourteen year olds aren’t qualified to make decisions about what they should do for the rest of their lives.
You’re talking about bringing back child labor, not about improving education.
Sure, 14 yr old men and women are probably not qualified to decide what they’re going to do with the rest of their lives. But is a 15 yr old? 18 yr old? 21? 33? 42? In the first place, they’re only deciding what they will do now, rather than 20 yrs from now. In the second, people every day are required to make decisions for which they may very well not be qualified, although who decides who else is “qualified” is another good question. Also, just because they start working does not necessarily mean they are cut off from friends and family, just that they are more likely to be the one ultimately responsible for the decisions.
On another note, consider this: 70 yrs ago, a 16 yr old boy had both his parents die. He had 7 siblings. Nowadays, social services would swoop in and send them all to foster homes which, even if they turned out to be good homes for the children (not a guarantee), would break up the family. Then, he took over the farm and kept the family together, led a fairly successful life, and is now in his 80’s living in a small town in South Dakota. Did it suck that his parents’ died? Yes. Should there be help for him? Of course! I somehow doubt those kids managed it on their own. But should it be required by law that they not be able to at least try and make it on their own? Goodness no!
Keep in mind that the very concept of a “teenager” is a very novel concept. I have a difficult time believing that a fad of a mere couple of centuries trumps millennia in which people started working for a living without having gone through at least twelve years of what passes for an education, instead of working for letters on a piece of paper. At the very least, there is not enough weight of evidence to make even reexamining the question worthless.
That said, I happen to also think that loosening of some of the so-called child labor laws and reducing the amount of mandatory education would, yes, improve education.
I have a difficult time believing that a fad of a mere couple of centuries trumps millennia
So you’re keen on forced marriages, slavery, and serfdom, too, then? Being new doesn’t make it a bad idea.
The simple problem with your idea is that it seems dangerously ignorant of, well, just about everything.
For one, how is increasing the size of the unskilled labor force going to be good for working conditions in that labor force?
For another, as I’ve said before, the bit in between where they can be taken out of school and the bit where they can leave home seems ripe for exploitation by their parents (and it’s a lot harder to get an education when you’re an adult, for a variety of reasons).
For a third, deciding what you do now ends up deciding what you will do in the long term. And younger people are less well equipped to make those decisions. Thus, it makes sense for society to do whatever it can to make sure they are as well-prepared for those decisions as possible before they make them. There are a lot of flaws with modern social services and public school, but going back to the eighteenth century isn’t the solution.
And finally: have you read history?
I agree that by age 14-16, a teen who knows what they want to do should be able to go to some kind of vocational school / apprenticeship to get a focused education, so that by age 18 they’re able to go directly into the career they want. That’s a good option, and options (particularly for kids who know what they want are great. Broad-spectrum learning is the default for kids who simply don’t know what they want, and shouldn’t be expected to know.
It’s also worth pointing out that the area that I live in actually has a lot of farms, and a good fraction (probably around 15%) of the kids my fiancee teach live on farms. These kids may also very well never use the skills they learn in school, but that’s a heck of a decision to give a 10 year old, “Do you ever want to do anything with your life besides work on this farm?”
Oh, and God yes does college need to be un-romanticized. The amount of debt that the next generation is piling up to get liberal arts degrees that will never help them get a job is positively staggering. College should be unquestionably for people who need a focused technical education after high school, and for people who want to work in academia; almost everything else can be handled through vocational schools, community colleges, or plain work experience (if employers didn’t require a degree…). The purpose of high school should be to give the kid all the tools they need to decide what they want to do when they graduate, and how they can go about doing that. Obviously, the school system failed Shamus in that regard. That doesn’t mean the system needs to be abolished.
I don’t mind electives in college, however. I took quite a few of them as part of my degree program, and while I can’t say they’ll ever be useful to me in a professional sense, they certainly influenced how I think about things. A little broader education is worth the extra year in college, in my opinion.
Yeah, that’s a good point. Very, very few people actually know what they want to do. The farming thing was actually rarer than I made it sound – everyone else had no clue what they wanted, and so got the broad spectrum approach.
“the most interesting people I know didn't know at 22 what they wanted to do with their lives, some of the most interesting 40 year olds I know still don't”
On higher education – a lot of jobs will simply not look at you unless you have a degree, even if it has no bearing on your knowledge or abilities, or even if it is related to the job.
There’s a whole bunch of rage sloshing around (like slurry), over University fees in England at the moment – they’ve gone up drastically, in the hope that it will put people off who don’t actually need to go.
Hopefully it will start killing off “mickey mouse” degrees, too.
There is anger about this in Canada too, though it might not be as obvious as it is in some other places. The economic collapse in 2008 and the drive to earn a university degree has left a generation of young people with university degrees, mounting debt, and no job prospects. They are trapped between aging baby boomers who will no long retire early, as their savings have been wiped out, and the younger students that continue to pour out of university who will be first in line if ever jobs do open up again. And often, the only thing you can do to make yourself stand out from the pack is to continue up the educational ladder, accruing even more debt and hope you earn a degree while it is still worth something.
“School spending, like many forms of government spending, is always more politically feasible to raise than to lower.”
Your experience is far different than mine. Not sure where you live, but in here in Michigan, cutting/freezing education budgets is the norm. Raising them is the exception. Our public schools are in a constant fight to keep the teachers and programs they have. Those serviced by education can not (as a general rule) vote. Those who work in the industry can vote individually, but have relatively poor financial resources to lobby with. There is a lot of political force to overcome to use education as a budget saving tool.
I have lived in four states. NEVER have I heard of school funding being raised outside of local property tax levies, and those few and far between.
I think total abolition goes too far because the reason, as far as I see it, why public schools were originally invented was to give every child a chance at gaining knowledge and skills. There were times when many children from poorer families couldn’t read, probably because their parents couldn’t either, and they had no other chance to learn it – public schools gave them that chance. That’s why I think public schools, paid for from taxes, should stay, only that they should not be mandatory to attend.
Actually, the public school system in the U.S. was started in order to get children out factories. They were taking jobs from adults.
Actually that is incorrect. School was initially designed to create an adult workforce that was content to do monotonous repetitive factory work. Child workers were left feeling high self esteem because they had accomplished something and grew to be adults who couldn’t stand the jobs they had enjoyed as children. The industrial revolution would require millions of drone workers.
There’s one big difference here, though, and you can see it in comparison with home schooling and private schools.
I, a childless person, pays through my property taxes for schooling. I don’t use that schooling … but then I have no additional obligations either. I just pay my property taxes.
Couple A decides that they want to send their child to private school. If they do so, they would have to a) pay for the public system, like I do and b) pay for the private school on top of that. They get dinged twice, where I get dinged once.
Couple B decides that they want to homeschool. If they do so, they have to a) pay for the public system, like I do and b) pay for whatever expenses are incurred from them homeschooling. They get dinged twice, where I get dinged once.
So it’s not quite a non-issue, since it does indeed limit how many parents can take advantage of that option.
But you get dinged once for something you don’t use. That’s the same as getting dinged twice for something you do use.
I would have to say that “use” is a bit more complicated here. Does someone with no children “use” the education that the cashier at the grocery store he goes to got? Or if he starts a business, will he use the education of his potential employees?
Education is highly useful to a whole lot of people, only some of whom are actually being educated. It’s also expensive, and will be paid for if it exists. It’s somewhere between possible and likely that it will be paid for by people who benefit from it, one way or another.
Except that people who send their children to public school get dinged once for what they use. In my case, I write it off as the cost of supporting society. Those who use public school write it off as the cost of supporting their children. Those who don’t end up paying for something they don’t use AND paying for what they DO use. Monetarily, they’re behind me because they pay for what they aren’t using AND paying for what they’re using. That double dip impacts budgets.
This is the argument some use when talking about school vouchers. I do not know if homeschooling is included as an option for vouchers under the most common models.
I am torn on the issue of school vouchers. On the one hand, it does prevent double-dipping. On the other hand, if widespread it can impact the quality of public education by removing critical funds.
One of the things about public education is that it necessitates buildings and staff and various other resources which vary some per student, but don’t match up exactly. Get enough students and you need a larger building, but you always need some kind of building even if you only have a few students. You need more janitors and maintenance people and counselors and whatnot for a larger school system, but a smaller system still needs access to these folks even if they are small. In this way larger school systems CAN be more cost effective by virtue of being able to make the most of shared resources.
If a school system runs optimally at a set size, reducing the student population and funding by a critical amount can suddenly push it into territory where finances cannot match the costs of maintaining the facilities needed for busier operation. Then again, there are many other reasons this particular problem could occur that are far more likely than the loss due to vouchers.
Vouchers also tend to favor those with greater financial resources. Folks with stable finances are more likely to be able to homeschool through being able to afford having someone home teaching the kids or to be able to afford private schooling. This could lead to students with more stable home lives (and thus better grades, on average) fleeing the public schools, leaving the public schools a dumping ground of sorts for poor or disadvantaged students (already the case in some communities, even without vouchers).
Can you see why I’m conflicted on vouchers?
On the voucher thing:
I totally understand the thinking behind them, and I’m as eager as anyone to see people try as many different styles of education as they can, but vouchers are more about economics than education. To wit:
Let’s say we give everybody $5k vouchers for private schooling. Private schools can then raise their tuition by $5k and make a lot more money while having exactly the same enrollment as before. In fact, they would be idiots not to.
I think this is a big reason college is so expensive.
* Government allows all students to borrow $5k in gov’t backed loans for school.
* Tuition goes up by $5k over the next few years.
* Government allows all students to borrow $5k more.
* Tuition goes up by $5k.
* OH MY GOSH! College is SO EXPENSIVE! The poor can’t get in! We need to help these kids!
* Government allows all students to borrow $10k more.
* Tuition goes up by $10k.
50 years later, college now costs as much as a house and nobody can find a job that can keep up with their debt.
Same thing would happen with private schooling.
This is exactly why I believe that the government should not give student loans out.
The UK system has a different problem caused by solving this one.
In
the UKEngland (Scotland has a different system), the amount a University (= US college. UK colleges are something different entirely) can charge in tuition is capped.
You can then take out a loan from the government. Because this is a loan from the state, it doesn’t have some of the problems endemic to a private student loan. The way I pay it back is essentially by means of an extra tax once I earn more than a certain amount. If I leave University and fail to get a job, then I do not have bailiffs coming around to repossess my things: I just don’t pay it back.
In this system, the government is making an investment in me (in the hope that I get a better job and hence pay more taxes) in the same way that I am (in the hope that I get a better job and can afford a swimming pool of money).
The problem is that our last government tried to get everyone through higher education. This resulted in “degree inflation”, in which a degree isn’t worth quite as much in the job market because everyone and their cat has one.
And because it’s an easy debt to live with (if I can’t pay I don’t), it’s really easy for lots of people to take up the offer. I couldn’t have afforded to go to University otherwise. This probably makes me part of the problem :D
tldr; higher education is a bit of a calculated gamble. You put your chips in and hope that the odds turn out in your favour. The people running the game are trying to minimise the chips, maximise the players and maximise the odds, and there’s no real right way to do it.
This extends all the way back down the tree to the original point about basic education: you’re trying to minmax a whole bunch of variables, and it becomes really hard to think about “individuals” at that level. Also, like Shamus says, you’re minmaxing people. You can’t just guess and hope it turns out ok, because then you risk screwing the people you’re trying to help (or rather, screwing them over more :D).
My impression had always been that, in a completely tax-paid education system, those who come out of the system with a high degree and manage to get a well-paid job, will automatically pay higher taxes who won’t, and thus refinance the system anyway. So I am not so convinced that vouchers, student loans etc. are really necessary at all, if schools and universities would just get sufficient funding.
It’s the same with street tolls – don’t people already pay for the streets by paying taxes (and car owners here have to pay additional car-taxes just for owning one)? Why should they pay an additional fee for using what they have effectively already paid for?
I think the underlying issue is lack of solidarity. I hear a lot of talk about how people don’t want to pay for something they don’t deem themselves like to ever use; in the most extreme case, some people want most of all taxes be abolished and replace with usage-fees. The idea of paying your share of something “for the greater good of society”, as in schools, roads, hospitals, police etc. seems to have come under bad reputation lately. When I look at the the tax I pay, I know that they are spent on building roads, maintaining hospitals, having a fire station in the city etc. Yet some other people seem on the brink of regarding even that as “socialism”… facepalm
I would condition that with a, “to everybody”. Loans and other such things can be worthwhile for individuals, it is the widespread nature that causes problems for the system as a whole.
The REAL problem was there were some statistics a while back that said that people who get degrees earn more on average, so that kind of drove the equilibrium thinking upwards, without regard to how the system can change as a result of this – with the result being the return expected from giving out a loan was inflated, causing an oversupply of loans. This is further complicated by the fact that there is now backlash to cut back, which is hurting us even more in the short run.
Long story short: we’ve been way too liberal with the lending, and it’s hurting us quite a bit now.
You know, I hadn’t thought of it from that angle. On the other hand, the private school I attended in TN has had tuition go up at a rate that rather closely matches those of colleges and universities, and all their financial aid and loans are private.
I suppose there’s the possibility that they are just following a trend, but as someone who has worked in and around academia for many years, colleges and universities don’t have a good handle on their expenses. They are mostly not for profit institutions, so they don’t just raise tuition because they can. If they raise tuition that money has to go somewhere. Now, it may be that having greater loan money available enables them to offer new things, and as one school offers new things all the other schools have to start offering them, too. I would not be surprised if that was involved. But even with loan money allocations increasing schools like Harvard have decided to no longer be need-blind, meaning they leave themselves leeway to pick people based on their means to pay, suggesting that even with increasing loan availability, the very top schools are seeing a lack of available loan funds. My alma mater charges a hefty sum for tuition and room and board. There’s no way loans would cover all of it. But they are very generous with scholarship money, despite the fact that they are a highly regarded institution. If they let you in, they are willing to try to help you out.
So now I’ve veered WAY off topic… Yes, Shamus, I hadn’t considered your point, and now it’s in my brain and is something I will not be able to gloss over from here onward. It is a good point and I agree that what you suggest is a potential risk. I’m conflicted on vouchers, but not so conflicted I think they are a good idea just yet.
Vouchers only work if you eliminate the public education system completely, and the voucher is as good as printed money when cashed out by an educational corporation. And then you have free market at work.
(For homeschooling, you can create “homeschooling schools”: you hand them your voucher, they give you back materials and perform exams.)
Of course, poorer families can even cash out some of their assigned money for something else they value more than their kids education. For rich people the scenario don’t vary much either way.
I send my children to private school, at great expense to my family’s budget. We can’t afford even so much as a pizza without a dreadful reading of the budgetary tea leaves, because my children’s not-top-of-the-line private school costs so bloody much. I consider myself ~lucky~ to live in an area where I have more than one choice of private school, because some kids are fully SOL even if their parents had the money to spare.
That said, if I could withdraw the educational portion of the taxes I pay and put them in the private school I would do so without a second thought.
which is why you can’t, of course. it’s a public school because its for the public, even if you don’t use it you gotta pay. I don’t use public parks, why should i pay for them? i could drive everywhere and not use sidewalks, does that mean i dont have to pay for the maintanence? do i not have to pay for the police because i never got robbed?
In Colorado, they started an online charter school. The children were technically homeschooled, but the state sent the allotted money for the year to the charter school, who turned around and used it to buy computers and books for the kids. Each student used their curriculum, but could go as fast or as slow as they needed to for each subject, as long as they could pass the state tests (which are ridiculously easy). I felt that this was a great middle ground for parents who didn’t have the time to take a more active role and actually homeschool, but also didn’t think their children should be in the public school system for whatever reason.
I was homeschooled from the end of 6th grade through high school. There are things that I missed out on that I wished I had been able to experience, and my parents basically let me learn on my own .. which means I stopped studying math by the time I got half way through my pre-algebra textbook … instead, I spent my time writing and painting in photoshop. When I was done with school, I went on to design websites, using … writing and photoshop design skills.
I was put into homeschool because of bullying .. I was too quiet and shy and girls can be jerks. The teachers didn’t do anything to stop the physical abuse that I tolerated every day even though they stood and watched (I remember being repeatedly stabbed with a sharpened pencil until my arm bled .. when I asked to be moved to a different seat, and showed her my arm, I was told to tough it out. Sure, I should have fought back, but I had been taught to never fight, always be passive, etc. in church as well as at home by my mother).
I agree about not making it a money issue. My kids aren’t school age yet, but they will be going to a small private school. I’m willing to take the financial hit to keep the government from telling them how to run the school. The more support from government (by lower taxes, or funds for the school), the more government will require you to do things a certain way.
Speaking as one of those single guys who is helping pay for your kid’s education* if you’re going to be the one educating your kid or you’re going to put your kid in a private school, I would greatly prefer you have the money that would be going towards your kid’s public school education especially since they wronged me almost as badly as they wronged you (I think I was lucky enough to have a few more teachers who cared and knew how to ignite my passion for learning but it was clearly their doing and not a consistent feature of the institution.)
*Ok, I’m not literally directly paying for it. I mean, we don’t live in the same state or county and I rent but surely a portion of my rent is helping the landlord pay property taxes which go to schools for children who are not my own. You know what I mean. -Dennis Moorism
Wow this is a late night post for you Shamus given that it’s 0940 or so UTC!. I find home schooling disturbing not because I believe parent’s are poor educators or that home schooling turns out socially maladjusted people but rather because in the US in particular there are no national standards.
I’m not trying to claim that everyone needs to know this, that or the other but does the child not have a right to a certain minimum level of understanding of the sciences, history, art, maths and languages? As you say attending a school is no guarantee of that but at least the testing system forces some rigour on their efforts. I’d be interested in whether you feel standardised testing has any place in home schooling or should parents be free to decided on their own what their children should learn?
The issue with testing is that it only proves how good someone is at tests, and highschoolers who can barely read prove that it’s a poor barometer of someone’s actual knowledge.
Given how curious children naturally are, you’d practically have to try to prevent them from learning certain key things-at least enough for them to get by-and that would probably be part of a pattern of abuse and not due to poor curriculum or a lack of resources.
I don’t have the links right at hand but look up unschooling sometime. Seeing how the people who promote that methodology think and work shows just how questionable the agreed upon standards really are.
If you tried to enforce standards, it would destroy the entire point of homeschooling. If you want standards, then someone has to decide what those standards will be, and we’ll have the entire OBE debate again, only on a more comprehensive scale. EVERYONE will want their ideas to be mandated.
Also, it will require you to prove that your kids are meeting the standards, which means tests, worksheets, etc.
Worse, what happens if a kid isn’t keeping up? I would have failed at standardized testing in Kindergarten, because I was “dyslexic”. Someone would see my low scores, conclude my mom was a bad teacher, and forcibly put me in the madhouse.
It would negate the benefit of allowing kids to follow their passions. “Yeah, I know you love math and computers Shamus, but you need to fill out this quota of history, science, phys-ed, civics, art, music, reading, penmanship. Also, you need to follow this proscribed path for math or you’ll fail the tests. No skipping ahead or learning things in a different order.”
Might as well not bother. Might as well just make them all go to school.
I started to compose an argument around only testing fundamentals before realising that there is no such thing and everyone differs on what constitutes a fundamental component of education. For every person who could agree that algebra is a core element of mathematics there will be those who argue that trigonometry is just as vital or matrix transformations. History as a subject is a minefield of competing narratives and perspectives that is probably best approached as an adult in all but the most superficial sense (given the tendency for children to impose goody/baddy narratives).
I would hope that the consequences of a child failing standardised testing would not be labelling but an offer of assistance or teaching materials to the parents so they can help their child recover. Sometimes standardised testing can uncover genuine issues that a parent may be faulting themselves for or could benefit from alternate learning methods. There’s no doubting that labelling in formal education can be used as an excuse to ship the child off to ‘special’ classes that serve as an educational gulag but would that happen with home schooling?
Perhaps my perspective is too naive in hoping that standardised testing could be made to assist parents home schooling rather than becoming a trap to drag their kids back into the formal system. Are there any peer-review style schemes where home school parents can get an outside perspective on their child’s progress?
This is why they try to jam more and more into the curriculum every year–every one in educational academia has their pet project or subject or topic that is “essential” in their mind. All it does is guarantee that there is more and more that is NOT learned.
And is in fact learned worse with every passing addition.
Even worse, after we drill in the idea that “the tests are important” to get the kids to take the tests, they stop seeing a point in going to/participating in school after the tests are taken (which is necessary to get a response back in time).
I feel this type of thing is emblematic of the critical juncture the country is facing at the moment, where everyone feels the need for change but no one can agree on how to change.
When I was being homeschooled, my mother had to submit a curriculum plan to the SAU (School Administrative Unit) at the beginning of the (academic) year and send in some sort of review at the end of each year, whether it was an interview with a certified teacher or the results of an accepted test. I believe that if I had failed any of these things, we would have either been forced to send me back to school or used the school’s lesson plan (which we tried the first year I was homeschooled. It was absolute rubbish).
So in New Hampshire, at least, there’s a little bit of what I believe you’re looking for. I can’t speak for anywhere else, though.
imo, the fundamentals are reading, writing (not penmanship, but being able to put what you think down into words on a page, or at least spoken aloud in eloquence), and logic … and using an internet search engine ;-)
Words are the basis of being human, and so it is essential that we teach children how to interface with our culture … with other humans.
There is such a standard that has to be met for private schools to be accredited and to get state money. I can’t remember which side of the line we were on at the private school I went to high school at, but I don’t think the requirement to teach state history really helped anyone.
“…and forcibly put me in the madhouse.”
Possibly in our day (I’m 45) as back then dyslexia was just starting to be generally recognised but were it today and over here you would receive a “Statement of Special Educational Need” the school would be required to set up an action plan to assist you and would have had a period of one-to-one support from a “Learning Support Assistant”.
As regards curriculum, for us subjects are assessed separately and whilst we have do a national curriculum it has flexibility built in.
Sounds ghastly. Maybe it works in practice, but doesn’t sound like it would.
Ghastly? Really?
Stripped of the titles it boils down to – a child is identified as having a special need and gets someone paid to give them one to one help in the classroom.
Good theory, which has failed in practice. I was in a herd of students who all had identical “individual education plans”. The paperwork became an obstacle instead of a tool, and I went far beyond the courses in math and science while barely passing the class titled “English”. I still don’t know what that class was intended to teach, but I think I already knew it.
er…I think we’re talking at slightly cross purposes. I’m talking about helping primary school children (so age 5-11) with disabilities in main stream mixed ability classes by giving them one to one support.
I’m discussing the results of implementing a paper policy that intends to do that. I agree with the intended result, I just don’t think that requiring that result will result in it.
It isn’t perfect but it does help.
That said I could be biased – my eldest is an LSA. He originally worked with a lad with cerebral palsy & selective mutism now he works with a lad with behavioural problems.
Basically it is: 1. child gets singled out; 2. the school gets assigned paperwork; 3. the school has to pay someone to teach one person at a time.
It sounds like it’s made to encourage a school to hide anyone needing the help and to try and solve it on their own. Which they most likely can’t do and only end up burying the problem. Or they don’t hide it and find an easier way of handling individual events (a standard “action plan” that is used more or less the same for everyone and, like in decius’ case, putting them all in front of the same teacher).
The reason I called it ghastly however is not that it doesn’t sound nice in theory, it’s that the titles give the whole process an aura of failure. I mean “action plan”? “Statement of Special Educational Need”? “Learning Support Assistant”? I mean, seriously? It sounds like something that was designed by someone who works more with bureaucracy than other people.
Almost. Step 3 is actually –
…school gets extra central government funding to employ someone to teach one child at a time.
To give you an idea of the money involved in 2009-2010 they spent £5.2 billion ($8.33B at today’s rates)* of which “£2.1 billion was delegated to mainstream schools; £1.6 billion was delegated to maintained special schools; and £612 million was spent on placing children with SEN statements at independent and non-maintained special schools.” Yes, they spent several hundred million sending disabled kids to private schools.
I’d agree with you about the job titles mind.
*
“…school gets extra central government funding to employ someone to teach one child at a time. ”
Oh. Well, that’s good.
There is an elegant solution to both this problem and the money issue mentioned above. Permit homeschooling broadly, and refund some portion of the tax money that would have been spent on public schooling of children to the parents of homeschooled children who can pass standardized tests with comparable grades to publicly schooled children taking the same tests.
This provides funding for educational expenses related to homeschooling and a small compensation for the loss of income from the homeschooling parent for those parents who simply feel they can do at least as good a job teaching their children as the public school system.
It doesn’t prevent parents from homeschooling if their child, like you, has something akin to dyslexia that prevents them from doing well on standardized testing. At worst, it defunds them to the point that, well, to the point that they’re currently being defunded.
It prevents parents from abusing the system by sitting their child in front of the TV and collecting “homeschooling pay checks”
Or the reverse. Give everyone back their money and let the public school require tuition to teach state or federal curriculum. State or federal programs currently in use to provide poverty assistance can provide that tuition directly to the school for students without the means.
The poor are educated by public money through the state curriculum and everyone else is free to choose what they wish. Certainly states or municipalities with an interest in education are allowed to make grants to school systems in order to ensure up to date computers, or higher salaries or whatnot.
And what about the money of childless individuals and couples? This would also directly harm those incapable of receiving effective home-schooling. There is no simple solution. Shamus’ suggestion that the option remain available while changing nothing else is the closest to a simple solution.
Agreed. If we are to be a community then certain services must be in place. Many require that everyone pays in, regardless of whether or not they choose to use those services. However, the freedom to choose not to use those services must be fiercely guarded.
Anyone not interested in my list is free to stop reading here.
Education
Defense
Infrastructure
Public Safety
Emergency Response
Basic Research
This is my minimum set, i.e. those things that a country needs in order to thrive, ultimately benefit everyone, and have not (yet) been convincingly made available to EVERYONE through private means.
To this minimum set I would add Health Care and Space Exploration, but my evidence is more shaky and may be colored more by personal bias.
How does this fit with your “man on the street” example? There are certain standard pieces of knowledge we expect everyone to know by the time they reach adulthood – “Lincoln was not America’s first president” or “Solve for X” or “Formulate a coherent argument” or “Work together with a small team.” Everyone has an interest in ensuring this stuff becomes universal knowledge, which means knowing who has learned what. How do we get proper metrics without some sort of testing?
They didn’t learn it. The system failed to instill that information in a meaningful way.
The point was that you wouldn’t be losing that “standard” knowledge because you don’t really have it to begin with.
You misunderstand. I’m not saying everyone NEEDS to know those things. I’m saying not everyone WILL know those things, even kids from public schools. People saying, “Homeschooling doesn’t lead to well-rounded people” are holding HS’ing to a standard that not even public schools can achieve.
I like the idea, suggested by someone else, of giving tests. (SATs or somesuch.) Purely voluntary, take them whenever you are ready. Businesses and colleges will want to see that you have some moderate level of proficiency. If you want to work on a farm, be a homemaker, or go into some area of skilled labor, you can skip these tests. If you want to go for a more advanced job or education, then you’ll probably have to take the test. However, you can learn the material however you like and at whatever pace suits you and your family.
That gives a nice safety valve for people who want to educate themselves, while at the same time encouraging them to get that “rounded”-ness that is a sticking point for so many.
SATs (and similar exams) will likely remain in place regardless what the primary education system does. Unless you propose to change the entire university system as well which, on the surface, seems completely unworkable.
So here’s an idea: You don’t take tests to get out of school, but rather to get in to school (except elementary school, obviously).
That makes a lot of sense, because the things you are tested for are the things that apply to whatever area of education you are pursuing. Though there would still need to be some minimum standard for everyone/all schools.
This is actually quite similar to how people are admitted(?) into music studies (at least over here in Norway). Half of the students are let in from their middle school (13-16 yrs) grades, and the other half from an audition. There’s no reason why it shouldn’t be like this for other “specialized” courses.
The private school that my kids will be attending is held to a higher standard than public schools. For a kid to pass a subject they have to achieve 80%. If not, they do it again. Once kids get to high school, if they aren’t interested in taking advanced math and science, they aren’t forced to. They can focus on things more suited to their interests without any stigma of “being in the general classes” (vs advanced).
My brother passed grade 9 in public school and then went to this private school for grade 10. He was always a good student and got good grades (75%+), but when they tested him to enter the private school they found his Math and English skills were at the level of a 5th grader! It turns out he wasn’t smarter than a 5th grader (sorry). He had to go back and fill in the gaps in his learning. The school allows all students to work at their own pace, so he was still able to catch up and graduate on time. Of course no system is perfect, and I think this private school suffers from some of the same problems of kids just cramming and then forgetting, but it does do a better job than the public system.
Also, my brother was falling victim to the peer pressures of high school. He was hanging around with kids who were a bad influence, and wasn’t trying to learn anymore. I think getting him out of the public school was the best thing for him at the time.
I don’t remember many details, but there are independent standardized tests that you can take on a voluntary basis. I’m in Georgia (AKA Public Education Can of Worms, Exhibit One*), and I know several homeschooling families here. A few months ago, a friend of mine had a couple of her kids take a standardized test just to make sure they were on track- it wasn’t required. (Not much seems to be here.) Of course, I can’t remember the name of it, I’m pretty sure it was attached more to an Institution of Higher Learning (Princeton, maybe?) than to a government entity. And yes, they did fine.
*for bonus fun, look up what’s been going on with Georgia education. The Atlanta Board of Education was a mess, loss of funding for some charter schools (almost including the one my kids attend), and TEACHERS cheating on standardized tests! At least the travesty that is our high school math curriculum is getting fixed… slowly… oh, and they did stop testing on Kindergarteners and first graders here… because they cost too much. You can’t make this stuff up, and if not for my charter school I’d be homeschooling too.
My older siblings, who were all homeschooled and have all been through university, took the ACT or SAT (there’s no Australian equivalent and the uni accepted the US tests) to get in.
Needless to say they all had exceptionally high scores: not a standard I could hope to match up to, even though I had essentially the same schooling, but then we’re different people…
Not necessarily.
I was a public school kid, but due to a lot of moving around in my youth I went to a *lot* of different schools in different districts – even with “standardized testing”, there is a *lot* of variation in how material is presented (even beyond “good/bad teacher”).
My brother and sister (who are 10 and 9 years younger than me) were both homeschooled for reasons unimportant here, and that brings me to the other Dirty Secret – the actual required curriculum (the “this is what your kid is supposed to learn”) is *tiny*. Jaw droppingly tiny. (I tried to find a link to it, but smartly they don’t make it too easy to find). Most of what you do in school is review, electives, and waiting for the slower kids to catch up. My sibs did half days for half a year, and easily covered everything required *plus* anything they wanted to do on the side. And had plenty of time for anything else. Hitting the required standards is far easier than you think. (I suspect the “standardized testing” makes it worse because instead of just letting you show that your kid can add, you have to hit these *specific* questions, which is worse than stupid.)
My daughter just entered the school system here, so I’ve had a lot of thinking into it. I’m fortunate enough to live in a system that has a very flexible set of programs (instead of a bunch of private schools, the public schools each sponsor special programs – this is the list just for K-6 kids – and you can put your kid in any program that will take them. Want them in a second language? Just pick one. Science-focus? Arts-focus? Sports-focus? IB? All there.
To my mind, this solves the big problem with schools – education is what kids put up with at school to get what they want. I was an honors student, but I was never a huge fan of any of those subjects. I went to school for band and the computer lab and the school paper. I put up with the rest of it to “pay” for the fun parts. Making it at least possible to tailor your school to your kid’s quirks goes a long way.
As for homeschooling, I believe it can totally work – for some kids and some parents. But not all kids are self-motivated enough to do the work and readings just ’cause. And as for the parents… remember when it was mentioned that most people don’t remember their junior high classes? Guess what – if you’re homeschooling you not only have to relearn it, you have to learn it well enough to *teach* it. And no classroom means no other kids to crib from. Be prepared to call up relatives, friends, anyone with needed skills (I tutored both my sibs through math, and I couldn’t believe how much of it I forgot in only ten years). On the plus side, you can get far cooler experiences that way (my sibs learned bio from my wife’s aunt, who’s a vet – straight from the horse’s mouth, as it were).
One last point before I get off the wire – I think there is a benefit in making kids (especially pre-high school) take a smattering of different courses. Letting kids specialize too early (or worse, letting their parents specialize them!) means they might never find out they had a knack or interest in something else. (Not to mention that everyone should have at least basic competencies in math and writing and reading. Enough to balance your checkbook, say.)
You seriously should learn math in the correct order. Math is probably the least flexible thing in the universe. Math is the hardest science in existence. There is good reasons for proscribed paths in math.
Say for example you wanted to learn multiplication before addition. You could memorize the tables for all of the digits in base 10, but you would have no idea what they mean. You could regurgitate 3*5=15, but you wouldn’t understand that the equation is a shortcut for 3+3+3+3+3=15. Learning addition before learning to count is just as ridiculous. In a well crafted math curriculum, every additional step builds on concepts already learned. Material from Algebra informs Geometry, which in turn informs Advanced Algebra, Trigonometry and Calculus. If you learn these disciplines in the correct order, you are able to see the elegance and internal logic of Math as a whole. If you skip around, you might as well just use a calculator.
Here in Aus the math curriculum involves far more than all that though.
We have statistics and probability which can really be taught anywhere.
Lots of time was spent on polynomials which to my eyes were just more algebra.
Algebra itself is taught as a big thing far too late.
Radians (and pi itself) are taught in the middle of things without context (it was years between when I knew there were 2pi radians in a circle and when I learned what a radian represented when doing trig).
I was taught complex numbers before vector math.
I remember doing Venn diagrams years before dealing with sets.
I went right through uni and worked as a programmer for years without ever being taught matrices (which I had to learn when reading a collision detection book).
I was taught that base 8 and 12 existed around age 10, but never even slightly used that knowledge until working in binary at uni (and I’d bet most people never use it ever).
We were taught factors existed long before we had any need to simplify equations.
We were taught something to do with perfect squares, I don’t know what use it ever served.
In primary school time was spent teaching us what hexagons/rhombuses/square-based pyramids were, I think the closest those ever came to mattering was over a decade later doing trig.
We were taught what arcs/sectors/segments were years before we knew what pi was.
Some parts of math need to be in the right order, but the curriculum is also filled with a lot of unnecessary fluff.
Also because each thing is taught at a different level, you either learn stuff before it’s useful, or after you’ve been taught another way around it.
Like algebra, I knew people in high school who didn’t understand why we were using letters instead of numbers. The problem (I believe) was that algebra was being taught as a subject in itself rather than just a way of treating numbers.
Like when I was little I played math games on PC, sometimes instead of saying “2+4=?” it would just ask “2+x=6, what is x?”. It was just another way of asking the same question, but it meant I was representing numbers in abstract ways whilst learning addition. By the time I was taught what the word algebra meant, I’d already been using it for years as a means to an end.
And vectors, to me would make the most sense to start touching on at the same time you’re first learning graphs, if I had’ve been taught x or y was a unit vector along a certain axis it would’ve been easier to learn at that point rather than years later.
I always learned best by going off on tangents as particular things piqued my interest, and if you imagine math subjects as a kind of tree diagram with multiple dependencies, I would’ve learned much faster rushing up branches as far as I could go before needing to backtrack to learn a different branch to keep progressing.
I believe any time maths is taught without context it’s hard to learn, and I think a level based approach tends to kill that context.
On learning things in the “wrong” order, this is one reason why I am a huge fan of, I don’t know if there’s a word for it, but “alternative” courses. Instead of taking a regular English class, you take some other class that incorporates English and it still counts as a credit. For example, in Michigan, they just recently got it pushed through to let industrial technology (shop/technical classes, mostly) classes count as a math credit. There’s so many people I know who that would be perfect for. They’re never going to take calculus, pure math just isn’t their thing. But working with their hands? Yeah, that’s something they would be great at!
Unfortunately, so many schools these days just don’t have the funds to pay for “unnecessary” extra classes like that. Or don’t think they’re important. It’s unfortunate, because it hurts all of the kids who don’t learn very well in “traditional” classes.
There is already a sort of standards enforcement for home schooling: the GED. No homeschooler is required to pass the GED, but even many of the simplest jobs these days require a high school education or a GED. For homeschooled students who want to go on to college, the SAT or ACT are the standards. In these cases the student is measured against the standard at the end of a particular process rather than incrementally. No one is required to take any of these standardized tests, unless they want to move into a job or college that requires them. This allows homeschooled kids and their parents to pick their poison. Once your own kids get older this may be an issue, because you’ll have to decide with them whether you want to prepare them for a particular test and how you want to do so.
the standard could just be a given curriculum that needs to be filled a some point, so they need to learn at least some basic things, with a broad limit as to when and no limit as to how. having a more choice based system, as some are, like A levels or the IB programme might also be an interesting path to take as you have quite a lot of leeway but you dont just get to do whatever the hell you please, which might help mitigate that whole issue.
But I bet even with that I would’ve been forced to study history and SOSE, I knew from before I set foot in those classes they were never going to be relevant to my interests. History was the only class I ever got kicked out of (which I did by being intentionally disruptive mind you) because it bored me. If I could’ve taken another maths class or two instead I would’ve loved it.
Apart from literacy and arithmetic, I think everything else needs to be optional. I wasted years of my life learning irrelevant things in high school when I could’ve been getting further ahead and not bothering everybody else.
I knew when I was little I wanted to be a programmer, most of the people I knew in high school had a pretty good idea what they wanted to as well (or at least knew what they didn’t want to be, why try to force trigonometry onto someone who has always hated maths, whose brain just isn’t built for maths, and knows she either wants to be a psychologist or a writer?).
We had people who wanted to be farmers and tradies who instead of being given the chance to learn those skills, was bullying those around them because it was more fun than listening to the teacher talk about colour changing chemical reactions.
Science tells us adults actually learn quicker than kids, which means if people find out late they need to study something in order to change career, they can do it then.
I think if people could specialise or move into careers at 14, many would come back later studying the one or two things they also needed, but doing it far quicker, cheaper, more maturely and better than when they left.
The only real requirements in life that everybody needs are literacy and arithmetic. Any curriculum beyond that is going to be detrimental to someone.
lol what. youre telling me history is useless? and geography? thats just basic stuff, man. if you come up to me and dont know about ww2 or the crusades or at least a basis behind what ww1 was about imma laugh in your face.
Shit you need to know, if you dont want to look like an idiot. its all well and good to focus on just the things you like, but LIFE ISNT LIKE THAT, YOU NEED TO DO SHIT YOU DONT LIKE. YOU NEED TO KNOW STUFF THAT YOU DONT WANT TO KNOW. i reserve the right to judge someone based on their ignorance of common events and i will not give up that right just for your entitlement of “i dont need to know history cuz i dont like it”
I don’t know about the whole country, but I’m pretty sure there are already a few states that have tests every few years that kids all have to take. If you really desperately want a test, just have ’em take the GED. Lord knows the one regret I have about school is not just taking that test and getting out of there when I could.
That said, kids are naturally curious and do not like feeling stupid. I’d think that the consequences of not being able to handle the the R’s (reading, writing, ‘rithmetic) these days painful enough for this to be essentially a non-issue. Not that history, the sciences, and even the arts aren’t good to know, but trying to force them down the throat of people who neither want nor need them will do no good anyhow.
I could see, I guess, giving a test at about 14 or maybe 16 yrs of age to test for the 3 R’s and MAYBE some rudimentary American History, but I’d be very hesitant about anything more than that.
Plus it would be hard to have a national homeschooling standard here in the US because the federal government doesn’t have the authority to mandate most educational matters. But I thought that I’ve heard of a few states that did have homeschooling standards too.
Here here!
I don’t have much else to add at the moment (though as someone who was homeschooled and favors unschooling I could come up with something) but I will share a link which is tangentially related:
Schooling is drastically overvalued in our society. Not education, schooling-just like you said. I don’t think progress can be made on a large scale unless we’re willing to slaughter the sacred cow and realize institutions don’t make people smart or successful, people do that for themselves. The right structures are a big help but nothing can substitute for an individual’s passion and focus.
I haven’t heard of unschooling before, and Wikipedia suggests it’s a rather broad term. Would I be understanding you correctly if I read it as “there are still sit-down lessons, but learning is offered through other activities as much as possible?”
In other words: Unschooling intrigues me. Could you write a short newsletter on how you view it? ;-)
(Finally: it’s “Hear, hear!”, as in “Hear him, hear him!” Or “hear her”, naturally. I wonder: if “here, here” ever displaces “hear, hear”, will people then start thinking it comes from “^^^This.”?)
Unschooling is where you just let kids run wild. They had a rather long article in the Dallas Observer about the movement. Kids learn such useful skills on their own or apprenticing themselves, such as dumpster diving, whoring and the like.
Apparently it works for some. I had a client who had been raised “unschooled.” He taught himself to read around twelve years of age by breaking into a neighbor’s house with a friend and reading the books in her library. Have to wonder how she always had various primers for reading left out in the middle of the library for them to find until they got better at it. He finally started as a freshman at Duke in his early 30s, having become the boyfriend of a graduate assistant there. Luckily for him he was tall and goodlooking.
It is an interesting movement.
No. No. Sigh.
My wife is a mentor to a large group of unschooling women, and at no time does anyone suggest “letting the kids run wild”. Unschooling has a lot of forms, but in general it’s a “learn by doing, no by reading a textbook”. Example: My son reads, and was never “taught” to read by traditional methods. He learned to read the same way he leaned to walk. He kept doing it until he was good at it. He’s 10.
If kids are whoring and stealing, it’s not the fault of their education style. It’s the fault of their idiot parents not teaching them right and wrong and common sense.
The people you’re talking about are a different problem.
“I think spanking kids is wrong. Actually, even shouting is mean and abusive. In fact, I don’t like to use force or coercion on my kids at all. I believe that if I love and respect them unconditionally, they will do the same.”
(Then the kid grows up to be a useless thuggish moron.)
These people have existed for a while now, but once the homeschool movement formed they sort of gravitated our way. Opponents of homeschooling can use them to score easy points against us, and there’s nothing that can be done about that. Still, don’t confuse “unschooling” with “unparenting”.
EDIT: To be clear, I’m not blaming this on the no-spanking parents. I’m just showing how some people take that so far as to stop parenting entirely.
Heh. This sounds like one of the lectures in Starship Troopers. Specifically the paragraph about punishing children.
I love how so many scifi classics make political points like that. These days people get voted off the island for politics too much of the time.
starship troopers (the book, not the movie) makes a crapton of good points. for serious.
Yeah, we’ve touched on that on here before.
The local, formal “unschooling” movement is different from the “homeschooling” movement locally, though I’ve had unschooled clients who were unschooled in Louisiana and in South Texas as well.
Another use of unschooling in Texas was to collect disability payments from the state. Kids were pulled out of school until they fell far enough behind that they tested as disabled and the parents started getting “Crazy money” (as one family at Church described it as I sat in the lobby with them while they were talking to another).
I had the interesting coincidence of trying to figure out just what they had been talking about or why it worked when there was a news special on the same topic.
What you do I would call homeschooling rather than unschooling.
Which is why I said what I said below at
So when you talk “unschooling” you mean teaching by doing, not by lecture.
Locally there is a huge difference between the homeschoolers and the unschoolers. I would not consider them to be similar in any sort of way, though I would agree that they are unparenting. Great term.
I would also note that some of them do not grow up to be thuggish at all.
The bottom line, from here, is that in parts of the country “unschooling” has been semantically contaminated.
“The bottom line, from here, is that in parts of the country “unschooling” has been semantically contaminated.”
I think you’re right. To be fair, I HATED the term to begin with, even before it became bent.
So many people have the notion that school=learning. So they see “unschooling” and to them it sounds like “unlearning”. Getting dumber. More ignorant. Terrible, terrible term. You have to sell them on the entire IDEA of freeform education before the term itself even makes sense to them.
Hm. Now that I think of it, “Freeform Education” would have been a much better term.
I’m pretty sure that nobody else here thinks that word means what you think it means.
As someone who was unschooled for several years (and homeschooled for my whole life) I can assure you, as Shamus did, that is absolutely not the correct meaning of the word. What my mother did over that time was to just let us do what we wanted when we were interested. So, for example, instead of working on some of the math textbooks we had I spent quite a bit over time working on a movie script. Looking back it was really, really, terrible, but do you know what? If I hadn’t taken the time off of doing more traditional schoolwork I doubt I’d as good of a writer as I am today.
My city has a large homeschooling community that uses all manner of teaching methods. I’ve never heard of anyone doing anything even close to what you described.
I was homeschooled via a more traditional curriculum up until the age of 14, then I started unschooling and went whole hog into exploring religion, particularly the history of Christianity and the proper methods of interpreting the Bible. Though I was raised in a conservative religious household, my mother was wise enough to realize that she couldn’t force me to adhere to a set of beliefs and that I was going to question and explore things one way or another, so I started breaking my conditioning within the very structures that indoctrinated me in the first place. There’s no way I would have had the time or the means to gain the insight and depth of knowledge that I did if I hadn’t delved into it then and I’m much better off for it.
I’m also the kind of learner that, even today, does not do well in a class room. I want to get my hands dirty. If something requires instruction to do it properly, I’ll keep a book in one hand while I’m working with the other. It’s far less important to learn specific things than it is to know how to learn what you need to know when you need to know it. Someone who can rapidly develop new skills is infinitely more valuable than someone with limited expertise, even if they only apply that flexibility to a single field.
Vocationally, that’s all well and good, but that all breaks down if you get into academia or any sort of abstract field. For instance, I cannot for the life of me figure out a way to “hands on” learning how monetary policy in one country can affect the investment rates of another country, or how a tail call can speed up a recursive function.
For me, that breaks down to creating theories and methods of my own as I take in the information and comparing them to real-world outcomes. As long as I have a standard I can measure my work against then I’ll keep adjusting until everything aligns with it. When possible, I test ideas through action so I don’t remain stuck on the level of theory.
Essentially it’s about finding the shortest distance between learning and application. It’s difficult to figure out how to work it with some things but the principle can almost always be put to work.
Unschooling, as you say, can be a lot of things. But I think it’s well summed up by the nice buzzwords many unschoolers use to cover their tracks with people who think like Stephen there: student-directed learning. The kids learn the things about which they are passionate or in which they have an interest. Often this leads to other “incidental” learning (think Shamus with his interest in programming – at some point he taught himself “advanced maths” just to keep learning new things in programming; the math wasn’t the goal but it was something he learned on the way to his goal.) They may use a variety of resources to pursue their interests and passions, from library books and other solo research, to asking for lessons from a person who excels in that field, to watching documentaries, engaging in hands-on practice, you name it.
One of the things that appeals to me most about unschooling is that it’s better placed to aid kids in developing useful life skills for adulthood like time management, goal setting, prioritizing, etc. Instead of an adult/teacher-person saying, “Here’s what you will be doing in my class this year:…” you have a student saying, “Here’s what I want to learn and how I’m going to go about doing it:…” That sounds a lot more like adulthood to me. I’m not saying that this ideal outcome is guaranteed, but it gets you a lot closer than teacher-directed learning.
And lest this misunderstanding pop up, I’ll try to head it off early: unschooling does NOT let parents off the hook for parenting and educating their children. If anything, it requires MORE of the parent to be successful because parents are educational facilitators who have to help students develop those skills to direct their own learning as well as being closely in tune with their children to see what learning is happening, what learning is desired, and how further learning can be worked in. It requires a subtle observational and guiding approach rather than an an authoritarian approach but parents are typically very, very involved in the process.
And I think, as a general rule, this approach is far healthier than public schools which, after a certain point, are basically daycare for teenagers. As an outsider looking in, it seems like the whole structure is built to keep people artificially young. It shouldn’t be possible to graduate without basic life skills, work experience or a certificate that makes it easier to procure work (not your highschool diploma-I’m thinking something a bit more specialized), and the ability to handle yourself as an autonomous adult. That many of my peers when I was 17-18 could barely read was mind boggling.
I’m with Shamus when he says that more flexibility in the system would go a long way toward remedying this. Leave traditional education alone because nobody can agree what to do with it and provide experimental learning environments people can opt into. As for one alternative modality we might consider, I present Sudbury Valley as an example:
I also think it would be extremely beneficial for us to decide what, exactly, schooling is supposed to be, because that appears to be at the center of a lot of the debate. Is it to enrich us as people through art and culture or to train us to enter the work force? I don’t think these two purposes are necessarily at odds but I don’t know that a system which is trying to cater to both simultaneously can really work. It would be better to disconnect the two functions and let people pursue them separately as per their needs and desires. I’d like to see something where you study math, arts, and the humanities through age 14 and then begin work on a practical skill that, while it may not be your passion, will enable you to earn above minimum wage when you’re out of school and thus provide you with more options and less pressure to jump straight into more school. Neither would be mandatory but they’d be available to anyone.
I also like the idea of turning schools into community centers as opposed to segregated learning environments. In other words I want to live in a world where learning is a common, shared hobby and not something people are forced to do for the first quarter of their lives. The authoritarian approach doesn’t work and there’s a lot we can do without giving up our standards altogether. The aim is learning, the method doesn’t matter as long as it’s safe and it works.
Schooling does have other non-education related benefits to society though they have no bearing on the child. For a start it frees up a significant portion of the labor force that would otherwise be engaged in educating their children. Given that this role has traditionally fallen on women, the availability of ‘free’ public education has allowed more women to enter the labor force by acting as a sort of child-minding service.
This assumes that children need adults to educate them.
Which is definitely not true for all children.
For example i dropped out of elementary school after grade 2 and after that i learned a wide range of knowledge without anyone teaching me it explicitly.
There is just so much information in the form of text, audio and video that you seldom need another human explaining stuff face to face.
Absolutely true but it appears to be necessary for most children, in the classic bell curve the majority require some form of directed assistance be it from their parents or teachers. A lot of the materials that you reference are also affected by socio-economic factors not everyone has easy access to the internet, not all counties invest in libraries to allow those who have not to access it and the wealth of knowledge in books.
“This assumes that children need adults to educate them.”
Ahahahaha. No, I think you missed his point. (EDIT: I mean the point of those who started the whole thing.) The point is not to free parents up by educating their kids, but to free parents up by occupying their kids’ time with something.
Child labor laws prevent kids from helping their parents at the textile mills or whatever. But getting the kids out of the workforce resulted in a bunch of kids running around, not knowing what to do and being a nuisance. Thus: public schools. That’s a cynical simplification, but more or less what happened.
Cynical, but just as truthful today as it was back then. This is the world we live in, you can’t just take public schools out of the equation and expect all families to deal with it well.
Despite being a roughly similar product of the same system you’ve described, I disagree on a whole lot of what you’re saying here, but I’ll save that for others to argue. Not my thing, for the moment.
However, since I missed the last post, I will say thanks for writing these. They’ve caused me to think about my own past, and any time I’m made to do that it’s generally a worthwhile thing. And these posts have been a superb illustration of your writing talent and why I come here every day.
Thanks.
My thought on Shamus homeschooling his own children was this: He’s married to a teacher, has the technology, skills and desire to access an entire world of educational material, and his personal experiences with public schooling means he’s been thinking of a better way to do this since he was a child himself.
Who the hell would want to challenge this guy? It’s like someone saying “Hey, I don’t care that you’re an experienced businessman with resources and passion. You can’t just make up your own rule on how businesses work.”
I know it’s a poor analogy, but I can’t imagine any decently-intelligent person looking at Shamus’s current setup and wanting to get in his way.
I know. However, as you mentioned: he’s a highly intelligent man and from his and her posts, I get the feeling his wife is as well in addition to her skills as a teacher. This means that they are thoroughly capable of teaching their children.
However, this is not true for everyone. And sure, they have the right to home-school their children. I would say though, that their children’s right to good education has a higher priority. This is the main point of friction for me when talking about home-schooling.
The real issue is “who should decide what a good education is?” The children’s parents, or you? (Or someone else, I’m not picking on you personally.)
Parents are responsible for their children and what they learn, whether they teach themselves or delegate to others (including public school).
I agree. However, I don’t want the children to suffer from the ‘mistakes’ their parents make, whether it is by sending them to a public school or by choosing to home-school them.
All children suffer from the mistakes their parents make. They also benefit from the non-mistakes their parents make. The problem with monoculture is that single mistakes affect everyone.
Expanding on what lazlo said, everybody suffers from SOMEBODY’s mistakes. The question is not whether we can eliminate suffering of children from adults’ mistake, but which solution has the least cost for the greatest benefit. If the mistakes of public education forced on those who would otherwise home/private school their children is more dangerous/harmful than allowing those same children to be home/private schooled, it’s still the wrong path to take, even if home/private schooling fails to eliminate all harm.
Lazlo and DungeonHamster: Quite so! How, exactly, does one shield children from their parents? One would need to abolish the concept of “parents” altogether. I seem to remember reading about that in “Brave New World”. Lovely book; Do read it won’t you?
When it comes to education, though, we as a group — society, whatever you want to call it — have a valid interest in what the young are taught and how effective that teaching is. Each generation contributes to society. Twenty-some years from now, kids in school today will be fixing your car’s brakes, piloting the planes you fly in, setting your broken leg, cooking your food, and coding the software that controls the traffic lights in your town. And in a mass, they’ll be voting on laws that you’ll be obliged to obey if they pass, or voting against laws that might make your life better/easier/safer.
I have a vested interest in kids’ education, even though I have no kids of my own. When the company I worked for “adopted” a couple of elementary schools in the area, I went over and volunteered to help in various ways, from doing in-class demonstrations on how computers work to sewing Glinda the Good Witch’s dress for a third grade play. Parents and teachers who chatted me up always asked how old my kids were, and were astonished to hear I had none. The idea that anyone without kids would care about education, much less be willing to volunteer at a school, was boggling to them. To me, it’s perfectly logical.
I don’t think anyone’s arguing that bright, motivated kids will find ways to learn, or that bright, motivated parents like Shamus would do an excellent job homeschooling their kids. But if some parent thinks they can teach their kids just fine, and turns out to be wrong, that’s everyone’s problem, not just theirs. And it’s not in the best interests of society in general to let those kids — or millions of those kids — just turn out however they turn out, and then try to figure out how to integrate them into adult society.
I’m absolutely with Shamus that there need to be more options for kids who aren’t in with the bulk of the bell curve. I have a few teeth marks left from where public school chewed on me, and I certainly have complaints about how my education was managed. But I don’t think throwing it open to absolutely any parent who wants to experiment with their kids, and then twelve years later saying, “Oh, well, your problem,” if that kid hits eighteen and can’t function as a competent adult.
Angie
+1
Thank you for saying this. I thought I was going to explode reading the comments above.
You have some solid thoughts in what you say. The problem is that public schools do the exact same thing. Surely you’re aware of the fact that at least some kids graduate from public high schools unable to read or write. It doesn’t take homeschooling to subvert the education of a student. Public schools do it, too. Here in Texas one school district was shut down this year because for the past five years a large majority of their students were unable to pass basic competency standardized tests. Another school district, right in my region, is under state supervision because they’re on their fourth year of the same thing. So for at least 4 years now a bunch of kids have attained the age of 18 and had public schools say, “Oh well, not my problem anymore.” despite their lack of literacy or basic arithmetic.
I am incapable of understanding this. How the HECK do you go through 12+ years of school and not learn how to read? What are you supposed to do with someone who is either too stupid or not motivated enough to learn that? (how can you not want to know how to read?) Then, of course, there’s falling standards, which make it to where people who can’t read well CAN pass.
There are a lot of ways you can make it through school unable to read. The most common one around here is simply be a really, really good athlete. The pressure from administration to promote students with athletic abilities is intense because of “no pass, no play” rules. So teachers are “encouraged” by principals (who, in turn were “encouraged” by coaches) to pass students who play pivotal roles on sports teams, regardless of whether the kid earned a passing grade or not. Alternately you can become so much of a classroom management problem that teachers will pass you just to get rid of you. Or you can slip by under the radar of “we won’t detain a kid more than X number of years because it sets them up for social isolation and further problems.” It’s a funny world.
“how can you not want to know how to read?”
I imagine that after a certain point, the prospect of asking someone else to teach you such a basic skill becomes embarrassing enough to offset any desire to actually have that knowledge.
These kids probably find ways of faking not being able to read (such as pretending to not do work because they just don’t care, so nobody catches on that they couldn’t do it if they wanted to). They don’t want anyone to know they can’t read, which means they can’t ask for help, which means they can’t learn.
Well, there’s also the case of genuine reading disorders. My Dad got far into college before anyone suspected he had severe dyslexia. He understood the material, but was failing because he couldn’t read the tests fast enough. He still reads painfully slowly, but he’s quite successful despite it. Being able to read, do basic math, understand history, and appreciate art are useful, but they aren’t everything.
Dyslexia I get, but just not having the motivation… not so much.
I support public school in part because my folks could not afford to home school me: they had to work if I was ever going to go to college and they were ever going to retire and their jobs could not be done from home. I needed college level instruction for the job that I wanted and they would not take on debt (they both grew up poor but proud and debt is antithetical to their worldview). Public school let my parents work while giving me what I needed to eventually live my dreams. Could I have done better in some less structured environment? Maybe. Surely in some subjects, but not in all.
Full disclosure: I was blessed with some truly outstanding (though woefully underpaid) teachers. I realize that this is far from universal.
EDIT:
Details on a couple of my statements are provided for those who might be interested.
My mom’s family lived in half of a converted boxcar on a pear orchard where my mom and her sister avoided child labor laws to help her family get by. My dad’s folks moved around a lot, stopping wherever my grandfather could find mechanic work after the ranch went under. My dad put himself through college working as a gas station attendant so that his folks could provide for his four younger brothers.
My folks worked hard, as did theirs, but they were also lucky. When things are that tight, it only takes one major illness or accident to derail a lifetime. This is one reason (among many) why generational poverty is so hard to shake. This is also why it’s so hard to hear people talk about cutting services to those that need them in the hope that it will “encourage them to better themselves” or some such nonsense.
When I was five I realized that I wanted to be a scientist. Modern science is nearly impossible without college level instruction. Even with both parents working, we could only barely afford college, to the point where I worked in highschool and held a variety of jobs during college sessions and held construction work during the summer. I spent the last dollar of my money the day before graduation, but we had no debt.
+1 Thank you for saying this. I was starting to be scared I was all alone in the world :-P
Thank you.
Unfortunately, you’re the exception to the rule (in caring about the education of other peoples’ kids) — well, you and those below who have agreed.
But there is of course the question: is fitting with the current social status quo truly what these kids will need when they grow up? Or is it better that society change to fit the needs of the new adults — whatever their upbringing and education? Public schooling will always be one step behind social change, yet the very kids in who current society is being instilled will be a part of a different society by the time they finish.
So while I applaud you for caring about the kids — nobody can complain about there being one more good role model around! Seriously, good work! — I can’t agree with the reasons behind it.
Well here’s the thing: your parents don’t need to be especially knowledgeable to educate you, they just need to be able to provide you with the resources you need to learn what you want to know. For instance, in the unschooling model, having a tutor or taking college classes is well within acceptable bounds. The object is to go the most efficient and beneficial route to the desired end, and if a kid isn’t in highschool that frees him/her up to jump into classes at the local community college if they want to. There are also countless resources available for little money, sometimes for free, so the economic argument doesn’t hold a lot of sway except in the poorest areas where there might not be a library, or if there is it doesn’t have internet access. I feel for those kids-their schools are usually terrible and they don’t have any other options. They have to claw their way out if they want to get somewhere in life.
“Who the hell would want to challenge this guy?”
Simply, various agencies of both state and federal government. I was home-educated from middle school until my graduation in 2006. During this time, Ohio required my mother to submit a huge packet of papers to the state each year, proving that my sister and I were, in fact, learning. Furthermore, the state government authorized police officers to arrest children who were out of school during school hours on sight and take them down to the station until their parents picked them up (truancy laws). My friends and I had to carry papers issued by the state giving us permission to walk out in public, and on several occasions a friend of mine was accosted by officers who manhandled him until he finally managed to shout out that he “had papers.”
Cynically, on some level it comes down to power. Bureaucrats in Washington or state capitals have utter dominance over public-schooled students, and each student that escapes their grasp seems to rankle them to no end. It sounds vulgar, but it’s the truth that I lived first-hand for many of my formative years.
Part one: I start from the position that people learn best when they are learning things they are interested in. Add to that the idea that for someone to be interested in something they have to know that it exists and, I suggest, in most cases be given a bit of a start. In a home schooling situation the number of “leaders” (not to say “teachers” – see later) is likely to be more limited than in a school environment.
Part two: Some people learn best when they are actively taught and teaching is a skill, and one that not every parent is going to possess. In itself, allowing that teaching is a skill, then it is a skill that can be improved with practice and study. If we allow that, then I suggest that professional teachers teaching will be higher skilled and, AOTBE, will achieve better learning.
Lastly: Targets in any shape or form, are the bane of our society. Certainly over here in the UK and I think probably in the US. And I mean targets as in scholastic test results targets, or waiting list targets for hospitals or sales targets for salesforce.
Targets will always be abused but without them how do you know whether all that money being spent is being spent well? After all a charismatic person can be terribly popular with both pupils and parents but how do we know if they’re actually imparting much learning?
I agree Labour went mad with metrics though, Private Eye was filled with hilarious and tragic examples of tricks to ‘achieve’ the target that did nothing for pupil or patient.
Except, in practice, professional teachers protected by tenure and unions have little incentive to strive to improve their teaching. Not that their are no good teachers in public schools, but that they have less reason to do a good job than homeschooling parents taking care of their own kids. Can teaching be improved by practice? Yes. Do enough people improve by teaching in the public school system to achieve better results on the whole? I have seen no data to support such an assertion.
That’s why you need to pay your teachers decent money and have teaching standards. People TALK about having reviews and such for teachers, but I can tell you that at least some slip through the cracks.
In general, though, that is definitely the biggest problem with home-schooling. Even if you ARE an intelligent person, that doesn’t mean you’re a good teacher, and what you teach will certainly be biased by your own preferences. That’s why any kids I have will probably go to school (Maybe even public), and I’ll just have an intelligent environment at home.
That last part is important. The environment at home has almost as much to do with school as the environment at school. If your parents don’t care, and don’t discuss anything of importance (i.e. schoolwork, interests), then you just aren’t going to learn.
To be honest, I’m a tad bit disappointed by this post. That is, it’s mostly about why homeschooling should be allowed, and why the public schooling system doesn’t work for some people. The thing is, you already had me convinced of this throughout the entire blography.
[little personal story here, skip ahead if you want to]
In fact, I’ve had pretty much the same experience. In my entire childhood, I was told about the importance of having a diploma. When I finally flunked out of college, I felt incredibly bad about it. Until about a few years later, I landed a job at a cutting edge web company. And they didn’t care about my diplomas, but how well I did on a few puzzles that they laid out for me during the job interview.
Then again, maybe I’m just lucky that I’m working in a field that’s been rapidly changing for the past decade and will probably continue to do so for a while longer, and keeping up with it is just simple, plain fun.
[end of personal rant]
So to get back to my first sentence…
I was hoping that in this post you would tell about How you applied homeschooling to your kids (with a couple of examples), how they react to it, and how you ‘measure’ if you’re doing a good job at it.
I know this is supposed to be the last part of the autoblography, but since this does seem to be something you feel so strongly about, I was hoping you would like to elaborate on this nonetheless.
I was wondering about this, too. I’m interested in homeschooling my children, even if right now the finances are not there. But what resources do you use, Shamus? Where should an interested parent go to learn more?
I talk about this a lot on my own site (when I have time) as well as on the various groups/group sites I run. We both feel that at this point in our children’s lives it is better to keep their particular schooling out of the public forum (our oldest is nearly 14, youngest just turned 10).
That said, we don’t use curriculum, the internet is a key resource in our household as is the library and museums or wherever we are at the moment. Most of the kids learning comes from reading and conversation and just plain life experience. They are actively engaged with us throughout the day and even this comment has been interrupted by various conversations/interactions with kids. We are both with them 24/7 and are actively involved in their lives so we know them well and can strew things around (place things that will stimulate interest in places where they will find and use them whether on a table near where they like to sit or on their computer or whatever) and the dry erase board in the office is often used to demonstrate/explain things.
Financially we are not well off but we have no intention of letting that stop us from giving our children the best opportunities we can which in our case means being with them and being involved in their lives, knowing them and helping them to discover who they are and what they love and are passionate about. We have never bought formal curriculum (why would we when we are still paying off my college loans). We have always used cheap or free resources and haven’t bought “school stuff” in years.
I have examples on my site (– search for unschooling as well as many discussions going over at.) There are tons of resources online that are free– just a google search away. We are Christian so we come at these things from a Christian perspective and therefore my own resources are all from a Christian perspective (not Bible thumping just “love and respect one another” which is our one and only household rule.) There are plenty of secular homeschooling resources out there as well. If you are interested in homeschooling but not unschooling then look into Charlotte Mason which is the best free/cheap homeschooling style out there.
If by “finances are not there” you mean “both parents must work full time and can’t spend the time to teach the children” then that is a hard situation. I know a number of people who switched to single-income and moved to a smaller house just so one (usually Mom) could stay home and take care of the kids. That’s a big sacrifice.
If, however, you mean “we can’t afford the fancy ‘school stuff’ that everyone really needs to get a good education” then read Heather’s blog. Your time and good will is sufficient to teach your children everything they will ever learn. The paraphernalia is completely beside the point.
Heather, thank you for the link and ideas! I have a 4-year old daughter in Pre-K now and 14-month old boy. Even if we don’t home-school, I’d like research the options and perhaps incorporate some of the homeschoolin or unschooling into our children’s lives.
Paul, we’re currently a 2-income family barely floating along, about to drop to 1 as my wife goes back to school to learn something useful. It’ll be a tough couple of years, but rewarding when done.
I don’t recommend the “go back to school” route unless you are 100% sure that the income will far outweigh the expense. (Still paying my college loan here and it is not likely we will ever have the funds to pay it off completely.) We both work from home, me occasionally getting paid for my art and web design/hosting stuff, Shamus occasionally bringing in income from his writing and programming. It is not a fancy opulent lifestyle by any means but the time spent together daily makes it so worth it. Shamus and I wouldn’t trade it for the world.
What about going back to school because it is what you want to do? Sometimes it is not as straight-forward as “I will make more money!” I went back to school because I wanted a career change. My wife is back in school because she wants a deeper understanding of her field. My own path doesn’t necessarily mean a pay increase, but a possible happiness increase. My wife’s path may well result in a pay increase, but if it doesn’t, she will be better at a career she loves and make her more able to switch to a new position somewhere else if her current one gets to be a PITA.
Sure. I think implicit in what she was saying was “If it won’t pay for itself, make sure you can afford it.” Which sounds obvious, but sadly isn’t for a lot of kids.
When you have children the “make sure you can afford it” bit is a lot harder. I don’t yet have children, and for my wife and I, our loan debt is and will continue to be significant. But even with our current meager earnings we are managing to make payments and slow progress. If we had kids things would be a lot tighter, not to mention having little to no time to even take classes, should we have wanted to go that route.
The rule over here in England is that parents are required to make sure their child gets a suitable full time education (however delivered). If it appears they’re not the local education authority can require a parent to prove that they are and then can only step in if they aren’t.
It would probably take all day to go through the differences in our education systems but briefly our one is geared towards specific qualifications validated by external exam boards rather than a single high school diploma.
My main concern about home education is that, whilst home schooled children can do the exams (most do), if they opt out they could find themselves limited in adult life. Even if they were the next Shakespeare, without the line in the CV saying – GCSE “English” – then they wouldn’t reach the interview stage where they could prove it.
This is a very good point, while it may be distasteful that society has come to regard tests and results as the measure of a person, they do. Yes if a person gets to the interview stage of a job application their insight and intelligence could come across and they could land the job but how likely are they to get there without some externally validated benchmark?
Couldn’t they just take that exam the day in life they find they need it then?
Maybe but I’d have a hard time even passing my Leaving Cert in any subject if I needed it in a few weeks time let alone getting equivalent marks to what I achieved when I was 18. A lot of these standardised exams include stuff that you’ll never use again (hello inter-war Irish politics) so the odds of being in a place where you could take the exam as the need came up is very low.
mmm….well the day you need them might be iffy as the final exams are usually in May-June with the results issued in August; – but there is nothing to prevent you doing them later in life.
On a personal note, a couple of years ago when we were looking for our youngest the local secondary school (11-16yr) was bloody awful. We were lucky enough that he passed the 11+ and got a place at a Grammar (selective)School but home education was an option.
Had we taught him at home we probably wouldn’t have stuck to the national curriculum but would have looked for him to take the usual exams.
Wait, where is the 11+ still used? I thought it, and grammar schools, got wiped ages ago. I certainly never did one, but then Wales has a slightly different education system to England. I had to learn Welsh, for one.
Apparently it still hangs around as a sort of local thing for entry into grammar schools rather than being a nationally mandated exam as it was
Most were, but each LEA is independent – Kent has kept the old Grammar/Secondary Modern system.
Where we are most schools are comprehensive. I think there are 8 grammar schools (all single sex) in the entire county plus a two Catholic schools and two Comprehensives that offer a few selective places.
Edit: Nevermind, wrong page.
This is a fantastic idea, as long as public schools must achieve the same standard that non-state institutions must meet. One could easily imagine a double standard springing up.
I like it though. Make a standard, get there however you want. Simple and fair.
I’m still quite a few years away from a teenage child, but I’ve already thought a lot about this topic and have come to some of the same conclusions as yourself.
I completely follow your logic Shamus, and I think I agree on all your points. However I’m still not entirely sold on homeschooling end-to-end – The fact of the matter is that as parents we really don’t know everything and whilst I’m sure we could pick up a bunch of books and go through them with our children, will we make a satisfactory effort?
I feel like its a serious undertaking that can only be done at a decent level by the lucky few who are stay-at-home parents.
I wonder if you’ve considered any schools that employ the Montessori methodology? I’ve been thinking about whether its a worthy path of education.
I went to a Montessori school (a *genuine* Montessori school, not just a normal school that is awkwardly wearing some of the same clothes), and I have to say that of the critiques Shamus made of education above, it adequately addressed a lot of them:
Giving people a broader classroom social setting than people exactly their own age? Check. (3-year classrooms)
Allowing different individuals to work at their own pace, and receive more (or less) help as needed? Check.
Allowing people to spend more or less time on areas that particularly interest or disinterest them? Check. (Though everybody had to do at least SOME math, writing, etc.)
Deemphasis on busywork, testing, and lectures, in favor of learning by actually doing things? Check.
I don’t know that Shamus would’ve been 100% happy at my school (though had he been attending it contemporaneously with me, he would have had the opportunity to start learning some simple programming and such as early as fourth grade…) – but I’m pretty sure he would have had a much better experience than at the schools he actually did attend.
On a side note, I should mention that my Montessori experience only went through 6th grade, at which point I began attending the region’s “best” high school in terms of test scores. I had some outstanding peers and some very good teachers there, but in terms of educational quality, it was a big step backwards, just because of the systems involved, as Shamus talks about above.
That sounds pretty good to me. I’m very in favour of giving kids more freedom to work at their own pace and to seek out more help/information from an expert when they’re ready. I wish I’d gone to a school like you describe.
I think the next logical step is not just parents teaching their children – how about multiple families (probably where the parents are friends with each other) banding together so they can mutually fill out the weak spots of the other? I think I could very well teach a kid about how physics or chemistry works, but I would make a very bad teacher at history or arts, for example.
Also, you don’t have to know everything, you don’t even have to pretend to towards the child. If you say “Oh, I am not sure, let’s go find out” and then you go to a library, with the child, and together you look it up in a book (or on the internet) – that would also be a very valuable lesson, namely how to actively seek knowledge you don’t have yet.
I know, people don’t change their opinion due to reasoning (because you have to admit you were wrong), but there you go:
You have successfully convinced me that homeschooling isn’t as bad as I thought it would be.
I blame that I learned a ton during school (and university!) due to generally good teachers, that my father is actually a great teacher himself, and that both my parents always encouraged me to learn stuff for thinking homeschooling was the devil’s work.
Homeschooling can make sense, if you have the time and resources to do it. I would hope for one thing though: The parent should have at least some basic understanding of didactics. Your story essentially shows one thing: Clever people usually make it.
I think a lot of people are missing the point but talking about how ill-suited many parents would be towards teaching or about how parents don’t know everything
The point is that genuine, lasting education is primary self-directed and therefore would not primarily come from the parents. You’re still stuck in the conception of education as somebody sitting a child down and actively imposing knowledge, when genuine lasting education requires very little of that at all.
I was going to say, “So long as the child can be taught to read…” but then realized that even this is largely unnecessary. The sheer utility of literacy in today’s world would motivate any child to learn to read on their own in the same way that they are motivated to learn the far more demanding skill of spoken language to begin with.
I think you’re investing far too much maturity in small children, how many children understand rewards delivered at the end of the day let alone diffuse benefits accrued when you enter the labor market decades hence? Literacy in particular is extremely difficult to just ‘pick up’
Counterpoint: My two year old daughter understands “yes, but you must wait” as well as “If (X) then (Y)”. She also responds immediately to “stop crying”. I just “picked up” literacy because I wanted to read Calvin and Hobbes, and she is doing the same.
Conclusion: Children are real people. Treat them as such.
I always talk to children like they are adults. My sister says this is why I am good with kids, I treat them like real people, not leg-biters.
This reminds me of Ender’s Shadow, actually. I know it’s fiction, and Bean is supposed to be crazy smart, but how he learned to read isn’t all that different from most smart children. You can “pick it up”, similarly to how you learn to talk. It’s just more complicated because it’s harder to connect the word with the letters than to connect the word with the sound – which is why having parents read to their children (WITH THEM ABLE TO SEE THE BOOK) is a really good way to teach them to read themselves.
to be fair, I learned to read before I could talk. From the stories my mother read to me, I had learned the meaning of quite a few words and I could read and understand easy sentences (obviously not talking Dickens or Verne stuff her, but “See Spot Run” :-P) before I was 2 years old, while I started talking at 3 years old.
The thing is, some kids do need it. Maybe for you, the best kind of education is self-directed. I’m like that too, actually. But not everyone is. Some kids really do respond best when they read a few pages in a book, get a lecture, then do a set of exercises to put what they read/heard into practice.
And no, not all kids are self-motivated to learn to read even now. You’d think so, but there are plenty of young people (and older as well) who see reading as an awful chore, who never learned to do it well enough to be able to do it easily, much less take any pleasure in it, and who do it as little as they can get away with. This is one area where I think it’s appropriate to have hard, non-negotiable standards, whatever system of schooling is being used, to prod the ones who won’t learn it on their own.
Angie
“This is one area where I think it's appropriate to have hard, non-negotiable standards, whatever system of schooling is being used, to prod the ones who won't learn it on their own.”
But will having hard, non-negotiable standards actually make a difference? How will this standard help kids who don’t want to learn to read, other than to give them one more way to know they’ve fail?
Of course people are going to think of reading as a chore, when it’s taught in school.
Modern schooling can turn ANYTHING into a horrible chore.
This. I despised reading books in or for school, because the choice was almost exclusively bad, with only very few exceptions (Faust, for example, was really nice; and Der Untertan was most entertaining while also teaching a lot about the time when it was written). But when on my own, I devour written text and books if the subject is of interest and the text of quality.
That said, when I learnt reading in first grade, we were taught some special “writing font” that could only be found in our textbooks at school and very few books specifically made as an exercise in this manner. I taught myself reading normal printed Latin letters in parallel while the rest of the class was just halfway through the alphabet of that other abomination. I learnt later that politics changed stance on whether to learn some special writing font or normal printed font initially every couple of years.
This continued through all my school time. If the lessons went boring, or the subject just seemed totally useless, I usually just skipped ahead in our text books and looked for the more interesting stuff. How much time was wasted where I could have learnt even more interesting things…
Heh. Yes. Same here. Back when I was in first grade, we were ABSOLUTELY FORBIDDEN ON PAIN OF…well, pain of something to even attempt to write in cursive. I guess they thought we weren’t ready for it yet? I went and found a little booklet or something on how to form letters and basically taught myself–and, yes, occasionally got in trouble for forgetting and using it for assignments in school.
And then in second grade, they finally started “teaching” us cursive, and I abandoned it completely (except when they made us use it) because I started to hate it so much.
(Third grade, there was an absolutely wonderful senior volunteer who taught us all penmanship; he would actually go around and look at people’s work and gently correct us on an individual basis when we needed it. I’m pretty sure he single-handedly (pun sort of intended) got me back into it.) (I was then homeschooled from the middle of fourth grade on.)
Heh. The infamous “you’ll use this for the rest of your life” line from third grade. I think what happened is it got replaced by typing, but.. I don’t know. I don’t understand how cursive could POSSIBLY have been the standard because it’s so hard to read. Not to mention write when you don’t see it often (There are capital letters I don’t remember. There’s this one statement you have to write in cursive for some odd reason on the SAT and I didn’t know some of them. And I got a 2320. :/)
The weirdest thing, though? I do use it every day. We’ve actually gone back to handwritten notes about certain things at work because it’s actually easier to keep track of than by spreadsheet or email. I took so many notes in college I was getting hand spasms. And there’s nothing better for keeping track of information in games than keeping an old half-used school notebook by the keyboard. (I’m 25, by the way.)
But those capital Qs will get me every time. Why does it look like the number 2, anyway?
What?! What crazy style would write a Q to look like a 2?
It comes from the loop not being complete. Start at the middle left, draw the loop clockwise, then before reaching the start point, reverse direction and draw the tail. Examples:
If you think that’s bad, take a look at cursive capital G. It takes some serious typographical research to make sense of that one!
When I was in first grade, we had to learn a similar variant, yet some things, like the capital G, where completely different. In other words, to make matters worse, there are multiple competing versions of that thing out there. *shudder*
Do you use cursive or print? Or pursive, like it seems 90% of the people who actually write notes naturally do?
The thing is, my brother is one of those people who find reading to be a horrible chore and won’t do it if he doesn’t have to. It’s entirely because of the way it was taught to him in elementary school. (i.e.: poorly)
Sure, he can read, but I don’t think that’s good enough.
I’d like to point out the three people I know that don’t like reading all went to school. Two of them are not very academic, and didn’t respond well to reading Shakespeare, in original, in 9th grade. (I wouldn’t either. I could hardly stand Shakespeare in modern English in 10th grade). The other one is highly dyslexic.
I love to read. My best friend loves to read. We were both homeschooled for a good portion of our lives. We’re also huge nerds…
So, at my university, I’m an undergraduate teaching assistant and take a pedagogy class. The whole “school is not learning” statement gets put out alot — albeit in more subtle forms. There is a ton of research about how people, especially children, learn complex subjects and how we can tailor the teaching process and environment to reach more students more effectively. The catch is that the large majority of teachers either don’t look at this research or just don’t care. Some of the studies we read were from the 70’s and they sounded like good ideas that would require a radical restructuring of a class — 40 years later.
One of the big advantages of homeschooling is that you’ll be using formative assessment — whether or not you know it by that term. Formative assessment is the idea that a teacher should basically keep tabs on where their student is in terms of understanding, rather than finding out at the end of a chapter when the test grade gets computed. The time required to actually apply formative assessment to a full lecture hall of students is just impractical. The university I attend makes nods at it occasionally, but a professor can’t know where 200 different students are with relation to his teaching goals, he can get a feel for a general trend.
tl;dr Teaching is hard, especially to large groups. Homeschooling eliminates the biggest roadblock to advancements in teaching techniques and some of those techniques are intuitive and just naturally happen when you don’t have a large de-humanized mass of students in front of you.
Isn’t that what TAs are for? Just saying. Also why smaller class sizes are so important.
If they want us to bridge the gap, then the physics department needs to give us more time with the students and give them less graded work for that time slot. Right now, I spend an hour and a half a week with about 40 or 50 students while they rush through assignments that take them most of that time.
Other departments handle things differently. The math dept recitations actually consist of a lecture recap from the TA and then Q&A/practice work. That system isn’t widespread at all from what I hear, but it works quite well. Student who are too intimidated to stop a lecture hall of 200 for a question are more likely to stop a second lecture on the same topic when it’s being given to a classroom of 20 or 30. We actually pitched the idea to the physics department as something they should move their recitation toward or pay us to do optional sessions like that for the students who are interested.
I suppose I should thank you for solidifying how I feel about homeschooling. I’ve felt for a long time that public schools were a broken system but at the same time I’ve been of the impression that homeschooling was something reserved for religious fundamentalists or worse. (I’m not sure how to word that without it sounding derisive of religious folks, so apologies in advance)
Now I’m more of the opinion I’d probably homeschool any children I have myself, the major sticking point being I don’t feel as though I have the credentials to do it properly, which is a bit of a sticking point.
I’ve been given the impression that private schools aren’t much better in terms of methodology than public ones and they’re expensive as hell in addition.
This leaves me wondering what the solution is.
I’d file it under “What about parents who want to keep their kids home to indoctrinate them with strange beliefs?”
Part of the problem is, I think, relying too much on credentials granted by the same schools that we agree don’t necessarily actually teach very well. That said, if you honestly believe that you cannot competently teach certain subjects, there are many home school groups where certain parents will teach certain subjects, and there are also deals you can work out with local schools to take certain classes in school and be home schooled for the rest (for instance, when I was in 5th there was a kid in my neighborhood who only showed at regular school for sciences and maths).
While I agree in principle, I still see a lot of benefit to judging people by schools. Imagine the number of teenagers playing Battlefield 3 right now who see some problem with the game and say “I want to become a game designer and fix that!” Many of them have no idea what that actually involves.
I work at in the IT department of a large company. We specifically recruit from a number of schools in the local area. We even have a little say in the curiculum that gets taught at some of these schools. We know that if Joe Schmoe graduates with Degree X from University Y that he must have SOME familiarity with Technology Z.
The HR department does not just say “This guy when to school and got a 4.0 GPA”. They say “This guy went to a school with a very challenging curiculum which directly involves what we do here as a company AND he did very well.”
The system is not perfect. The system should allow for people who are not good at “school” but are good at the work involved at the job to be able to get a job. But there is no perfect system for evaluating someone without some machine that can see into the future.
I’ve been involved with a number of interviews. Some people are able to answer the questions, they have great references, they are well spoken, but they just can’t handle our environment for one reason or another. The hiring process as it stands now is very expensive.
I do believe the schooling system needs work. I believe that once you have reached college age, you should have a basic idea of what you want to do and don’t need to be required to take an art class if you want to be a gym teacher. But I also see the value from the business side of things to knowing what a person has some experience with.
Reading this set of posts was particularly powerful for me, as I am currently in school to become a teacher: you describe alot of the problems the profession itself sees with the educational system as currently constituted.
Let me touch on a few points:
-While it perhaps true that Shamus was “unsuited” to school, the practices he describes as not working for him are widely known as bad ones within the pedagogical literature, and don’t work for most children. Most kids, I guess, were/are willing to play along a little.
-People who are training teachers are, at present, taking a newspaper and hitting future teachers over the head and saying “don’t do that!” The fact that retention of pure lecture based lessons is abysmally known is well established now.
-I almost hesitate to go into the money issue, but it does not mentioning. Do you know what the most direct and large predictor of a school’s effectiveness, as measured by any standard you care to name, is? The amount of money available per students. In the US, schools are largely funded by property taxes from the local community, which means affluent communities are likely to have good schools with nice libraries, computers, and the best teachers who inspire students, or at the leats prevent them falling by the wayside.
-While I don’t per se “support” homeschooling, I think its fine. If you think that’s what you want to do, more power to you. In the US, at least, homeschooling is a perfectly legal and viable alternative to sending your kid to public school, and any parent who makes that choice is likely to both have the time and inclination to make home schooling work for their child.
-As a matter of *public policy* we obviously can’t say “home schooling for everyone!” as that would people (and lets be honest, it would mostly be women) staying home and teaching the kids. There are all sorts of alternatives to public school which are also fine in my book, but they tend to cost money, or suffer from limited availability. As such, I think any discussion on education needs to focus improving public education, both in terms of its results and its experience.
I’ve got to take issue with this one part:
Posit, and I have not reason to doubt it, that there is a correlation between the amount of money spent on students and school effectiveness. Obviously, more money can be spent on teachers and facilities, which in turn leads to better education. I think it’s hard to argue that this does occur, however there is an alternate factor that is almost certainly at work, and it is difficult to dissociate the two effects. The money that schools have, as you mention, is provided in a large part by property taxes. That is influenced by the affluence of the area, which in turn is correlated to the drive and intelligence of the parents of the students. There is of course also the factor of the benefits of an affluent home life on a student’s ability to excel. These are difficult factors to separate, but important to acknowledge the existence of.
I would like to suggest that, at least beyond a certain threshold, education spending might very well little to no effect on actual learning. Take, for instance, this:
In sum, South Dakota (yes, I live there) ranks 44th in the country in terms of spending, and 7th in terms of performance by any available metric.
Now, I will be the first to concede that one state is not sufficient all by itself to demonstrate the ineffectual way in which our money is spent, and it’s been long enough since I did any research on comparing the states as a whole that beyond the fact that the only available results for cost/benefit analysis were in terms of test scores rather than any sort of future success and there didn’t seem to be a very strong correlation in any case, I can’t remember much. But at the very least, we should not simply assume that throwing money at the problem automatically makes it better.
Hello, fellow South Dakotan! If you don’t mind my asking, where at?
’round Sioux Falls area at the moment. Only been here a couple years, though.
Watertown, here. Don’t see too many people from around here on the web (at least, the places I frequent).
In the 2007-2008 fiscal year, the Los Angeles Unified School District spent $29,790 per student, while the average cost per student throughout the country was $10,297.
Yet somehow, our SAT test scores are still well below average, even for the rest of our state.
As lazlo says, there are other factors that contribute to low scores here such as a very high percentage of low income families (53% make below $30,000) and fewer parents with a higher education (33% have no High School diploma).
There’s also the fact that Los Angeles is more expensive than many other parts of the nation; just living there and buying things there takes more money to do, because it’s Los Angeles.
I would say it helps, to an extent. There’s a point at which more money doesn’t really help. (My school irritates me. We have probably the biggest athletic venue in the STATE, and they can’t pay for a weekly bus for the academic team. Or even for the dang robotics team who made it to the championship the first year. Messed up priorities… ANYWAY)
IMO, the one biggest thing about public education is paying teachers. Teachers are paid HORRIBLY a lot of the time, and thus you don’t get good teachers (because they’re better off doing something else). If you pay them more and have higher standards of teaching, then you fire the bad ones and get better ones. Better teachers = better schooling.
One thing you DON’T pay for is a computer lab with TOUCH SCREENS. WTH? Such a waste…
“One thing you DON'T pay for is a computer lab with TOUCH SCREENS.”
From what I’ve been hearing, some schools are trying to get iPads for their students:
Which, of course would lead to this:
For the most part I have to agree with everything Shamus has said thus far about homeschooling… with the exception of the part about social skills. Yes, children still develop them while working in a home environment, but they’re an order of magnitude less likely to have contact with other children especially on a regular basis. You could perhaps send them to another institutionalized club or place of meeting, but ultimately it would be much harder to make and keep friends (the majority of which go to schools during the day) or even learn how to do so.
As a good example, in the first year of high school I had a good friend fail a number of subjects and do just this… and for all intents and purposes he just completely disappeared. Keeping up contact with him was devilishly hard, nobody else I knew had spoken to him in months, and the few times we did drop by to visit it was apparent that the only people he did see on a regular basis were his parents. Though he may have been learning the fundamentals of whatever his parents saw fit to teach him, he was learning nothing about living and working with anyone outside of his immediate family.
Speaking personally, as a young child it took me years of being surrounded by others to figure out how best to interact favourably with different types of people. A handful were always incorrigible assholes, and just as many were consistently nice people, but in the end I learned to get along with the vast majority of others who fall between the two extremes.
If I had simply called it quits then and gone on to learn entirely from home, isolated from all aspects of social interaction both positive and negative, I doubt I would have ever developed the same set of skills. I would certainly never want to force this constant social contact on anyone as some universal mandate, however. A degree of isolation is a small price to pay for avoiding countless wasted hours in a poorly-constructed and ineffectual educational system.
Mind you, my schooling experience is from a modern tech school. As a mechanically-inclined individual I had a schedule composed near-entirely of interesting material. In a two-day rotation it wasn’t uncommon to have MIDI composing, 3D animation, Computer Art, Programming, English, Electricity, Engineering, and Physics as my entire curriculum for a year. There were tests and notes in places, and the formula you speak of was still in effect, but the subject matter was infinitely more appealing than anything being taught in the schools my parents attended in the 80’s.
One does not have to stay home to be “homeschooled.” I recall Shamus or his wife mention this before – his kids did schooling outside the home, interacting with the public. In this, they are actually BETTER served than a public school kid. In public school, you are almost entirely limited to authoritative adults and kids your own age. In high school, you might get a year or two difference. The real world exposes you to a much greater range, experience that will be valuable as an adult.
Yeah, my family is always running. There’s the kids in the neighborhood, they meet kids at the library, and they meet kids at church. They get to the science center as often as they can, and so on.
If anyone is living a strange hermit existence, it’s me. My kids actually poke fun at me for how rarely I leave the house.
What is this science center thing? Is it a museum, or like a science lab in a school that you get to use?
I’m considering the whole kids thing and along with that comes considerations of education. One of my concerns is that home schooled kids are not likely to get access to some of the niftiest equipment we had in my (very good) public school. We had an observatory, a planetarium, and well stocked science labs. In a school with 4,000 kids, it doesn’t cost that much per student to have these things. That does not make them affordable for the home schooling types. Does the science center fill that gap?
The Carnegie Science Center is an interactive museum in Pittsburgh Pennsylvania. Super fun for kids and adults alike.
God I miss the Carnegie Science Center. The Omnimax was one of the coolest things I have ever seen. Do they do 3D on that now?
The California Science Center is a great resource for our community with a cool and educational environment for all ages! My brother and I have gone there quite a bit to help out.
… your public school had an OBSERVATORY? With, like, a telescope? Oo… our 2000 kid 11-12 school doesn’t even have an astronomy class of any kind…
Coming from a school in a town whose total population was only a little over 2,000 (the town’s population: that is, everybody in town, young and old) let me just say that I hate you. I hate you so much. Nothing personal. It’s just that I’ve always hated how the kids at larger schools get all the cool stuff. A planetarium???? We had a computer lab full of emacs, a library full of books from the 70s, and a gym. If you wanted to learn a language than it was either French or Spanish. Thats it. I always hated hearing about the kids who could learn German or Japanese or Russian and who got cool science toys and stuff. So now I hate YOU!
Sorry. Just had to get that off my chest.
we have a school with that many people in two grades and we STILL have a horrible foreign language program. German’s been cut, I think, I don’t think French goes longer than 2 years, and Chinese (which was just added, oddly) is having trouble. The only consistently offered language is Spanish.
A vim lab would have been far preferable.
After I left they cut the astronomy, German, Russian, and Latin classes. Also, for the first three years I was in high school, the building was condemned. It had cracked asbestos tiles on the floor and exposed pipes. The new building with the observatory was big enough to handle (projected) population growth for a whopping 7 years after it was finished. It also didn’t have windows that opened. The observatory was stuck between the biggest road in town on the East, a reasonably large city to the South, and very tall hills to the West. It had an okay view of the Northern sky.
Of course, none of that changes the fact that my educational experience was way better than yours or that of Shamus. Neener. Did I mention that we had the best math program in the state?
It’s possible to have the best of both worlds. Many public schools make their facilities available to “independent study students” at no cost. It’s a bit of a hassle (isn’t it always?) but then you could home-school your kids, and also take advantage of whatever local facilities your tax dollars are paying for. The availability varies widely however. Some schools are quite flexible. Others, not as much.
I did mention this, but where does one go to have regular daily contact with lots of other people? Most other kids are likely at school during the day, and adults are at their jobs. Barring a club or something similar I’d imagine it’s hard to meet anyone on a daily basis. I’m actually quite curious now.
It’s certainly not impossible to keep up social contact while being schooled from home, but you have to admit it’s a lot more effort than having to spend a large portion of every day in direct contact with other children.
Schooling from home, one has to actively seek out interaction and work at maintaining it, while it’s absolutely impossible to avoid while attending a school. For better or worse you will make friends and enemies, and much time will be spent interacting with them. Without that, there are people like my friend – hell people like me who would have spent large swathes of time completely isolated.
EDIT: Pre-empted by Shamus, that conniving internet time-lord. I must admit I never thought of that last option. Science centres are amazing places provided they’re not owned by a man named Cave Johnson.
“It's certainly not impossible to keep up social contact while being schooled from home, but you have to admit it's a lot more effort than having to spend a large portion of every day in direct contact with other children”
It may be harder to spend a large portion of the day with other kids – but not other people. A large portion of our society have jobs specifically focused on interacting with the public. Museums, libraries, churches, stores – the world is full of people.
There is a large focus on getting kids to interact with kids their own age. There is value in that – it is nice to be able to have shared age-related experiences. But the real world is not age divided. In the decade I’ve worked professionally, I’ve never worked with someone my own age. In my current workplace, the closest is over 5 years apart, and the total range is over twenty.
This is a very good point. I went to public school and did outside activities mostly divided by age group, but I nearly always related better to adults than to kids my own age. Even as an adult most of my friends are closer to my mom’s age than mine, especially the ones I’ve made at work. People my own age make me nervous and I think it’s because of bad times at school. I don’t worry as much about “fitting in” with older adults. As Shamus mentioned, that need to be part of the crowd in school can be detrimental to everyone.
In any reasonably populated area you probably aren’t the only person doing homeschooling. Networking works fine here, as the other homeschooling parents are frequently looking for the same kinds of contact you are. Right now my kids go to a homeschooling choir, lego club, chess club, a social, nominally phy. ed. group, concerts for schoolkids, …
Not to mention the 12hr /week /each of gymnastics they do.
Probably the main reason we don’t have a whole lot of “free time” social contact is that both we and the other homeschooling parents are too busy doing things with our children to get together socially.
Wow. Imagine having to go out of your way to maintain relationships with friends. Almost like – adulthood?
I’ll put it this way: my kids have more and better social experiences now that we’re homeschooling than they ever did in public school. They hang out online with other homeschooled kids, hang out in real life with other homeschooled kids, go out in public where they’re interacting in a mature way with adults and kids of all ages, plus hanging out after school with public school friends. They have the energy to do all this because they’re not in public school with forced social interaction which sucks the life out of my introverted kids and makes them weepy messes by the end of the day who want to crawl in a hole and be left alone. So, they’re opting out of forced social contact with kids who spent 9 years telling my kids (with adult tacit agreement) that they’re horrible people who aren’t worthy of even being treated with basic human dignity and opting into putting effort into maintaining a variety of healthy relationships with people with whom they have interests in common who affirm their value as human beings.
Granted, we’re still working with one of my girls on self-esteem and being willing to reach out to others. The years of emotional abuse at school had led her to a point where she rejected any overture of friendship from anyone and she had stopped even speaking to people outside the family. Mostly what she said to the family was apologizing for being stupid, fat, bad, and worthless. She’ll talk to some people now and I’ve seen her starting to have moments of happiness again but she’s still a long way from where she should be.
Ah, yes, I’m glad this was brought up. I have always been an advocate of homeschooling, when the parent has the drive to make the sacrifices necessary to accomplish this. But this social ineptness that seems so endemic to homeschooling is what has always been my concern. I suppose it’s rooted in the same broken ideology that education/school/learning is an imparting of facts that will enable successful job procurement. I can usually pick a homeschooled adult out when speaking with them individually, simply due to the social aspect. It seems that one of the greatest advantages of homeschooling, the much more equal ratio of teacher to student, gets turned against it. Shamus and Heather seemed to have found great ways to combat this inherent disadvantage of homeschooling. However, I think this is the most common issue of neglect in homeschooling and certainly would be my greatest challenge.
On the other hand, those of us who were homeschooled are almost always shocked by how we’re expected to act in society…you’re judging people on your expectations or those of society, not on their own merits. has an excellent answer to your assertion, much better than I could say.
Shamus, you have a wife with the skills of a school teacher to teach your children. Would homeschooling work for parents who don’t have that skill set?
Furthermore, would homeschooling have been even possible in your childhood circumstances?
I ask this not so much in response to you, but to the people who seem to think they are being oh so daring in suggesting the abolishment of the public school system.
“Would homeschooling work for parents who don't have that skill set?”
I mentioned in a previous post about being home schooled for a year in elementary. My mother had no previous teaching experience and I learned more in that year than any of my previous classmates learned for the rest of their elementary careers. I think it has more to do with a parent having a much more vested interest in their child and their wellbeing, than does a bureaucratic government-run agency.
I remember, I took Algebra 1 in middle school after being told that that way I wouldn’t need to take it in High School, freeing up a slot for another class I would like. Cut to next year, in High School, being told that I had to take Algebra 1…again. It wasn’t because of poor grades; I passed with an A- the first time. It was because the system-they-won’t-deviate-from tells them that I should be taking Algebra I in 9th grade. I tried to plead my case, to no avail. I don’t remember what I was told specifically, but it was some non-committal garbage about them not having the authority to override…yadda, yadda…the previous teachers were mistaken, etc. That was a very disillusioning day.
Later, I wound up with an extra elective period. They can’t just give me a free period. No, no, no that’s against some regulation that I’ll never get to see myself. And I can’t take another art class (the only thing I cared anything about), I’m already taking an art class. Can’t have you pursuing something you enjoy and will use the rest of your life. I had to take REMEDIAL READING!!! Never mind that I was reading at a college level by Middle School and had excellent grades…*sigh* at least I could ace that class with zero effort given.
If I had been home schooled I could have avoided all that garbage, and the bullying, and run-down school building/equipment (they got a new building two years after I graduated >_<) and would be taught by someone who actually gave a damn if was learning or not.
… what the heck? I really don’t like school course counseling >.> As for HAVING to take Algebra 1 in 9th grade, that doesn’t make any sense, especially if your district offered it in 8th. My school actually has 3 or 4 different math tracks. (Ranging from Algebra 1 through Geometry and Algebra II to Pre-calc in 9th grade. I have no idea what they’ll do with the kids taking AP Calc as a sophomore when they get to the seniors, we just added a Calc 3 class this year.)
There are options out there for supplemental classes for homeschooled kids. I was homeschooled from 6th grade through 12th grade and while I was taught at home for the majority of the time, I also took supplemental classes from a variety of schools aimed at homeschoolers. I took these classes because my parents are not good at math and science. Having those opportunities was a huge benefit to me because at the time, I was very advanced in what people call “liberal arts” but struggling in math and science.
So the quality of education you get by homeschooling does not depend entirely on the parents. A lot of parents have the sense to know when they need additional help teaching their kids about a particular topic, and there are tons of excellent resources available for them.
We spend time interacting with our children and discussing real life things with them as they come up. I spend very little time doing what would be considered “teaching”. Also I have multple friends who are single parents who also homeschool/unschool their children. homeschooling in the school at home sense is very hard to do and takes a ton of time and energy (you are both teacher and parent and it gets expensive to keep up with the Joneses as far as curriculum and studies go. However, unschooling is fairly simple as a single parent as it is just taking time to be with and really know your children and have a real, honest to goodness, person to person relationship with them. This way even if it means working all day or whatever you are still able to get to know your child and interact with them and all their various experiences inside and outside the home are involved in what is considered their education. A lot of the single parents I know who unschool either work from home or do jobs like owning or working for small businesses where the child can be actively involved in the family business.
Let’s call that sacred cow into question: does a teaching degree make someone better suited to be an educator than someone without it?
This is purely anecdotal, but in my experience someone either has a knack for teaching or they don’t. I met with teachers as a kid who didn’t get me at all and completely failed to explain key concepts of whatever subject we were talking about even when we were one-on-one. Then I’d talk to someone else who wasn’t a teacher but was knowledgeable about it and they’d present the material in a much more novel way that synced up with my own thought process and made it much easier to grasp.
Teaching is one of those things you’re either good at or you aren’t, and if you aren’t and you want to be it takes serious effort to develop the kind of empathy which is necessary to connect with different kinds of students. In that sense parents have a leg up because they have a vested interest in their child. As counter intuitive as that is, that matters more than actual knowledge of the subject matter because it provides the necessary motivation to get over hurdles in the way of understanding. It’s even better if you take a freer approach where the child explores their passions-nothing can stop a student who wants to learn as long as they have the right resources at their disposal.
I agree with most of your points, but I am still not sure that homeschooling in general is a good idea. It might work for your kids, since both you and your wife are obviously intelligent folks, but the world is full of stupid sheeple and allowing them to teach their kids is depriving them of any chance to become mature and complete humans.
Wait, a minute. The world is full of sheeple and the the solution to this is to send them to an institution which is notorious for encouraging peer pressure, cliques, etc., etc. Don’t get me wrong, I agree that people are idiots, but that includes an awful lot of teachers. I don’t really see public schooling helping this.
My public education was fine, but I’m still convinced that homeschooling is a perfectly viable option for many parents. There are plenty of resources out there to help parents homeschool their kids, and if they lack the ability or faculty to educate their own kids, then public school is an option.
It’s not like they would be completely unable to educate their kids, at least to a certain degree, but they just don’t care. I am actually very glad that kids here have to go to school until 9th grade.
I’ve heard it said (and I think there’s some truth to it) that the modern primary education system in the US is essentially a factory to create… factory workers. The good students are the ones that will become… factory managers. That’s the base premise that everything else has been built on.
Problem is, people aren’t machines and we’re all out of factories these days anyway.
100% true. You can even find it stated explicitly in the original charters of many public school districts. At the beginning of the industrial revolution, it was hard to find workers who had the required habits, so they created them. Show up every day at this time, obey instructions precisely, stand here and do this repetitive task for hours, ask for permission to go pee, eat lunch at the correct time and go back to work promptly, keep working until the last bell rings. Rinse, repeat.
All of the public-school “reforms” in the US since then have been minor tweaks to a system that needs to be torn down and rebuilt from scratch, and you simply can’t do that all at once at a national level, because no one knows what to replace it with. Everyone has a pet theory, and many of the theory-pushers haven’t been in a classroom with actual kids in decades, if ever.
When my mother started teaching graduate-level classes in Education, one of the things she did was have me come in and teach her students to juggle, and then force them to analyze how they learned a new thing. Who worked best off alone in a corner, who got a kick out of helping others solve the problem, who insisted on learning a completely different kind of juggling that was much harder, who got angry and frustrated at simple failures, who needed coaxing and encouragement, who got smug about a quick success, etc. It was a humbling experience for most of them, because they hadn’t been on the receiving end of the experience for many years.
-j
Pretty good example.
Teach people about teaching by teaching them a skill they’ve never mastered before.
(Unless they have…did any of the people you taught have any experience juggling before you taught them?)
No, they were all complete novices. They had a lot of fun analyzing the stubborn guy who insisted that the cascade wasn’t proper juggling and insisted on learning the shower. He was cool about it, fortunately, and it became a useful discussion of finding a balance between catering to the different ones and keeping the whole group progressing.
They all did quite well, by the way, and one of the points she stressed at the end was that they’d learned not just the basic skill, but also how to evaluate their performance and improve on their own.
-j
I benefited a lot from school. While I’ve taught myself a lot, and consider the way my particular graduate degree is taught to be shameful, there are also benefits to schools.
I’ve seen excellent results from homeschooling and I’ve seen disasters, the same as public schools. I’ve seen “unschooling” which I consider an abomination in most of its forms.
I’ve known people who succeeded like Shamus, and those I really think could not have.
Most recently I’ve seen charter “schools” which are basically collectives for redirecting tax money to home schoolers. That is an interesting development.
We’ve also considered homeschooling our youngest.
It is complex, but I appreciate Shamus, his voice and his story. I’d like to see that strung together into a book, perhaps in alternating chapters with material on teaching and children; homeschooling and creating a cooperative collective charter school to support homeschooling.
Seems the biggest problem with education in most western countries is that it’s a political issue at all. Politicians are not teachers, yet they decide what gets taught, what texts are used, how much time is spent in each area, and then try to measure that process from afar and pretend the numbers they see mean anything.
Everyone learns by doing. Do fake stuff, learn fake stuff. Do real stuff, learn real stuff. Want to be a writer? Write, and write some more. Race driver? Drive cars too fast. Surgeon? Cut into dead people and poke around. Reading explains what you’re seeing and feeling, lets you understand it, but doing it is what matters.
I’ve heard plenty of times from people with nice tertiary degrees that while it got them in the door somewhere, it was completely useless for understanding the real world. Shamus here isn’t alone in that.
If you’re lucky, your teacher at school will let you do a few real things, between preparing for more pointless tests.
Of course it’s a political issue. Public School is funded by the government, and the government is fundamentally a political organization. Everything having anything to do with the government is political. Just one reason that perhaps we should be encouraging people to seek education, when feasible, out from under the government’s auspices.
Anything having to do with more than two people is political. Politics is the interaction of social groups; any time there’s a social group, there’s politics.
touche
Ah, this ties in very well with some of my prior musings. I think that there should be an instituion that provides testing. Basically they have tests and expert exams and they give out certificates for passing them. Preferrably the testing would come in a form that doesn’t allow guessing, maybe suprevised by an expert.
Anyway, it would work in a way that no matter where and how you’ve attained your skills and knowledge, you could attempt to take those tests. (maybe have a mandatory interval between attempts) You know trigonometry in 6th grade? Pass it and skip the relevant lessons later. You’ve spent the summer looking at free online courses on database management? Prove your ability to them and write the certificate on your CV.
The Autoblography series really struck a chord with me. I grew up with very similar circumstances. The most common phrase teachers had when describing me to my parents was “… capable of much more than his grades show.” The standardized tests would come back showing top 10% or so performance as compared with peers, but my grades tended to top out with B’s. Gold stars and grades meant nothing to me, and the repetitive tasks were apparently there to exercise my patience more than my ability. My response to become apathetic about school in general. Sadly this also carried over into a period similar to your dark years in fast food. For me it was a dark decade in various unskilled positions (fast food, call centers, retail). Luckily that is in the past now.
Thanks for writing this series. Although I was sure there were more people like myself out there, this series and the many comments posted make me think it’s far more common. I agree with almost everything you had to say about public education and homeschooling.
The only exception is the section about socialization. As a parent I think you are understating the value of peer to peer socialization. I am NOT claiming that schools are a good place for that kind of socialization. They are just as you claim; cliquish, and full of petty cruelties.
Unfortunately kids learn about socializing by actually socializing. What they need is for those social experiences to be guided until they’ve mastered it like any other skill. The easiest example is conflict resolution. If left to their own devices kids will learn by experimentation how to resolve conflicts. This tends to lead to the social hierarchies ruled by power. However if a parent or teacher is present they can monitor conflicts and step in when the conflicts aren’t being resolved, or are being resolved poorly. Note; they should NOT try to prevent the conflicts. That’s like preventing a kid from walking for fear that he will stub his toe.
Obviously none of that has to take place at school, and can easily be accomplished with non-school related social groups. The point is that peer socialization plays a very important role in a child’s development that cannot be replaced with child/adult interactions, and that their ability to interact with adults should not in any way be considered an indicator on how they interact with peers.
I think this discussion is missing a few things:
1. After going through a standard K-12 education in the U.S., a large percentage of kids hate school and education generally.
After graduation, the average person in the U.S. reads less than one book a year. The public schools are actively harming these people, and reducing their ability to absorb new information or keep up with changes in the world.
2. Even the successful students get a warped attitude towards learning. They think the only way to learn something is with lots of drill and in tiny, ordered, bite-sized chunks.
At tech companies, I’ve had them drop a thousand pages of reference material on my desk the first day and say “Learn this. We’d like you to start contributing in a couple of weeks.” When I told that to family, they were horrified. “Don’t they send you off to a class to learn all that stuff?” School just doesn’t operate like the real world.
3. Many students think it’s all about credentials, since that’s all anyone cared about in school. They don’t want to really learn the material — they want to pass the test. And they think if they have the degree, that means they’re educated and entitled to a job, even if they can’t do anything.
4. American graduation rates are appalling. See
“¢ Across the United States, … the Averaged Freshman Graduation Rate (AFGR) was 74.9 percent. This rate ranged from 51.3 percent in Nevada to 89.6 percent in Wisconsin.
“¢ Across all reporting states, the AFGR was highest for Asian/Pacific Islander students (91.4 percent). The rates for other groups of students were 81.0 percent for White students, 64.2 percent for American Indian/Alaska Native students, 63.5 percent for Hispanic students, and 61.5 percent for Black students.
—–
Since a person without even a high school diploma is almost unemployable, this is tragic. Anyone who cheers the public school systems should also be saying “well, except for the 25% who never graduate.”
Almost all the best techies I’ve met over the years did it as a hobby before they worked. None of them were relying just on their schooling.
Even if school doesn’t hurt some of the motivated students, it also doesn’t guarantee anything for the average students. Their education is nearly worthless.
+1
Standard schooling brainwashes kids, not unlike the way communism brainwashed people.
I have no idea how you went from any of those statistics to “school is like brainwashing”. And you threw communism in there too. I think there’s a 50% probability that your next post with invoke Godwin.
It is, I concede, a bit of a leap, but not without basis. Communist countries have state-run education systems more concerned with controlling the youth than actually conferring skills and/or knowledge. The same is true of, well, just about any government-run education system I can think of, and quite a few that aren’t. Notice how many private schools are associated with religious groups. I hesitate to make such sweeping statements off the cuff, but it looks to me like formal education in general is more about instilling ideas about how the world works/should work than actual education. Not that’s necessarily a bad thing; I haven’t decided yet, but my gut reaction is against it.
Well, history is certainly about instilling ideas on the way history should have been. There’s quite a few inaccuracies and falsehoods to make heroes out of the people on our side.
History is written by the victors, after all.
I’ve had the opposite experience in the real world. My company is very pro-training. In fact, I’ve run into “Hey, I see you’ve been doing this work that is outside your job description for a while. Now go take this training.”
Many people seem to think that sitting in a class room with an instructor is how you learn something. If I’ve been doing the job for a couple months and you have no complaints about how I’ve been doing, can I please skip the training?
I’ve always found training useful because it gives me a wider view than what I’d learn on my own. On my own, I only learn what I need to get the project done. I ended up, for example, taking the Advanced C++ course after working in C++ for a while, learning what that one warning message meant, and then when back and changed it because it contained a nasty hidden potential bug.
As a complete aside, the very epitome of Shamus’s frustration with superfluous subject material is still lurking around even at the level of post-secondary education, and it is ugly.
General Education Courses (conveniently coded as GNED’s) are a cruel and ridiculous blight upon humanity as a whole, and need to be subjected to the business end of a ravenous bear. A ravenous conceptual bear able to maul abstract ideas with no demonstrable merit other than wasting both time and money.
For those of you who may not be privy to the horrifying specifics of the system, here’s the deal: here in Ontario, colleges offer programs of different courses based on specific interests which are meant to contain everything required to land a job in the specified field. A program for 3D Animation includes classes on making models, rigging, animation fundamentals, drawing concept art and storyboards, and the odd outlier maybe involving art design throughout the last few decades. Everything fits the description on the tin… so far.
However, one cannot receive a diploma on these courses alone; an elective extra is required for every semester (sometimes even two). This is a General Elective, or GNED course. By definition, a completely irrelevant subject that may be of absolutely no interest to you. That you must both attend and pay for.
But relevance completely aside, do they teach anything of actual merit at all?
No. Emphatically no. These courses have apparently been selected using the educational subject material edition of MadLibs, and sport names like “Global Citizenship”, “Exploring Creativity”, “Growing Up Digital”, “A Wellness Approach”, or “Integrated Digital Media”. Having attended at least five of these things, I can tell you that I still have no knowledge of what four of them actually intended to teach. The entirety of Integrated Digital Media consisted of sitting in a classroom while an instructor pointed out where websites used different forms of media, while we took “notes” and were quizzed on the fact that yes, the internet can host videos, photos, sound, and text all in one place. Marvelous!
Essentially, you must pay someone to stand in front of you and waste 2-3 hours of your own time once a week, teaching you not only nothing of benefit to you, but nothing of substance full stop. You must pay attention and complete their busywork, as a grade of 60% or higher is required to receive the credit. You must do this five times over the course of two years in order to receive a piece of paper that qualifies you to submit an application for a job without being skimmed completely over.
If you’re like me you may also neglect to pick one up in a semester loaded down with actual work, in which case you have a whole five months of nothing but GNED waiting for you after you’ve for all intents and purposes finished your education.
Shamus, I admire your sound judgement in walking right out of that course on programming. High school has nothing on our system of “specialized” higher education.
In university — although at least parts of this were a while ago — your elective courses were simply courses taught by other departments, and I really enjoyed them. I took Russian, two English courses, interdisciplinary courses around Technology, Society and Environment, and two Geography courses on Environmental and Politcal issues respectively. The problem seesm to be that in college you don’t have the breadth of departments to make electives about exploring things outside of your field that you might like to learn something about.
Still, I think there were enough departments on my campus that I would’ve gladly swapped my nonsense GNED’s for a piece of that particular pie. Five courses of sketching, concept art, and creative writing over two years as an aside to my game development program? I’d be game for that… no pun intended.
Also, Russian as an elective. Seriously? You lucky villainous mountebank.
I have two degrees, Computer Science and Philosophy.
In my Computer Science undergrad, I had to take free electives — outside of my program — throughout most of it and had to take a first year science and in second year had to take a science or business elective on top of that. I took Physics and Astrophysics for my sciences, and avoided business.
For my Philosophy undergrad, my electives were … my Computer Science courses, since I did that degree after finishing my Computer Science degree and getting a job. It was and as far as I know still is pretty open. There are no specific GNED-type requirements at the university level that I know of.
Most degree programs that I know of require you to take some kind of elective courses, but (for example) I got mine by doing a few comp sci courses, getting a Spanish minor, and taking some random but thought provoking English courses (a sonnet writing course – which I have used to make anniversary gifts – a film criticism course, and a short story criticism and writing course). All of these things broadened my horizons in various ways (the comp sci in particular has helped distinguish me from other students in my program who don’t know the first thing about programming), and at worst were an enjoyable break from the Chemistry course load I was pulling. If you couldn’t find any electives in your school that taught anything worthwhile, that’s a problem with your school, not the idea of electives in college.
He’s not completely talking about “electives”, though. He’s talking about “general” credits, which are courses that you can pick for yourself, yes, but from a limited list.
For example, I had to take 2 years of math, a year of science, a year of history, a semester of psychology, etcetera. With the limited course choices in each of those blocks, the only ones that could have possibly been important for my computer science degree were the math classes (calc 1 and 2, linear algebra, logic).
I guess my point is, if I had a real choice in my “electives”, I’d have taken World History for a year or two, perhaps a second language, and probably music-related things. But I was required to take credits in my choice of: chemistry, biology or physics (interesting, but I’m not good enough at memorizing formulas or math to do any of them well. Bio is the one I tried and my class was 500 strong, which I believe was my downfall), micro-or-macro-economics (useful, maybe, if it wasn’t only one semester and there was actually time in later schedules), American lit or composition (I had as much of a bearing as I needed for either from high school), and others. The only elective I actually enjoyed and got anything out of was my World History course.
(Of course, the real factor that drove me away from that school was the fact that all of their computer degrees were basically programming degrees, something you don’t find out until you’ve been there a couple of years. I wanted to be a network admin, not a programmer. So I left. But that’s another story.)
From what I’ve gathered most universities have requirements similar to this, general education in things not related to your major, i.e. Math with an english major, in addition to electives that could be darn well anything.
Yeah, they do. It’s one of the reasons I’m not so hot on the whole University thing. The vo-tech school I ended up at was great, teaching me stuff that actually mattered to my chosen path.
It still strikes me as very flawed logic, regardless of what the courses actually are. You pay out of your own pocket for a specialized education in something… so they force you to learn completely ancillary things for no immediate benefit before you can be acknowledged as competent in a completely unrelated field?
There is literally no reason to do this other than some transparent talking point about teaching students “additional skills” that holds no real weight. High school teaches general skills. Colleges offer courses you are free to sign up for should you personally want to learn additional disciplines. It’s ridiculous that I should be mandated to spend my time and money on courses that are absolutely unrelated to my program by definition, especially when I need to cut into my study time for actually important classes in order to churn out their related busywork.
I would have no issue selecting electives from a list of courses even vaguely relevant to my discipline. Electives themselves are not a problem. Having to waste time, money, and effort on courses that have nothing at all to do with the diploma I’m working for in order to receive that diploma is the problem. The fact that I don’t enjoy a single one of said courses and none of them teach anything of merit to anyone is just icing on the cake.
But what about overspecialization? It’s easy for a Comp. Sci or other technical person to learn about technology, but isn’t it important to have at least some grounding in, say, the humanities, if only to understand how other people might view the world and approach a problem? Shouldn’t an educated person also be well-rounded?
My experience in college has been a bit different, seeing as they had very broad categories (like, “Understanding the Individual in Society”) which could translate to all manner of things, for Philosophy to Sociology to Economics. They’re broad enough that there’s bound to be at least a passing interest in something. And perhaps you’ll come across something you didn’t realize you liked before, too.
The four-year programs at the university that I am currently attending require 3 science classes (at least one outside your major’s requirements) and one class in each of the following categories: history, foreign culture, fine art, mathematics, English composition, social science, philosophy/literature.
This sounds all well and good, since you can knock out math and most of the science requirements as part of any engineering major. English composition was marginally helpful. The problem lies, for me, with the remainder of these courses.
There are no history courses offered that interest me or that are applicable to my major. History of American Sports is class that fulfills this requirement — that’s an actual class, that you get college credit for! And what department offers this fine class? The kinesthesiology department — which is basically code for the sports and sports education department. How does it help make you a more rounded person to take the history of your own field?
I’m just bitter because I don’t have time to get a minor in computer science and take the Introduction to AI Techniques class. And that the fine arts class I want to take is never actually offered. Futurism and the Arts sounds awesome, but it is never actually offered by the University of New Hampshire.
Our degrees are (or at least were) more specialised – my mid-1980s Chemistry degree consisted of the following courses:
Year 1
Chemistry, Physics, Environmental Chemistry
Year 2
Chemistry (split into Organic, Inorganic & Physical)
Year 3
Chemistry (split into Organic, Inorganic & Physical)
& a small research project (IR spectra of copper catalysts)
One thing that I haven’t seen mentioned yet (apologies if it has), but I know one argument I’ve heard against homeschooling is that public schools serve as a way of detecting kids with developmental problems like autism or asperger’s, things that might go undetected in a home environment. Although the counterpoint to this would be that such diagnoses are potentially vastly overinflated.
I’m also quite wary of homeschooling without any supervision or tracking of progress from any institutions. Some parents have very narrow political or religious beliefs, and some of those parents are going to push those beliefs onto their children. At least in a public school the ideas of a parent have to compete with other ideas and experiences.
I think abolishing the entire public school system would be silly. It’s in the interests of every member of society (those without kids as well), that everybody has the opportunity to achieve at least a baseline level of education. There’s an old saying that you can build schools or prisons, and unfortunately the US seems to have been focusing on the latter for a lot of the last few decades.
Being an Aussie I’ve never really had to deal with any of this stuff. The education system over here is not nearly as much of a political football and the schools don’t vary nearly so much in quality because the funding system is more equitable. I was quite fortunate in that my local primary school was small and I enjoyed it, and I got into a selective (a bit like the US gifted and talented program I think) high school which had good teachers. My general belief about the US education system is the same I have about its health system, that it’s the best in the world if you can afford the right place.
I also just wanted to say I’ve been reading this blog for several years now (since DM of the Rings) and it’s been thoroughly enjoyable. Please feel free to make more complaints about the retail price of video games in Australia the next time you’re on the subject of video game pricing, as at the moment I’m faced with a situation where the Steam price of MW3 is 40 dollars cheaper for the US than Australia.
I will submit to you this:
If your child is being kept in your house all by him or herself their entire childhood, they’re going to be indoctrinated, period. I don’t care what they are taught, it will be indoctrination. This is an abomination.
HOWEVER, a homeschooled child does not need this to happen. There are a variety of ways for children to socialize outside of school. I don’t know how it works in the US, or other such nations, I didn’t grow up there. I made most of my friends because my parents knew their parents or they went to my church. (I grew up in Bangladesh, among the ex-patriot community). I met other people, and a lot of them had similar beliefs to me. I also had a friend who getting drunk and smoking at age 14. I also had friends of different religious beliefs to me. I also had friends from other nations than my (I’m American, I had Bangladeshi, Indian, German, Australian, and New Zealand(ers?) friends).
I realize I’m somewhat the exception to the rule here, but I think it holds to reason that if the parents are engaged in society, then their children will likely also be engaged in society. At least, that is how it worked for me. If your children are engaged in society they will meet other people, some of their age, some older, some younger. My best friend, yes, he is 22, two years older than me. But I had other friends. One of my good friends is a man who works with my parents, he’s in his thirties. In highschool I hung out with a lot of university aged people, I consider these people my good, close, friends.
Honestly, the fact that all my friends are basically my age right now is rather boring. They’re all white too, basically. No offense to white people (see, I’m white myself :D) but I thrived in my multicultural surroundings. Being at a party with Koreans, Aussies, Bangladeshis, Germans, Americans, and Brits… thats going to be 100% more exciting than a party with a bunch of boring Americans. :p
I don’t know how it works in Australia, but in the US schools do absolutely nothing to identify LD or Gifted kids until the parents start screaming about it. I was in and out of public school and homeschool in some of the best and worst districts in the US – we moved a lot – and the one thing they all shared was a system designed for the teacher’s convenience. If a student needed something out of the ordinary they and their parents needed to fight for it. Even if individual teachers were flexible enough to work with different learning needs, the system wasn’t set up to handle it. There are laws that mandate accommodations for LD/Gifted students, but public schools in the US just weren’t built to handle individuality and they still can’t.
Statistically, homeschooling and public school turn out kids with the same overall level of socialskill, but with different patterns of strengths/weaknesses. Overall, homeschooling produces better educational results, no one iss sure why although many people think it’s related to the close interaction, better feedback and greater motivation. It’ll be interesting to see what happens as homeschooling moves out into the mainstream.
My experience is that parents who care enough to teach their children at home usually have the best possible method of detecting autism/learning-disability.
They also usually have good, one-on-one methods of getting around that problem.
I odn’t disagree on any particular point, if you want to homeschool your children thats just fine. I don’t think there should be stasndards and arbitruary goals to reach but i do believe progress should be assessed. I saw this radical liberal set of parents who “homeschooled” their kids but never put forth any effort to teach them. They said they will learn what they want when they want. I don’t know that i would agree with this as a form of homeschooling. It seems to me that it would create ignorant and parental-dependent people. The reason we put kids in school is becasue kids are more able to learn at that age than at any other time. Structure is a nessecary tool. Maybe school isn’t the right structure for every kid but even the homeschooled kids i’ve known had structured learning enviornments. These kids didn’t. and because they didn’t they 14-16 and they didn’t know basic math outside addition, very limited knowledge on how to read and no knowledge of history, science, philosophy, or anything other than their friends most recent status updates.
Homeschooling should be slightly regulated, Not with standardized tests but an interveiw occasionally about what they’ve learned since the last interveiw wouldn’t go amiss. I don’t know what kind of punishments would be imposed on those who didn’t show any progress, but i feel there should be something there.
You have a point in denouncing parents that don’t care for their kids, but I’m still very interested in what these kids do know. I imagine it to be quite a feat to learn nothing in 14-16 years time.
This is why I (sarcastically) believe there should be a license for having kids. I don’t believe it would actually work, but there are things people should have to know and be able to do before being aloud to have kids.
Interviews would be so subjective as to be worse than useless. Social Services is bad enough now; can you imagine with that much power? A few questions to which “there are no wrong answers” determining whether or not people were competent instructors? No, if there must be an assessment, it needs to be as objective as possible and limited enough for that objectivity to not stifle the students. I said this a few comments up, but I am doubtful that testing anything more than reading, writing, and arithmetic would not do more harm than good.
Which is about all that standardized testing IS. The SAT has those exact categories, and the ACT has those plus science, which is more science literacy then content, since science curricula are no where near standardized, unlike math.
So, basically, we’re left with at least one area where it ain’t broke and don’t need fixing. Nice to know we can get a few things right, or at least not wrong.
We still have it in our heads that the more useless cruft you know, the smarter you must be. Name dropping facts and titles is like flashing bling, from scientific journals, to formal literature, to pop culture, to every day conversation. Public education makes you know the minimum amount of cruft so you dont look stupid at parties.
The useless cruft are actually usefull as hooks and references for learning new stuff that’s not useless.
You don’t learn who the first presidents were so you can recite this in a party. You learn it, so that when you learn some other historical fact that went on when Lincoln where president, you’ll automatically know something about the context of this new fact.
Basic knowledge, useless as it may be on its own, still greatly facilities later learning.
I look stupid at parties, but it is because you can name almost any song, movie or TV show from the last 20 years and I will have no idea of what you are talking about.
Though if you want to know the distinction between NP-Hard and NP-complete we can have a conversation.
No knowledge is every completely useless. Just because you might not need it for your job, it really truly does make you a more interesting well-rounded person to know a little bit about a variety of subjects. Besides which, stuff’s just interesting.
I really don’t understand the attitude of so many people (I’ve noticed it’s very strong in the readership here) that they shouldn’t have to know a single fact if they don’t need it to program a computer or do a chemistry experiment. That’s equally ridiculous to ‘all children should learn at the same pace, via the same methods’. You don’t have to throw out the entire system to improve it.
Agreed. General knowledge is important. Shamus mentioned people thinking Lincoln was the first president, and that is a really good example. It’s best if you know just a little bit about as much as you can, in addition to as much as you can about just a little bit.
Huh, this blog post has a weird comment thread. Even off-comments towards the bottom are being picked apart. Thought I’d be ignored for being stupid, but here we go.
There came a time in my life when we learned about Shakespeare, I dunno when that was. Second or third grade. But the thing is, I already knew about Shakespeare. I knew he was English, he wrote Romeo and Juliet, he wore a ruff and poofy pants, because he was from some older time. I remember being wiered out about this. Where the hell did I learn about this? Certainly not from school. I realized that this was what the cool kids called general knowledge, something infused in our culture, repeated and referenced ad nauseum so that no one could escape knowledge of this person.
Almost all the useless cruft knowledge that one needs to know about culture, history, and science can come second hand from just living in that culture. From reading books, or blogs like these. I learn far more from this blog and a few webcomics than I learn in half my college classes. Of course half my college classes are English, but dewp-dee-dew.
School can teach fine details. It can introduce you to new fields of learning. I think its probably the best way to learn math, but that may be because I suck at it. But everything you learn at school can just as easily be osmosis-ed from being aware and participating in life, especially now that you can look up the facts online.
EDIT
And anyone just mutely participating in media and getting nothing from it still might not learn anything from school either. If they’re so hard set in remaining ignorant, then having them recite things in blando-land is not going to shove things into thier skulls. Life and learning is about participation in the environment. School can be one of those environments, in highly concentrated form. But its just not going to get through to some people.
You just made a general argument in favor of a variety of homeschooling known as unschooling. Welcome to the dark side. We have cookies and knowledge by osmosis. Of course, it’s not really so much osmosis as the natural curiosity and observation inherent to being, in the words of one of my friends, “new to this planet.” This curiosity and observation is primarily how babies learn to walk and talk. Why is it no longer good enough to teach other, less fundamental, things? Widespread public education didn’t exist to the masses until around the industrial revolution (though some public schools have existed as far back as the first century AD) so before that children learned in some different way. The different way was by being around people all the time as they lived and worked, observing and absorbing.
Even more important, perhaps, is that whatever people do at their job, people will be making decisions such as voting, spreading rumors/news around, joining or supporting political groups, etc., and these sorts of decisions can significantly help or harm other people.
The amount of times I see people spreading wrong information about various health or psychology studies, making really dumb political assumptions (“The Iraqis will welcome U.S. forces”), doesn’t speak well for the quality of this sort of learning, however it is being done.
Yeah, thats one of the careers I would say needs a strong schooling background… but we cant predict when a kid is going to be a politician, so I dunno….
I’m not talking politicians here (The point of my comment is to add to the argument that education is about more than just preparing people for jobs).
Everyone (in the U.S. at least) is involved in politics in some sense, through voting decisions (even not doing anything at all is a decision, in a sense), decisions to talk about or watch particular news stories, rumors, or pieces of information, talking to other people about politics, etc., and political decisions will be effected by how people act and what they know.
The same applies to a number of other areas in life. Spreading incorrect rumors or information about health, for instance, has a strong effect on other people’s lives.
(I may have a future additional comment on these issues, if I can think of a clearer way to say it.)
School is necessary to get into college if your kid has aspirations to be, say, a doctor/lawyer/research scientist.
School helps develop critical social skills in most kids.
Coloring your perceptions based on a small sample size (n = 1) is usually a bad idea.
“If public schools can't handle kids from broken homes, or kids with odd behavior, or socially awkward kids, then what should be done with those kids, if not give them over to some other form of education?”
I don’t think broken homes are in a position to be home schooling kids.
You’re just reciting current doctrine.
Do you, for example, _know_ that school “develop critical social skills”. Or is this just something you’ve been told by the powers that be?
Of course many of us feel that we personally DID develop critical social skills. I’m not quite sure whether it did or not, I went into 9th grade after being homeschooled 3 1/2+ years, and I have no idea when or where I got mine.
If you think about how kindergarten/pre school and school work, it’s not really very “normal” environment or way of interacting with other people. Socially it’s a strange kind of hierarchy, where the kids are equal, all the grown ups are kind of formal persons, and the head master is some kind of angry person you’re afraid of being sent to (at least he were at my school). It’s a very artificial community, and a strange place to learn social skills. Normal interaction with grown ups are missing.
Is school necessary to get into college? Not necessarily, there are procedures at many colleges for evaluating home-schooled applicants. I’m almost 90% certain that my high school lost it’s state accreditation, but I still got into college easily.
Socialization has been addressed from several viewpoints already, and I’m not personally convinced that public school helps much. Private school gave me a better view of where I stood with respect to other people after school. I didn’t graduate high school intimidated by older adults or even professors. I think that public school indoctrinates that kind of awe where my little private school encouraged critical thinking and discourse with my teachers on a more equal footing.
You’re right in thinking that a parents assessment of their success might be flawed by not having a large sample size or clearly defined control group with which to compare their child. However, public school education suffers from poorly defined objectives and atrocious assessment of student progress. Grades can be almost entirely disconnected from student understanding and yield a false indicator of success in teaching. One-on-one it becomes exceedingly difficult to hide a lack of comprehension.
tl;dr Homeschooling isn’t perfect and presents a unique set of pitfalls and new considerations. I disagree with Melf_Himself on the necessity of a formal high school education to enter into higher-level education.
Above and beyond the question of how hard it is to get accepted to college, if you’re already enlightened as to the virtues of doing what’s important and avoiding needless busywork, you may want to apply to a college as a non-degree seeking student. As I understand it, the requirements are more lax, and if you want, instead of a degree, to receive actual education then you can choose the courses appropriate to what you want to learn.
A whole lot of this seems like getting to that point where you make a decision of whether you want to get a diploma/degree, or an education. Either has value, and it may be possible to get both.
Many colleges like you to take the SAT or ACT anyway.
The first google result for ‘homeschool college admission’ said that most colleges that have a set procedure for homeschool student admission require the applicant to take subject tests in addition to the general SATs.
A ton of selective colleges make you take those subject tests anyway. Just saying.
Anyway, I think one of the biggest problems with public education is standards. The schools themselves are more focused on passing the kids with at least the bare minimum than actually education them.
How interesting– most of my friends who were homeschooled themselves went on to be lawyers, doctors, and scientists. Almost all of them on full scholarships (off the top of my head I can think of 9 and I know I know more.) In fact, only one I know is even “just” a stay at home mom but she is also a well paid writer.
To add to your data pool:
I come from a family of five. All were homeschooled (after the eldest got to fifth grade at a private school).
So far, four of the five children have attended college, and two of them have achieved master’s degrees.
The fifth child is still in high school.
Generally, SAT and ACT, plus a recognizable transcript, have paved the way into college-level work.
I’m from a family of six homeschooled kids, of which the eldest four have all been through uni — and yep, one of them’s a doctor.
The other two of us decided we didn’t want to go to uni straight after school, and haven’t needed a degree to lead successful and happy lives.
I’ll probably be attending uni in a couple of years, but only because I’m changing careers and it’s pretty much a requirement for employment in the new one.
The one point i would make is that your kids are exceptionally lucky to have educated and able parents to homeschool them, most kid’s dont.
But but … they all went to public school, so they should be educated and able?
That irony aside, I agree that at least some kids would suffer from their parents lack of abilities if home schooled.
I think the best way to solve this is some required tests at regular intervals, to check that the kids are not totally neglected.
There must be some balance between individual freedom and protecting kids from less that able parents.
I’m a big fan of homeschooling myself, and intend to do a fair amount of it, much as my parents did. And, like them, I’m likely to take advantage of the “free” daycare that I’m paying for with my taxes as well.
While I did learn some trivia in public school, (and a smattering of quadrivia as well, though light on the astronomy) I also learned three very important things that I can’t shake the feeling would be much more difficult to learn in a purely homeschooled setting.
First, I learned to interact with other children with a minimum amount of bloodshed. Reading your arguments about socialization gives me pause, but I really find it hard to shake the belief that I wouldn’t have been able to learn to deal with others if I hadn’t been forced to do so for 13 years. I haven’t met any homeschooled children myself, so at most I only have half of the observation needed to make an informed conclusion on this. Maybe if I did, I would change my mind on this point.
Second, I learned to pass standardized tests without any knowledge of the subject matter being tested, and to excel at them with only a modicum of knowledge. This has proven to be an invaluable and (frighteningly) widely applicable skill throughout my career. Actually, it’s unfair to say I learned that in school… I learned it from my father, but school gave me abundant opportunities to practice and hone the skill to a razor sharp edge.
Third, I learned the very important lesson that teachers (and by extension many other authority figures) can be, and often are, completely wrong. I already knew that my parents could be wrong… I think all children learn this, and mine made no bones about it. But, strangely, it’s a lot harder to believe that other people are wrong unless you see it happen repeatedly.
Now, while I generally agree with your thesis statement up there, I would have to insist that you should make one change (and you kind of mention this at several points). You say “Homeschooling works. People should be allowed to do it.” I would change that to “Homeschooling can work. People should be allowed to do it.” I think it’s certain that there are some people for whom it won’t work. Even you. While I think that, from an educational standpoint, you would have been much better served by homeschooling (or really almost any type of schooling other than what you got), from a practical perspective I don’t think it’s something that your family could have done (based on what I know of it from these posts). If your mom had quit her job to teach you and Patrick full-time, how could you have survived? If she could have kept a full-time job and only taught you in the evenings, what would have been the disadvantage of having you in school while she was working?
In the end, while I and, apparently, everyone else is very passionate about education and the need to argue about it incessantly, I have this nagging suspicion that it really matters a whole lot less than anyone is comfortable believing. I suspect that to a very large extent, some people are smart and motivated and will do well in life, while others are not and will not, and no amount or type of education will change either of those people.
And I also think there’s a 90% rule going on here. 90% of the resumes you send out won’t lead to a fantastic job. 90% of the people you date won’t end up marrying you and being the perfect spouse (ok, maybe more than 90%). 90% of the features of a piece of software are unused by each user. 90% of a public school education is worthless. However, you cannot know *which* 90% is worthless until you’ve done the whole damn thing. And, very importantly, the 10% that’s useful to you will not be the same 10% that’s useful to the person in the seat beside you, just as your perfect spouse and dream job would make him miserable.
‘I have this nagging suspicion that it really matters a whole lot less than anyone is comfortable believing.’
Yep, I think that’s the problem right there. The whole issue seems to me like a paradigm situation like the science philosopher Thomas Kuhn describes. We just might be on the edge of a paradigm switch between our current understanding of education and a new, as of yet unknown one.
Current education was created about two hundred years ago to answer the questions they had then: factories needed workers, poor people needed a way out of poorness, the masses needed to be controlled. Centuries later, we’ve got different questions that require different answers: Businesses need specialists, people need fulfilling jobs, the masses need to consume responsibly.
There’s no doubt in my mind that sooner or later our education will be forced to change, to deal with the changed role it has in society.
That’s a good point. HS’ing isn’t a guarantee, and can go wrong for all sorts of reasons, just like public schools.
I think one of the issues with the conventional mindset is that we’re trying to turn education into a science when it’s as far from that as a human endeavor can get. People come in lots of varieties and even with the best resources and brightest minds available a child is not guaranteed to grow up cultured and capable. That’s exactly why more flexibility would serve us because we haven’t even scratched the surface on the things we can try.
Hold on, that’s not entirely true. Pedagogy IS a humane science. It isn’t a positive science; a person is still a person…
The biggest problem is cost/efficiency. A system where every child has several different tutors for different subjects, all personally invested in the child’s rearing but without a reason to try and coerce the child in any particular direction, with all of the tutors/teachers/coaches having plenty of experience in both the fields they teach, and in teaching, and has the equipment to really use and persue any ideas, can work quite great, for practically all children – be they more gifted mathematically, more linguistically adept, interested in art, dyslexic, suffering from Aspergers, socially inept, very sporty, quadriplegic, interested in animals, or what have you.
Unfortunately, such a syste is absolutely impossible to afford.
Homeschooling, private schools, public schools, all kinds of programs to “help” children who are ahead/behind/otherwise challenged/… are all just ways of trying to fit a system that’ll get the most out of most children with the minimum amount of waste (human, intellectually, spending, whatever).
I’m personally convinced that public schooling CAN work, in most cases better than homeschooling…But it ISN’T, at the moment, performing as it should.
Ideally, most children can learn properly in relatively small groups and do well; special cases can then be given additional or replacement lessons to try and have everyone leave school at a certain age with a certain minimum knowledge (such as reading/writing/basic addition/enough knowledge of at least one language to function in society, but obviously determining the “minimum” required is a very touchy political problem), and those capable of it, with much more. Then, afterwards, they can follow a path of interests and more specific learnng – be it academical, technical, or whatever.
Obviously, at what age to start diversifying (at 6? College?), how much “help” and what type to offer, etc etc, are all once again political questions.
Don’t let anyone tell you otherwise – the working/failing of any schooling system is, at its root, a political and cultural problem.
Despite it’s length, I believe paragraph 2 sentence 2 is actually a sentence fragment. It is missing a verb! “A system where (modifying clauses).”
Grammatical snobbery aside, you’re spot on. There are lots of things we could do with infinite resources. Your description of the ideal educational system is beautiful and fantastic. I also agree that public schooling can work. It is not perfect, but neither is it somehow impossibly flawed.
The trouble is, just as you say, someone has to pay for all this. My stance is that I will pay for my children, which is all well and good. Where people (myself included) get upset is when someone (invariably well meaning) says “You must pay, not only for your children, but for John Doe’s children as well. If you do not, I will kill you.” This is what “Free Public Schools” means. Someone always pays for it, and if the government enforces the payment, then it is under threat of death.
But, like Shamus said, there’s probably no hope of it just going away. So, there’s that, for good or ill.
I would posit that everyone benefits from a more educated populace. Some disagree with this.
Assuming for a moment that everyone benefits, then everyone who can afford to do so should pay, just as we must for infrastructure, national defense, basic research, and emergency services. Anything else would be parasitism on the community.
I can’t find any missing verb, the verb is “work”.
Yep; My bad.
Though, to be fair, I did make it a needlessly long and convoluted sentence :-P Sorry, typing while answering phones and writing about work makes me los track of what I was writing, exactly, so my posts (when made from work) tend to come out a bit too train-of-thought :P
It’s also a question of methodology, which is why political and social problems become such a nuisance.
Psychology is a science but people are individuals and individuals will respond very differently to the world around them, each according to their own mental processes and worldview. If I understand you, you’re saying school would benefit most or all kids if they had the resources to cater to every kind of learner, yes? I don’t think that’s possible within a bureaucratic system, and the art involved in this is figure out what appeals to different kinds of students and then optimizing it for their use.
Don’t get me wrong, I’m not saying science is irrelevant, I’m saying that intuition plays an incredibly important role in properly shaping a child, perhaps a bigger one than any data sheets we currently have available. The science of the mind is still very primitive when you consider how much we don’t know and how far it can go so it’s going to take some bold experimentation to figure out what’s optimal for the most people.
That last bit is the most important part of that post. Different things are important to different people, and public school probably gives you a wider view (or a potentially wider view) than being homeschooled, especially when you’re interacting with other people with vastly different interests.
Well, yes. It’s perfectly possible to be a parent who truly means well and wants to give their children a perfect, balanced education so they’re knowledgeable about all matters of importance – but if you happen to be tonedeaf and not have a musical bone in your body, your little Jimmy Hendrickx might go unnoticed.
Of course, as has been pointed out earlier, it’s not because youre homeschooling that you can’t ask others t help in the education to try and broaden their horizon; nor is a public school a guarantee a talent will be picked up (as can be seen in Shamus’ tale).
Still, I do think it’s a valid concern.
I just want to leave a comment saying thanks for writing all of this. I wish I could have contributed more these past few discussions.
I agree with a lot of what you say, though. But on the whole, this was a fascinating look into your life. Thanks for taking the time to get through it all.
First I wanted to thank you for sharing your story with us Shamus. I’ve really enjoyed reading it.
On the issue of education I am of a similar mind. I never finished high school (I couldn’t bring myself to finish grade 13 English. I tried 3 times). I wasn’t dumb, I was uninterested. After high school I took a job as a security guard and was eventually convinced to go to college (here in Ontario this is like a trade school). I dropped out once because the first year was just like high school (busy work). Eventually I tried again and found it really enjoyable once I got past the first year (it was a three year program). Now I work in IT as a programmer/analyst. I make a good living and love my job.
As my kids enter the school system (my oldest started kindergarten this year) I am very anxious. I hadn’t considered home schooling as an option until I read this post. Thanks for opening my mind to it as an option!
I don’t have a problem with home schooling. I know lots of adults who were home schooled and plenty of kids who are home schooling right now. The “products” of home schooling usually turn out just fine, if nothing else, because of the extremely low student-to-teacher ratio. They are able to get personal attention from someone who cares about them.
Let me rephrase that last one because it’s important: as long as kids get personal attention from someone who cares about them, they’ll probably turn out alright.
The problem I have is that while home-SCHOOLING maybe very effective, from society’s point of view home-TEACHING is extraordinarily inefficient. You have robbed society of an fantastic person (Heather) who could otherwise have been positively contributing (i.e. making $$$) to the larger economy.
It’s really hard to say that last part without sounding trollish. Heck, it’s hard to THINK that last part without feeling trollish…but it’s true. From a policy perspective, public education serves TWO major functions:
#1- Educate the next generation of adults to be positive contributors (i.e. make $$$) to society…this is already being discussed ad nausea above so I won’t get into it.
#2- Free parents to work. For all the complaining people do about the high cost of education, they never seem to remember that “free childcare” allows an extra 20-30% of the population to work…and that “pays” for education right there.
Oh sure. These days we talk more about reason #1, but it’s #2 that provides the biggest boost to the economy. As bad as all the involuntary unemployment in this country is right now, the VOLUNTARY unemployment (or underemployment if I’m being fair) caused by home-teaching is worse, because it generally self-selects the brightest and most motivated. It’s fine if a few people home school their kids, but don’t go making a movement out of it. The economy is bad enough already.
A lot of what you write seems to be based on an implicit idea that individuals belong to society, and not that society is there for the individuals.
While I do agree that we need most people to be positive contributors to our society, I think that this should never come at the expense of the individual.
When you’re building a society at the expense of individuals, you’ve lost sight of the reason we have a society in the first place.
The solution to this problem is simple: Make the schools so good that most people want to use them. And allow the few that still don’t want to use that option the freedom to choose otherwise. (But check up on the kids, so that they’re not neglected by their parents. This is also about protecting the individuals, and not something done for the sake of society.)
Never forget that society is there for the individuals that make up the society, and not the other way around!
Easier said than done. I agree, though.
Seconded on both counts.
It seems your argument could be made not just about home-schooling, but at stay-at-home parenting as well. Is my wife robbing society by staying home to raise our two boys? I’d emphatically argue, no. Her contribution to society is… two well-adjusted boys.
If efficiency is the issue, then I’d just argue for larger family sizes. Considering that the average size of the home-schooling families I know is about 6 or 7 kids, I think home-schoolers have the efficiency thing down too.
The ironic thing is, it doesn’t matter what proponents of small families and/or public education stand for. They will be out-reproduced right off the charts by people (good or bad, knowledgeable or ignorant) who have lots of kids and teach them personally. In the long run, the best way to spread your ideas is to spread them through your progeny and teach them to do the same.
This doesn’t account for entrepreneurial efforts which can be undertaken from home, such as freelance writing or programming. The internet makes it far easier to build income streams without formal employment than it’s ever been before, so if someone wants to make a contribution to society there’s nothing stopping them, and it’s likely that it will be more meaningful than a lot of the work they could land in the corporate world.
People who don’t do anything of economic value most likely don’t want to, and as long as there’s enough money coming into their household to support the family I don’t see a thing wrong with that. Anyone who wants to claim ownership of someone, their time, or their work, can sit on a cactus for all I care.
Dunning”“Kruger effect. how do you estimate that you are fit to teach your kids? your own success? lot of people go far in their career without having a single clue on how to teach. because your wife is a teacher? isn’t is the exact same kind of people you don’t trust?
don’t get me wrong, I’m sure you did great with your kid, but how a lambda guy (or gal) know if he/she have what it take? by the Dunning-kruger effect, the worst people for homeschool kids will be the first to do it.
I’m from france, and here school isn’t only to teach you a job. it’s also a good way to mix different social class and “races” as you say in the US. it’s the occasion for kids to see something different than what they have home, outside of their parents supervision, and I think its important. school is seen as the very fabric of the social tissue.
of course french and american school system are quite different. I must have paid less than 4500$ for my whole education (I’m currently a Ph.D student (with a salary)). so high level education is more of a choice than an investiment (or only an investiment in time, depens how you see it)
Your education isn’t cheap, it’s just paid for with other people’s taxes.
And I thought Paris had a ring of un-assimilated minorities around it. Did they not go through your educational system too?
the education of everyone is supported by the society as a whole (as it should be, as it improved society as a whole). on the personal level, there is no family that can’t afford an high level education (if the price is still too much there is grants, based on the family revenue for the attribution). as I see it, that mean that the people having a diploma are the most motivated/talented in the pool of people who wanted to study a field, not the most motivated/talented in the pool of people who could afford to study a field.
the question of the suburbs and the question of emigrants in france are both complex and it’s not the best place to discuss it, but keep in mind that I didn’t say that the french school system was perfect, I just pointed out some differences.
as of the suburbs, this is the limits of a systems who was built assuming a certain variety of population in every city. interesting enougth, the second generation population of the suburbs tend to define itself as “from the suburbs” not from the country of theyr parents. this is quite interesting when you consider that the population is a mix of different arabs country, from africa, from the Antilles, from portugal, from china and more and more from east europe.
as assimilation as a whole, even with the bad reputation of racism that france seems to have, if you look at it from a demographic point of vue, it works. there is something around 30% of wedding between people of imigrant origin and the “french” population, and the measure tend to show that population of foreign descent tend to align on many metrics with the national average, like level of education, level of crime, level of religious practice, level of fiscal fraud,… ( in both way, if a population have a lower criminal activities, it rise until it reach the french level). I have to add that older emegrant comunauties have been completely assimilated, notably the swiss,the italian,the spanish,…
finaly I want to point out that racism in france is mostly based on the culture, not on the race. not saying its better, just pointing out a difference.
if you are interested in the subject, you should read “le destin des emigrées” from emmanuel todd, a really great book on the subject (its compare emigration in england, the us, germany and frances. not sure if an english traduction exist).
love sea of memes by the way.
Thanks. What I had read about France was that it got very idealistic about education and immigration — “We’ll teach them to be French. End of story” and didn’t even keep track of success rates by race/culture.
Then you read that there are areas where the police won’t go, where unemployment is very high, and where burning cars are a common sight. So I wonder if they’ve had any success at all.
I hope it’s better than it sounds.
ah ah, yeah, that basically how it go. it’s illegal in france to make statistique by ethnie (for historical reason, it was decided after the german occupation in world war two). that make precise stat a bit hard to obtain, as we have only indirect observation and comercial study to work with. this lack of data tend to add to confusion.
the suburbs are a very real phenoma that is a shame for the country, but it shouldn’t mask the fact that statistically speaking, France is succeeding in it’s assimilation of the emigrants culture (in a painfull and ugly way, but still).
Couldn’t resist pointing out that my favorite political economist and all around practical thinker, Frederic Bastiat, was French. Check out his writings, especially “The Law”, some time. Most of my thoughts on education can be traced back to him.
We love Frederic Bastiat around here– brilliant guy.
The Law is a brilliant tome that explains the meaning of plunder.
My wife and I are considering homeschooling our children (when we have them) for most of the same reasons that you’ve enumerated above, though I must say that we’re less confident on the socialization angle than you are. We’re also idly considering starting a Montessori school, provided we have the opportunity to pick up the necessary teaching credentials in the meantime…
Regardless, I think it’s beyond dispute that homeschooling is preferable the normal educational system for some children, but I am concerned that there may be something of a lack of correlation between:
1. Parents who have the time to successfully homeschool their children.
2. Parents who have the ability to successfully homeschool their children.
3. Parents who have children who would particularly benefit from being homeschooled.
4. Parents who actually decide to homeschool their children.
Which is to say that many children who should be homeschooled are probably not, particularly because their parents lack the time, and many children who ARE homeschooled receive a very poor education because their parents aren’t up to the job. (And I know a half-dozen or so of the latter type personally…)
I also want to take issue with one of the points you raised above, which is:
I wish it were that simple, but that more or less Enlightenment view of how people’s minds work doesn’t seem to play out that well in practice, thanks to our brains propensities for things like confirmation bias and our ways of coping with cognitive dissonance. As a species, we’re just not great at being persuaded to believe things that are true when we already have a firm belief in the opposite, especially when that belief is strongly associated with our self-image.
Then avoid giving them a firm belief and discuss both sides of the issue.
Is it wrong to want your children to hold the same beliefs that you do, and to teach them those beliefs at the exclusion of others? After all, you who hold those beliefs are yourself a member of society…
My parents brought me up with one set of religious beliefs and taught me that all others were wrong. Was it wrong of them to do this? I’m sure that lots of the people here would answer an emphatic yes…
I would say you don’t need to teach them the alternate ideas yourself, but be willing to discuss them if they come up. Fair compromise?
If you truly believe that those ideas are wrong, then why would you be willing to discuss them beyond denouncing them? You wouldn’t want your kids to have anything to do with them. So no, I don’t see discussion as a requirement, but I agree that it’s good.
What parents shouldn’t do is limit their childrens’ access to information — not something I’ve personally encountered in any homeschooling families but it would appear to be more common in the US (from comments here).
Hmm. I see. It is REALLY hard to be unbiased in a conversation like that. I think what I’m looking for is not so much something concrete, but more a general atmosphere that allows children to disagree with their parents on such issues, even if the parents never really discussed the alternatives.
Yah, I don’t think we really disagree on the fundamental: people, both the parents and the children, must be free to hold their own beliefs.
But if you start trying to influence what parents may or may not teach their kids then you begin to impinge upon other freedoms. Atle’s comment above is pertinent.
And of course it’s all very cultural, and such questions would never even arise in many countries around the world. :)
As a teacher, I can tell you that we have long been aware of the fact that traditional educational methods don’t reach everyone. We give it a lot of lip services. Most professionals have taken “Multiple Intelligences” classes, where they study that sort of thing. Yet the basic outline of K-12 education has not changed in thousands of years. The basic concept of grade levels is in itself archaic. Yet we do nothing.
The scary thing is, in the US right now, because of the economic difficulties, less and less money is going to education. Schools are having to make do with less. Fewer teachers, fewer classes, fewer materials. That means there will be less experimentation, less reaching out to children who learn differently and more focus on teaching the one way that gets test scores up.
And as a teacher, let me say this. If I could home school my daughter, I would.
hasn’t changed in thousands of years…
Actually, it has.
That is, K-12 education as we know it has been practiced for approximately a century.
If you go back a century before that, most children in America tended to learn literacy and (maybe) arithmetic. Many children stopped formal schooling between the ages of 12 to 16, and a few went beyond that.
I seem to remember that during the late-Colonial period, the average age of admittance to Harvard was 16. Said Harvard students had to show the ability to translate Greek or Latin to English before being admitted…talk about skills deemed useless in the modern world.
Every once in a while, I’ll get an email claiming that an impossibly-hard high school exam was ‘typical for 1890’. I then learn, from my own research, that during that time period less than 15% of the population finished high school.
It really is amazing that America has gone from 15% graduation rates to 75%+ graduation rates. But then I ask…does a high school diploma from the 1990’s have the same meaning as one from the 1890’s?
Anyway, I digress. But I think I’ve shown that thousands of years is hyperbole.
Here’s why I’m so torn on the whole issue, and be warned that I’m going to repeat many of the points mentioned above. I’m admitting that I’m not really adding anything new, so feel free to skip past. However:
1. Socializing with other children does not build the social skills you need as an adult. Socializing with adults teaches you those things. This might be a danger if you literally never left the house, but any kid who does any kind of community activity–volunteering, going to church, even just being a part of a large family–will get plenty of interaction with non-parent adults.
2. I don’t know who’s supposed to do all this homeschooling. I realize that Shamus and many of the posters here aren’t advocating abolishing the public school system. Even so, for people to care about the quality of public schools, people of means have to have children in public schools. If the public attitude (I’m not talking about laws) moves in the direction of homeschooling, just as with private schooling, the public school is entirely populated by the children of people who don’t have the resources to homeschool. Public schools languish even more and you end up with a class of children with, functionally, no access to education. As a citizen, I care about this.
3. Public school education is already languishing, though, and the argument about some parents being innately more qualified to homeschool than others is offset in my mind by the fact that many public school teachers–particularly elementary and middle school teachers–are equally unqualified to teach their particular subject. I’m talking about 7th grade science teachers who, in a social environment, will say things like, “Math is hard,” and mean it. I’ve had some very good teachers who were very knowledgeable and I’ve had some teachers who were dumb as rocks. (A particular English teacher comes to mind, who was always mis-pronouncing stuff. She wasn’t very good at reading on the fly.) I blame the attitude passed down to college students that, if you don’t want to try hard, you can always go after your teaching credentials and some college out there will give them to you. It seems like we put many of these people in charge of the youngest children.
4. Also, there is already a class division between the students in public schools whose parents can supplement the school’s inadequacies during non-school time and the students who don’t have that support for multiple reasons. This is not a good solution in the long run, and, putting my citizen hat back on, does not ensure that the majority of children will grow up with the basic skills necessary to support and further a democratic, technological, and enlightened society.
5. Finally, I generally approve of people learning professions and those things being done by those people, for this reason (bear with me; I’m going to go through a couple logical steps): Most people get their college educations because of some thing they want to do. If I, say, get a physics degree, it is because I want to be a scientist and do research in a related area. For any other subject, particularly in any field that undergoes rapid advances, my understanding becomes fairly frozen in a place in time. I can keep up with some things in my spare time, and I may try to be well-read on these things, but they pass you by; it’s just what happens. The goal of education is not just to get kids to the point where they know exactly as much as the last set of kids to go through–it’s to get them farther. Every generation has more to learn about each of the different school subjects because they’ve advanced. So how to you really reconcile the desire for your kid to surpass you (general sense) with the fact that you’re the one teaching them? It seems like that’s a pretty good case, at least, for the cooperative homeschooling organizations, but it’s not exactly easy.
So, you know, if anyone knows how to fix that… Well, I’ll bake you a cheesecake, because I don’t. Because of this post, though, I am thinking more about using the resources I do have to have my own small-person-to-be homeschooled (by Grandma, since Mom and Dad both have to hold down careers to afford the whole thing) for some of the earlier years, and switching to a public school when the time seems right for little Spike. (Her name, until we pick a real one.)
I was about to give you the answers, but I hate cheese cake. :D
No, I think you should name your daughter Spike. That’s awesome.
Well, I do have an answer, but it’s a hard one and goes pretty deep. Basically, the difficulties you are struggling with are a result of a false philosophy. The core idea is “Through education, socialization, and knowledge, anyone can be made into a good person.” If we assume free will (and if not, then why are we talking at all?) then this is demonstrably false. If people can choose, then some will choose evil, because that is what they want.
Neither parents training, nor government sponsorship, nor rewards, nor threats can change a person’s heart. The way to a changed heart comes through Jesus Christ. Shamus alluded to it, and I believe this is the (fairly unsatisfying) “way to fix that”. You can’t fix it, only God is able.
We can talk all day about the details. Is it better to live among bad people to help them, or to live among good people to become like them? How much effort should we spend trying to improve bad people? How much can education change a person’s mindset? When is it useful? All excellent questions. But, if you are seeking salvation from government or society, you will remain unfulfilled.
If anyone knows another way to change a person’s heart and motivations, their pleasures and intentions, I would love to hear it.
P.S. My wife makes a mean cheese cake. Give it to one less fortunate than I.
…
What?
Is Jesus a mind controller?
You are saying that the only way to change from bad to good is through Christianity. This carries an implication that the only way to be good at all is through Christianity. Both statements are demonstrably false.
And also something Shamus never said, so you probably shouldn’t try to use him to support your argument.
Yes, that is what I am saying, with one niggling caveat: substitute “Jesus Christ” for “Christianity”. I know it’s petty, but the organized religion and the person have always been distinct entities. Shamus has alluded that he is a Christian of sorts. The central concept is, “We all bad. God is good. Jesus Christ! QED.” But I don’t claim to speak for anyone here.
I don’t want to start a flame war or “religious discussion” (so just nuke this whole thread if it’s out of line Shamus) but… here goes!
I trust you with this krellen. Would you please summarize the demonstration?
Barry White; his life was changed by music, not Jesus.
Moses was a good person. Mozes was not Christian.
QED: it is possible to be a good person and not Christian.
I’m at work and tired (it being 11:30 pm here), so I can’t think of an example right away, but for the second: anyone in the Old Testament who changes from bad to good, must have done so without Christianity.
“Logic” aside, if you aren’t open to the idea that it is possible to be a good person through any other moral or ethical dogma than your own, your worldview is either incredibly narrow, or incredibly biased.
Consider that, by what krellen said and you acknowledged as your point of view, it is literally impossible for anyone to be a good person other than a Christian. This in direct contradiction to what Jesus and, more explicitly, the Apostle Paul said.
Counter example?
Me.
I live by a moral code, do good works, and love unconditionally. This was not always true, but is now and has been for quite some time. I was changed by three things: love, life experience, and education.
I am not Christian.
Tell me I’m wrong.
Edit:
Your comment offends me, but it is your right to say it, even on my favorite blog. If Shamus decides that this reply is itself inflammatory I will withdraw it.
Thanks for the temperate response. I know this stuff really sets people off, and I’m always gratified when people respond calmly.
I want to add to this: who decides what’s “good” and what’s “bad”? Even things like unconditional love aren’t agreed upon because the term is just vague enough that it can change definitions depending on the context. It’s abundantly clear what it is, or what it’s supposed to be, but the ways it can be expressed will always be under debate.
From a purely pragmatic standpoint there are plenty of reasons not to steal and kill, the most blatant one being “I don’t want to live in a society where that’s acceptable because then it’s more likely it would happen to me.”
Myself, I don’t believe in objective morals or some kind of higher order, and I don’t believe peace and love are “good” just because they’re the human ideals we praise in our time. I do, however, think that war is a stupid waste of our resources, I like walking down the street without fear of being murdered and I suspect there’s something seriously wrong with people who feel otherwise, and stealing on a large scale would render society untenable so it’s probably a good idea that we enforce our economic systems.
In short: if someone isn’t stabbing you or taking your stuff, what does it matter to you whether they’re “good”?
I was home-schooled, and while I respect your opinion on it, I disagree, especially on socialization. My social development was nearly crippled, and it took me years to learn how to behave in social situations acceptably, well into high-school.
Maybe I’m the flip-side of you, I might have been ill-suited for homeschooling and public school might have been a better choice for me.
Granted, I learned a lot more then I probably would have in public school, but I’m not entirely sure it was worth it.
Anyways, just my 2 cents. Great series, thanks for the read.
Jericho- do you think it was homeschool that crippled you socially? Or just that you were different from the “crowd”, or your family was weird? There are socially crippled people in public school. Often when I see grown homeschoolers blaming homeschooling for their socialization issues they had I have to think back when I was in school. I was weird. I didn’t fit in and kids tormented me endlessly. To this day I am an introvert that has to try hard to get along in social situations. I mean no disrespect to you I just think that homeschooling doesn’t always deserve the blame for lack of social skills. What could school have done to improve them?
Yep. If you roll an 8 on your charisma score during character creation,even public school can’t turn it into a 18. Likewise, homeschooling can’t actually turn your 16 into a 10.
Your actual personality doesn’t depend entirely and exclusively on the school you went to.
[sorry for the D&D analogy, I just figured it demonstrated Aadel’s point accurately]
I like you a whole lot at this moment in time :-)
Very interesting post. I can only find one statement that I take issue with. (There are others that I’m not sure about, but I don’t have the experience with the American school system to know for sure.)
But I disagree when you say “schoolwork isn’t learning”.
Now, I understand fully that schoolwork wasn’t learning for you, and you got what you needed through listening. I never had that ability, however.
Listening to a lecture in class would make me kind-of-aware of what was being taught. But I learn by doing stuff. It wasn’t until I did a worksheet, or example problems, or something else (preferably something more interesting, but it wasn’t completely necessary) that the concept really stuck.
Would I have learned better if homeschooled? Who knows. All I know is that without schoolwork to reinforce what I was learning, I wouldn’t have learned enough to become a civil engineer, as I am.
So yes, schoolwork (not testing, but assignments) is indeed learning. But it is only one type of learning, and it obviously won’t work for everyone. Just as lectures won’t work for everyone, reading textbooks won’t work for everyone, etc.
Shamus learned states and capitals by the worksheet method. I can’t think of a more efficient method to learn them.
But a worksheet full of “Calculate x for a=x+b” (Or the equivalent) doesn’t teach a thing to anybody. The people who don’t know how to do it don’t learn, and the people who do know how don’t learn anything new.
Problem solving (NOT “Calculate x for a=x+b after determining a and b from the paragraph”) has some advantages in math, but a key feature is that they have to be unique. Things like “Sum all the integers between 1 and 100 inclusive” are problems once, until everyone knows how to get 5050 quickly; then “Sum all the integers between a and b inclusive” becomes a rote exercise.
The problem is, how do you determine the difference between a “problem” and an “exercise”? It’s extremely difficult to have different assignments for different levels in a single class, so you HAVE to go to the average. Personally, I would say that for an average person the easy ones should approach (APPROACH) exercise, while the harder ones should be problems, hopefully with some they can’t figure out. At least that’s what I’m used to, and it makes sense.
I can't think of a more efficient method to learn them.
Here’s how I learned them, no worksheets involved:
Wakko’s America
” a worksheet full of “Calculate x for a=x+b” (Or the equivalent) doesn't teach a thing to anybody” has been proven false a hundred times over.
There may be *better* methods to learn, there may be more efficient, faster, interesting, motivating,… ways for people to learn something, but it still works for most people.
To YOU this may not seem ideal; it’s still one of the most efficient methods of teaching that we have; with “efficiency” determined as the amount of paid hours needed to teach a specific skill to a group of people. Obviously you’d rather things were taught without regards to the money it costs, but we’re not there yet by a long stretch.
Repetition of a task helps form specific problem-solving pathways in our brain. By repetition – and ONLY by repetition – of identical or similar tasks can our brain learn how to tackle certain problems. Yes, that can lead you astray when presented with similar-seeming problems with a different type of solution – but in most cases it’ll be useful.
As much as I dislike repetition, this is a proven neurological effect, essentially the knowledge counterpart to “muscle memory”. It may be the primary means by which I learn, though the repetition is usually embedded in some larger project. Perhaps therein lies a better alternative.
Honestly, I have the most difficulty with History/Geography, whether in worksheets or lectures, because it’s rote memorization. Math, as well, can be difficult in that format, I agree. (It still helped me in Math, however.)
But it’s the sciences and applied sciences (Physics, Chemistry, etc) that worked best for me. You hear and read the basic concepts, but it’s while applying them to actual problems and exercises that I learned them well.
As you’ve shown by your comment, this sort of method obviously doesn’t work for everybody. But like I said before, it’s still learning. It’s just a different type of learning.
This is pretty deep and buried pretty far, but I do actually have another question I wished I’d seen in bold type:
Shamus, you’re 40 years old and talking about one education system, which at best was state-wide. How do you know any of this still applies?
At my public high school I learned a ton, and I was well-ahead of the curve. Teachers let me change assignments around to be more interesting, frequently blow off ones they knew I could already handle and gave us interesting and widespread discussion topics. A history class could easily launch into a political discussion and our world religions class sprouted into serious philosophical discussion that name-dropped Descartes and Plato and the like. I did musical theater, extra-curricular reading programs and played tabletop roleplaying games and was one of the most popular kids in school. Never suffered for dates, or parties or anything like that. Ask anyone, and I was a “nerd”, but that just wasn’t a big deal. Nobody wanted to be the stereotypical bully from some after school special, and when it came to making fun of people, you stuck to your friends so they knew it was cool. It was one of the best times of my life and five years on, I still can’t believe how good I had it.
The fact is, you’re complaining about a system being outdated and useless, and it already changed in the 20 years or so you were away. Kids are smarter (although arguably, they find new ways to be stupid), teachers are more reasonable, and the system is better funded. Granted, I’m Canadian and don’t want to make generalizations, but it just doesn’t seem like I ran into any of the problems you did, until you got out of school which is when I really started to empathize with you.
I live in Estonia and am going to school right now.
Only thing I can say is, nope, absolutely none of that holds true for my school. School still shit, people still assholes.
Much of this I agree with. “Nerd” is no longer an insult, at least among the more intelligent, popular crowd. (The way AP programs are set up, my community is essentially 300 or so smart kids in a class of 1000, with occasional appearances by others).
Political discussion was often skirted around (we never talked about abortion in my english class because it was too controversial. This was a class where we talked about the mosque being built near the 9/11 ground zero. And my US History teacher never told us her party affiliation.), but we’ve attacked it several times in my AP Government class.
It’s actually pretty amazing how varied the students are, to be honest. I’m going to take a guess and say it just depends. I’m sure there are schools where it is still much like Shamus describes, and then there are schools like ours.
I went to school roughly (2 years older) the same time as Shamus, only a bit west (Utah). My high school experience was much like yours. But.* My brother a year behind and a friend a year ahead had much the stereotypical bad high school experience, as did my wife and ex-wife. I don’t think it has changed much, save the people going and running the asylum.
*I know it is not proper grammer. I intentionally did to emphasize my point(lessness). Spelling on the other hand is completely my failure.
You didn’t actually spell anything wrong. Other than grammAr.
Disclaimers:
I was educated in a public school.
My grandmother was a public school teacher for 16 years.
My mother was a public school teacher for 30+ years.
My mother taught at the high school I attended, and I was her student in 5 different classes.
There is no single system that can work for every child. It’s simply not possible. Try to make a single educational system for every child to go through is foolish and shortsighted.
People decry (or at the very least express concern about) homeschooling due to a lack of standards, particularly national standards. The national standards for public education are absurdly low (may as well not exist), and the standards that actually matter are at the state level (highly variable from state to state and ranging from demanding to absurdly low). This is no different with homeschooling. Illinois has standards for homeschooled children. They have to meet the same amount of math/English/science/history/etc as everyone in public school. The difference is how it’s taught and learned. Yes, tests still have to be done for proof for the state, but how you get to that point is not dictated by a school board and the needs of the many outweighing the few. Is Illinois’ standards for homeschooling the perfect solution for kids? Of course not, but no system is perfect.
Personally, even with my family history, I was so bad with the arbitrary rewards system that I even turned down money for good grades from my grandmother once.
State standards for curricula and performance can also be arbitrary. In Maine, for instance, the private school I attended had to add a state history class in order to apply for accreditation.
in colorado, everyone was required to take state history in 4th grade, and then constitutional studies in some later grade. I think it’s good to learn about the place you live, and I can still spout off some of the interesting facts I learned in that class.
I’m sure that every state has something interesting about it, but it’s hard to devote an entire year (or even a semester) to a state, especially a newer one. Oklahoma is basically “trail of tears, land run, plus oil and natural gas.” (Note: OK is the 47th state, second last in the continental U.S., being founded in 1907. There’s just not that much.)
OK was the 46th. New Mexico and Arizona were the 47th and 48th, respectively.
Raar. I was close. Point is still valid.
Still feel bad, though. I should know that. Probably just got it stuck in my head that it was 47th. Maybe I’ll remember now. Wait, I got the second last in continental U.S. right, so I just got the number wrong. Then my math is just off. Now I’m confused :/
No, you didn’t get second last in the continental right. New Mexico was the second last in the continental. NM and AZ were not admitted on the same day, like the Dakotas; there was a month between admissions.
… I need to pay attention. 3rd last… I was wrong. Okay. Admit it, move on…
3rd last and 46th. Remember, self.
Although I have nothing to offer on the subject of Homeschooling or Education, I can say that my biggest concern about Home Schooling my children would be wether they’d be able to get jobs. I have been fortunate in going to University(here in the UK) and as a result I have a lifetime debt of £25,000 plus interest to the Government. I am currently unemployed, despite my considerable qualifications. However, despite the fact that for all intents and purposes it is my actual skills and experience they intend to hire me on, a depressingly large number of companies here have taken to automating their hiring processes via their websites.
It is impossible for me to communicate as a Human being with these companies. I cannot give them an impression of my real abilities and capacity for the job. Instead, I have to select qualifications, tick boxes and fill in 250 character boxes to describe prior work experience. At my previous Job, I had to try and actually modify one of these labyrinthine databases to allow for internal position filling. The idea was that people best suited for the job would automatically be assigned to it. The problem was that the nature of the software we used was strictly quantitative. If I assigned Qualification B to Position 1, then only people with Qualification B would considered. If i select Qualifications A-Z, then only people with ALL of those qualifications would be considered.
Long story short, I imagine that this worrying trend towards automation is actually moving companies further towards relying on qualification asessments. And the only way to get these Qualifications is to fork out money at a local or not-so-local College or Adult Learning Centre, and do busy work for six-twelve weeks to get a certificate.
In contrast, I sent my CV via email to a small local business. They had me in for an interview within 2 weeks. They were able to asess me on how I presented myself and how I responded to general questions. I didn’t get the job, but in the process I learnt that I didn’t really want the job anyway. So, in conclusion, my point is, if you want your kids to go to University or work for something like IBM or Halliburton, you’ll have to put them through public education. Take them outside the system, and they can apply more readily to small companies.
Wait, thats not a bad thing….
I offer the following rebuttal: I don’t WANT to work for a company that can’t be fussed to use a real person to rummage through the CVs. There will always be places of employment that do things the easy way. These places will always skew towards the public school graduates. There will also always be places of employment that are run by real people who are interested in hiring other real people. These places will still be accepting and looking through CVs the old-fashioned way. I’d much rather work for the latter because it would be a work environment in which I could thrive and we could form a relationship of mutual benefit (I do good work for you which directly or indirectly increases your profits which you will use to pay me a wage that keeps me eating to continue to do good work for you). Companies with an automated CV-scanning process obviously don’t value me as a person from the outset. I am an algorithm to them and will continue to be one as long as I work for them. When the algorithm that is me ceases to fit into the algorithm that is the company they will cease to pay me without ever once knowing who I am, what work I’m doing for them, or anything else. I don’t care to work there so I’m not particularly put off by the fact that their employment screening process makes it impossible for them to sell them on ME.
I can’t imagine a company not even conducting a cursory interview, except in a minimum-wage, entry level position like Shamus’ initial fast food job, and maybe not then.
My department had a speaker come in September to talk about hiring in biomedical science industries. His firm specializes in – and I couldn’t make this up – outsourced human resources. In other words, they make all of the preliminary hiring decisions for other companies on a contract basis.
He said that all application submissions are automated and only those that meet set criteria in their parsing algorithms and are identified as the best 5% for a given position are ever seen by an actual human. Even then, he instructed us on the use of keywords and advised against the use of non-prescribed synonyms lest prose ourselves out of job opportunities.
Thus making my point for me. I don’t believe I care to work for a company that uses that firm for hiring. Luckily I’m not in biomedical sciences so no worries, eh?
But yeah, I’ve seen some of the ugly side of non-human resources by watching the hubs in the workforce before he quit playing with computer chips to go play in the dirt. Honestly I don’t envy any of you in the job market to work for others.
“Non-human resources” = an annoyed minotaur behind a desk with a towering stack of memos and a cold cup of coffee.
As to the job market thing, that talk was just one more thing that convinced me to never work in the biomedical industry. I’ve too much of a basic science bent and a problem with authority anyway. So it’s academia for me.
Great series, It has really reinforced for me the idea that educational systems need to cater to each child individually.
I have had the fortune of skipping most of normal schooling. I dropped out after fourth grade and went to university, graduated at 18 with a Computer Science degree, and I am currently finishing my Game Development qualifications.
This would not have been possible if my mother hadn’t recognized that I was incredibly bored with school, and there is very little that I would have learned in school that I haven’t taught myself.
Though i largely agree with all that was written, my education helped me with discovering my interests. Having focused solely on science in high school i learned about my strengths, weaknesses and my passions. And while it was a miserable experience being the “weird kid” and one of a few people actually being bullied in school (small school). The education itself helped me decide what college degree to pursue and that resulted in meeting like-minded people and having the time of my life.
Babies learn to walk between 9 and 18 months. That's a really large window. Imagine if we sent babies to school to teach them to walk. Imagine the hassle of of trying to make kids learn to walk before they were ready, and the hand-wringing over all of the “under-performing” babies. Just picture how wasteful this would be, since by two years you can't tell the difference between the early walkers and the late walkers. This is public education.
We cannot forget the other ramifications. Babies that learned to walk early and on their own would still be required to go through all the “walking lessons”, and even babies who have already learned to walk would be required to take frequent “walking tests” to demonstrate that they still know how to walk. Walking babies would be required to “show their work” in order to demonstrate that they understand the concepts of balance, center of gravity, and momentum – and babies that could not show the math would fail, despite their demonstrated proficiency.
But yes – you’ve hit the nail on the head with this analogy!
Thank you for your story. I enjoyed reading it, and although I’d like to get involved in what is no doubt a very interesting debate on education, I’m going to keep my blood pressure low by not reading it.
Your children spent the day with me awhile back. You live in a rural/suburban neighborhood. I live in a diverse, and sometimes rough urban neighborhood. I took them to the park down the street from my apartment, and watched your children interact with ease [on their part]with the other children there. Your son approached two boys, one much older, one younger, and boasted about his knack for swinging very high. The boys looked and acted very differently than your son. I know most children would have been hesitant to approach them, but your son only saw potential friends. Your daughters did the same. When we left, they all ran to say goodbye to their “friends”.
I found this remarkable and wonderful. They were not intimidated by the new surroundings, or different kids. They were very socially graceful. I was proud to be their aunt.
Bingo! People worry all the time about how non-standard methods of child-rearing perform. “How will they do on tests?” and “How will they become socialized?” To which we need only respond, “Look and see!”
XD “Who cares HOW they did it? They ARE!”
I may have missed/forgotten something from all the posts, but I take it that this whole discussion on schools is targetting the grade-school system (up through high school).
Clearly college education is different because it has only [mostly] students that want to be there, and are willing to pay for the privilege (or are smart enough for scholarships).
For grade-school, I am mostly in favor of the homeschool concept. But I do have a question. How do you take the homeschooled knowledge, and get into college? Particularly some of the big-named universities?
Um, you do know that Shamus never went to college right? I did and barely use what I learned other than as an “expert” because people are all about that.
And colleges adore homeschoolers, especially self-directed ones. You create a transcript and send it in and take whatever tests necessary for that school. All of the homeschooled kids I know who chose to go to college are doing excellently, enjoy their classes, and are there because they want to be unlike most of the public schooled kids. Professors enjoy having homeschooled kids in their classes (especially unschooled kids) because they actively enjoy learning and are interested. (I am friends with many college professors and it is an ongoing conversation about how horrible it is to have public schooled kids in class.)
“You do know that Shamus never went to college right? I did and barely use what I learned other than as an “expert” because people are all about that.”
Whereas I discovered what I wanted to do with the rest of my life because I went to college. All growing up I never had the slightest interest in computers. Then my parents got me one for high school graduation because I’d need it in college, and I thought, “Hey, this is kind of neat. I’d like to learn how to take care of this.” And then one year one of my roommates was taking a C++ course that looked really interesting, so I took it the next semester. And here I am six years later working as a sys admin at an aerospace company.
I’m not trying to argue against your point (and I know you weren’t saying college is useless for everyone), just presenting a different experience.
But it wasn’t college that sparked the interest in you. It was getting the computer, which occurred prior to you leaving for college. If you’d gotten that computer eight years earlier what would have happened? If you hadn’t gotten the computer at all, would your college career still have been the same?
I think even if I had gotten my own computer 8 years earlier, I wouldn’t have enjoyed it the same way; I just wasn’t ready for that. Had I not gotten the computer at all, college would have been much different. Far more annoying, in fact. I can’t imagine I would have enjoyed school as much if I had to traipse over to the college and wait for one of the crappy lab computers to open up every time I needed to do my homework.
So yes, while it was getting my own computer at the right time that sparked my interest, it was still college that fanned the flame. I never would have learned to program on my own; I needed the structure of a classroom setting. And while I’m not cut out to be a programmer, those skills deepened my understanding of computers and how they work, and have made me a better geek.
I was home-schooled all the way up to college, and ended up getting a scholarship at CUA’s graduate philosophy program. The place I did my undergrad had an admission guy specifically dedicated to homeschoolers, as will any college worth its diplomas. Homeschooling in no way disqualifies you from a university education.
Very true.
I was wondering about this… Very glad to hear it.
One standard and well-respected method is to attend a “junior college” or equivalent part time during highschool, to build authenticated credibility. I got into a good school with no problems that way.
That said, College was a colossal waste of time and money (for me anyhow) and you should avoid it if at all possible.
… You say it’s a waste specifically for you, and then say YOU should avoid it. College, just like school before it, is good for some people and not good for others.
College isn’t for everyone. It’s like fried calamari that way. I recommend that folks try both to see if they like it, unless they’ve already found their perfect fit. (Like Shamus with code, my buddy Scotty with the Marines, or my three-year-old with tomatoes.)
College introduced me to cultural differences that I never would have encountered in my very homogeneous home town. Liberal arts requirements also introduced many subjects I’d otherwise have avoided but now enjoy: anthropology, philosophy, East Asian art, theater, biblical literature, etc.
Besides which, there’s really no other place to learn at least the laboratory portions of my upper level chemistry and molecular biology courses (though the latter is changing somewhat if you can find a used thermocycler on Ebay and don’t mind smelly microbes at home).
Seriously? I am just NOW coming upon this site?? OH my heart is broken.
This is the most amazing piece! It says everything I’ve been trying for years to convey. It’s amazing..and I’m sharing it with everyone.
My wife and her siblings were home schooled until highschool. They are all now: a nurse, a lawyer, a teacher, and a banker.
Interestingly enough, the teacher stopped teaching so that she could home school her own kids. They all entered into a private school around 4 or 5th grades due to not learning very well at all. The 8 year old couldn’t read or write much beyond her name. Whether home schooling works has just as much to do with the parent(s) teaching as it does the kids learning.
I read a news article yesterday about how some people – that is, ministers, officials and such, not “some regular citizens” – want to add hours into the school day here in Finland.
Fun fact: Finland has been on the very top of the PISA ranking in several years.
These people want to make school days longer because… because what? Because other countries have longer school days? Seriously, that’s all there is in the news article. Finland has the “3rd shortest school days in OECD countries,” we are so helpfully reminded in the article, by a quote from the secretary general of the Mannerheim League for Child Welfare.
That and “short days causing problems for families” are the only “arguments” for it in the article.
Basically, Finland looked at things and said “our education has a very good reputation, how do we punish children for it?”
WHAT THE HELL IS GOING ON?
When I was a kid, I had long school days simply because it was a more convenient way to work with parents’ schedules. It does not strike me as a very good reason.
LOL I had pretty much this argument with my sister (a US public school principal) a week or so ago. She’s in favor of even longer school days here in the US because our kids aren’t “up to snuff” on the PISA rankings. My point was “Look at who IS on top and emulate them. Finland has shorter school days, starts mandatory education later, and ends it earlier. So if we want their ranking, why would we do the opposite??”
Two ways of looking at this:
First, Finnish officials, ministers etc. including quite a few “commoners” view the popular culture impression of USA as something to strife for. Pop culture says education USA has bad education, so Finland needs to have one too. (Of course, they most likely looked at the longer days and decided it must be good because it’s USA doing it.)
Second way of looking at this is that in Finland the people deciding about education are bloody idiots. They’ve been actively trying to make it worse on all levels for well over ten years by aping what other countries are doing. And because they are bloody idiots they’re aping the wrong stuff.
Normally I’m not big on correcting people’s grammar and syntax on the web but I’m just going to get this one out there because it has the potential to get you into trouble. “Something to striFe for” would mean “something for which to go to war.” I think the word you’re looking for there is “striVe” which means “set as a goal and work to attain.”
Other than that, good points. If the first scenario is the case I sincerely hope someone shakes some sense into those people because the US educational system is not something to strive for.
Thank you. I was wondering about that one when making the post, but it seemed close enough according to the dictionary. Really should’ve checked both spellings.
How do you take the homeschooled knowledge, and get into college?
My 17 year old son, who has never been to school. already has one $80,000 scholarship in the bag, (with an invite to interview for the full ride) and he is being aggressively recruited by a lot of schools, many that you have heard of. And this is for academics, he will not be playing any varsity sports.
The reality is that it is much easier for a homeschooler to stand out from the crowd. In fact, I’ve been a little surprised at how little of an issue this has been with college applications. Pretty much every college now has a process for dealing with homeschoolers, and most of them seem to want homeschoolers.
Excellent! However, perhaps consider skipping college entirely and going straight into the workforce. If a university is trying to give away the “education” in order to secure a clearly well performing student, what exactly will they be able to teach him? Once he gets about ten years of experience (the length of a doctorate program) his diploma may not be worth the paper, let alone the wasted years.
…Or maybe they think being able to say “X went here”, having him think fondly of the school, or simply having him as a student will bring in more money in the long run than his education will cost.
I’m *really* curious how many long-term jobs you think there are out there for kids with just a high-school degree.
I summit, in response to your question, the following link to a list of 100 entrepreneurs who hit it BIG without a college degree. It includes some interesting names from Benjamin Franklin to the guy who started Tumblr.
I hit my face on my keyboard when it put Christopher Columbus on the list. Of course he was mostly home schooled! They didnt have public schools, and they didnt have schools at all if you were a commoner. Also, there werent very many schools in America in Jacksons days on the fronteir. The fact that he became a lawyer is amazing.
I would point out that I said jobs, not entrepreneurial opportunities. The idea that people will be jumping up and down to hire the kid because a college wants to let him go there for free seems very debatable.
Also, a hell of a lot of people on that list made it on that list before modern restrictions, or back when having a college degree was a 1% thing, not a 10%, 20%, or 30% thing.
… 80,0000? That’s way, WAY more than enough for my state universities for 4 years, and a HUGE (more than half) chunk of an ivy league school.
*applause*, shame you didn’t run for president! *laughs*
I wish I had homeschooling, your kids are lucky Shamus, you are a level headed and logical thinking parent, I assume your wife is similar.
By the sound of it your kids are very objective in their view of the world, which in my opinion is ideal.
Am I correct in assuming the following Shamus:
That rather than encouraging your kids to only one specific way to solve a problem, you instead encourage them to come up with a valid method of solving the problem?
This is something that most school programs fails to do.
Note! For those no clue what I’m talking about. Teaching someone a specific way to solve something only makes them good at solving it in that way or under the same conditions.
Teaching someone to think of a method to solve something teaches them to become more adaptive in problem solving, and more capable of dealing with unknowns.
oh yes. I have no idea how many times I’ve been trying to help my sister through a problem and she says “but that’s not the way the teacher said to do it!”
To be fair, though, sometimes you have to do things the hard way or the long way for later use. To be unfair, though, that means you picked a bad problem. If a method is useful, then assign problems where it is the most useful.
Mr. Young, there’s already lots of people that have thrown their two cents into this discussion on education, and since I was a bit unconventional in my schooling (twelve years at private schools, currently attending an engineering college), I don’t really think I have a say.
So I’ll just say this:
Thank you so much for this Autoblography series. Seriously, I think this is one of the best things you’ve done on this site.
The way you’ve written it leaves us in awe and in wonder about what will happen next, even though we knew that everything turned out alright for you in the end. Your writing style is clever and funny when it needs to be, serious and somber when it has to be. Never once did it feel boring, and at the end of every part I was left wanting more. Everything just flowed naturally.
My favorite bits would have to be the day you finally got out of the Dark Years, and when you met the future Mrs. Young. Beyond that, your recollection of the events was astounding, and did a great job of placing the reader in your mindset. When you were stressing yourself out at the college you went to, the writing style made it seem even more stressful. When your life turned around after the Dark Years, your writing style reflected the pure euphoria you felt. When you were dating Mrs. Young, the Adorkable-ness on your part and the unconditional love on her part made it really heartwarming.
In short: Thank you, Mr. Young. This was a great read.
Now, let’s just hope your novel is as good as this. :)
I was lucky enough to have attended a succession of public schools where the teachers were knowledgeable in the fields they taught and given enough leeway by the administration to engage their intelligent students. Or, I should say, I was lucky enough to have had parents who went out of their way to find and then send me to such public schools. (The faculty might have thought them just another pair of pushy busybodies, but I suppose I managed to vindicate them.) The sheer economics of the situation mean that few schools can attain this distinction, but they are out there. A hint might be a high concentration of AP classes.
No nontrivial education can succeed without the involvement of somebody who understands the student, and nobody understands the student better than the parents. Whether it’s by escaping the system or simply making it work to your advantage, education – and, by extension, parenting in general – produces the best results by the application of proactive involvement. I’m half your age and I can say such things, but I can hear you thinking, “Yes, well, wait until you actually have to do it, sonny!”
It was a great read.
As someone who has been homeschooled for my entire life (save for a couple of months of preschool) it’s really nice to read something from someone that I admire so much that addresses the complaints I’ve constantly heard about my education. The biggest being the one about a lack of socialization. I think when most people hear homeschooling they assume that means sitting at a desk and working all day, just at your own home rather than at a school, when in most cases that is wholly incorrect. Granted, I do some of that now as a necessity for my diploma, but most of my life I never had to sit down and work more than an hour a day at the most. My city had quite a large homeschooling community, organized groups such as one where people could (but didn’t have to if they were shy like me) give a little presentation about something tangentially related to a theme like history, survival, engineering, or even toys. Every month we’d host it at someone different’s house, and we’d all get together and play for a while, then go listen to all the presentations, then go play some more. These were big groups with quite varied ages as well, probably upwards of twenty people sometimes, ranging from infants to about sixteen, not counting parents. We also did all kinds of tours, classes, and sports days. I also had quite a decent amount of friends over the years. Maybe not as many as if I were in school, but if I had been more outgoing there were certainly enough that I could have had more (especially considering that some homeschooling families have absolutely ridiculous amounts of children.) Basically, my point is that anyone who says homeschoolers don’t have any oppertunity to socialize are making what I understand to be an almost universally incorrect generalization.
While doing all those activities, I also did do some more traditional (and nontraditional) learning at home. My elder brother went to preschool for a year, but my parents felt he wasn’t ready for kindergarden yet after that and decided to homeschool us. I’ve tried all different styles of homeschooling; when I was quite young it was mostly a focus on reading, basic math, and history (which both my brother and I were interested in.) Then we got more into working with textboooks my Mom bought with her still teaching us the material before we did the work. Then we did a couple of years of unschooling, which at the time felt like getting a few years off from learning, but when looking back I realize it was incredibly educational.
Once we hit highschool we went back to something a bit more structured, using math and writing programs that instructed with DVDs and textbooks. The writing one didn’t work for us, so we stopped after a couple of weeks, but the math one is great and very effective. In the last few years I’ve been taking “regular” courses online, because it is unfortunately very tough to get a job without a highschool diploma. I eased into it at first, just taking one fun computer elective over the course of a year in addition to continuing with the math. The next year I took another computer course that looked good and a social studies. After that I took a much heavier five course load with some more intense subjects like accounting and English. This year I’m just taking the final English course because of weird regulations involving adult diplomas, so I’ve taken up working on a novel which is something that I’ve always wanted to do, but previous attempts haven’t gone beyond a few pages. Forty three pages in after a couple of months and with a good outline laid out, I’m feeling pretty confident this time. :)
Woo, while not nearly as lengthy (or interesting) as Shamus’s, that may be a bit more of my life story than anyone cares about. Maybe its time for me to start a blog.
can’t you get a GED by taking a few standardized tests or something like that? It’s essentially equivalent, and I thought that’s what most homeschoolers do. Or maybe I’m completely wrong :/
Could be where you are, but since I’m in Canada the rules are a bit different =/. I believe it’s possible to “challenge” a course and write a test to prove that you have the knowledge for something such as math, but it’s not a method I’ve ever really looked into or heard of anyone else doing. The “weird regulation” I mentioned is not so much logically problematic as it is a personal annoyance. The rules used to be that to graduate you needed English 12, Math 11, Social Studies 10 or 11, a grade 11 science and X amount of grade electives. So when I was grade 10 equivalent I took the Socials 10 course and planned to take all of the 11 and 12 courses in the appropriate years, using the Social Studies as an introduction to doing a more academic course. Unfortunately, our premier (the person in charge of the province) made some incredibly unpopular political decisions that culminating with his resignation, and his replacement decided to change the graduation requirements to include grade 10. So when I was looking at my options this year, it was either a whole ton of courses over the next year (about 14 I think?) or just go for an adult diploma, which only requires English 12, Math 11, and three grade twelve electives, the catch being that I can’t graduate until I’m 19, which having a late September birthday complicates. So it’s all kind of weird, but since I have no idea what I want to do once I graduate at least it gives me an extra year to think on it. :)
Another voice to say getting into college from being homeschooled wasn’t hard – I was homeschooled from 6th grade to highschool, and managed to get into a great local college and get a degree no problem.
Unfortunately, I have problems suggesting homeschooling as heavily as Shamus does. While it’s not reflective on all homeschoolers (obviously, as I am one myself), some of the most intolerable, intolerant, ignorant people I’ve met have been homeschooled or homeschoolers. I think part of the problem is that it’s actually a hard task for the parents; it’s easy to say that intelligent parents should be allowed to homeschool, but I feel like there still needs to be some sort of standards in place, to prevent parents from raising children with no “real” education. At least those in a bad public school can try to seek out knowledge on their own, from their favorite teacher or whatever. But someone with bad parents who is being homeschooled is basically screwed, and that’s what doesn’t sit right about me.
I was in that kind of situation and I found ways to get books from the library, discuss taboo (within my limited circle) topics on internet discussion forums with educated people, not to mention the whole slew of resources that were on the internet. I eventually found out I could be more open about my questions/interests without repercussion, but when I was starting out that was invaluable.
It’s easier than ever to get your hands on knowledge these days, and kids are very clever. I’d even say homeschooling allows more opportunities for breaking from the mold because there’s no way your parents can monitor you closely 24/7, and a typical homeschooler will have a lot more free time because s/he can get through their work a lot more efficiently.
That’s no guarantee they will. I know one family that was super strict with their kids; they weren’t allowed to play video games, and the only music they could listen to outside of hymnals was classical. Let me put it like this-I went to a conservative church that banned Christian rock and considered the King James bible the only valid english translation and these guys didn’t think it was strict enough. Their kids are still very much stuck under their thumb, both of them living at home, one of them married to an army man that now shares the basement with her. It is pretty much the worst case scenario as far as religious homeschooling goes.
But you know what? They (the two kids) never tried to break out of that. When I started questioning my conditioning, any challenges I posed to them went right over their heads. Part of me wants to say they were afraid of disrupting the status quo, another part of me thinks they were content like that. Probably both are true to some extent. I know they did things without their parents’ knowledge that are taboo even by conventional standards, I know they had a bit more freedom than they ever fully exploited, so while I hated what their parents did to them at this point it’s on their shoulders. If they want out, they have to break out, and if they wanted out they needed to use their intelligence more fully than they did.
And for all the bad things I can say, they’re very smart. They’re socially dull and their heads are filled with a lot of empty rhetoric designed solely to defend irrational beliefs but they have a ton of book knowledge and are very competent at anything they set out to do. They’ll do just fine economically when they’re on their own, the question is where they’ll go from there.
Shamus Wrote: “I don't think there is a simple answer that will fix everything.”
A simple answer that will fix everything? No. However, there is a simple answer that will fix everything that CAN be “fixed”–get rid of government schooling. Privatize the whole business. Completely. No vouchers. No government-assigned requirements or curricula even for private schools and homeschoolers. (I don’t know how they do it in PA, but in a lot of states, homeschooled kids still have to take standardized tests and their parents have to jump through a ton of hoops. This also needs to go.)
How will this fix things? People will be free to seek out and find the education solutions that work for them or their children. Schools (and individuals) will be free to offer a wide variety of customized education solutions.
So why hasn’t this been done? Because people react hysterically to the idea of just leaving other people alone to figure out what works for them and what they can afford. If we don’t FORCE people to go to school NOBODY will EVER LEARN ANYTHING OMG!!!!
Is this true? No–and even if it were true, it would not justify taking people’s freedoms away from them. Some people eat bad food and ruin their health. This doesn’t justify putting them on a government-mandated diet and exercise program or fining them or locking them in jail if they don’t comply with it.
That being said, I am in favor of one form of government intervention re children that does NOT take place nowadays. If you violate your children’s rights, your children get taken away. Permanently. You do not get to take your former heroin-addicted self to court six years after the police took your twelve starving kids away from you and make some claims about how you’re clean now and you WUV your kids SOOO MUUUUUCH and get them back. You do not get to fight over custody of children placed in foster care for years and turn the life of those kids into a living hell. Why? Because kids have the original rights. The rights of parents to/over those children are derivative rights legally assigned to them *because* they provide for those children. If they fail to do so, they forfeit now and *for all time* any rights regarding those children.
That, the government can and should mandate. But not education. If your parents, for whatever reason, don’t provide you a formal education, you can, of your own initiative, supply that lack later in life. If they fill your head with nonsense about mystical spirits, leylines, and sacred rituals, you can still change your mind later in life. If they beat you up or starve you or lock you in a tiny room, you may be damaged permanently. THAT makes them criminals. Not lying about their address to try and get you in a different school district. :P
Or just copy what Finland does. Which is quite the opposite.
I’ll just say straight up that your idea is terrible:
Look at catholic schools in the UK.
Look at what happens to teachers that aren’t unionised.
Look what happens to kids whose parents don’t have the ridiculous amounts of money it takes to get into a would-be decent private school.
You just need a competent government. Which means Scandinavia is a good place to be.
The biggest reason the U.S. government is incompetent (it is, in a way. The way it was designed and the political atmosphere has issues, occasionally), is that the population is so diverse, ethnically and especially socio-economically. Some public schools are just fine, and others aren’t. What needs to be done is to figure out what makes the good ones good.
As I understand it, schools in rich neighbourhoods get more than those in poor ones.
That right there would seem enough to screw up a system.
The problem isn’t the diverse population, but the way governing is so decentralized. The federal government has too little power, and the states too much. There’s also too much of an “us vs them” mentality resulting from the two-party system, rather than a “good solution vs bad solutions” thinking you get with a multi-party system.
The taxes are also too low. And capitalism is broken. Just putting that out there.
The federal government has too little power, and the states too much.
Yet somehow a great many of us would argue we have exactly the opposite problem. Funny that.
Welcome to America.
More like the founding, and ongoing argument, of America, from ALL the way back to what, 1776?
“Look at catholic schools in the UK.”
Not just the Catholic ones of course. There are 4,456 Church of England, 1,708 Roman Catholic, 26 Methodist, 52 other Christian, 28 Jewish, 4 Muslim, 1 Sikh and 1 other(?) state funded faith schools in England.
We also have religious education on the curriculum. My youngest went to both CofE and RC primary schools and was taught about non-Christian religions in both.
It’s mostly that I wanted a specific example, and that’s what came off the top of my head. But yes, most faith schools have the problem of teaching the kids lies and fiction, and if every school were to be privatized, I can tell you what the result will be…
No, people react hysterically to the idea that a child’s access to education would be dependent on their parents’ economic circumstances. You are advocating an education system currently employed in rural India and sub-Saharan Africa.
… and given to whom exactly? It can’t be the government, because then the government would be responsible for educating those kids.
You have a very optimistic opinion of both the malleability of the adult mind and of the ability of children to ignore emotional (non-physical) trauma.
“No, people react hysterically to the idea that a child's access to education would be dependent on their parents' economic circumstances.”
Isn’t this already the case, though? You have to send your kids to the school in your district, which is funded by the taxes from your district. Poor family = poor neighborhood = poor school, while rich family = rich neighborhood = rich school. If you want to send your kids to a better school in another district, you either have to move (which assumes you can afford to live in the better neighborhood), give custody of your children to someone else, or forge papers saying your kids live with someone else and risk getting convicted of a felony.
Sane countries don’t do it that way.
Things used to work that way. And a lot of people didn’t get educated, in part because they couldn’t afford it, and in part because many parents saw more value in putting their kid to work in the fields. Yes, this actually happened. I know people who used to get hauled out of school once their passing was inevitable so they could work in the fields.
There are many, many bad parents who will not send their kids to school if they do not have to, and many poor people who won’t be able to send their kids to school because they won’t be able to afford it. As far as I can tell, you expect these kids to catch up in later life. In addition to being massively unfair, that’s also likely to be nigh-impossible.
Oh, and the freedom to be forced into failure from birth is a greatly overrated one.
No. No, no no no, no, no no no no no no, no, no (!), no.
“Privatize everything!” has never, ever worked. People with power (ie money) will use the resources they have available to consolidate the power towards themselves.
Everyone else, who does not have the resources available to consolidate more power unto themselves, are left further and further behind. There’s less of the pie available to them because the big pie eaters own the bakery, get the bakers to tell them when the pies will be ready, which pies will be ready, etc. etc. By the time the average person shows up – even if they had been trying REALLY HARD to get there first – all they’re left with are crumbs in a tin.
Education is one of the few (and I mean VERY few – less than 5, for sure) ways to break out of the cycle of fat cats eating pie. Letting the powerful work their tomfoolery on that system will result in feudalism. Powerful ruling classes and subjugated peasants with no hope EVER for upwards mobility.
The USA is famous for already having that social rigidity crystallizing. Why would you make it worse?
Shamus I completely agree, but that’s not saying much; We had the same thoughts before you wrote it down. I hope what you have written is able to convince those who wish to require state-sponsored indoctrination that it is not the best course. I am glad to hear that there are others in the world who are dissatisfied with the waste (in both potential and in practice) of bulk education.
Comments were tl;dr though I’ll probably go back over them later.
Yep, went through and read a bunch. The whole “cool and don't post mad” thing kept catching me under the chin. Here’s a free sample:
“AAAAUGHHH! You morons! What’s wrong with you? Don’t you know anything about logic? Statistics? How did you even survive long enough to learn to type? Where do I even start? What you just said is just so… what?”
It goes on and on like that in my head.
So, here’s to all the excellent comments and cool headed responses to what must appear to be infuriatingly stupid ideas (my own comments among them). Well done everyone!
But someone with bad parents
who is being homeschooledis basically screwed, and that's what doesn't sit right about me.
FTFY ;)
I don’t agree with that. I know plenty of people who have had bad parents of different cuts, who managed to turn out OK due to the ability to pursue things on their own, find help elsewhere, or make escapes elsewhere.
Children don’t have much independent power as it is, a child with little independent power who isn’t introduced to other adults looking out for their interests and even other kids and other kids parents necessarily?
Besides how would you judge it? The parents might just be crud at teaching people things and the kid is in no position to demand they’re schooled. The success of homeschooling involves every parent being good at evaluating their own teaching ability and has no place for kids being taught nothing because there parents have a bad idea of their own ability.
As I said elsewhere, your parents don’t need to be good teachers for you to learn, you just need to be dedicated and have the right resources available. If your parent isn’t getting you to a point where you’re able to grasp a topic, any parent that cares is going to hire a tutor or buy books relating to the subject. Depending on what it is, it might even be possible to try it firsthand and practice as you’re learning.
When traditional schooling doesn’t work, the kid is basically brow-beaten until he conforms to the system. When homeschooling doesn’t work, you alter your methods until it does. A roadblock isn’t the same thing as failure, failure is giving up and/or not caring about your kid in the first place.
You make many excellent points, Shamus (as usual).
My concerns about homeschooling/”unschooling” are mainly cultural.
American society is already highly anti-intellectual. And whatever the potential virtues might be (and it sounds like your children are benefitting well from this arrangement), my concern is that home-schooling is primarily of interest, not to parents who want to EXPAND their children’s education, but to parents who want to CONSTRAIN it.
Hide from science, here, read this Bible instead.
I think certain minimum national standards for education are a good thing. Maybe there’s no stopping parents from raising their kids as creationists, but doggone it, their kids should at least be required to have a minimum basic understanding of what evolution ACTUALLY IS before dismissing it.
Certainly, standardized education can go too far. And it’s insane that, for example, to get a decently-paying programming job (which is something I was highly interested in from my first exposure to computers), I had to get a piece of paper from a university, which required me to pass multiple courses in Calculus and Differential Equations (which I loathed, and has zero to do with programming) first.
But I do think we need a certain basic “competency” level of required education, with enforced standards, prior to “follow your heart, learn what interests you” — which admittedly, would have served me very well…
“Maybe there's no stopping parents from raising their kids as [evolutionists], but doggone it, their kids should at least be required to have a minimum basic understanding of what [creationism] ACTUALLY IS before dismissing it.”
See, this is why I homeschool my kids. Creationism is awesome. It’s supported by geology (the layers are flat!), physics (thermodynamics!), biology (this would take a lot more explanation), and most of all, history (genealogies to Noah, nations being named for their patriarch, deification of ancestors, flood legends, etc.) and philosophy (the meaning of life, ethics, etc.). It’s illegal, according to the supreme court, who said it was religious in Edwards v. Aguillard, to discuss it in a science class. Making something religious doesn’t make it false, and yet our government categorically rejects anything religious; thereby, it rejects what is true. Homeschooling is the salvation for my kids.
I advise that you consider just how much evidential support evolutionism has. Is is any less of an extrapolation there than you get with high caliber creation scientists? The motivation is certainly different between the two (humanism vs. Jewish history), but they’re looking at the same evidence. Perhaps you don’t know of any reputable Creation scientists. Look up Dr. David Menton, Dr. Steve Austin, or read Dr. Carl Werner’s book, “Living Fossils”. You’ll find it interesting, even if you don’t find it convincing. Do you think that these men needed more or better education?
Read “JUSTICE SCALIA, with whom THE CHIEF JUSTICE joins, dissenting.” here:
Creationists may have lost the vote in the supreme court and in the court of popular opinion, but we are certainly on the side with the evidence. To force all families in America to conform to wrong ideas is, itself, a wrong idea.
You make Unbeliever’s point for him remarkably well.
Perhaps we should stop giving tests to the students, and simply make the _teachers_ – including homeschool parents – pass a test before they’re allowed to teach.
What I read from that is that you are a creationist because you dont understand geology, thermodynamics, history and apparently philosophy has a say in anything besides dealing with morals.
Im interested in the biology part though, if you could be persuaded to type up your explanation.
Nononononono.
[Don’t get me wrong; I’m interested too. But I have *ALREADY* annoyed Shamus by trying to start a religious thread once this week. I will not do it again.]
This is about HOMESCHOOLING, and my concern that some people use it, not to educate, but to indoctrinate. (Public school at least provides a tiny tap on the eggshell. Hey, look, there’s stuff you’re not being told about at home, if you’re interested…)
There are plenty of opportunities to debate creationism on other sites…
I’m Shamus Young, and I endorse the above message.
(For clarity in this messy thread: I’m talking about Unbeliever.)
Public schools indoctrinate quite as much as homeschools do. They’re just using different materials.
Imagine the issue was the application of survival of the fittest in human morals. Would you begrudge a concerned parent for removing their kid from a school where this idea is promoted? If atheistic evolution is as true as “unbeliever” makes it out to be, I see no reason why teaching children that the mightiest nation will rule the lesser ones is wrong philosophy. It flows. I just think that’s reprehensible. Don’t you? Or would you let the kid go to a public school to hear that every day? Would 20 minutes a night be enough to counteract it? It’s just easier to develop good habits when they’re young so that they won’t have to break bad habits when they’re adults. If they decide that modern evolutionary science is true after going through college, they can change.
I’ve never heard of a YEC turn atheist ever regretting their past. I’ve never heard of an atheist turn YEC who didn’t.
All right. I *WILL* respond to this. Briefly.
1) I did not refer to “atheistic evolution”; I just said “evolution”. If you ever find a public school actually saying “evolution happened, THEREFORE THERE IS NO GOD”, please let me know. [I’ll move there.]
2) The fact that you “see no reason” why “atheistic evolution” wouldn’t lead to ghastly, amoral philosophic teachings… says much more about you, than it does about atheism.
Hint: Read up on Humanism. You may be surprised…
Where in formal education is the accepted doctrines questioned?
For my part, I think I’d be content if the whole random/deliberate creation debate and all such questions were moved to where it belongs, in philosophy classes, rather than the science classroom
And then I, as a philosophy minor, will be outraged.
“This isn’t a question of philosophy, this is a question of theology! Move it to the theology classrooms!”
You just can’t win, can you?
One thing: I accept that there is evidence that a worldwide flood happened. That doesn’t really support creationism, though, because it can be explained. (like, I dunno, the end of an ice age? Civilizations started next to water)
No. I won’t argue in any way about history, biology, geology, or philosophy. But that is not how Thermodynamics works. The law creationists so often invoke (The 2nd law, to be specific) applies only to closed systems. The Earth is not a closed system, as there is an external source of Energy. That is all.
Here’s the thing: a god isn’t required to explain any of that, and the assumption that there is a god is non-falsifiable. It’s completely unscientific. That doesn’t mean it’s false, it means that under current methodology it’s meaningless. We have a lot of “I don’t knows” and saying “God did it” isn’t an explanation, it’s a crutch which would prevent us from digging further if it were a formalized explanation.
I have no problem with someone teaching their kids about their god and their perceptions about the meaning of life but we have to understand that this isn’t rational or scientific and a proper education in these disciplines won’t let them say it is. I think there’s a lot to be gained from spiritual inquiry but only when we acknowledge its limits.
If it’s not science, it’s not considered in science. That kinda puts limits on what is allowed to be true, doesn’t it?
First year university geology was enough to teach me that many layers aren’t flat. They start flat, mind you. But tectonic forces throw them about. And then you’ll get flat layers on top of the angly layers. Fun times.
I’m not even getting INTO history.
The struggle occurs over who decides what is “basic competency”. Nearly always this is resolved to be “the majority decides”. That’s fine if you’re part of the majority. But just imagine that the majority were (to amplify your example) militant fundamentalist Christians? Suddenly the whole “majority decides” thing looks crazy right? Suddenly it’s very sensible to start yelling “Leave my kids alone! Don’t teach them that stuff! I’m keeping them home to keep them out of your hands!”
Well, that’s what it looks like from the other side of wherever you’re standing, no matter who you are.
Yeah, but they’re NOT the majority, and the whole concept of majority decides is that the majority is always right. Since the majority AREN’T fundies, they’re wrong.
I seem to be working myself in a circle. There’s an abstract concept I’m trying and failing to explain :/
They’re not the majority because they cannot defend their points well.
Majorities aren’t just randomly selected; important things factor into the status of a majority as well.
For example: most of North America is white. There are a number of very logical reasons for that to be the case, though a good number of that number are kind of horrifying.
Now apply that line of thinking to fundies. As of right now, they CAN’T be the majority. I imagine that, if their breeding programs continue successfully, they will start meeting more and more resistance as they take up bigger and bigger chunks of populations.
“Fundies”?
“Breeding programs”?
Do make an effort to remember they’re human beings. I disagree with their politics as well, but they aren’t some hive mind or conspirators. You sound no different to me than a preacher warning his flock to look out for the “Gay agenda”.
You’re correct. I should have made an effort to clarify as to what I was referring to. Be aware that I can feel my face blushing right now.
*I heard about one church / community / something which is evangelical and has put forward organizational efforts to maximize children in an attempt to become a statistically significant population with which to influence politics. I never did any further investigation on this topic, so it could very easily have just been blatantly false anti-religious propaganda. I guess I internalized it without skepticism because a number of peers have also mentioned it offhandedly before, and that builds the kind of mental laziness that requires a kick to realise the topic warrants a deeper investigation.
My public high school’s Honors Biology class was taught by a creationist who made it perfectly clear that the section on evolution was being taught only because the state required it, and not because it had any place in science. I almost spat in his face, and settled for failing his class that quarter.
So, yeah, there are homeschoolers who do so because they disagree with parts of the curriculum, but there are also incompetent teachers who inflict their ignorance on the children they “teach”. The homeschooler may damage their own children’s education; the bad teacher damages thousands of children, and the union protects his job.
-j
This happened in honors biology?
Wow.
Yes. My biologist friends cringe when I tell the story. Science education in Ohio has improved since 1982, but a bad teacher is still hard to get rid of.
-j
Blah blah blah. I have never experienced this serious intellectualism that you allude to in the formal schooling except for a few professors.
If you don’t think public schools have a doctrine you are mad.
Remember above: Don’t post mad.
Mad angry or mad crazy?
In either case I’m not angry. I merely maintain that teachers and even entire institutions have doctrine that fervently subscribed to and deviation is not taught as a practice.
Which is not to say that a student deviating cannot be a basis for thriving. I did well in public schools, grade side, even if I see very little purpose in the dogma.
Uh…they do. I spent all of last year sending out applications I would be ideal for. I got called back twice, because my educational background isn’t a cookie-cutter diploma. Anymore, the portion of HR that fields resumes is nothing more than a bot that looks for keywords in your resume, run by an HR company that’s managing the company you actually applied to plus fifty others. Even if it makes it past the bot, I guarantee the first human who looks at your information will have zero clue about the nature of the work you are applying for, let alone whether or not you are qualified.
Paying employees to look at applicants is all well and good, but it’s way cheaper to just ignore the applicants and let the computer take care of it, right? Gotta make sure we make that bottom dollar…
Going the formal route is a bad way to get a job, period. Even if you have the credentials it’s way better to know somebody or to get to know somebody than it is to send a cold resume.
I rather like this article for breaking down the basics:
The nonchalance in your dismissal of what society’s kind of based around in the “finding a job” section…
I find it really terrifying.
Not everyone “knows someone”, especially people who seek to escape their horrible, horrible hometown.
I don’t disagree with you in that this is how it ACTUALLY works. I disagree in that it SHOULDN’T work this way. It shouldn’t!
It doesn’t matter how things should work, effective people work with what is. Things can change and if there’s a notable improvement to be had it should, but I don’t necessarily see how it’s horrifying to think that building social connections is just as important as important as credentials, or that being able to perform a skill is more valuable than schooling.
Both the formal and informal markets have their place but if I had to pick one to dispose of it would be the formal market. Why? Because it gives us the impression that if we feed the right papers through the machine we’ll be rewarded for it. It mechanizes human beings and takes away any sense of community we build through our interactions. That is what I find horrifying. If the crux of a society rests in dehumanizing mechanisms that society shouldn’t survive, and if it can weather changes that move away from that it should.
Employment as we know it has only existed for the last 150 years or so. Before that people worked on their farms or a trade they apprenticed in. The idea that you relied on other people to determine your value and pay you based on that would have seemed absurd prior to industrialization. I’m not bringing that up to say we should return to it, I’m saying that our systems evolve and that there are things we can learn from that approach which would enable us to make something better in the here and now.
%^&$ the status quo. I don’t want to return to it or say it’s how things should be, I want something better. This is the perfect time to make it happen.
… Let me break that down for you.
You want to get rid of the “status quo” in preference for something better, while espousing the merits of the system that has existed for the entirety of the history of civilization.
You also say that “being able to perform a skill is more valuable than schooling.” This is a nice statement in one respect – very difficult to disagree with – but the ramifications of it are huge.
Blacksmiths, shoemakers, sweetmakers, ditchdiggers, these are the kinds of people who have skills but no schooling. Compare them to individuals who have educated themselves to the doctorate level or whatnot. Now, let’s say society breaks down. I don’t disagree that the blacksmith will be more likely to survive; not only does he have valuable metalworking skills, but he likely has closer relationships to persons with similar immediately useful skills. But the zombie apocalypse, or mosquito-born Ebola, or magnetic reversal of the Earth’s poles causing the destruction of all digital data, or the pulling out of the alien colonization project due to unmet profit expectations, or etc. passes. Now there’s no one around who can start building the infrastructure back. There’s no one to consider the effects of a psychologically scarred population’s sudden penchant for twinkies. No one to look at the before and after literature. No one to start genetically engineering crops that will feed the once-again booming population. No compscientists to replace the lost data networks.
Because those people were all locked up in their ivory tower with no where to go. Social networking stratifies society and forms different society-spanning cliques. Walk into a middleschool English class and ask for some opinions on Twilight, and then walk into a postsecondary institute’s English department. These two groups will (most likely) NEVER get along. They’re too separate to reconcile with each other.
If the “formal” job market was the only one, then people are based on their apparent merits. References can be used to show whether or not a person’s actually personable. Don’t be afraid to fire people for not being able to pick up the job-specific tricks and knacks required. Yeah, firing someone’s kind of expensive, but you know what? It’s also direly needed in most of the world today.
Because, frankly, most people don’t know what they’re doing. I work for the government and my bosses definitely favour that “informal job market” thing, and it’s AWFUL. People who are amazing work like 10 hours a week, and bumbling incompetents get 40. A new position opens up and people who knew the new boss from her old job get on the fast track – screwing over those 10 hour people again. You only see like 1 in 10 people who actually know what they’re doing – in ANY job – but no one calls them on it because the 1 in 10 who are good don’t have the power necessary to make actually beneficial changes (and they never will).
This whole informal job market thing leads to a world where people predict the housing bubble burst five years before it happens and get fired for it. Then the housing bubble burst happens and no one knows what to do. No kidding, you laid off the only people who can actually tell what’s going to happen just because they had negative predictions. This is not ok.
I’ll gladly take a world where qualified professionals deem you qualified or unqualified for the job over one where I get forced to work with the boss’s obnoxious daughter for 4 months before she moves to take college classes on becoming a certified aromatherapist. I’ll take a country where democracy functions as it’s supposed to, instead of being entirely driven by making the right childhood friends and getting on the only track with a political career. The “informal” job system leads to people who don’t know what they’re doing, nepotism, and a complacent culture. And you are OK with this?
P.S. Got my government job through a cold resume and an interview after being told about its existence by a friend. That is the most “informal” the system should get.
I agree that homeschooling IS an effective and capable alternative to normal school. I can even accept it’s better in many regards. Hell, there’s issues with public schooling you haven’t even TOUCHED upon…
I disagree with the socialization aspect though. Sure, public school socialization may not be the best, healthiest or even kindest. But going from MY personal experience, living in that environment, watching the other kids, has been invaluable to me. I’ve learned more about human nature, about what makes people tick and about how I can make that tick to MY advantage than I could EVER have learned at home.
And it’s a skill that’s helped me in pretty much every facet of my life. Every job, every relationship, romantic or otherwise. Getting people to think, feel and want what I want them to has made my life considerably better, and it’s a skill I wouldn’t have learned without being able to watch and test out possible methods against hundreds and hundreds of other kids…
Granted, I’m not the norm… Just offering a little counter point.
Homeschooled kids are MUCH less diverse than public school kids. Thus, it’s difficult to have as diverse a social experience as a homeschooled student.
The experience of my family and every homeschooler we know (who number in the dozens if not hundreds) says quite the opposite. Homeschoolers are a very diverse bunch with a wide range of life experience, much more so than the kids who receive cookie-cutter public schooling… (in Australia anyway)
I don’t significantly disagree with anything in your essay, Shamus, but I think it is worth stressing that in addition to being abnormally poorly suited for school, it sounds very like went to some abnormally bad schools.
My education experience was almost nothing like yours. Filling in worksheets was something I did (at all, and not much of the time even then) for perhaps the first two years of schooling; there was no rote learning; the only tests we had were at the end of the school year on the entire year’s work; good students got good marks, while poor students (even if they put in a lot of effort) failed (“passing” was not required or demanded- there is no such thing as “graduation” in Scottish schools).
I think you may also have ended up in something of a vicious circle. You had a bad experience for the first few years of your education, so you didn’t try, so you ended up in classes for poor students, where the education was in general poor and particularly poorly suited for you, so you became even less motivated and never got into some decent classes that you might actually have found useful.
Incidentally, I have absolutely nothing against home education.
Well said, Shamus. Again, it was a pleasure and an honor to read your autoblography.
I’m working on my Masters in History and I cannot disagree more. A lot of home schooled folks that get into college with this course of learning in mind found at the collegiate level that they had studied the wrong things to make it through the survey courses. Many found that vital facts had been twisted or left out by the slant of their at home texts. Some had been taught that the South had won the Civil war. Those people are not going anywhere in this field.
No one that I have met in my 3 Graduate courses thus far are home schooled. In History you -need- at least a Masters Degree in order to make a good living or do anything with your knowledge unless you want to teach at elementary or high schools.
Religious private schools are not much better. In a graduate program your up bringing isn’t going to save you at the lofty heights of the Ivory Tower; if your view of History is wrong, then it is wrong. As the Professor of my Historical Methods (HIST 600) once said, “We don’t acknowledge or give legitimacy to ignorance.”
So he ignores ignorance? That’s barely forgivable for a historian. Ignorance has profoundly shaped history and continues to influence modern social and political movements.
The ivory tower is supposed to be a beacon of light in the darkness, providing hope and direction to the masses. It is NOT a fortress to exclude the uneducated.
SUDDENLY, COMMENTS. THOUSANDS OF THEM.
School up to grade 10 (or 11, or whatever) should be a general-purpose education that everyone needs and/or should have. Math, language, a general understanding of history and ethics, science and critical thinking. This is about opening doors: giving everyone chances to see what interests them, and what they want to continue working on.
I’ve learned a lot of interesting stuff because I had to go to classes I didn’t think I would like. With home-schooling, I think there’s a danger of the kids learning only what the parents think is interesting, and also the 20-something year old versions of those things.
Throwing lots of information and ideas on young kids – and then letting their interests be piqued – is what (elementary) school should be about. It should not be about forcing the kids to remember all the information, else they fail. I think everyone can find anything interesting (or at least appreciate the worth of) as long as it is presented properly. Though this will require a huge amount of staffing, a gap home-schooling can easily fill.
Why not have the best of both worlds?
PS: There’s a reason the “man on the street” is on the street.
One note: Elementary SHOULD teach basic math and reading skills to a standard, IMHO. Everything else… anything goes, really.
But failing people who are obviously competent in specialized areas seems like a bad solution. Failing people who are just lazy – however – I am totally ok with.
I had an idea in another post here: you have to pass tests to get in to school, not out. A more specialized study course could have lower requirements for subjects not directly related to the content of that course. Nobody is left doing extra years of unnecessary paperwork, and everybody gets an opportunity to get an education that directly applies to a job, or move on to higher education.
But hey, there’s a reason I don’t want to work in government.
I love your topics/blogs and I never would have guessed that I’d enjoy the autobiography more than almost anything else here. I see a lot of my own experience reflected, and it’s weird to look into a mirror with someone else’s face on it!
I always like my stories end in tragedies. It decreases the chances of a stupid sequel.
So which way now?
To the Left, where nothing is right? Or to the Right, where nothing is left? Turn Back, to where everything was a front? Or go Front, where everyone has turned their back on you?
And then, in a mere two hundred years, everyone in this story, everyone who read this story, and everyone who remembered those people, was dead.
The end.
Unlike Shamus, I have only fond memories of all my years of schooling. But even bearing that in mind, I am not so foolish as to say the system “worked” for me. There are tons of ways in which a curriculum more tailor-made to my own interests would have done wonders for me.
A few remarks on the points addressed in the post.
On Reform:
either you’re making ambitious reforms, or you just put a new coat of paint on a crumbling buildings. The ambitious reformers, admirable as they are, never seem to address the question: “Who is going to teach your stuff?” As in: if you want to revolutionize the way a subject is taught, and roll back decades of training, how many teachers are able, willing, and have the time to completely relearn their subject and how to teach it? This must be one of the main reasons behind the failures of the more ambitious and worthy reform attempts.
On waiting for kids to be ready:
kids are not all ready to learn at the same age. Schools tend to force the issue, meaning also that the way things are taught have to be progressively emptied of their substance since many kids are not ready for it. Things cease to make sense, and test results are poor. What is the solution? Let’s start teaching that subject/concept even earlier, so that it has more time to sink in. Vicious cycle anyone?
On the tyranny of GPA:
I’m still trying to figure out who started this obsession over GPA and grades and standardized testing. In the US, it appears to be profoundly rooted in the culture. (E.g.: though IQ tests were invented in France, the US was the first country to use them widely.) Whoever is to blame,
I don’t know who is going to get us out of it. I’m just glad to point out that some pioneers have started working on this:
1. Catching abuse is really really difficult with homeschooling. I’m not sure where the line goes on badly educating the country and letting some child be a sex-slave to their parents and locked in cupboard for their whole life is, but I myself would set it pretty high in favour of not having the latter.
Even with the system as it is with an absolute crudload of people trained and designated to look out for it it’s not perfect. Legally letting parents keep their children out of sight would only make it so much worse. (My parent is a childrens commissioner in the NHS)
I had a lot of other points, mainly that learning to deal with bullying is a skill just as invaluable in the work place as it was in school. Not everyone is as lucky as you in working from home. But in the end it really begins and ends at point one for me, people do things that most of us are luckier enough to never have to hear about on a scale larger than we’d ever think
Why on earth would I want to spend 24/7 with my children?
I don’t think it would be sane for them. It certainly wouldn’t for me.
Besides, sometime both parents need to work.
Why the hell would they be home all the time? Let them go see their friends or other family members, or give them what they need to pursue an obsession of theirs while you’re taking care of something around the house. The older they get and the more self-directed they are early on, the less time you actually need to spend watching them. It’s actually not long after they normally start school that they have some level of autonomy. There are plenty of scenarios where a healthy parent-child relationship in a homeschool environment is a lot closer to three or four adults sharing the same living space and spending time together on the evenings and weekends when there’s not much else going on. That doesn’t mean taking a hands-off approach, it means putting the machinery in place to make it work like that as they grow up.
I find kids aren’t nearly as much of a handful when they’re granted enough freedom to become self-sufficient but not so much they fly off the rails. Maintaining that balance is the challenge, not spending 24/7 with them.
I wish Homeschooling were more prevalent and understood. My mother tried homeschooling me when I was a child, but stopped after one year for a variety of reasons, the main one being she didn’t know how to turn me into a self-motivated learner. Now that I’m older I enjoy learning about things all on my own, but I regret that some of the resources we have now didn’t exist twelve years ago.
I still don’t like school that much. It taught me a couple things I wouldn’t have known if I hadn’t gone, but I desperately want my children to never have to go through the pain and boredom of a public classroom. I can teach my own children much better than even a good teacher can, because where I can afford to focus my attention on one student at a time, the teacher has to divide his or her attention between thirty.
And I’d be more willing to say “Some parents aren’t meant for homeschooling” than “Some students aren’t meant for school.” 90% of children would probably do well in homeschooling, but there’s probably a lot of parents that just aren’t prepared for it.
I’ve just read a bunch of different people’s comments with variations on a theme of interest-based learning; e.g. “you can’t force someone to learn who doesn’t want to”, “let students explore the topics that they’re interested in”, etc. I wish I could tack my reply onto all of those threads, but I can’t decide which to choose, so I’ll just start my own.
I have nothing against homeschooling, and I think the percentage of homeschoolers who truly follow a “let them do what they want” approach all the time would be very very low, so I’m not trying to use this as an argument against homeschooling. But I would argue very strongly against letting that “let them do what they want” approach become too central to the learning process. Shamus, in his autoblog, showed himself to be exceptional in a number of ways; he may not have been motivated enough to do makework in most areas, but he was strongly self-motivating in at least one:computers. He _wanted_ to learn, he just wanted to learn certain things. But how did he _know_ he wanted to learn about them? Because he was exposed to them _in school_. Would he have learned about them anyways? Probably eventually. Is that a problem for kids today? Well for computers, obviously not. But what about the kid with a deep-seated passion for quantum physics that he just hasn’t discovered yet?
My nephews are good kids, and they’re both smart in various ways, but neither is a self-motivated learner about much of anything. Neither does terribly well at school. If you gave them the choice to pursue whatever they wanted in their learning, the one would play basketball, and the other play computer games all day. They wouldn’t learn _anything_ if it was left up to them to decide what to do.
Shamus doesn’t say we should disband all schools, he says we should be tolerant of people who don’t fit into the school mold, and are drawn elsewhere by their passions. But to find their passions in the first place, they have to be exposed to a lot of experiences, many of which they’ll _hate_ at the time. People can do that for their kids at home; heck, almost by definition its easier to do in any environment where you can work 1-on-1 or 1-on 2 with the kids. But not _everyone_ can or will do that for their kids at home. So to the couple of people in comments here who seem to be twisting Shamus’ argument of tolerance into an argument for totally unstructured learning, or on the other hand to an argument for abandoning anyone who doesn’t express an interest in learning, I have to say you’re taking it too far. The ideal is not that you only teach kids what they’re already interested in, its that you teach kids in such a way that they _become_ interested in what you’re teaching.
This. So much this.
Not only is it that you don’t discover new areas of interest when noone presents them to you, it’s also that you wouldn’t realize that something that seems uninteresting at the time can have direct usefulness for something interesting later. Take the remark Shamus made about “Cosine? I should learn about that” when first encountering 3D graphics. Learning trigonometry might have seemed like a waste of time when it was first presented, but it has its applications elsewhere.
I keep hear new stories of people saying that they wished they had paid attention in class X, because they in retrospect realize that it was actually useful. This is why everybody should have a minimum required knowledge in several areas: it lets you make better choices on a more specialized education later in life.
Not everyone fits into the mould. And home-schooling can definitely fill part of the hole left behind of the public schooling system. But in no way does it fill the entire hole, let alone replace the void left behind if the public schooling system were to evaporate.
I’ve already begun amassing a massive library for when I have kids. Politics, religion, physics, quantum physics, evolution, biology, business, entrepreneurship, computer AI, game design-you name it, I’ll have a book on it.
Whether or not someone will be exposed to something they’re passionate about is always a crapshoot because you don’t know what it is until they find it and you don’t know that it will compel them the first time they come across it. This isn’t a flaw in any system, it’s a matter of how humans work. I think we need to realize there’s only so much we can do for kids and past teaching them how to learn and how to take care of the basics they’re going to have to do some legwork on their own. That’s why homeschooling and unschooling is so ridiculously valuable-that’s pretty much all you do. It’s hands-on from the word go. That seems to give them the best chance of finding what they’re looking for.
I think perhaps it’s simply that we’re leaving out part of the self-directed learning. I never meant to imply that I never expose my kids to new things. I don’t MAKE them study new topics. I might guide, prod, strew, and suggest, but I don’t force. Part of self-directed learning is broad exposure to a variety of topics. Some of them will click, some won’t.
Using the example of Shamus and trig: when he first encountered “trigonometry” as a word it made very little impact. It wasn’t until he found a practical use for it that he was interested enough to pursue it. At that point he DID pursue it. Given Shamus’ approach to his other school work, how much of that class do you think would have made a dent on him prior to his having a specific reason to learn it? It probably would have been nothing more than a vague exposure to the topic and he would have still had to go back and RElearn what he was supposed to have gotten from the class when he decided he needed the information.
That’s where self-directed learning comes in. If you expose children to a lot of things they’ll eventually hit on something that interests them. In the process of pursuing that interest they’ll pick up a slew of other “incidental” knowledge along the way. Because they’re motivated they learn it faster and more thoroughly.
To give another example, I recently read an article by an unschooling father. They didn’t make their kids learn things, assuming that when the knowledge was needed or wanted the kids would work for it. At some point one of the kids decides he “needs” math. They’ve never done any formal mathematical education. The adolescent kid wants it now, though, because he wants to take the SAT exam and go to college. So he asks dad. Dad grabs a couple of books off the shelf and they begin. In SIX WEEKS Dad takes the kid from basic addition, subtraction, and grouping through transformation matrices and the like. Granted, Dad and son work 7-8 hour days only on math during this time but that still works out to around 900 instructional hours of math. The kid does fine on his SAT so the math must have “taken.” Compare that to the approximately 12,000 instructional hours that a student in public school math gets by high school graduation. But a tremendous amount of that instructional time is spent re-teaching things that have been forgotten either due to rest periods in the school year or just lack of retention because the kids don’t give a rat’s behind about the subject.
Shamus, thank you again for writing the Autoblography, it’s been a wonderful read.
I propose Thunderdome education standards. However you come by it, everyone passes a test at majority. Pass and live. Fail and die. Everyone has concrete reasons to study, everyone in society knows basic math. Winning.
It makes such an epic story, especially as a child.
When I was about ten and playing soccer (football for the rest of the world) I would often reflect how much harder everyone on my team would try if we were going to be executed if we lost the next game. Or even if there was some sort of standard that you had to pass, or you were kicked off the team. Concrete consequences go a long ways toward motivation, which I think was one of Shamus’ points.
Seriously though, why make it just one test? Why not require passing the test every year? Any atheist state (like the USA and the European Union) should be willing to kill off the weak, the retarded, the sickly, and the old to maximize social health. It’s only good sense, and the Nazis found it did wonders for efficiency. I’m truly baffled that no modern governments have active social programs to euthanize the unfit.
Do not equate atheism to amorality. Atheists can see value in human life. Anyway, the EU is not a state, and US, while technically having a separation of church and state, is pretty dang religious.
Also, secular does not equal atheist.
I had a snappy retort, but now I’m convinced you’re just trolling.
Atheists don’t kill people very often, FYI.
Good entry. My comments:
adversity builds character – actually quite the opposite. There’s a discipline called Interpersonal Neurobiology. Basically our brains depend on relations with other people.
indoctrinate them with strange beliefs – everything is indoctrination. That’s how culture works. Every word you know has been taught to you by smb else one way or another.
Shamus, you may be interested in the work of Gabor Mate:
Unschooling was already mentioned in the comments but if anyone is interested see this lecture:
Okay so would you say that a homeschooler or someone who spends 6 hours a day minimum with other peers has a better chance of building those relations?
Besides you tried to combine to things which are normal to each other. Having bad relations doesn’t affect the quality or quantity of your good relations and a bad relation is still a relation. That we mainly learn through relationships doesn’t stop us learning from bad relationships.
(Btw just to say, yes I was bullied at school continuously for a good 10ish years and then by Yr9 I learnt how to deal with it and became friends with people who I wouldn’t normally have become friends with. I’d definitely be more arrogant without that and I would struggle to deal even more to deal with people who have problems with me now)
Maybe that was a bit too generic. What I mean is: being a victim, or looked down upon or ostracised or whatever is detrimental to physical and mental health.
everything is indoctrination
… for wide enough definitions of “indoctrination”.
Just as for wide enough definitions of “stupid”, everyone is stupid.
There is a tremendous difference between
a) being raised in a closed system with one single correct opinion, one single answer to every question, one single reason for everything that happens, one single culprit for every problem and one single authority to give them to you,
and
b) a place where you are taught by different people with different opinions, and you are exposed to the fact that people can have different views. Where you learn to deal with this fact and you have the opportunity to compare what your parents are telling you to what your teachers are telling you, to what the other kids saying and doing.
There’s also a huge difference between a school where teachers follow the “official” political line or teach open-ended.
To say that this difference doesn’t matter is like setting fire to your car because, you know, it’ll stop working sooner or later, so you might as well speed it up, don’t you?
to make that clear: I’m not implying that homeschooling = indoctrination and public school != indoctrination. I was born in a country where indoctrination started in kindergarten (big luck my family managed to leave the country before I had to go there. No small achievement!), and so were millions of my compatriots.
People who shout “indoctrination!” as soon as a teacher doesn’t share their own beliefs are insulting everyone who has ever suffered from a totalitarian state’s school system. I know at least around here schools are far too disorganized for any of those shenanigans. And I’m fine with that.
Frankly there’s no difference. If you teach a kid to be close-minded then he’ll be close-minded and if you teach to be open-minded then he’ll be open-minded. For the rest of the life probably. I’m not judging which is better.
I attempted here to correct a misconception. People call “an indoctrination!” something that they don’t like. While your views, values, beliefs etc. are a result of cultural information influence. Humans are programmed by the environment.
What’s the wide definition of stupid?
Weeell, that’s a pretty wide definition … so for example … Sauerkraut. I don’t like Sauerkraut. What does that have to do with indoctrination?
Less literal interpretation of your definition: Someone having an opinion I don’t like and telling that to someone else. I think that’s what you meant.
So, the according definition of “stupid” then is “anyone who disagrees with me”. Under some sarcastic light this is actually true (as in: disagreeing with me will make me start a discussion with you, and that might have been a stupid idea), but in general, this is not a useful definition, it would (if I actually used it) tell more about my own character than about the word.
Indoctrination is not at all about which opinion anyone has, it is about forcing an opinion about a topic on people who are new to that topic, while preventing them from realizing that this may not be the only valid opinion. Either by preventing them from being exposed to differing opinions or by vilifying those who hold them.
The nice thing about this definition is that firstly it is independent of the observer (i.e. it allows even people with differing worldviews to agree on whether something is indoctrination or not), and it is also pretty clear to anyone but wannabe dictators this is not something you do if you want to be one of the good guys.
This is the misconception. NOT THE DEFINITION.
My sixth grade teacher (Mr. King) told me that education is that which remains when what is learned is forgotten.
That’s a good one.
I like this quote. Your teacher must have been a very smart man. (Please dont take any of this as sarcasm)
Einstein said something similar, but with a couple of rather important extra words at the end: “Education is what remains after one has forgotten everything one learned in school.”
EDIT: Homeschooling is legal in the UK so I feel my position is weaker.
My position is though, that we don’t need to prove homeschooling works. We know it probably does for some people. We need to show what happens when it doesn’t work and bad parents decide to homeschool. Shamus is proof the school system doesn’t screw up people who don’t fit it.
The argument that homeschooling works is irrelevant. So is the argument about which is superior for who. The argument should be, does homeschooling fix itself if the kid doesn’t suit it?
I don’t think it does so I think at the least it should be far more heavily regulated than it is currently. People need to check the kid is okay
“Shamus is proof the school system doesn't screw up people who don't fit it.”
You might want to look back over this story. I think you might have missed about 25 entries or so.
My problem is that the comparison is being made between a person who was poorly suited to the school system, going to schools which also sound poor, with how that same person would have done being homeschooled in a great environment (ie like the one Heather appears to provide).
Given that starting point it is obviously a no brainer. But this is a very, very specific example.
Every case is different but if we try to look at more typical kids in more typical situations and how more homeschooling by typical parents would go then I think you get a rather different picture. Some or even many of these typical kids would probably do fine but I’m sure there would be a significant number who reach 17 with no knowledge of basic mathematic or literary skills, either because their parents didn’t give a damn (or didn’t have a clue) or because the child didn’t want to learn and was able to manipulate their parents.
And that is of course assuming there is a parent available to do homeschooling (there wasn’t in Shamus’s case). Earlier there was a comment about how much money would be saved by abolishing schools… have you thought about the cost of every family in the US needing to have one parent stay home to homeschool? Your GDP would probably drop by a quarter overnight! Schooling may have its problems but from a financial point of view it is vastly more efficient than homeschooling to a similar standard.
I still agree with Shamus that more thought needs to be given to alternatives and being flexible, particularly for exceptional cases, but I have a much less positive view of how well the alternatives would work in the general case.
Well, you ended up all right, right? So it didn’t screw you up PERMANENTLY.
Despite that, it obviously caused you a lot of strife, so….
It’s complicated.
In the bell curve of kids that go through the education system there are always going to countless situations where the “right people” don’t see the difference between DID not mess him up and COULD not mess him up.
Just as you said, it’s complicated. I’m in NZ and I imagine our school/class sizes are significantly smaller than in the US or some other countries and there were enough problems here. I had teachers that ridiculed me and made me feel worthless even though I was a smart kid in a small (approx 25 kids, I guess) class because I wasn’t at the bulk of the student bell curve.
I am going to over-generalize. Badly. Here goes:
Home-schooling requires that a parent is at home, and well-educated.
Well-educated people – on average – have a day job.
Alternative 1: The kids might as well go to school in the day: it’s free, and it doesn’t interfere with the parents’ schedule.
-> public + home-schooling all in one, maximum results.
Alternative 2:
People who do not have a day job have – on average – a reason why this is not the case. Usually education (I said I would be generalizing).
These people have the time to do home-schooling, but not the competence-
-> no public school & bad home-schooling, minimum results.
Home-schooling makes sense as a supplement, but not as a replacement. If home-schooling doesn’t work for a kid, more home-schooling won’t fix it. If public schooling doesn’t work, more public schooling at least can fix it, as long as the kid is moved to a more appropriate class(es), or another school altogether.
I think for starters you’re vastly overestimating the amount of energy both parent and student are willing to expend on education at the end of a long, hard day. I know people who have done this and it was met with some degree of success but not nearly the degree you’re trying to award it. In fact, if memory serves Shamus’s wife has mentioned that basically she came home from school every day and was “tutored” for hours by her parents. But from my own limited experience, my family found it intensely frustrating and rarely had the energy or willingness to keep up “homeschooling after school” on a long-term basis.
I think you’re also vastly UNDERestimating the number of intelligent/educated people who work within the home in some manner (either, like Shamus and Heather who make their income from inside the home, or like me and the majority of my homeschool group, who have one parent who works outside the home and one parent who functions as a stay-at-home parent and spouse). It’s going to vary from place to place but I know around here about a third of all households have one full-time at-home parent. In this area most of those ARE the educated families because the less educated families are the ones that need both incomes to live on. I can count at least 14 women in my own social circle who are college graduates and stay-at-home mothers/housewives. | http://www.shamusyoung.com/twentysidedtale/?p=14045 | CC-MAIN-2019-30 | refinedweb | 69,657 | 69.31 |
The UI for the timer attached to my sprinkler system makes it
difficult to understand exactly when the various sprinklers will
run. All of the data is there, but with only a few controls and a
small LCD screen, there aren’t a lot of presentation options. Using
Python’s calendar module I was able to write a simple program
to format the data to make it easier to identify cases where I might
be over, or under, watering.
The Problem
We don’t have a large yard, but we’ve tried to invest in making it an
attractive place to spend time. A big part of that, especially in the
southeastern US, is keeping plants properly watered through the hot
summer. A couple of years ago, I had an automated irrigation system
installed, with a programmable timer to control the watering schedule.
The timer support three “programs”, each of which can be scheduled to
run on different days of the week or month, at multiple times. Each
program can activate the sprinklers in several “zones” (areas of the
yard), running them for different amounts of time. This is, as far as
I can tell, a pretty standard internal model for one of these timers,
and once you get the hang of it programming it is pretty
straightforward.
This spring we decided we needed to change the way we were watering a
particularly troublesome spot in the front of the yard, to run the
system for two short cycles instead of one long cycle (the theory
being that this would allow more water to soak in and be used by the
plants in that area). When I examined the current settings, I
discovered that I had also been watering one zone more than I
realized, because it was scheduled in multiple programs. It wasn’t at
all obvious, given the limitations of how the timer shows its
programming, and I only discovered it when I wrote down the entire
schedule to review it. As part of my audit before updating the
schedule, I decided I would write a program to show the schedule on a
calendar so it easier to understand what was happening without having
to perform the calculations in my head.
Designing the Inputs
The first step was to design an input format to represent all of the
data I had in a way that was easy to collect. I chose a YAML format,
since I have lists and mappings of data and using YAML meant I
wouldn’t need to build a separate parser. The first section of the
input file lists the zones, mapping the number used to identify them
in the timer with the name I use for them in my notes.
zones: 1: turf 2: f shrubs 3: b shrubs 4: patio 5: garden
The remainder of the input file describes the schedule for each
program (named A, B, and C), including the times of day when the
program runs (multiples are allowed), the days of the week when the
program runs, and the zones to be watered and for how long.
For example, program A runs on Monday, Wednesday, and Friday at 4:00
AM, watering the front shrubs for 15 minutes and the back shrubs for
15 minutes.
programs: A: start: - '4:00' days: MWF zones: - zone: 2 time: 15 - zone: 3 time: 15
Zones are identified in the program schedule by number, and although
they can be listed in any order they are always run in numerical
order.
There are two ways to express the rules for determining which days the
program is active. A program can either run on odd or even days of the
month, or any combination of explicitly selected days of the week. I
decided to use “odd” and “even” as literal values for those cases, and
to use one or two letter abbreviations for days (where Tuesday is T,
Thursday is Th, Saturday is Sa, and Sunday is Su).
Designing the Output
I decided to generate output using a monthly calendar format. I’m
likely to be the only user of the program, so I didn’t worry about
generating HTML and opted to use a simple text chart format.
$ wateringtime -c May +------------------------+------------------------+------------------------+------------------------+------------------------+------------------------+------------------------+ | Mon | Tue | Wed | Thu | Fri | Sat | Sun | +------------------------+------------------------+------------------------+------------------------+------------------------+------------------------+------------------------+ | | | | (1) | (2) | (3) | (4) | | | | | | 03:15-03:30 - f shrubs | 03:00-03:30 - turf | 03:15-03:30 - f shrubs | | | | | | 03:30-03:45 - b shrubs | | 03:30-03:45 - b shrubs | | | | | | 03:45-03:55 - patio | | 03:45-03:55 - patio | | | | | | 03:55-04:00 - garden | | 03:55-04:00 - garden | | | | | | 04:00-04:15 - f shrubs | | | | | | | | 04:15-04:30 - b shrubs | | | +------------------------+------------------------+------------------------+------------------------+------------------------+------------------------+------------------------+ | (5) | (6) | (7) | (8) | (9) | (10) | (11) | | | | +------------------------+------------------------+------------------------+------------------------+------------------------+------------------------+------------------------+ | (12) | (13) | (14) | (15) | (16) | (17) | (18) | | 03:00-03:30 - turf | | 03:15-03:30 - f shrubs | | 03:15-03:30 - f shrubs | 03:00-03:30 - turf | 03:15-03:30 - f shrubs | | 03:15-03:30 - f shrubs | | 03:30-03:45 - b shrubs | | 03:30-03:45 - b shrubs | | 03:30-03:45 - b shrubs | | 03:30-03:45 - b shrubs | | 03:45-03:55 - patio | | 03:45-03:55 - patio | | 03:45-03:55 - patio | | 03:45-03:55 - patio | | 03:55-04:00 - garden | | | | | | | | | +------------------------+------------------------+------------------------+------------------------+------------------------+------------------------+------------------------+ | (19) | (20) | (21) | (22) | (23) | (24) | (25) | | | | +------------------------+------------------------+------------------------+------------------------+------------------------+------------------------+------------------------+ | (26) | (27) | (28) | (29) | (30) | (31) | | | 03:00-03:30 - turf | | 03:15-03:30 - f shrubs | | 03:15-03:30 - f shrubs | 03:00-03:30 - turf | | | 03:15-03:30 - f shrubs | | 03:30-03:45 - b shrubs | | 03:30-03:45 - b shrubs | | | | 03:30-03:45 - b shrubs | | 03:45-03:55 - patio | | 03:45-03:55 - patio | | | | 03:45-03:55 - patio | | | | | | | | | +------------------------+------------------------+------------------------+------------------------+------------------------+------------------------+------------------------+
I used Python’s calendar module to find the days of the month as
weeks. I treat Monday as day 0, which leaves the weekend at the end of
each row of output. That’s different than a typical American calendar,
but it works out well because I may have weekends as a special case,
depending on how bad the drought is here in Georgia and whether we
have watering restrictions in place.
Building Tables with PrettyTable
In addition to the calendar output mode, I included a simple table
output mode to report the settings in a form that is easy to carry
outside and program into the controller. (I still have to do that step
by hand.)
$ wateringtime +------+----------+ | Zone | Name | +------+----------+ | 1 | turf | | 2 | f shrubs | | 3 | b shrubs | | 4 | patio | | 5 | garden | +------+----------+ +---------+-------------+------+-------+ | Program | Start Times | Days | Zones | +---------+-------------+------+-------+ | A | 4:00 | MWF | 2(15) | | | | | 3(15) | | B | 3:00 | MSa | 1(30) | | C | 3:15 | even | 2(15) | | | | | 3(15) | | | | | 4(10) | | | | | 5(5) | +---------+-------------+------+-------+
That second table contains all of the information I need to reprogram
the timer quickly. This simpler output mode is implemented in
simple.py in two functions.
show_zones() prints the table with the names and id numbers of
the watering zones, taken from the input YAML file.
def show_zones(data): t = prettytable.PrettyTable( field_names=('Zone', 'Name'), print_empty=False, ) t.padding_width = 1 t.align['Zone'] = 'r' t.align['Name'] = 'l' for z in sorted(data['zones'].items()): t.add_row(z) print t.get_string()
It starts by building a PrettyTable object, configured with
two columns. Then it adds one row at a time to the table, where the
data for each row is held in a tuple with two members. The
get_string() method of the table returns the formatted results,
complete with headings and decorations.
The program list is a little more complex, since some cells of the
table have multiple lines. PrettyTable handles that easily,
but I need to build the multi-line strings myself by combining the
zone data.
def show_programs(data): t = prettytable.PrettyTable( field_names=('Program', 'Start Times', 'Days', 'Zones'), print_empty=False, ) t.padding_width = 1 t.align['Zones'] = 'l' for p, pdata in sorted(data['programs'].items()): zones = 'n'.join('%(zone)s(%(time)s)' % z for z in sorted(pdata['zones'], key=operator.itemgetter('zone'))) t.add_row((p, 'n'.join(pdata['start']), pdata['days'], zones)) print t.get_string()
Adding Algorithms to Data
The simple output format works with the data in the YAML data
structure directly. The processing it does is very basic, since it is
primarily formatting the existing values. For the calendar view, I
knew I would need some more complex algorithms. I have several
different rules to apply to decide if a program should be included in
the output for a given day, for example, and I want to compute and
show the actual start and end time for each watering event, not just
the program start time. I decided to create a Program class
to help with some of those calculations.
class Program(object): def __init__(self, name, pdata): self.name = name self.data = pdata self.days = pdata['days'] self._day_checker = self._make_day_checker(self.days) def _make_day_checker(self, s): """Parse a 'days' string A days string either contains 'odd', 'even', or 1-2 letter abbreviations for the days of the week. """ if s == 'odd': return lambda dow, dom: bool(dom % 2) elif s == 'even': return lambda dow, dom: not bool(dom % 2) else: valid=[ self._day_abbr[m] for m in re.findall('([MTWF]|Tu|Th|Sa|Su)', s) ] return lambda dow, dom, valid=valid: dow in valid _day_abbr = { 'M': calendar.MONDAY, 'T': calendar.TUESDAY, 'Tu': calendar.TUESDAY, 'W': calendar.WEDNESDAY, 'Th': calendar.THURSDAY, 'F': calendar.FRIDAY, 'Sa': calendar.SATURDAY, 'Su': calendar.SUNDAY, } def occurs_on_day(self, dow, dom): """Tests whether the program runs on a given day. :param dow: Day of week :param dom: Day of month """ return self._day_checker(dow, dom)
The first piece of data I addressed was the rules for which days a
program is active. I have three different modes, and I knew I didn’t
want to test the mode each time a date was checked because the mode
doesn’t change after the YAML file is parsed. I decided to define
_make_day_checker() a factory method that returns a callable to
perform the test. For the “odd” and “even” modes, it returns a
function that looks at the day of the month to see if it is odd or
even respectively. For the explicit day list, I use a regular
expression to parse the string into individual abbreviations, and then
convert those to numbers using a dictionary that maps between the
abbreviations and values from calendar. The public API
occurs_on_day() wraps the checker function.
Next I defined a property to sort the zones before returning them,
just in case I enter values out of order:
@property def zones(self): """Returns the zones used in the program, sorted by zone id. """ return sorted(self.data['zones'], key=operator.itemgetter('zone'))
Another property converts the string representation of the program
start times to datetime.time instances, which are easier to
manipulate and use for sorting:
@property def start_times(self): return sorted(datetime.datetime.strptime(t, '%H:%M').time() for t in self.data['start'])
A final property produces a series of run time values with the start
and end times as well as the zone id. It is used to build the schedule
part of a calendar cell, which shows the times and zones when the
sprinklers are running. I perform the calculations to find the start
and end times myself, because datetime.time objects do not
work with datetime.timedelta objects.
@property def run_times(self): """Returns iterable of start, end, and zone name tuples. """ for s in self.start_times: for z in self.zones: # FIXME: Convert to datetime and use timedelta? h, m = s.hour, s.minute m += z['time'] h += m / 60 m = m % 60 e = datetime.time(h, m) yield s, e, z['zone'] s = e
Building the Calendar
With Program in place, the next task was to figure out how to
construct the calendar grid. I knew that Python includes a calendar
module, and that I could have it give me a list of weeks containing
the days of the month. To build my table, then, I would just need to
iterate over the weeks and days, deciding what to put in each cell.
I started by setting up the data I would be working with and the table
object.
def show(args, data): programs = [Program(*p) for p in data['programs'].items()] programs.sort(key=lambda p: p.start_times[0]) t = prettytable.PrettyTable( field_names=calendar.day_abbr, print_empty=False, hrules=prettytable.ALL, ) t.align = 'l' cal = calendar.Calendar(calendar.MONDAY) month_data = cal.monthdays2calendar(args.year, args.month)
Each row of the calendar is based on a week, and each cell is a
day. There are two nested loops to iterate over the calendar days and
determine the cell and row contents. Some weeks contain days from
multiple months, the end of one month and the beginning of the
next. The output of monthdays2calendar() reports the day of the
month as 0 for days in a week that fall outside of the current
month in either direction, and I skip them in the output (filling the
cell with a blank string to preserve the table structure).
for week in month_data: row = [] for dom, dow in week: if not dom: # Zero days are from another month; leave the cell blank. row.append('') continue
For the remaining days, I loop over the programs that occur on that
day and place a watering event (with start time, end time, and zone)
on each line of the cell. The datetime.time values are
formatted to show only the hour and minutes, and the zone name is used
instead of the zone number so I don’t have to do that conversion in my
head as I read the calendar.
# Show the day and all watering events on that day. lines = ['(%s)' % dom] for p in (p for p in programs if p.occurs_on_day(dow, dom)): if args.verbose: lines.append('') lines.append('{name} ({days})'.format(name=p.name, days=p.days)) for s, e, z in p.run_times: name = data['zones'][z] lines.append( '{s}-{e} - {name}'.format( s=s.strftime('%H:%M'), e=e.strftime('%H:%M'), name=name, ) ) row.append('n'.join(lines)) t.add_row(row)
Before printing the table, I use its width to center the month name
over the top.
formatted = t.get_string() # Center the name of the month over the output calendar. print 'n{:^{width}}n'.format( calendar.month_name[args.month], width=len(formatted.splitlines()[0]), ) print formatted
Conclusion
With an hour of work, I was able to create a simple script to let me
visualize the watering schedule more clearly. I found one case of
potential over-watering, where a zone was in a program it shouldn’t
have been, and I was able to modify the timer’s programming to fix
that and make the other adjustments I needed very easily. | https://doughellmann.com/blog/2014/05/26/watering-time-practical-uses-for-python-s-calendar-module/ | CC-MAIN-2018-17 | refinedweb | 2,468 | 61.87 |
#include "unicode/utypes.h"
#include "unicode/uenum.h"
#include "unicode/uloc.h"
#include "unicode/localpointer.h"
Go to the source code of this file.
C API: Calendar.
UCalErrorCode status (such as only year and month but no day in the month), or there may be inconsistent information (such as "Tuesday, July 15, 1996" – July 15, 1996 is actually a Monday).
Insufficient information. The calendar will use default information to specify the missing fields. This may vary by calendar; for the Gregorian calendar, the default for a field is the same as that of the start of the epoch: i.e.,:
24:00:00 "belongs" to the following day. That is, 23:59 on Dec 31, 1969 < 24:00 on Jan 1, 1970 < 24:01:00 on Jan 1, 1970
The date or time format strings are not part of the definition of a calendar, as those must be modifiable or overridable by the user at runtime. Use icu:.
Definition in file ucal.h.
Useful constant for days of week.
Note: Calendar day-of-week is 1-based. Clients who create locale resources for the field of first-day-of-week should be aware of this. For instance, in US locale, first-day-of-week is set to 1, i.e., UCAL_SUNDAY. Possible days of the week in a UCalendar
Definition at line 457 of file ucal.h.
Weekday types, as returned by ucal_getDayOfWeekType().
Definition at line 1341 of file ucal.h.
System time zone type constants used by filtering zones in ucal_openTimeZoneIDEnumeration.
Definition at line 534 of file ucal.h.
Add a specified signed amount to a particular field in a UCalendar.
This can modify more significant fields in the calendar. Adding a positive value always means moving forward in time, so for the Gregorian calendar, starting with 100 BC and adding +1 to year results in 99 BC (even though this actually reduces the numeric value of the field itself).
Clear all fields in a UCalendar.
All fields are represented as 32-bit integers.
Clear a field in a UCalendar.
All fields are represented as 32-bit integers.
Determine how many locales have calendars available.
This function is most useful as determining the loop ending condition for calls to ucal_getAvailable.
Get the current value of a field from a UCalendar.
All fields are represented as 32-bit integers.
Get a numeric attribute associated with a UCalendar.
Numeric attributes include the first day of the week, or the minimal numbers of days in the first week of the month.
Get a locale for which calendars are available.
A UCalendar in a locale returned by this function will contain the correct day and month names for the locale.
Returns whether the given day of the week is a weekday, a weekend day, or a day that transitions from one to the other, for the locale and calendar system associated with this UCalendar (the locale's region is often the most determinant factor).
If a transition occurs at midnight, then the days before and after the transition will have the type UCAL_WEEKDAY or UCAL_WEEKEND. If a transition occurs at a time other than midnight, then the day of the transition will have the type UCAL_WEEKEND_ONSET or UCAL_WEEKEND_CEASE. In this case, the function ucal_getWeekendTransition() will return the point of transition.
Return the default time zone.
The default is determined initially by querying the host operating system. It may be changed with ucal_setDefaultTimeZone() or with the C++ TimeZone API.
Return the amount of time in milliseconds that the clock is advanced during daylight savings time for the given time zone, or zero if the time zone does not observe daylight savings time.
Return the difference between the target time and the time this calendar object is currently set to.
If the target time is after the current calendar setting, the the returned value will be positive. The field parameter specifies the units of the return value. For example, if field is UCAL_MONTH and ucal_getFieldDifference returns 3, then the target time is 3 to less than 4 months after the current calendar setting.
As a side effect of this call, this calendar is advanced toward target by the given amount. That is, calling this function has the side effect of calling ucal_add on this calendar with the specified field and an amount equal to the return value from this function.
A typical way of using this function is to call it first with the largest field of interest, then with progressively smaller fields.
Gets the Gregorian Calendar.
Get a UCalendar's current time in millis.
The time is represented as milliseconds from the epoch..
Get the UDate for the next/previous time zone transition relative to the calendar's current date, in the time zone to which the calendar is currently set.
If there is no known time zone transition of the requested type relative to the calendar's date, the function returns FALSE.
Returns the time during the day at which the weekend begins or ends in this calendar system.
If ucal_getDayOfWeekType() returns UCAL_WEEKEND_ONSET for the specified dayOfWeek, return the time at which the weekend begins. If ucal_getDayOfWeekType() returns UCAL_WEEKEND_CEASE for the specified dayOfWeek, return the time at which the weekend ends. If ucal_getDayOfWeekType() returns some other UCalendarWeekdayType for the specified dayOfWeek, is it an error condition (U_ILLEGAL_ARGUMENT_ERROR)..
Determine if a field in a UCalendar is set.
All fields are represented as 32-bit integers.
Open a UCalendar.
A UCalendar may be used to convert a millisecond value to a year, month, and day.
Note: When unknown TimeZone ID is specified or if the TimeZone ID specified is "Etc/Unknown", the UCalendar returned by the function is initialized with GMT zone with TimeZone ID
UCAL_UNKNOWN_ZONE_ID ("Etc/Unknown") without any errors/warnings. If you want to check if a TimeZone ID is valid prior to this function, use
ucal_getCanonicalTimeZoneID.
Create an enumeration over all time zones associated with the given country.
Some zones are affiliated with no country (e.g., "UTC"); these may also be retrieved, as a group.
Create an enumeration over all time zones.
Add a specified signed amount to a particular field in a UCalendar.
This will not modify more significant fields in the calendar. Rolling by a positive value always means moving forward in time (unless the limit of the field is reached, in which case it may pin or wrap), so for Gregorian calendar, starting with 100 BC and rolling the year by +1 results in 99 BC. When eras have a definite beginning and end (as in the Chinese calendar, or as in most eras in the Japanese calendar) then rolling the year past either limit of the era will cause the year to wrap around. When eras only have a limit at one end, then attempting to roll the year past that limit will result in pinning the year at that limit. Note that for most calendars in which era 0 years move forward in time (such as Buddhist, Hebrew, or Islamic), it is possible for add or roll to result in negative years for era 0 (that is the only way to represent years before the calendar epoch).
Set the value of a field in a UCalendar.
All fields are represented as 32-bit integers.
Set a numeric attribute associated with a UCalendar.
Numeric attributes include the first day of the week, or the minimal numbers of days in the first week of the month.
Set a UCalendar's current date.
The date is represented as a series of 32-bit integers.
Set a UCalendar's current date.
The date is represented as a series of 32-bit integers.
Sets the GregorianCalendar.
Set a UCalendar's current time in millis.
The time is represented as milliseconds from the epoch. | http://icu-project.org/apiref/icu4c/ucal_8h.html | CC-MAIN-2017-22 | refinedweb | 1,292 | 65.22 |
In-Depth
SQL Bulk Insert has been tuned over the years to work well with the Microsoft .NET Framework. This tutorial shows you how to take advantage of its power.
SQL Bulk Insert is not a new technology. In fact, I've used it since SQL Server 6.5., when it was a very cumbersome implementation from Microsoft that required a great deal of preparation of the Bulk Copy Program, otherwise known as BCP.
To use BCP, developers and database administrators were required to set up elaborate BCP instruction files that outlined all the BCP flags, columns and data types. Additionally, the error handling was limited to outputting the results to a log file. Today's use of BCP -- or SQL Bulk Insert, as it's referred to now -- is much simpler and tightly integrated with the Microsoft .NET Framework. The migration of the Bulk Insert process to the integrated coding environment has opened many more effective uses of Bulk Insert to .NET developers. The goal of this article is not just to show developers how to use the SQL Bulk Insert component within the .NET Framework, but to show how it can be effectively integrated into an automated system to greatly improve flexibility, code reuse, speed and efficiency.
Get Organized
The first step may sound obvious, but many developers rush to the final step of a solution. This results in wasted time and unorganized code. In this article I'll use the following components:
Why Use Generics
I'm sure many of you will ask, "Why use a generic list?" The main reasons are for type safety, usability, supportability and flexibility. In the ever-changing world of business-focused information technology, I always strive to design these key attributes into my code at the beginning; it's not simply enough to create a DataTable from a data provider. However, when a custom DataObject class and custom attributes are used, these components can be reused and offer much more flexibility.
Use Case
When it comes to getting your data, I'll leave that part to you. In this scenario, consider that a generic list of data objects are loaded from another database where users have requested a large amount of data to be copied to a separate database. In Listing 1, I created a simple DataObject class with some basic properties. Each of these properties should correspond to the columns you're pushing to your database. It's important to consider your data types at this step, because the Bulk Insert process is sensitive to incompatible data types.
Listing 1. A simple DataObject class for a generic list.
public class DataObject {
public Int32 ID { get; set; }
public String Description { get; set; }
public Int32 UseCode { get; set; }
public Boolean Active { get; set; }
public DateTime UpdateDate { get; set; }
}
Use a DataAdapter fill a DataTable from a basic SQL statement, like this:
SELECT ID, Desc, UseCode, Active, UpdateDate FROM SomeTable
The key to the flexibility and reuse of this code is the use of the DataObject class and a generic list. Listing 2 demonstrates the creation of this list from a DataTable. This is where that additional logic can be added to handle business requirements when transforming the data between sources. In this scenario, I had to remove leading spaces in the description.
Listing 2. Filling the DataObject list.
public List<DataObject> FillDataObjectList( DataTable dt ) {
try {
List<DataObject> myList = new List<DataObject>();
foreach ( DataRow row in dt.Rows ) {
DataObject myObject = new DataObject();
myObject.ID = Convert.ToInt32( row[ "ID" ] );
myObject.Description = row[ "Desc" ].ToString();
myObject.UseCode = Convert.ToInt32( row[ "UseCode" ] );
myObject.Active = Convert.ToBoolean( row[ "Active" ] );
myObject.UpdateDate = Convert.ToDateTime( row[ "UpdateDate" ] );
// The description has leading spaces so remove them.
myObject.Description =
myObject.Description.TrimStart();
myList.Add( myObject );
}
return myList;
}
catch ( Exception ex ) {
throw ex;
}
}
Before we pass this object to our Bulk Insert logic, it's useful to expand on our DataObject to include some custom attributes. The use of these attributes, shown in Listing 3, allows the subsequent Bulk Insert code to read our object and adapt to changes in the object, or allow other objects with the same custom attributes. I won't go into details about implementing custom attributes because there are plenty of samples publicly available. Additionally, the downloadable code for this article contains all the samples needed.
The changes to the DataObject class in Listing 3 are in bold. Each property is assigned a custom attribute that reflects the column name in the destination table. Additionally, the class itself has a custom attribute that reflects the destination table's name.
Listing 3. A DataObject class with custom attributes for a generic list.
[DataTable( "SomeTable" )]
public class DataObject {
[DataColumn( "ID", DbType.Int32 )]
public Int32 ID { get; set; }
[DataColumn( "Desc", DbType.String )]
public String Description { get; set; }
[DataColumn( "UseCode", DbType.Int32 )]
public Int32 UseCode { get; set; }
[DataColumn( "isActive", DbType.Boolean )]
public Boolean Active { get; set; }
[DataColumn( "UpdateDate", DbType.DateTime )]
public DateTime UpdateDate { get; set; }
}
Set Up the SqlBulkCopy
Now that I have the DataObject class set up with custom attributes for the column names, data types and destination table name, and have loaded the generic list of data objects from the source, I'm ready to set up the SqlBulkCopy method. The key to this implementation as compared to others is the use of these custom attributes. The following code shows that the method signature will take a list of data objects and a list of property names (note that the property name list is critical to loading the Bulk Insert object, so add your properties in the order that you've set them in your destination table):
public Boolean BulkInsertDataObjectList<T>(
List<T> myDataObjectList,
List<String> propertyList ) {
Within the BulkInsertDataObjectList method are two crucial blocks of code that will use the custom attributes. The first one, creating the dynamic DataTable shown in the following code, loops through the passed property list to dynamically create the data table and find the corresponding property in the DataObject:
PropertyInfo[] props = typeof( T ).GetProperties();
for ( int i = 0; i == propertyList.Count - 1; i++ ) {
DataColumnAttribute col =
GetColumnNameFromProperty<T>( propertyList[ i ] );
dt.Columns.Add( col.ColumnName, col.ColumnType );
}
The next step in this dynamic process is to load the data table. A simple loop is needed to create data rows for each data object in the list that was passed in:
foreach ( T rec in myDataObjectList ) {
DataRow row = dt.NewRow();
for ( int x = 0; x == propertyList.Count - 1; x++ ) {
row[ x ] = typeof( T ).GetProperty( propertyList[ x ]
).GetValue( rec );
}
dt.Rows.Add( row );
}
To truly achieve a flexible design, incorporating custom attributes allows the SQL Bulk Insert method to "learn" what is required to correctly insert the data. Now you're able to pass any object to this method as long as it has its table and column attributes set.
SqlRowsCopied Event
The Bulk Insert component has a useful event that should not be overlooked: the SqlRowsCopied event. This is a valuable event to provide feedback to logs or perhaps to a UI from which a user may have kicked off the process. This event, when paired with the NotifyAfter property, will raise the number of rows inserted to any subscribers throughout the entire insert process. I've implemented this for log tracking as well as UI progress meters:
bulkCopy.NotifyAfter = 10000;
bulkCopy.SqlRowsCopied += new
SqlRowsCopiedEventHandler
(bulkCopy_SqlRowsCopied );
When it comes to inserting data quickly and with minimal impact to server performance, SQL Bulk Insert on average can load a database table in seconds. In my test runs, I was able to insert 700,000 records in less than 20 seconds.
High Performance and Flexibility
In every project, your design goals should be to maximize performance, flexibility and code reuse. Designing software for the moment just isn't feasible. SQL Bulk Insert is a powerful way to deliver high performance when moving large amounts of data. Designing flexibility into these types of methods will help you in the long run.
About the Author
Erik Bartlow has programmed with Microsoft technologies since 1992. He has specialized in C# and ASP.NET for the past eight years. Additionally, he has extensive expertise in database design, DHTML and object-oriented programming. Currently with Hewlett-Packard, he's worked in the past with a range of businesses, from small IT consulting firms to large corporations.
Printable Format
> More TechLibrary
I agree to this site's Privacy Policy.
> More Webcasts | http://visualstudiomagazine.com/articles/2013/03/01/effective-use-of-sql-bulk-insert.aspx | CC-MAIN-2014-52 | refinedweb | 1,398 | 54.32 |
Alternate title: News flash: Sometimes things happen by mistake
rbirkby asks
why the
SHCOLUMNINFO structure has 1-byte packing.
"Was the expectation that there would be so many columns
in a details view that the saving would be worthwhile?":
#include <pshpack1.h> /* Assume byte packing throughout */
(There was of course a matching
#include <poppack.h>
at the bottom.)
This set the default packing for the entire header file to byte
packing instead of natural alignment.
By the time this mistake was identified, it was too late. Windows 2000 had already shipped, byte packing and all. And once the code ships, it's done. You're stuck with it.
Sorry.
Congratulations, this blog post is already Google result #2 for "SHCOLUMNINFO".
Does this have any unwanted consequences then?
@NB
It can lead to members being stored at non naturally aligned offsets. This could lead to lower performance on certain architechtures (not x86) which do not support unaliged access.
@Sunil
Wouldn't this lead to decreased performance on the x86 and exceptions (crashes) on CPU architectures that do require aligned access? (I would presume that the SHCOLUMNINFO for the embedded Windows platforms would be properly aligned).
Now, you would probably never actually notice the decreased performance on the x86, because I doubt anyone does enough manipulation of the SHCOLUMNINFO to ever notice.
SimonRev, For members of a structure declared as packed [rather than, say, pointers that just happen to have an odd numbered value that they shouldn't], the compiler will generate the extra code needed to unpack the number (i.e. getting two adjacent words and shifting bits of them together, or maybe just accessing the four bytes separately)
Sunil, it bombs performance on x86 too. The processor makes sure (for legacy instructions at least; don't try with SIMD ones) that unaligned accesses give you the right result, but it takes its own sweet time doing it (usually involving costly traps to microcode).
Actually, unaligned access is only slower when crossing cache-line boundaries, and then only if you would not have accessed the data on each side of the boundary. If you are processing data and accessing all the elements consecutively, then the performance hit will be undetectable and you could even have a gain, thanks to the higher-density packing, when you have a lot of consecutive elements.
There is no "drop to microcode trap" due to misaligned data access on x86.
Tests:
@Henning Makholm
I have never actually measured but my understanding was that on x86 unaligned accesses (except for _m128 and it's ilk) did not perform badly enough to worry. I have ready this in several places mostly recent in a description of IA-32el the dynamic translator of IA-32 to Itanium code. On of the problems it had to handle was the frequent use of unaligned access in IA-32 code and it says "the penalty for unaligned access on the IA-32 architecture is ver low." Similarly, I know vc does not have an __unaligned ptr type for x86 (unlike IA-64) as it's not worth it; the UNALIGNED macro is defined as nothing on x86.
Also unaligned SIMD performance is much better on Nehalem. Or so Intel claims.
@SimonRev
If the compiler knows about unaligned access (as it would if you access the members of this structure using . Or -> it can generate fixups.) This is why __unaligned works. In the general case, when the compiler does not know (i.e. If you pass a integer ptr to a separately compiled function) you get exceptions and fireworks etc. Unless the OS emulate unaligned access for you.
But what structure(s) in shlobj.h did require the packing directive that was previously there? Was there a structure that was used so much that packing made a noticeable change in memory usage?
Given that packing matters so little on the processor platforms on which Windows is most popular, and that the number of these structures allocated will probably be relatively small, I think even calling it a mistake is saying too much. This is a ‘don't care’.
@Henning:
I'm not sure that's true. I think I've heard somewhere recently that unaligned accesses on x86 actually aren't too bad. I wrote a little program to at least provide a tiny bit of evidence; after presenting it, I discuss possible failings. I'm on Linux at the moment so this would have to be modified a bit for Windows (e.g. the method of exiting):
_start:
mov rdi, 2000000000 ; rdi = 2 billion
mov rsi, rsp ; rsi = rsp
add rsi, 2 ; rsi -=2 OPTIONAL
jmp bottom
top:
mov rbx, [rsi] ; rbx = *rsi
sub rdi, 1 ; rdi -= 1
bottom:
cmp rdi, 0
jg top ; if rdi>0, goto top
mov rax, 1
int 0x80
I compiled it with '~/Downloads/nasm-2.09.04/nasm -f elf64 hello.s' and linked with 'ld -s -o hello-unaligned hello.o'. Then I removed the line labeled "OPTIONAL" and rebuilt, naming it 'hello-aligned'. I then tested with 'time hello-aligned; time hello-unaligned'. I ran it 6 times (there's no real method to that). This is running on a Core 2 Quad Q9400 (2.66 gHz).
The aligned version completed in 0.753 sec ("total" time) in five out of the six trials; the sixth took 0.754 sec. The unaligned version completed in 0.753 sec in four out of the six trials, and in 0.754 sec in the remaining two trials.
So the unaligned access to [rsp-2] in hello-unaligned vs the aligned access to [rsp] in hello-aligned doesn't seem to be hurting this particular test case.
The are a couple ways in which this test may not be so great. First, obviously the access is to the same memory location in each iteration of the loop. Thus the cache line will be warmed immediately and then there will be no misses. It's quite possible that an unaligned access that has to go to either L2 or main memory will incur an unaligned penalty. Second, the results when I was running a 32-bit version of that program (just replace 'r' with 'e' in all the register names) were a bit different. While most runs were the same, every so often the unaligned version would take far longer.
Some quick searching indicates that there probably *isn't* a performance penalty to unaligned accesses on x86 unless the accessed region spans a cache line. It's possible that this is what was happening in the long case.
If it's a ‘don't care’, it's also a ‘don't use’.
Am I correct in determining that the member missing padding is VARTYPE vt, which is 2 bytes, thus shifting the following 3 fields (DWORD, UINT, DWORD) out of alignment? After those are a couple Unicode strings which should also have 2-byte alignment, so they shouldn't be affected by it.
So to me it looks like the padding mistake saves 2 bytes in a 450-byte data structure and causes misaligned accesses to 4-byte 3 members. I would have to agree with Anonymous that this is a ‘don't care’.
@Nawak ITEMIDLIST used to live in ShlObj.h but it now lives in ShTypes.h; it needs byte packing because it's a concatenation of SHORT lengths and variable-length BYTE arrays.
Does this mean your post backlog is now up to just 10 days shy of 3 years?
Unless it's open source code, in which case you can change it and break backwards compatibility, because hey, it's open source. And then later you can change your mind again and change something else. And then three releases down you can change it again. But hey, it's still open source.
Apology accepted.
Still waiting for the Windows ME apology.
>once the code ships, it's done. You're stuck with it.
>Unless it's open source code
Or unless it's made by Apple. You know, they (try to) fix their mess-ups every few years, because they allow themselves to break downwards compatibility. And probably MS should do that too. Not all the time for minor things, mind you, but once ever two system versions would be fine. I am writing code for Windows 7 right now, and if it didn't work on 2k, I wouldn't be bothered. Because you know why? It does not work on 2k to begin with.
Having a problem nowadays which was made 10 years ago sounds quite a bit harsh to me, considering how fast the software world moves.
Smaug: What you don't realize is that the only reason people are using Win7 in the first place is that it runs approximately all Win2k software. If Win7 couldn't run important Win2k software, people just wouldn't use it, and you would have no market for your Win7-only software. WinXP was released nearly 10 years ago and some major corporations have only recently finished migrating FROM Win2k TO WinXP!
Microsoft doesn't control the hardware so they have no choice over whether to have backwards compatibility. If they want to sell a new version of Windows, it had damn well better run virtually everything that the old version ran, including that mission-critical VB6 app whose source code was lost 10 years ago. Even with the quite good backwards compatibility of Win7, WinXP still has 50% market share! MS has to stay compatible with everything but the worst security problems for decades if they want to keep selling software.
Companies like Apple that make the only hardware that their software runs on have the luxury of being able to stop making hardware that will run their old software. Since people will eventually need to buy new hardware and new hardware requires a new OS, people have no choice but to "upgrade", whether their old programs run or not. And of course they make their new software stop supporting old hardware, forcing anybody who wants to run new software to have to upgrade their hardware also. Thus, Apple has a sliding window of just a few years where they have to keep compatibility. Of course, it helps that people generally don't write their mission-critical apps for Apple operating systems (perhaps because they'd have to keep rewriting them), so backwards compatibility isn't such a big deal for Apple in the first place.
I see it the same as "WinXP". Heck, we even still use Win98 on some rare computers because the program running on them won't work with XP. (Another program could be convinced to work with 2k by some strange ancient voodoo but stops working for good on XP).
I was going to point out the same thing, the reason why Windows is pretty much the universal environment for computing is because MS bend over backwards to retain backwards-compatibility. I still have users running NT SP6 machines, and my code will run on them without any problems (and, just for reference, on Win7 as well). OTOH doing that with an Apple machine, or Linux, or […], not a hope.
Another thing that Apple can get away with, which almost no other company can, is to tell their users point-blank "X isn't being supported any more, gee it sucks to be you, get something newer", and most users will do so without much complaint. This makes them more a special case-study in abnormal customer behaviour than an example for others to follow. | https://blogs.msdn.microsoft.com/oldnewthing/20101216-00/?p=11993 | CC-MAIN-2018-30 | refinedweb | 1,937 | 71.04 |
Once a socket has connected you send data to the server via an output stream. You receive data from the server via an input stream. Exactly what the data you send and receive means often depends on the protocol.
The
getInputStream() method returns an
InputStream which reads data from the socket. You can use
all the normal methods of the
InputStream class you
learned about in Week 10 to read
this data. Most of the time you'll want to chain the
InputStream to some other input stream or reader class to
more easily handle the data.
For example, the following code fragment connects to the daytime server on port 13 of metalab.unc.edu, and displays the data it sends.
try { Socket s = new Socket("metalab.unc.edu", 13); InputStream is = s.getInputStream(); InputStreamReader isr = new InputStreamReader(is); BufferedReader br = new BufferedReader(isr); String theTime = br.readLine(); System.out.println(theTime); } catch (IOException ex) { return (new Date()).toString(); } | http://www.cafeaulait.org/course/week12/17.html | CC-MAIN-2015-32 | refinedweb | 159 | 59.19 |
Talk:Rep-string
Contents
Inspiration[edit]
The task was inspired by this question on stackoverflow. --Paddy3118 (talk) 19:45, 10 May 2013 (UTC)
Clarification[edit]
The task needs some clarifation. What is a repeat? Is string "10" itself repeated once? Is string "101" a repeat of "10"? When finding a repeated substring "if any", what's the preferred answer for "1111", is it "1" or "11", or even "111" and "1111"? There needs be a clear definition of the word "repeat", not just relying on whatever the first sample solution says, beause can be too arbitrary. --Ledrug (talk) 03:53, 12 May 2013 (UTC)
- I think I was most sloppy about "a series of ones and zeroes in a string": I meant a series of ones or zeroes. .. Oh wait .. Re-reading your question, repeat means "two or more times" which is in the description.
- Alternatively:
- Take a string of ones and zeroes X.
- Find out if there is at least one string Y of ones and/or zeroes that when repeated and truncated on the right to the same length as X is both equal to X and contains at least two repetitions of Y.
- If any valid Y is found then X is a rep-string.
- Hope this helps :-) --Paddy3118 (talk) 08:22, 12 May 2013 (UTC)
- To answer the question: Is string "101" a repeat of "10"? Yes. Repeated (twice, and then truncated) to the original length of three. -- Gerard Schildberger (talk) 07:22, 13 May 2013 (UTC)
- Yes it is. Repeat "10" twice, then truncate to the original length (which is three), that yields "101". There is nothing in the task description that says the repeat string has to appear (I mean, multiple times) in the result string, as in the case when the string is replicated, then truncated to the original length. -- Gerard Schildberger (talk) 19:10, 13 May 2013 (UTC)
- The task description was amended twice after I had entered the REXX version 2 example. With the latest task requirements, 101 isn't a rep-string. -- Gerard Schildberger (talk) 19:29, 13 May 2013 (UTC)
- Well, it's more wordy. I preferred the original task requirement without the need for the the last part of the first part, and the whole of the third paragraph. I prefer simplicity (a clean definition) and succinctness, but then, it's not my dog. I'm now left with my old arguments ... er, arguing with the original wording, not the amended requirements. So it appears that my statements are out-of-sync with what's what. -- Gerard Schildberger (talk) 20:02, 13 May 2013 (UTC)
- By the way, almost all programming examples have incorrect output, showing strings to be non-reps, whilest in fact, they are. -- Gerard Schildberger (talk) 07:22, 13 May 2013 (UTC)
- To get sane output, you need the restriction that the repeating unit must be no more than half of the length of the input string. Otherwise, the longest “repeating” unit is potentially the whole string, which is nuts. Any decision procedure for this needs to be able to reject a string as well as to find the repetition if it exists. (I'll update the task description momentarily.) –Donal Fellows (talk) 08:26, 13 May 2013 (UTC)
- A task requirement is that the repeat occur two or more times. One repeat doesn't meet that requirement. -- Gerard Schildberger (talk) 19:10, 13 May 2013 (UTC)
Should this sentence of the task description be changed?
Use the function to indicate the repeating substring if any, in the following:
Use the function to indicate the repeating substrings if any, in the following:
Does '1111' have 1 solution ('11') or 3 ('1', '11', '111')
Maybe the expected results could/should be stated.--Walterpachl (talk) 21:25, 13 May 2013 (UTC)
- Hi TimToady, I widened the requirement to report longest or shortest or all reps as there could be equal argument for those cases but I can't envisage an algorithm returning naturally some arbitrary other set of rep solutions unless that arbitrariness is 'self-injected'. --Paddy3118 (talk) 04:17, 14 May 2013 (UTC)
- Substring types:
- longest/shortest/all ( length)
- ovelapping/non-overlapping
- are any others ? --Adam majewski (talk) 06:53, 28 April 2019 (UTC)
Reason for update request[edit]
Ledrug posted a great algorithm for Python that worked on the previous list of examples but would have failed on a string of all ones or all zeroes without a (very) minor tweak. I applied the tweak but thought that:
'11' '00'
Should added to the list of mandatory test strings. --Paddy3118 (talk) 04:51, 13 May 2013 (UTC)
- Why should these be nom-reps?? --Walterpachl (talk) 16:40, 13 May 2013 (UTC)
- Hi Walter. I meant that Ledrugs' original code gave the wrong answer for these, not that they weren't rep-strings. Sorry for the confusion. Ledrugs' method was a great new way of solving things and I had to unlearn how I was doing things to figure out what he was doing. I thought that the corner cases of '11' and '00' needed mental investigation and that made me look at the limit of a range and think it - the original code, would need tweaking. --Paddy3118 (talk) 19:15, 13 May 2013 (UTC)
Draft status[edit]
I guess we might want to keep this task as draft a while longer due to the nature of the questions above. --Paddy3118 (talk) 19:26, 13 May 2013 (UTC)
Curiouser and curiouser![edit]
Ledrugs' Python text.startswith(shifted_text) is equivalent to TimToadys' Perl 6 boolean shift and XOR. I'll remember that! --Paddy3118 (talk) 19:41, 13 May 2013 (UTC)
c program[edit]
Hi, C program works great. I have add new example and it failed ( or I'm wrong). The result IMHO should be rep-string "001"
/*
*/
#include <stdio.h>
#include <string.h>
int repstr(char *str)
{
if (!str) return 0;
size_t sl = strlen(str) / 2;
while (sl > 0) {
if (strstr(str, str + sl) == str)
return sl;
--sl;
}
return 0;
}
int main(void)
{
// input strings = tests
char *strs[] = {
"1001110011",
"1110111011",
"0010010010",
"1111111111",
"0100101101",
"0100100",
"101",
"11",
"00",
"00100100100100100100100100100100100100100100100100100100100100100100100100100" }; // not works
size_t strslen = sizeof(strs) / sizeof(strs[0]); // number of test values
size_t i;
for (i = 0; i < strslen; ++i) { // check all test values
int n = repstr(strs[i]);
// print result
if (n)
printf("\"%s\" = rep-string \"%.*s\"\n", strs[i], n, strs[i]);
else printf("\"%s\" = not a rep-string\n", strs[i]);
} //
return 0;
}
- Output:
"1001110011" = rep-string "10011" "1110111011" = rep-string "1110" "0010010010" = rep-string "001" "1111111111" = rep-string "11111" "0100101101" = not a rep-string "0100100" = rep-string "010" "101" = not a rep-string "11" = rep-string "1" "00" = rep-string "0" "00100100100100100100100100100100100100100100100100100100100100100100100100100" = rep-string "001001001001001001001001001001001001"
- When given ten 1's it returns five 1's as the rep-string. Maybe The C function returns the longest rep-string and you expected the shortest? --Paddy3118 (talk) 15:50, 28 April 2019 (UTC)
- You are right, it gives the longest. I think that it should be explicitly stated. What about splitting C section into the 2 subsections : longest and shortest ? Also example strings IMHO should have strings which give differrent results for longest and shortest test. Does it sounds good ? --Adam majewski (talk) 16:13, 28 April 2019 (UTC)
new test values,[edit]
{ "1001110011", "1110111011", "0010010010", /* 4 x 001 and truncated, lat char can be from 001*/ "00100100101", /* 4 x 001 but last 2 chars are NOT from 001 */ "1111111111", "0100101101", "0100100", "101", "11", "00", "00100100100100100100100100100100100100100100100100100100100100100100100100100" }; | http://rosettacode.org/wiki/Talk:Rep-string | CC-MAIN-2019-30 | refinedweb | 1,251 | 69.72 |
In this blog, I’m explaining the concept of Response.Redirect() and Server.Transfer() method.
Response.Redirect() and Server.Transfer() both methods are user for user page transfer on page to another page. Both methods are same like as but some but some differences. Response.Redirect() sends an HTTP request to the browser, then the browser sends that request to the web server, then the web server delivers a response to the web browser.
Response.Redirect involves a roundtrip to the server whereas Server.Transfer conserves server resources by avoiding the roundtrip. It just changes the focus of the webserver to a different page and transfers the page processing to a different page.
Roundtrip means in case of Response.Redirect it first sends the request for the new page to the browser then browser sends the request for the new page to the webserver then after your page changes But in case of Server.Transfer it directly communicate with the server to change the page hence it saves a roundtrip in the whole process
Response.Redirect() Syntax as like:
Response.Redirect()("webForm2.aspx");
Server.Transfer() Syntax as like:
Server.Transfer()("webForm2.aspx");
· Response.Redirect() can be used for both .aspx and HTML pages whereas Server.Transfer() can be used only for .aspx pages and is specific to ASP and ASP.NET.
· Response.Redirect() can be used to redirect a user to an external website. Server.Transfer() can be used only on sites running on the same server. You cannot use Server.Transfer() to redirect the user to a page running on a different server.
· When you use Server.Transfer(), then the previous page also exists in server memory while in the Response.Redirect() method, the previous page is removed from server memory and loads a new page in memory.
Create a form as given below:
/>
Write code in the webForm1.aspx file
using System;
public partial class webForm1 : System.Web.UI.Page
{
string MethodName;
protected void btnResponseRedirect_Click(object sender, EventArgs e)
{
Response.Redirect()("view.aspx");
}
protected void btnServerTransfer_Click(object sender, EventArgs e)
{
Server.Transfer()("view.aspx");
}
}
Run the application click on Redirect From Response button.
/>
Click on Redirect From Server button.
/> | https://www.mindstick.com/blog/682/response-redirect-and-server-transfer | CC-MAIN-2016-44 | refinedweb | 361 | 60.92 |
Code. Collaborate. Organize.
No Limits. Try it Today.
In this article, I will discuss about how to implement OAuth in getting responses from 4 major social sites (Facebook, Google, Twitter and LinkedIn). The demo application will help the developers working with social authentication or social login integration to their website. The article will cover points starting from difference between OAuth version 1.0 and 2.0 to getting user profile responses. The demo application is a playground to test OAuth process step by step. In the application, we have the scope to add other social provider if we wish to.
OAuth
I faced so many issues in getting started with Version 1.0 OAuth code with different social sites like Google, Twitter and Linkedin. There are so many frustrating errors and responses coming from social sites that are of no real help and hint. But understanding them over again, I came to know that it is just a matter of sending correct authorization header to valid end points. I compiled all the working code of all social sites and made a working project to successfully authenticate from 4 different sites (Google, Facebook, Twitter and Linked in) and lastly getting back the user profile responses.
OAuth 1.0 version specifications are given at. In a nutshell version, practical steps are:
OAuth 2.0 version has relatively less steps as follow:
Starting from step 1 and code sample:
CustomerKey
CustomerSecret
GetRequestToken()
ObtainVerifier()
GetAccessToken()
AccessToken
AccessTokenSecret
Code
GetProfileResponse()
In OAuth process, there are 2 phases:
The first phase process is straightforward and has common code for almost all social sites authorization (depends on version 1.0 and 2.0). But for the second phase, we need some awareness to call the resources APIs. E.g., In Twitter, even after getting Access token, we needed "screen_name" or "user_id" to get profile data from Twitter server. Profile request URL for Twitter should be.
screen_name
user_id
Similarly, other providers need some query string params to pass with URL. We have a function CreateQueryString() in OAuth\OAuthContext.cs to add needed vars.
CreateQueryString()
var
private string CreateQueryString()
{
string queryString;
switch (SocialSiteName.ToLower())
{
case "twitter" : queryString = "?screen_name=" + ScreenName; break;
case "facebook" : queryString = "?access_token=" + AccessToken; break;
case "linkedin" : queryString = "?format=json"; break;
case "google" : queryString = string.Empty; break;
default : queryString = string.Empty; break;
}
return (queryString);
}
ConsumerKey
ConsumerSecret
localhost:49262
This article, along with any associated source code and files, is licensed under The MIT License
Response.Write("<p>" + ex.InnerException.Message + "</p>");//Error.
General News Suggestion Question Bug Answer Joke Rant Admin
Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.
C# 6: First reactions | http://www.codeproject.com/Articles/314987/Getting-User-Profile-Response-from-Social-Sites-us | CC-MAIN-2014-15 | refinedweb | 447 | 58.18 |
So, REST based web services are simpler than SOAP, right? Then why's it so difficult to create a REST based web service in Java? Using tools I can crank out a SOAP based web service in seconds - not so easy with REST. But help is on the way.
JSR 311: JAX-RS: The Java API for RESTful Web Services aims to simplify the process. Paul Sandoz, co-specification lead along with Marc Hadley, does a nice job of introducing JAX-RS in the presentation he delivered last month at Jazoon, specifically by comparing the work you'd have to do using just the servlet API versus the proposed JAX-RS annotations....
@UriTemplate("/hello")
public class Hello {
public String sayHello() {
return new String("Hello there.");
}
@HttpMethod("GET")
public String sayHello() {
return new String("Hello there.");
}
@HttpMethod("GET")
@ProduceMime("text/plain")
public String sayHello() {
return new String("Hello there.");
}
Before we can deploy the application, we need to generate a class that will load our resource classes (hello in our case), into the application. JAX-RS ships with an annotation processor that will generate this class for us. And NetBeans 6.0 ships with the Ant tasks necessary to call the annotation processor. You'll find it in build-impl.xml. The only problem is these tasks will only run if REST support is turned on:
and NetBeans 6.0 does not yet include an option to turn on REST support via the project's properties, so we just have to do it manually.
rest.support.on=true
There's one more piece to the runtime puzzle, and that's the servlet that kicks everything off, which is provided by the JAX-RS runtime: com.sun.ws.rest.impl.container.servlet.ServletAdaptor. If you look in the WEB-INF directory above, you see a web.xml, which loads this servlet, was also generated for us:
<servlet>
<servlet-name>RESTBeans Application</servlet-name>
<servlet-class>
com.sun.ws.rest.impl.container.servlet.ServletAdaptor
</servlet-class>
<init-param>
<param-name>resourcebean</param-name>
<param-value>restbeans.RESTBeansResources</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>RESTBeans Application</servlet-name>
<url-pattern>/restbean/*</url-pattern>
</servlet-mapping>
However, the contents of this web.xml did not make it into our distributable.
Much of how all of this works is explained in detail in the resources I list below. I found the RESTful Web Services tutorial and the Getting Started With RESTful Web Services Development articles particularly useful. However, in summary, we have an application flow which looks like the following:
ServletAdapter => RESTBeansResources => Hello
The ServletAdapter is provided by the JAX-RS runtime and loads the generated RESTBeansResources class, which in turn provides the REST resources - Hello in our application. The URL, /hello/restbean/hello, breaks down as follows:
/hello - the context root, configured in sun-web.xml
/restbean - mapped to the ServletAdapter, configured in web.xml
/hello - mapped to the Hello resource, configured using the @UriTemplate annotation in the Hello resource itself.
Admittedly, the application is very simple, but the real point of this post was to get you up and running with JAX-RS in NetBeans 6.0. It should now be possible to continue with the other exercises provided in the tutorial.
I never understood the complaint.
There's nothing that says that you have to play games with URLs to be a RESTful web service.
I mean, this infrastructure is nice and all, but hardly required. The whole point of REST is that it uses (mostly) off the shelf URLs and payloads, that it leverages the HTTP protocol above and beyond GET and POST, and we've been dealing with those for years.
The only thing that makes REST particularly "easy to use" is that you don't have to interoperate with any standard, that you don't have to ensure that your formats match some more formal spec, a spec that may well go beyond the needs of your application. You get to just "make it up", which keeps it very nimble and "agile".
So, it's nice that it's now "easy to do", but, frankly, they weren't that hard before.
Posted by: whartung on July 19, 2007 at 10:58 AM
Nice tutorial!
I note that tweak on project.properties file is quite cumbersome, but fortunately it was just temporary. With the coming beta1 release of NB 6.0, the support would be turned on automatically as user typing in JSR-311 annotations. Even the setting up GlassFish installation for REST libary jars is not necessary anymore.
Posted by: ntn on July 27, 2007 at 10:47 AM
I am having a problem configuring SWDP on Glasfish V2. I have installed Netbeans 6 M10. I am running Ubuntu. Netbeans and Glassfish were installed to default directories /usr/local and SWDP was installed in root folder.
When I created Hello application, restbeans-api.jar and restbeans-impl.jar were not showing up under Glassfish directory structure. I tired removing and adding the GlassFish to NetBeans again but still I dont see those 2 files under Glassfish directory tree. Need Help. The tutorial by Arun Gupta said to Update Netbeans from Netbeans Update Center Beta. Dont know how thats possible in M10 incase that is required.
Posted by: chirdeeptomar on July 28, 2007 at 08:32 AM read what he has to say about brian leonard the football player.
Posted by: heyman4132 on August 13, 2007 at 11:32 PM
Too funny. Thanks for the pointer. /Brian
Posted by: bleonard on August 14, 2007 at 05:15 AM
Loved the tutorial thanks a lot. I was wondering how to do the opposite of what you showed here. I am developing a REST web service in RoR and want to consume it from a Java Desktop application. Is there a tool in Netbeans or other IDE that generates the stub for the client side in a desktop application?
Thank you for your time
Posted by: gustavomartin on August 30, 2007 at 03:30 PM
chirdeeptomar:
If you use netbeans 6.0 beta2 (), there is no need to install SWDP or Jersey library on GF. The support for REST on NB 6.0 grows at a quick pace. Please see: for latest info.
Posted by: ntn on October 25, 2007 at 10:47 AM
First of all thanks for the well organized tutorial.
I have tried to implement the same.But got stuck in the middle.
After building the application, it says "Build Successful". When i tried to run the application following error has been displayed on the browser
"HTTP Status 404 - Servlet RESTBeans Application is not available"
When i observed the build folder, it has not generated the folders and classes related to the RESTBean resources even though the build was sucessful.
Nore: rest.support.on=true property has been set in properties file.
Plz reply if any body gets some info for the above problem.
Thanks
Posted by: srini925 on April 03, 2008 at 05:58 AM
UPDATE: Since this blog was written,
the Jersey project has taken the place of the Sun Web Developer Pack. Jersey is the reference implementation of JAX-RS (JSR 311) and NetBeans has excellent support for Jersey. If you're using NetBeans 6.0, just go to Tools > Plugins and install the RESTful Web Services plugin. In NetBeans 6.1 this plugin is included with the standard distribution. So the steps I outline to start working with JAX-RS are no longer necessary - just get NetBeans and go. /Brian
Posted by: bleonard on April 23, 2008 at 01:17 PM:44 AM | http://weblogs.java.net/blog/bleonard/archive/2007/07/an_introduction_1.html | crawl-002 | refinedweb | 1,277 | 65.22 |
Revision history for ElasticSearch 0.65 2013-05-08 Add support for ignore_missing to get_aliases() 0.64 2013-02-26 Default query for count() 0.63 2013-02-12 Removed unsupported params from mlt() 0.62 2013-01-03 BUG FIX Don't destroy params passed in to new() ENHANCEMENT Added the 'order' param to index templates 0.61 2012-11-09 ENHANCEMENT Ignore empty queryb/filterb sections 0.60 2012-11-07 ENHANCEMENT: Added a max_content_length attribute to ElasticSearch::Transport to avoid posting too large a body to elasticsearch. The value is auto-detected in versions 0.19.12 onwards. Added doc param to update() 0.59 2012-10-31 BREAKING CHANGE: Added the 'explain' parameter to validate_query(), which now returns a hash instead of true|false BUG FIXES: The queryb->query, filterb->filter SearchBuilder conversions no longer change the original parameters ENHANCEMENTS: Added cluster_reroute() Added type_exists() Added warmer APIs Added explain API Added upsert to update() Added ignore_indices param to search(), searchqs() and msearch() Bulk error handlers now receive the element number of the error to identify the original item in the array (required for Elastic::Model) Errors now have string comparison overloaded 0.58 2012-08-09 Added a _method_name parameter to reindex() so that objects other than ScrolledSearch can be passed as the $source. The scrolling defaults to $source->next, but with $method_name will be called as $source->$method_name. 0.57 2012-07-31 Minor changes to ElasticSearch::TestServer to make it work consistently on Travis CI 0.56 2012-07-31 BUG FIXES - Trying to bulk create a doc that already exists should also trigger a conflict error, not a general error. 0.55 2012-07-06 ENHANCEMENTS - Added on_conflict and on_error callbacks to bulk actions and reindex() 0.54 2012-06-30 NEW FEATURES - Added exists() ENHANCEMENTS - An ElasticSearch::Error::Conflict object now contains the latest version number - delete_mapping() now throws an error when the index or type is - get() now accepts a 'parent' param - searchqs() now accecpts 'lenient', 'quote_analyzer' and 'quote_field_suffix' params - msearch() now accepts a 'search_type' param BUG FIXES - Removed dependencies on Module::Build and base missing - Worked around bug in ES which causes the default HTTP backend to hang by returning a response body to a HEAD request - Fixed current_server_version() to work with async backends 0.53 2012-04-14 Bug fix: - the timestamp param to index() should be a 'string', not a 'duration' 0.52 2012-03-17 BREAKING CHANGE: - get_alias() now uses the native GET alias request, and its output format has changed. Bug fix: - put_mapping() incorrectly required a single index. Now it can contain zero or more indices 0.51 2012-03-05 index() and create() were missing consistency and replication parameters 0.50 2012-03-02 - Added msearch() - The short-circuit functions for bulk/mget weren't working correctly either with as_json or async backends - Fixed bug in TestServer where it wasn't shutting down ES correctly if it failed to create a new ES.pm object 0.49 2012-02-17 Don't pass a custom port param through to ElasticSearch::TestServer 0.48 2012-02-17() 0.47 2011-10-24 Merged patch from AVAR, which ensures that the servers are used in random order. 0.46 2011-09-07 Fixed support for parent/child in reindex() - thanks to PERLER for reporting 0.45 2011-08-27 Doc typo corrected 0.44 2011-08-27 Added support for deflate() to all HTTP Transport modules. 0.43 2011-08-26 Added ElasticSearch::Transport::AECurl, and async backend which uses libcurl, via AnyEvent::Curl::Multi 0.42 2011-08-26 Dull Dist::Zilla change, for CPAN 0.41 2011-08-26 BREAKING CHANGES: - ElasticSearch::Transport::Thrift is now in a separate release - delete_index() and delete_mapping() now require an index parameter, to avoid accidental deletes. - the return value for the bulk() methods, when { as_json => 1} is specified, is now the JSON equivalent of the normal return value, not the raw value from ES OTHER: - started using Dist::Zilla - Added ElasticSearch::Transport::Curl, as a separate release - get_aliases now works with {as_json => 1} 0.40 2011-08-10 BREAKING CHANGE: - index_exists now returns an empty list if the index doesn't exist. Previously, it threw an error. OTHER: - Deprecated the use of top level mapping parameters in put_mapping() in favour of just using the 'mapping' param - IDs could not contain eg "/" before - now fixed with Any::URI::Escape ie (URI::Escape or URI::Escape::XS) - The 'servers' param to new() now defaults to localhost if not specified - The "scroll" param to scrolled_search() now defaults to '1m' - added search_from and search_size to mlt() - added analyze_wildcard and lowercase_expanded_terms to searchqs() - mget() now returns [] if no docs specified, instead of dieing - Made Test::More v 0.96 a dependency, and fixed the hashbang path in the example (thanks to AVAR) 0.39 2011-07-19 - "type" is now optional for get() requests - added index_exists() - added mget() - added SearchBuilder integration for aliases 0.38 2011-07-03 - Integrated ElasticSearch::SearchBuilder - Deprecated the use of query types as top level params to count() and delete_by_query() in favour of query or queryb - trace_calls() now also accepts a filehandle (thanks FERREIRA) - TestServer now supports ES_TRANSPORT=all 0.37 2011-05-01 BREAKING CHANGES: - ElasticSearch::ScrolledSearch $scrolled_search->next() now returns 1 result by default, instead of $size results, to make it easier to write: while (my $result = $scroll->next) {} - ElasticSearch::TestServer is now an object which subclasses ElasticSearch itself. connect_to_server() has been removed. Also, the port parameter can be used to specify a custom start port when starting the test server, making it easier to run the test server while there is an existing ES server running. 0.36 2011-04-24 Updated ElasticSearch.pm to work with ElasticSearch version 0.16.0 New features: - no_refresh: Disable the automatic discovery of live nodes, to work with remote clusters or proxied clusters - scrolled_search(): Convenience iterator to wrap search/scroll requests - reindex(): Utility to reindex data from one index to another, or one cluster to another - use_index()/use_type(): Set default index/type parameters - searchqs(): URI/query string search, (as opposed to search() which uses a request body) - New search_type's : 'scan' and 'count' - index_settings(): Retrieve index settings 0.35 2011-04-07 Added the 'dynamic_templates' option to put_mapping 0.34 2011-03-20 Fixed the tests for scrolling - turns out sorting when scrolling works correctly. It was my tests which were bad. 0.33 2011-03-19 Added the ElasticSearch::Transport::HTTPTiny backend 0.32 2011-03-19 - Added as_json as an arg to all ES requests. - Fixed a logic bug when setting the port manually in ElasticSearch::TestServer - Fixed a bug in ElasticSearch::TestServer which was preventing it from working on OSX Thanks to PERLER for the above - Changed some query syntax in t/10-queryparser.t for perl 5.8.3 0.31 2011-03-16 Fixed a bad test plan 0.30 2011-03-16 - Added some missing requirements to Build.PL - scroll() now accepts a 'scroll' parameter and works (but sorting when scrolling still broken on the server) - reindex_es.pl now also preserves the _parent and _routing fields 0.29 2011-03-15 - Updated the Changes file 0.28 2011-03-14 Support added for: - Percolators - create_percolator() - delete_percolator() - get_percolator() - percolate() - Open / Close index - open_index() - close_index() - Index templates - create_index_template() - delete_index_template() - index_template() - Routing - Parent docs - Versioning - Analyzer - analyze() - ElasticSearch::QueryParser - Parses and filters query strings, to ensure that user data is in an acceptable form for passing to ES - ElasticSearch::TestServer - starts a test server for use by the test suite - factored out to make it easier for others to use Also: - create_index() now supports adding mappings at the same time - Added bulk_create(), bulk_index() and bulk_delete() - Bulk actions now accept _id and id etc, which means that search results can be passed directly to bulk without renaming these parameters - Added river_status() - New errors - ElasticSearch::Error::Conflict - versioning conflict - ElasticSearch::Error::Missing - requested index/doct etc missing - both these errors inherit from ElasticSearch::Error::Request - Added ignore_missing to many methods which allows you to ignore Missing errors - Added query_parser - added timeout() as sugar for $es->transport->timeout() - added refresh_servers() as sugar for $es->transport->refresh_servers() In ElasticSearch::Transport - added max_requests() to force a refresh of known live nodes every $max_requests - on the first request, the list of live nodes is automatically updated - made httplite recognise more error states as temporary Connection errors - added support for recognising 404 and 409 HTTP codes - upgraded Thrift to version 5.0 - improvements to logging Miscellaneous: - added examples/reindex_es.pl - fixed a bug in the Makefile.PL 0.27 2010-10-21 Fixed an undefined bug in Transport::refresh_servers which would die if no nodes were found 0.26 2010-10-20 Added a missing dependency on parent.pm 0.25 2010-10-20 Another ambiguous use of localtime in ElasticSearch::Transport 0.24 2010-10-20 Corrected an ambiguous use of localtime in ElasticSearch::Transport Added examples/search_issues.pl Minor tidying to tests 0.23 2010-10-19 POD corrections 0.22 2010-10-19 Support ElasticSearch version 0.12.0 Added the bulk() method, for bulk indexing, creating and deleting Added create_river(), delete_river() and get_river() Added delete_mapping() Added error_trace() Completely refactored ElasticSearch to enable pluggable backends: - The request parser methods now live in ElasticSearch/RequestParser.pm although they are loaded into the ElasticSeach namespace - Added ElasticSearch::Transport as a transport base class - Added ElasticSearch::Transport::HTTP (default) as the LWP backend - Added ElasticSearch::Transport::HTTPLite as the HTTP::Lite backend - Added ElasticSearch::Transport::Thrift as the Thrift backend - Added ElasticSearch::Error class for exception objects - Added ElasticSearch::Util with some generally useful utilities - A number of methods have from ElasticSearch to ElasticSearch::transport including current_server(), servers(), refresh_servers() - Removed the debug() method - now use $ElasticSearch::DEBUG instead - Added filter_keywords to ElasticSearch::Util 0.21 2010-09-18 Supports ElasticSearch version 0.10.0 Added the _source parameter to put_mapping() 0.20 2010-09-04 Supports ElasticSearch version 0.10.0 Added update_index_settings() plus test Added pod coverage test 0.19 2010-08-19 Supports ElasticSearch version 0.9.1 Minor bug fix to cluster_state Updated tests to use facet_filter instead of filter 0.18 2010-08-01 Updated Changes file 0.17 2010-08-01 Supports ElasticSearch version 0.9, which removes support for some features of older versions. - In search() added support for 'script_fields' - In count() and delete_by_query() added support for 'custom_score', 'fuzzy', 'span_term', 'span_first', 'span_near', 'span_not', 'span_or' - Removed terms() - now handled by search facets - Added the 'full' parameter to flush_index() - Changed put_mapping() to automatically prefix the type properties definition with the type name - Removed get_mapping() and replaced it with mapping(), which uses the newly exposed GET _mapping API - Added current_server_version() - Added the 'filter_nodes', 'filter_metadata', 'filter_routing_table' and 'filter_indices' params to cluster_state() 0.16 2010-05-20 Added an ElasticSearch::Error::Timeout error class, to catch occassions when the request times out, instead of failing for a different reason. Also, catch 'Server closed connection' errors, and automatically refresh_servers and retry the request. 0.15 2010-05-16 Fixed a bug in refresh_servers() introduced in 0.14, when forking processes. 0.14 2010-05-16 The object now stores the original servers parameter, so that if the nodes disassociate and the live server list is limited, the object can still try the original servers. 0.13 2010-05-13 Added nodes_stats(), shutdown(), restart() and camel_case() Removed Alien::ElasticSearch, as it is now easier to install ElasticSearch directly. Tested against ElasticSearch version 0.7.0 0.12 2010-04-16 Added scroll() and the indices_boost param to search() Tested against ElasticSearch version 0.6.0 0.11 2010-04-07 Updated changelog 0.10 2010-04-07 Fixed the duration regex Improved docs for shutdown() 0.09 2010-04-07 Changed refresh_servers to handle http_address and httpAddress Added a terms filter test 0.08 2010-04-05 - Changed all_field to _all 0.07 2010-04 0.06 2010-04-03 - The test suite now requires Alien::ElasticSearch, and uses its own config file and work dir, so as not to interfere with existing data - Added clear_cache() - Added fuzzy_like_this and fuzzy_like_this_field clauses to count() and delete_by_query() - Added more_like_this() - Added more_like_this/more_like_this_field clauses to count() and delete_by_query() - Changed exclude_from and exclude_to to from_inclusive and to_inclusive in the terms() query - the filteredQuery clause renamed to 'filtered' as per a change in ES - Added aliases() and get_aliases() - Deleted the QueryDSL doc, as the ElasticSearch docs are much improved 0.05 2010-03-04 - Delayed connecting to the cluster until actually required (previously it refreshed the server list in new() ) - Restructured the internals again, to make it easier to read - Added cluster_health() - Fixed the test suite so that auto-started nodes don't take over the terminal - Enabled more tests as ElasticSearch now less buggy 0.04 2010-02-23 - Added terms() - Added get_mapping() - Renamed create_mapping() to put_mapping() - Added ignore_duplicate param to put_mapping - skip create-duplicate-mapping test if cluster has more than one nodes 0.03 2010-02-21 - Corrected the docs for search/count/delete_by_query - Added POD for the Query DSL - Added a SIG{INT} to the test file, so that it shuts down the servers if the test suite is interrupted 0.02 2010-02-21 - Rewrote the module completely to use a dispatch table - makes it easier to extend - Added a test suite - Added Alien::ElasticSearch so that we can test against a live server 0.01 2010-02-16 First version, released on an unsuspecting world. | https://metacpan.org/changes/release/DRTECH/ElasticSearch-0.65 | CC-MAIN-2015-35 | refinedweb | 2,252 | 51.58 |
When.
To take advantage of XML within your application, you should use LINQ to XML. I am sure you have used LINQ to SQL and LINQ to iterate over other types of collections. LINQ works just as effectively over XML, too. In this article, you will get an introduction to using LINQ to read, insert, update and delete data from an XML file. You will also see how to use isolated storage to store your XML files.
The XML Data for this Article
An XML data file called Product.xml is located in the \Xml folder of the Silverlight sample project for this article. This XML file contains several rows of product data that will be used in each of the samples for this article. Each row has four attributes: ProductId, ProductName, IntroductionDate and Price.
<Products> <Product ProductId="1" ProductName="Haystack Code Generator for .NET" IntroductionDate="07/01/2010" Price="799" /> <Product ProductId="2" ProductName="ASP.Net Jumpstart Samples" IntroductionDate="05/24/2005" Price="0" /> ... ... </Products>
The Product Class
Just as you create an Entity class to map each column in a table to a property in a class, you should do the same for an XML file, too. In this case, you will create a Product class with properties for each of the attributes in each element of product data. Listing 1 shows the Product class.
Just as you create an Entity class to map each column in a table to a property in a class, you should do the same for an XML file.
The CommonBase Class
Notice that each property set in the Product class calls a method named RaisePropertyChanged. This method is created in a class called CommonBase. This method will raise the PropertyChanged event to inform your XAML UI that a particular property has changed value. The XAML UI can then update the data on the screen automatically. Listing 2 shows the implementation of the CommonBase class.
Reading Data
One of the first things you will want to do with your XML file is read the data from the Product.xml file using LINQ to XML. After reading the data, you will display that data in a ListBox on a Silverlight user control. If you download the sample application that comes with this article you will be able to follow along. Create a list box to display the data from the Product XML file that looks like the following:
<ListBox ItemsSource="{Binding}" ItemTemplate="{StaticResource ProductTemplate}" Name="lstData" />
You will find the ItemTemplate in the App.Xaml file so it can be reused on each of the user controls in this application. The ItemsSource is set to "{Binding}" so it knows that you will be setting the DataContext for the data at runtime. Next, it is time to write the code to retrieve the data. You want to add a reference to the System.Xml.Linq.dll and import a couple of namespaces at the top of your user control.
using System.Linq; using System.Xml.Linq;
In the UserControl_Loaded event procedure you will call a procedure named LoadProducts to create a collection of Product objects.
private void UserControl_Loaded( object sender, RoutedEventArgs e) { LoadProducts(); }
In the LoadProducts procedure, you will use the Load method of the XElement class to load the XML file. Once the XML file has been loaded, you write a LINQ query to iterate over the Product descendants in the XML file. In this query you use an orderby clause to order each element by ProductName.
The select portion of the LINQ query creates a new Product object for each row in the XML file. You retrieve each attribute by passing each attribute name to the Attribute() method and retrieving the data from the Value property. The Value property will return either a null if there is no data, or will return the string value of the attribute. The Convert class is used to convert the value retrieved into the appropriate data type required by the Product class.
NOTE: There is a BIG problem with the above code (illustrated in Listing 3)! If you have any missing attributes in any of the rows in the XML file, or if the data in the ProductId or IntroductionDate is not of the appropriate type, then this code will fail! The reason? There is no built-in check to ensure that the correct type of data is contained in the XML file. You will learn how to deal with this problem in the next section.
Converting XML Values Using Extension Methods
Instead of using the Convert class to perform type conversions, you might want to create a set of extension methods that you can attach to the XAttribute class. These extension methods will perform null-checking and ensure that a valid value is passed back instead of an exception being thrown if there is invalid data in your XML file. Listing 4 shows the modified LoadProducts method using extension methods.
Create extension methods to perform null-checking and valid values when using LINQ to XML to read XML data.
Adding Extension Methods
To create an extension method you will create a class with any name you like. Listing 5 shows a class named XmlExtensionMethods. This listing just shows a couple of the available methods such as GetAsString and GetAsInt32. These methods are just like any other method you would write except when you pass in the parameter you prefix the type with the keyword this, which lets the compiler know that it should add this method to the class specified in the parameter.
Each of the methods in the XmlExtensionMethods class should inspect the XAttribute to ensure it is not null and that the value in the attribute is not null. If the value is null, then a default value will be returned such as an empty string or a 0 for a numeric value.
Working with Isolated Storage
When working with any .NET application you have the option of storing any data you want in a file located in a special folder on the hard drive. This special folder is unique for each application and user. Using isolated storage ensures that each application/user combination has a unique location, and any files placed there will not interfere with any other user files. In order to use isolated storage in your .NET application, you will add a “using” statement to the top of your file.
using System.IO.IsolatedStorage;
In the samples for this article you will create an entry into isolated storage using key/value pairs as shown in the following code fragment:
IsolatedStorageSettings. ApplicationSettings["Name"] = "Bruce";
This will automatically add a key called “Name” and set the value “Bruce” into that location. Using the key/value pair approach is nice because it allows you to check to see if a value exists prior to accessing it. To check if a key exists you use the Contains method on the ApplicationSettings property of the IsolatedStorageSettings class.
You can create a method named GetProductXml as shown in Listing 6 to either open the stored XML file from isolated storage or from the \Xml folder in your application. If the key name does not exist in isolated storage, you can open the file from the \Xml folder and store it into isolated storage so that the next time you call this method, it will retrieve the XML file from isolated storage. Placing the XML file into isolated storage will allow you to insert, update and delete data from that XML file. Notice that you are using a public constant from the Product class for the key name.
If you will be updating data in your XML file in isolated storage, you will first need to read the complete XML file into memory, make any changes, and then store that data back to isolated storage. You might want to create a SaveProductXml method that you can pass in an XElement object to. This method will replace the data with the data from the XElement object you pass in.
private void SaveProductXml(XElement xElem) { // Create/Modify data in Isolated Storage IsolatedStorageSettings. ApplicationSettings[Product.KeyName] = xElem.ToString(); }
Inserting Data
Now that you have learned how to read data using LINQ to XML and how to store the data read into isolated storage, you can now learn to add new data to your collection. Inserting data does not use LINQ to XML; it uses the XElement and XAttribute classes to create a new element you add to the XElement object that contains your complete XML file. Listing 7 shows how to create a new Product object and use that new object to create a new XML element with the appropriate attributes to add to your XML file stored in isolated storage.
Updating Data
To update data in your XML file, you will first use LINQ to XML to locate the specific element you want to modify. Once you have retrieved that element, you can modify the data by setting the Value property of the individual attribute objects in that object. Listing 8 contains the code to show you how to locate a Product object with a specified ProductId and modify the data within an existing XElement object. Notice that you must call the SaveProductXml method in order to save these changes back to the XML file.
Deleting Data
Deleting data is very similar to updating as you will see in Listing 9. You first must locate the individual product element you are interested in deleting. Call the Remove method on that found XElement object. When you call the SaveProductXml method, this saves the new XML file with this row removed.
Getting XML from the Server
So far, you have learned how to read, insert, update and delete data from an XML file using the XElement class and LINQ to XML. In the sample project, you already had a Product.xml file that was contained in your project. However, sometimes you may wish to retrieve data from a database server and then store that data as XML in isolated storage. This is useful if you have a salesperson that will be downloading data prior to going out on the road where they may have weak or only intermittent connectivity.
To accomplish this, you will need to create a WCF Service, or you could use the new Web API to return some XML. In the sample project for this article you will find a WCF Service that retrieves data from a Product table in a SQL Server database and converts that data to an XML string.
The GetProductXml method shown in Listing 10 uses a SqlDataAdapter and DataSet to retrieve data from a Product table. Once the DataSet is loaded into memory, loop through each column and set the ColumnMapping property to the value “MappingType.Attribute”. Setting this property makes the XML attribute-based as opposed to element-based. Attribute-based XML will make the data transferred across the wire a little smaller.
Set the DataSetName property to the top-level element name you want to assign to the XML, in this case “Products”. Set the TableName property on the DataTable to the name you want each element to be in your XML, in this case also “Product”. The last thing you do is call the GetXml() method on the DataSet object, which will return an XML string of the data in your DataSet object. This string is what you return from the service call.
The GetProductXml() method uses a connection string from the Web.Config file, so you need to add a <connectionStrings> element to the Web.Config file in your Silverlight web project or your WCF Service project. Modify the settings shown below as needed for your server and database name.
<connectionStrings> <add name="Sandbox" connectionString="Server=Localhost; Database=Sandbox; Integrated Security=Yes"/> </connectionStrings>
Consume and Store XML
In your Silverlight application you add a Service Reference to the WCF Service you created. Now you can write code (Listing 11) to call the WCF Service and store the returned XML string into isolated storage.
As you can see in Listing 11, this is a fairly standard call to a WCF Service. In the Completed event you get the Result property from the event argument. The Result property is the XML. You store the XML into Isolated Storage using the IsolatedStorageSettings.ApplicationSettings class. The key for the isolated storage comes from the Product class. After you have stored the XML you can now read and modify the XML in isolated storage without having an Internet connection.
More Samples
In the sample that you download with this article there are two more samples that I did not have enough room to cover in this article. The first shows you how to add a where clause to the LINQ to XML to read just a portion of the data in the XML file. The second sample is a simple add, edit and delete Silverlight user control to show you how to use the techniques discussed in this article all together. Figure 1 shows you how this sample looks.
Summary
XML files are a great way to store data in Silverlight, WPF, Windows Forms and even ASP.NET applications. I find XML files to be especially useful for prototyping applications. I can quickly create XML files and show a user data in their application without having to worry about connections to databases or creating services. XML files work great for offline storage too, as shown in this article. LINQ to XML is a great way to retrieve data and you have the full LINQ language to work with when using XML. I have used LINQ to XML to work with XML files up to 6000 rows of data and have seen a second or less response time. I am sure you will find a lot of uses for XML in your applications. | https://www.codemag.com/Article/1210021/LINQ-to-XML-Instead-of-a-Database | CC-MAIN-2020-10 | refinedweb | 2,317 | 60.95 |
03 February 2004 09:41 [Source: ICIS news]
ZURICH, Switzerland (CNI)--Swiss specialty chemicals company Ciba forecast on Tuesday an improvement in profits and sales this year after announcing a 28% (14% in local currencies) slump to SF571m ($453m/Euro365m) in 2003 operating profits.
Earnings before income tax, depreciation and amortisation (EBITDA) fell 20% (9%) last year to SF937m on sales down 6% (flat) at SF6.65bn. The EBITDA margin fell to 14.1% from 16.6% in 2002, while net income was down 15% to SF344m.
?xml:namespace>
Ciba blamed the lower earnings on adverse currency effects and the costs of temporary plant closures. However, it predicted that 2004 sales in local currencies, the EBITDA margin and net income in Swiss francs would exceed last year’s levels assuming business conditions are at least comparable to 2003 and currency levels do not deteriorate.
Although Ciba did not immediately quantify the expected improvements, it said that should a sustainable economic recovery take shape, it would expect “a rapid and substantial improvement in net income and margins”.
Ciba cautioned, however, that it saw no signs of a sustainable improvement in global business conditions and only the first indications of an upturn in several of its customers’ industries. Therefore, it would continue with firm measures to control costs globally as well as restrict hiring in lower-growth markets specifically.
Chairman and chief executive Armin Mayer described the company’s cost-cutting initiatives and their impact on profitability as “an acceptable, one-time price to pay to reduce net current assets and net debt.”
He added: “We will now focus on holding net current assets at these lower ratios, while again strengthening profitability. We used the last three years to lower our cost base and make our balanced sheet leaner, so when a sustainable economic recovery begins the company will be able to quickly leverage these improvements into substantially higher net income and profitability margins.”
Ciba said it made a concerted effort to cut operating assets, particularly inventories, in the fourth quarter last year. Although this helped boost free cash flow, it hit operating profits by SF60m. Fourth quarter operating income plunged by 46% (47% in local currencies) to SF87m on sales down 3% (1%) to SF1.62bn.
EBITDA in the three months to 31 December slumped by 30% (29%) to SF180m and the EBITDA margin tumbled to 11.1% from 15.3% in Q4 2002. Net income was slashed by 55% to SF43m.
Over the full 12 months last year, Ciba suffered substantial declines in operating profits from all business divisions, with plastic additives and textile effects especially hard hit.
Sales in Swiss francs were also down for all business segments, although up slightly or flat in local currencies apart from textile effects which suffered a 3% decline.
Ciba blamed the overall sales decline last year on volatile market conditions and a sluggish global economy which kept volume gains to 3%. Price reductions totalled 3%. Ciba explained that volume growth was unable to offset negative currency effects and lower sales prices.
However, it noted some improvement towards the end of the fourth quarter in sales to customers in early cyclical industries. It also noted that raw material price rises, particularly for the plastic additives and water and paper treatment segments, had subsided by the year end.
Unsurprisingly, Asia Pacific was the main sales growth region, with revenues up 5% in local currencies but down 3% in Swiss francs. Sales in Europe fell 1% in local currencies and were flat in Swiss francs. In the Americas, sales fell 3% in local currencies and, due to the weak dollar, tumbled by 16% in Swiss franc | http://www.icis.com/Articles/2004/02/03/555362/ciba-sees-better-04-after-28-slump-to-sf571m-in-03-op.html | CC-MAIN-2015-18 | refinedweb | 611 | 51.28 |
Java Basics - Interview Questions and Answers
What is a class?A class is a blue print from which individual objects are created.
public class Dog{ String breed; int age; String color; void barking(){ } void hungry(){ }.
Explain Polymorphism?Polymorphism is the ability of an object to take on many forms. The most common use of polymorphism in OOP occurs when a parent class reference is used to refer to a child class object. For Detailed tutorials on polymorphism please visit Polymorphism In Java.
Explain Method signatures.The signature of a method is the combination of the method’s name along with the number and types of the parameters (and their order).
Why we use static before public static void main?A static method is one that's associated with a class, but can be called without creating an instance of that class. Most methods (i.e., non-static ones) require an object to be called, but static ones do not.
The real answer is, of course, that this is just how they chose to do it. A non-static main() would have worked just as well; the JVM could create an instance of main()'s class to call it if it needed to. But since the JVM is designed to expect a static method, that's what you must use.
Can we have more than one public class in .java file ?No, we can have only one public class in a .java file. It's just for conventions. Think if you have declared a class as public that means that you want to access it from anywhere else also, now if you declare that class in some other .java file. How does compiler find that, keeping into this mind these conventions are derived.
What is enum in java ?Enumerations (in general) are generally a set of related constants. They have been in other programming languages like C++ from beginning. After JDK 1.4, java designers decided to support it in java also, and it was officially released in JDK 1.5 release.
Enumeration in java is supported by keyword enum. enums are a special type of class that always extends java.lang.Enum.
A simple usage will look like this
public enum DIRECTION { EAST, WEST, NORTH, SOUTH //optionally can end with ";" }
Here EAST, WEST, NORTH and SOUTH are final static inner classes of Direction of type Direction extends java.lang.Enum.
Difference between String Buffer and String Builder. | http://www.tutorialsdesk.com/2014/09/java-basics-interview-questions-and.html | CC-MAIN-2019-09 | refinedweb | 407 | 66.33 |
The Oracle Servlet Engine (OSE) works as a specialized Web server, designed as a scalable servlet server inside the Oracle8i database.
The servlet classes are loaded into Oracle8i with a
loadjava command and published in a namespace inside the database. A servlet runner handles HTTP requests, instantiates published servlets in sessions, and invokes servlet methods.
The following sections contains descriptions and diagrams of the following topics:
You can use one of the create commands to define domains, contexts, and servlets. All contents are served by servlets. The servlet location is defined by the client in the URL.
A Web page is defined as an HTML file containing only static HTML descriptions of hyperlinks, and graphic and formatted text display. A Web application provides users with a more interactive experience than a static page can deliver. When HTML content is extended by servlets, creating dynamic content, that Web page becomes a Web application.
The OSE is designed for virtually unlimited linear scalability. because each browser session is matched with a single virtual Java virtual machine (JVM), there can be multiple virtual JVMs (see Figure 1-1, "Browser Sessions Matched With Virtual JVMs"). The only limit on database platforms supporting the virtual JVM sessions is the amount of hardware present at any given time. See the Oracle8iJava Developers Guide for detailed information.
Although OSE serves static pages and runs CGI scripts, it is intended to be deployed as a servlet runner behind a standard Web server, such as Apache, Netscape, or IIS. See Chapter 5, "Apache Module for Oracle OSE".
One of the differences between OSE and other servlet engines is how the database session used is designed. Browser-sessions set up servlets sessions. The database session contains all the HTTP session objects created for that particular browser session. By employing database session memory, objects are not dropped after the request (connection) ends. However, objects are dropped when the database session ends.
OSE is a built-in Web server running inside Oracle8i supporting Web applications. Each session (virtual Java VM) executes the following items:
The sessions terminate either explicitly or on a time-out configured by the administrator. For more information, see Chapter 6, "OSE Server Configuration".
The OSE unique attributes are:
In the hierarchical arrangement of this environment, OSE serves as an execution context for one or more Web services. You must specify a service root in the namespace when you create a Web service. The service root is the top level that contains the domain information for the entire Web service.
When you configure a Web service in OSE, you create a Web service, its end points, Web domains, and servlet contexts. A Web service is associated with one or more network end points. HTTP clients, who connect to a Web service end point, get contents from one of the associated Web domains. You must also configure all the attributes so that information in the namespace configuration has paths and pointers defined to handle and execute the requests.
OSE supports two types of Web service configurations:
A single-domain Web service is sufficient for most cases. Configure the Web service to listen on a single port (8080 is used in all of our examples) and send any request received at the end point to the unique domain.
To support HTTPS, associate an additional end point to the single-domain Web service. This end point listens to a different port (9090 is used in all our examples), and you can configure it for SSL connections.
The multi-domain Web service is used for more advanced configurations, such as:
In the multi-domain scenario, the network uses either the IP addressing, or the host name, or both to establish the request connection and to route the request to the correct domain.
A Web domain contains servlet contexts or, in the case of IP and virtual hosted, multi-domained Web services, another Web domain.
The Web domain for HTTP requests is identified by the address part of the URL. The root of the Web domain is located in the service root of the contining Web service.
The configuration parameters of each domain are in the
config object in the Web domain's directory tree. Graphical representations of these configurations are shown in Figure 1-2, "Single Domain Namespace Model Structure" and Figure 1-3, "Multi-Domain, Multi-Homed Example with Virtual Hosts In the Structure". Notice the
config object at the top level of the structure.
The following list describes the Web domain hierarchy:
/contextssubdirectory, located in the domain root, contains the servlet contexts directories.
/named_servletsdirectory.
named_servletsdirectory are configuration parameters in the namespace objects,
config,
httpSecurity,
policy,
defaultservlet, and
doc_root.
doc_rootobject is a pointer (soft link) to static contents on the client.
The directory structure describing the namespace is a model you can use to explore and manipulate the elements that make up the Web domain. Each file and directory are actually objects with properties in the Oracle8i databases, rather than files with contents. However, for most of this discussion, a directory and file model will suffice while using the tools to create a Web domain.
When a URL, such as, is sent to a single-domain, the request accesses the Web service listening on port 8080, on the host named
cavist.com.
When you set-up a multi-domain Web service, the Web domain name is dependent on the configuration type of the service root. An example of a multi-domain, multi-homed configuration (more than one IP address on a machine) combined with multiple virtual hosts is shown in Figure 1-3.
For example, a virtual host,
cavist.com, in a domain defined by the IP address, 10.1.1.20, can have the identical structure naming pattern as another IP address and virtual host pairing, such as 10.1.1.30 hosting
jones.com, sharing the same service root. The names are defined in a path so that the lower branches are uniquely defined by the domain names.
Think of a servlet context as an application loaded into OSE. It is a set of servlets, configuration parameters, JSPs, and pointers to static contents on the file system that are all accessible below the same virtual path. The servlet context is usually identifiable as the first segment of a URL's path.
A servlet context configuration describes how the Web server behaves when serving its contents (security, timeouts, MIME types, mapping of virtual paths extensions to servlets, statefulness). OSE supports nested servlet contexts that can inherit configuration properties from their parents.
In practice:
/contexts, is a namespace subdirectory of its domain root directory.
winecellarservlet context is stored in the <domain root>
/contexts/winecellardirectory.
named_servlets, containing servlets.
The configuration information of a servlet context is a namespace object,
config, in the
servlet
context directory. Look at Figure 1-2, "Single Domain Namespace Model Structure" and notice the
config object listed under the <
servlet context1
> directory.
If the
config object contains the entry
/cellar as mapped to
/winecellar, then the URL would access the servlet context,
winecellar, in the Web domain,
cavist.com.
A servlet is a Java class. Load servlet classes and any related support classes, into the database with the
loadjava command. Publish the servlet into a servlet context with the session shell.
Publishing a servlet:
named_servletssubdirectory of the servlet context directory
configobject of their servlet context to be used when matching against a URI
A servlet accessible as could be published as a namespace object named
service root
/contexts/winecellar/named_servlets/winefinderservlet with the virtual path mapping entry
/winefinder=winefinderservlet in service root
/contexts/winecellar/config.
Earlier, we said the servlets are published in a namespace and that the directory structure was a model. This namespace is the Sun Java Naming and Directory Interface (JNDI). The OSE's JNDI implementation uses SQL tables to store the contents of a JNDI accessible namespace.
Access the JNDI with the session shell command-line tool. Use these commands to explore and manipulate the namespace.
Using the session shell you can navigate the namespace as if it were a file system to change directories and list the contents (see Chapter 3, "JNDI and the Session Shell" for tool definitions and examples).
The contents are organized into hierarchical containment relationships of security, mapping, servlets and default objects. Servlet contexts correspond to applications deployed in the Web server. Servlet contexts, which are mapped to the address part of an URL, are grouped in Web domains.
http://<
Web domain:port>/<
servlet-context>/<
path>
We can translate this example URL into a real URL and name such as this:
Web domains and servlet contexts have owners (Oracle schema) with full administration rights. The owner of the Web domain can administer the Web domain, create servlet contexts, and give access to other schemas. The owner of a servlet context can publish contents in it and tune its configuration parameters.
The ownership and permissions are similar in construct to the UNIX environment, in that there are read, write, and execute abilities defined with session shell commands. Web domain schemas are the only valid users in the JNDI namespace. The users are given permissions and ownership in their domains by administrators.
The containment hierarchy of the OSE is defined as:
Web Service(s) > Web Domain(s) > Servlet Context(s) > Servlets
OSE supports authentication and access control as required by the Servlet 2.2 Specification.
In defining your security, you must define a valid set of users. You can:
Principal declarations are held in the
realms directory of a Web service. The following are properties of realms:
servlet
contextswithin a service can use the same realm definitions.
The
policy directory is automatically created when you set permissions and create URL security mappings.
See Figure 1-4, "Security Components in the JNDI Namespace", for the general relationship of
policy to a servlet context.
Figure 1-4 shows the relationship of the
realms and
policy directories with respect to the rest of the domain in the JNDI namespace.
realms is at the top level of the domain, whereas
policy is a sub-directory of servlet context.
OSE supports servlets 2.1 and JSPs 1.0. | https://docs.oracle.com/cd/A87860_01/doc/java.817/a83720/introduc.htm | CC-MAIN-2019-47 | refinedweb | 1,691 | 54.12 |
Everything I know about Java collections I learned from Scala
From December’s JAX Magazine, Jessica Kerr explains how using Scala concepts can help us when using plain old Java.
From December’s JAX Magazine, Jessica Kerr explains how using Scala concepts can help us when using plain old Java.
Why should a Java developer learn a new language? To write better Java, of course!
Scala, a language that compiles to Java bytecode, enables stronger object-oriented design and slathers functional support on top of that. Who would have thought that playing around with Scala would teach me new ways of working with such a core piece of Java as Collections?
Techniques and idioms of Scala open whole new lines of reasoning that apply right back to Java code. This article details a few lines of reasoning: how they’re exemplified in Scala, how we can use them in Java, and how we’ll use them even more in Java soon.
Do you think this is simple?
I’m going to show a piece of Java code, contrast it with Scala, and then call out three disadvantages of the Java style that I never thought about before learning Scala. Then I’ll explain what it is about Scala that makes its superior style possible, and finally show how we can do the same thing in Java with a little more effort.
Here’s a common piece of Java code in Listing 1. Say we have a list of nearby creatures and we want a list of all the hostile ones:
Listing 1
public List<Creature> getHostileCreatures(List<Creature> allCreatures) { List<Creature> output = new LinkedList<Creature>(); for(creature : allCreatures) { if (isHostile(creature)) { output.add(creature); } } return output; }
This code is familiar to any Java programmer. Loop through a list, pulling out all the elements that meet a condition. It’s all over the Enterprise Java code I’ve written and maintained for years. The only part that varies is the conditional expression (highlighted in bold in Listing 1).
This common recipe is not a design pattern – don’t give it credit! It is a quilting pattern ie. a section of code that appears repeatedly in many places, with only specific sections varied. Remember: just because your grandmother wrote Java this way doesn’t mean you have to. It’s so familiar we don’t have to read it; we can skip straight to the conditional, to the one snippet of meaning in these nine lines.
I’ll show you simple
Reducing the boilerplate of quilting patterns is a strength of Scala. What are we really trying to do in getHostileCreatures? We’re going from one list to another with fewer elements; like coffee grinds the unwanted elements don’t make it through the filter. Here’s how this looks in Scala:
val enemies = allCreatures.filter(isHostile)
Oh, that’s shorter. It’s declarative: it states what we’re trying to do – filter some elements out of the list – without showing how that is done. The immediate benefit of this style is readability. Unlike Listing 1, this is readable to people who haven’t spend a decade staring at idiomatic Java code. One caveat – some people expect filter to eliminate elements that meet the condition; it seems backwards. However, this syntax describes the elements in the returned list, such as “creatures that are hostile.” We’re making a positive statement about the elements we want.
In addition to readability, there are two other big wins to Scala’s declarative style here. Follow along.
Simple means the hard stuff is easy
When we separate “what we’re doing” from “how we’re doing it,” we get more flexibility in the “how.” If this is the big battle scene at the end, the list of creatures could be huge. We could break it into pieces and filter in parallel! In Java, that’s way too much work. But in Scala:
val enemies = allCreatures.par.filter(isHostile)
The par property of Scala’s default List returns a different implementation of List, one whose filter method breaks the list into sections and filters each section on a different thread. The operation we’re performing isn’t inherently “loop through each element and add some to a new list;” that’s an implementation detail hard-coded into the Java version. Separating “what” from “how” means the “how” can be customized independently. This is a separation of concerns. It meets the Prime Directive of development, the Single Responsibility Principle.
The third superiority of Scala’s filter method lies in this line from the Java code:
List<Creature> output = new LinkedList<Creature>();
The particular implementation of List is tightly coupled with this method. What if lists of creatures are more efficiently expressed as ArrayList? Or not as lists at all, but as sets or streams? Every place this quilting pattern was used, a concrete implementation of List is stitched into our application.
Consider filtering an extremely long list, something read from a 250M file. The style in Listing 1 requires the entire list in memory all at once; every line must be processed before the method returns. For serious data processing, this is not acceptable. Scala’s filter method, on the other hand, is defined on collection types that work differently, including streams and iterators. For processing a very long file, I’ll stick with an Iterator (see Listing 2).
Listing 2
val source = io.Source.fromFile("creatures.scala") val linesIterator = source.getLines() linesIterator.filter(isRelevant).foreach { s => // process and output } source.close()
The entire file never has to be in memory in this Scala code (Listing 2). The filter is applied lazily, one row at a time, as the elements are requested from the filtered iterator. Elements that were filtered out or have already been processed can be garbage collected. We can process files of arbitrary size in limited memory.
What’s going on here?
We’ve seen that Scala’s collection processing idioms are more readable and more flexible than traditional Java style. There are many more collection-processing idioms that work the same way. Before looking at a few of those, let’s explore what it is about Scala that makes this style both possible and preferred.
val enemies = allCreatures.filter(isHostile)
Here, isHostile is a function that accepts a Creature and returns a Boolean.
def isHostile(creature : Creature) = creature.alignment == EVIL
In Scala, functions are first-class citizens, right up there with primitives and objects in Java. This means functions can be parameters to other functions. It’s convenient, and highly idiomatic in Scala to pass functions and methods around like this. Or to declare our own little anonymous function right inside the argument list:
val enemies = allCreatures.filter((creature) => isHostile(creature))
It is like being able to pass just the important snippet from Listing 1 – isHostile(creature) – into a method. This is how we separate “what” we’re doing from “how” we’re doing it. Passing bits of code around enables much more fine-grained separation of concerns.
That isn’t magic
Now that we’ve defined what’s going on here, we can do it in Java. One way to pass code is the Strategy design pattern, which wraps a “how” in a custom object. In list filtration, the Strategy is “how can I know whether an element belongs in the output?” We call this function of one argument that returns boolean a Predicate. This works in Java:
Listing 3
import com.google.common.base.Predicate; import static com.google.common.collect.Iterables.filter; … private static final Predicate<Creature> isHostile = new Predicate<Creature>() { @Override public boolean apply(Creature input) { return input.alignment == EVIL; } }; … Iterable<Creature> enemies = filter(allCreatures, isHostile);
The Guava library from Google provides some of the useful collections processing methods that are prevalent in Scala. There is some pain in the declaration of the Predicate because we have to wrap the code in an anonymous class. However, after shipping that mess off to a constant somewhere, we get all three benefits: our application logic is declarative and readable; the mechanics of filter are encapsulated elsewhere; and the filter method works on any Iterable or Iterator in a just-in-time fashion. Using Guava in this way, we aren’t tying ourselves to a particular implementation of List.
Caution
Be careful when switching between Iterables and Iterators. Iterables can be viewed, looped over, filtered, and transformed many times. These operations don’t change the state of a List or Set. With an Iterator you only get one shot – call one operation on an Iterator, and consider that variable expired.
The bad news is: this doesn’t give the warm fuzzies we’re use to from the quilting-pattern for-loop. Some of my past colleagues have declared use of Guava Iterables unreadable, because it is unfamiliar to them.
The good news: in Java 8 this will look a lot more like Scala:
Iterable<Creature> enemies = allCreatures.filter(creature -> isHostile(creature));
Two Java 8 features combine to make this possible: extension methods and lambda expressions. Virtual extension methods add to existing interfaces (such as Iterable) without breaking any old code. They do this by writing new methods in terms of existing interface methods. The quilting pattern for-loop will be encapsulated in a filter method on List. Hurray, we never have to write it again! The second killer feature in Java 8 is called lambda expressions. These eliminate the boilerplate in the Guava example, where it took seven lines to declare a Predicate.
In Java 8, we will write code snippets inline. The compiler forms these into whatever anonymous implementation of a single-method interface is required. creature -> isHostile(creature) becomes a Predicate at compilation. The code is much less cluttered, and no import is required. Therefore, if your coworkers complain about Guava collections hurting their poor widdle eyes, tell them to suck it up because a year from now this will be idiomatic, native Java.
Back up a step
That was a whole lot of analysis about a very simple task. It is worthwhile because the same thought process works on other operations on collections. For a quick example, instead of “extract some elements” substitute “pull some piece of data out of the elements.” Let’s take our hostile creatures and translate it into a list of their remaining strength (hit points). The same logic applies.
Listing 4 shows the Java example:
List<Integer> getHitPoints(List<Creature> input) { List<Integer> output = new LinkedList<Integer>(); for(creature : input) { output.add(creature.getHitPoints()); } return output; } List<Integer> enemyStrengths = getHitPoints(enemies);
That’s a quilting pattern all right. What we’re doing is turning each list element into something else. The one meaningful piece of code is creature.getHitPoints().
Here’s the Scala. For mathy historical reasons the method that does “translate each element into something else” is called “map.”
val enemyStrengths = enemies.map(_.hitPoints)
Scala programmers don’t like typing, so we use that underscore character to refer to the list element. This is equivalent to:
val enemyLife = enemies.map((creature) => creature.hitPoints)
In Java 7 + Guava, the method is called “transform” (Listing 5):
import com.google.common.base.Function; import static com.google.common.collect.Iterables.transform; … private static final Function<Creature, Integer> getHitPoints = new Function<Creature, Integer>() { @Override public Integer apply(Creature creature) { return creature.hitPoints; } }; … Iterable<Integer> enemyLife = transform(enemies, getHitPoints);
This has exactly the same perks as replacing the other quilting pattern: readable application logic, flexibility in concrete implementation, and just-in-time operations. The transforming function won’t be applied until later code requests elements from enemyLife.
Do it once, do it twice, third time generalize
Here, we took a piece of code so common I could write it with my eyes closed, and stopped writing it over and over. After working with Scala’s collections library, every time typing code gets this easy, I stop and ask myself, “Wait. Has someone done this for me already? How can I do this more generally?”
For example, perhaps I want to categorize my enemies according to character class, mages in one group, ranged fighters in another, melee fighters in a third. I want a map of character classes to lists of enemies. In standard Java I’d create the map by hand, looping through the list. In Scala:
val enemiesByClass = enemies.groupBy(_.characterClass)
Now enemiesByClass is a map whose keys are character classes, and whose values are sequences of Creatures. What kind of sequence? Whatever kind enemies is. It could be a List, a Set, or a streaming Iterator. Dividing a list into categories like this is a general enough operation that someone has implemented it for me. I didn’t have to think about how to instantiate a mutable map and loop through a list and instantiate new lists to go into the map values – all I had to think about was what I wanted to do. My code makes that clear, and my code is better for it.
Guava gives us this same ability in Java 7. Its Multimap is a generalization of maps that hold multiple values per key. To create the one we want:
Multimap<CharacterClass, Creature> enemiesByClass = Multimap.index(enemies, getCharacterClass)
When code is passed around as a parameter, no repetition is too small to be eliminated. This doesn’t mean we should generalize every for loop we see; there’s a balance. But every time I think about writing a for-loop, I ask myself, “Is there a function to do this in one line?” In Scala, the answer is usually “yes.”
Want to combine the elements of a list into one? That’s reduce. It could be a sum or a concatenation or any other operation that turns two elements into one element. Want to find a particular element? Find. Turn a list of lists into one combined list? Flatten. Check whether all elements meet a condition? You get the idea.
Table 1: Useful collection functions for Guava and Scala
Table 1 lists some other useful collection functions in Guava and Scala. The only consistency is inconsistency, so look for these same functions in other languages (such as Groovy) under entirely different names.
The payload
Each of these tools is useful, but the benefits compound when you put them together. Let’s get the mage with the fewest hit points. In Scala:
val target = enemiesByClass.get(Mage).map(_.minBy(_.hitPoints))
Guava offers this fluent interface in Java:
Creature target = FluentIterable.from( creaturesByClass.get(CharacterClass.MAGE)) .toImmutableSortedSet(compareByHp).first();
Composition is the silver bullet of Scala and other functional languages. The smaller the functions, the more separated the concerns, the more ways we can assemble them. Going from Java to Scala felt like graduating from Mega Bloks to Lego. There are so many more ways to fit the pieces together!
You don’t have to switch to Scala in order to get the benefits of thinking and coding in smaller, more precise pieces. Use Guava, cross your fingers that Java 8 comes out with lambda expressions in 2013, and consider your options before you embed another quilting patterns in your code. Trust me, it’s more beautiful without them.
Zoom in on the code (1)
FluentIterable.from( creaturesByClass.get(CharacterClass.MAGE)) .toImmutableSortedSet(compareByHp).first();
from: Guava’s FluentIterable wraps any Iterable with a fluent interface.
get: Multimap’s get method never returns null – only an empty collection.
toImmutableSortedSet: Passing a Comparator to a sort method is normal Java – see, this stuff isn’t weird!
- first: This is a standard Java Set method. It will throw an exception if the set is empty, which will happen after you’ve killed all the enemy mages.
Zoom in on the code (2)
val target = enemiesByClass.get (Mage).map(_.minBy(_.hitPoints))
get: Scala’s map method never returns null; instead, you get a collection of 0 or 1 elements, called Option. If there are any mages, the Option will contain a list of them.
map: The operation passed to map applies to the list of mages inside the Option.
minBy: This will choose the minimum mage, where .hitPoints defines what minimum means. We don’t have to pass a Comparator to minBy; any function that converts a Creature into something Comparable will do.
target’s type is Option[Creature]. If the enemy has mages, target contains the weakest one. If there are no mages to fight, target is empty.
Further reading:
-
If you want to learn Scala, I recommend Scala for the Impatient
- For more lessons from functional programming, see Neal Ford’s “Functional Thinking” series
Author Bio: Jessica Kerr is a Java-turned-Scala developer in St. Louis, MO. Her passion for learning is countered only by her taste for whisky. She participates in the JetBrains Academy, helps organize the local Java User Group, entertains her two daughters, and tweets as @jessitron.
This article previously featured in JAX Magazine TomEE: The Tomcat you love and more. For that issue and others, check here. | https://jaxenter.com/everything-i-know-about-java-collections-i-learned-from-scala-105792.html | CC-MAIN-2022-27 | refinedweb | 2,842 | 56.96 |
If you're just now catching up to this particular series, we're in the process of building our own custom messaging system that hooks into WordPress, allowing us to take advantage of some of the existing APIs, but also allowing us a bit more control.
From the previous tutorial:
But just as we looked at how to create custom administration pages, it's also possible to implement a system that allows us to programmatically set our own custom messages, their type, and when and where to display them on the administration page.
Though it's not required to read the series preceding this one, I do highly recommend reading the preceding tutorial. Each of these builds on the foundation of the previous tutorial (and we'll continue to do that for the remainder of the series).
With that said, the whole purpose of this series is to give an introduction as to how we can leverage the WordPress API and object-oriented programming to create a custom messaging system we can use throughout work that we may be doing for a client.
But before we get started, there are a few prerequisites that you should have in place.
Before You Get Started
- Read the previous article.
- Install PHP 5.6.25 and MySQL 5.6.28.
- Install Apache or Nginx.
- Set up WordPress 4.6.1.
- Have your favorite IDE or editor at the ready.
If you're looking for an all-in-one solution, check out MAMP, and if you're interested in how all of this fits together, then review these articles.
Our Roadmap
On the off chance you haven't read the previous tutorial, the roadmap we have set out for this tutorial is as follows:
- In this tutorial, we're going to lay the groundwork for the bare minimum of our plugin and what we need to get started.
- In the second piece, we're going to take the plugin a bit further by adding a very basic WordPress administration page. We'll also be making a call to the custom hook that we'll use, and we'll wire that up on the server-side. We'll also start the groundwork for our Settings Messenger.
- In this tutorial, we'll begin implementing our Settings Messenger by adding support for errors and success messages as well as covering some points on security.
- We'll end by tying everything together, seeing it in action, and making the final plugin publicly available for you to download.
Obviously, we've accomplished number one. So in this tutorial, we're going to be focused specifically on adding a basic administration page and setting up a custom hook that will allow us to take advantage of our custom messenger.
Getting Back to Work
With all of that covered, let's get back into development. Recall that, at this point, we should have the foundation of this plugin set up so that we're able to activate it and navigate to Settings and then Tuts+ Custom Message Example to see a generic administration page.
If you've been following along thus far, the code for the page is extremely simple (and we'll see a shot of it later in the tutorial), as well:
<div class="wrap"> <h1><?php echo esc_html( get_admin_page_title() ); ?></h1> <p class="description"> We aren't actually going to display options on this page. Instead, we're going to use this page to demonstration how to hook into our custom messenger. </p><!-- .description --> </div><!-- .wrap -->
I'm reiterating this because this is where we're going to begin implementing our own custom messenger.
To do this, we're going to need to introduce the following:
- a hook that we define
- a function that is registered with that hook
- displaying something when that function is fired
Defining a Custom Hook
Defining a custom hook sounds much more intimidating than it really is. Most of us are familiar with making calls to
add_action and
add_filter, but how can we use these functions to make a call to our own hooks?
Easy: We use
do_action and define our action that we'll register with WordPress. For example, take the code above and, just below the
h1 tag, let's do the following:
<div class="wrap"> <h1><?php echo esc_html( get_admin_page_title() ); ?></h1> <?php do_action( 'tutsplus_settings_messages' ); ?> <p class="description"> We aren't actually going to display options on this page. Instead, we're going to use this page to demonstration how to hook into our custom messenger. </p><!-- .description --> </div><!-- .wrap -->
Not bad, right? Now we need to register a function that will fire whenever that hook is called. Before we do that, though, I want to make sure we're all on the same page as to what
do_action really does.
Here's what the developer document says about
do_action:
This function invokes all functions attached to action hook
$tag. It is possible to create new action hooks by simply calling this function, specifying the name of the new hook using the
$tagparameter.
If the definition isn't clear, perhaps its implementation will help. So let's take a look at that now.
2. Register a Function
Just as we do with any other type of function, we need to register a function that will fire whenever our
tutsplus_settings_messages hook is fired. But since we're working with object-oriented programming, we're going to need to design a class that defines this function.
And this is where our custom settings messenger will first come into play. Granted, we won't be doing a lot of work in terms of adding custom messages, but we will be using our custom hook, and we will be rendering something on the page.
Furthermore, we'll be laying the foundation of the class we'll be improving in the coming lessons. From here, add the file
class-settings-messenger.php to the
admin directory in your plugin (and don't worry, all of this will be available for download).
<?php class Settings_Messenger { public function init() { } }
Remember that we aren't using namespaces or autoloaders in this tutorial (though we've covered them before). Note that I'll be providing code for the
init method momentarily.
For now, return to the plugin's bootstrap file,
tutsplus-custom-message.php, and add the following code to the main function:
<?php function tutsplus_custom_messaging_start() { $plugin = new Submenu( new Submenu_Page() ); $plugin->init(); $messenger = new Settings_Messenger(); $messenger->init(); }
Now let's revisit the init function in the
Settings_Messenger and hook it up to our custom action.
<?php public function init() { add_action( 'tutsplus_settings_messages', array( $this, 'display_message' ) ); }
Notice in the code above, the first argument we're passing to
add_action is the name of our custom hook. The second is going to be a method that will render a message on the administration page. We just haven't written it yet (so if you attempt to run this code, you'll get an error).
But let's change that.
3. Displaying a Custom Message
First, create a function in the
Settings_Messenger class called
display_message, and let's simply echo a statement to see if it's showing up in the custom page that we've created:
<?php public function display_message() { echo 'This is an example message.'; }
And when you execute the code, you should see something like this. Look closely under the
h1 tag and you should see the sentence we've included above.
Here's the problem, though: The message that we're displaying doesn't match any of the markup that WordPress uses to show success messages, warnings, or errors.
We'll be covering this in detail later in the series, but let's go ahead and display a success message. After all, we've come this far, right? We're displaying our own message through a custom hook using a messenger class we've created.
There are a number of ways in which we can do this: We can use a template file, we can use markup in the function and sanitize it there, or we can include the file in the function. For the purposes of this tutorial, I'm going to create the markup in the function and use
wp_kses to sanitize the code.
This isn't normally how I would recommend doing this, but it is one way that it can be accomplished, and it also exposes us to
wp_kses, which is a function we should all be using when rendering information to the browser.
Use this code:
<?php public function display_message() { $html = " <div class='notice notice-success'> <p>You have successfully displayed a custom success message.</p> </div><!-- .notice-success --> "; $allowed_html = array( 'div' => array( 'class' => array(), ), 'p' => array(), ); echo wp_kses( $html, $allowed_html ); }
And this should result in the following screenshot:
Notice here that the message persists. There's no save button, there's no way to hide this message, and there's no way to change this message outside of the code. But that's okay, because that's not the point of this exercise.
A few things I want to mention, though:
- The class attributes on the div element that you see are borrowed directly from WordPress. This is so we can inherit those styles.
- Some messages can be dismissed. We will cover this in a future tutorial.
- The
$allowed_htmlarray passed to
wp_ksesis what makes sure that nothing other than the specified elements and attributes are rendered. It's a very good, strong, and clean way to sanitize data.
And that's all there is to cover in this particular tutorial; however, we're just getting started.
Conclusion
As we progress throughout this series, we're going to take a look at how to handle success messages, error messages, and warning messages, and how to introduce the ability to dismiss messages.
Furthermore, we'll be able to see how to use input from the user to control the type of message that's displayed.
Note that I'm also always happy to answer questions via the comments, and you can also check out my blog and follow me on Twitter. I usually talk all about software development within WordPress and tangential topics, as well.
Until the next tutorial, download the files, study the code, and see how this runs on your local machine. In the next part, we'll pick up exactly where we left off. | http://esolution-inc.com/blog/creating-a-custom-wordpress-messaging-system-part-2--cms-27608.html | CC-MAIN-2019-51 | refinedweb | 1,731 | 61.16 |
CodePlexProject Hosting for Open Source Software
Hi, I am working on a module which deals with Azure Storage. Connecting to azure storage requires a connection string. I Can put this connection string in configuration file. But I am looking for a way to store this information somewhere else so that
admin user can change the connection string without dealing with the configuration file. I was thinking to store the connection string in DB. But problem is , I have to query the DB every time I need to connect to the azure storage. What is the best solution?
Storing the string in the DB inside a custom part you attach to the Site content type (thus site settings) is perfectly fine. Then it can also made editable from under site settings.
I guess this "connecting to Azure storage" should only happen once in a request life time, and one additional DB query per request is not a performance issue, but you could also cache the string with Orchard's ICacheManager. That way DB would be only queried
by the first request after app (re)start or after the value is modified.
There's lots of examples of this, but if you look at Orchard.Email you'll find a simple example
namespace Orchard.Email.Models {
public class SmtpSettingsPart : ContentPart<SmtpSettingsPartRecord> {
private readonly ComputedField<string> _password = new ComputedField<string>();
public ComputedField<string> PasswordField {
get { return _password; }
}
namespace Orchard.Email {
public class Migrations : DataMigrationImpl {
public int Create() {
SchemaBuilder.CreateTable("SmtpSettingsPartRecord",
table => table
.ContentPartRecord()
.Column<string>("Address")
.Column<string>("Host")
.Column<int>("Port")
.Column<bool>("EnableSsl")
.Column<bool>("RequireCredentials")
.Column<string>("UserName")
.Column<string>("Password")
);
return 1;
}
}
namespace Orchard.Email.Handlers {
[UsedImplicitly]
public class SmtpSettingsPartHandler : ContentHandler {
private readonly IEncryptionService _encryptionService;
public SmtpSettingsPartHandler(IRepository<SmtpSettingsPartRecord> repository, IEncryptionService encryptionService) {
T = NullLocalizer.Instance;
Logger = NullLogger.Instance;
_encryptionService = encryptionService;
Filters.Add(new ActivatingFilter<SmtpSettingsPart>("Site")); //***NOTE This is what attaches it to the Site Settings
Filters.Add(StorageFilter.For(repository));
OnLoaded<SmtpSettingsPart>(LazyLoadHandlers);
}
Hope this helps.
Thanx everyone. I will test it and let u know if it works. But I am pretty sure it will work
Are you sure you want to delete this post? You will not be able to recover it later.
Are you sure you want to delete this thread? You will not be able to recover it later. | https://orchard.codeplex.com/discussions/357460 | CC-MAIN-2016-50 | refinedweb | 385 | 50.23 |
The following excel file has a sheet with employees and their salaries. The goal of this tutorial is to raise the salaries and write them to a new column.
This tutorial uses openpyxl, a Python library to read/write Excel 2010 xlsx/xlsm files. To install, create a virtual environment and use the command:
pip install openpyxl
The downloaded excel sheet looks like this:
Company.xlsx
Employees
A2to
B8
Here is the code to read the data:
from openpyxl import load_workbook workbook = load_workbook(filename = "Company.xlsx") worksheet = workbook["Employees"] rows = worksheet["A2:B8"] print("Current salaries") print("================") for r in rows: # r is a tuple of cell A and B print(f"{r[0].value}, ${r[1].value}")
Output:
Current salaries ================ Vera, $2000 Chuck, $1800 Samantha, $1800 Roberto, $2100 Dave, $2200 Tina, $2300 Ringo, $1900
Here is the code that:
from openpyxl import load_workbook workbook = load_workbook(filename = "Company.xlsx") worksheet = workbook["Employees"] rows = worksheet["A2:C8"] print("Updating salaries") print("=================") for r in rows: old_salary = r[1].value new_salary = old_salary * 1.15 print(f"{old_salary} -> {new_salary}") r[2].value = new_salary r[2].number_format = '#,##0.00 €' workbook.save(filename = "Company.xlsx")
Output:
Updating salaries ================= 2000 -> 2300.0 1800 -> 2070.0 1800 -> 2070.0 2100 -> 2415.0 2200 -> 2530.0 2300 -> 2645.0 1900 -> 2185.0
And here is the resulting sheet in Excel: | https://pythonforeveryone.com/articles/read-and-write-excel.html | CC-MAIN-2021-43 | refinedweb | 222 | 61.83 |
How to Compare Two Strings in C Programming.
Ad
-Define the two strings you want to compare. For this example, we will be comparing two predefined char strings. You will also want to define the return value as an integer.[1]
#include <stdio.h> #include <string.h> int main () { char *str1 = "apple"; char *str2 = "orange"; int ret; }
-); }Ad
We could really use your help!
pranking?
foot care?
cleaning carpet?
married life?
Warnings
- Remember that the return value is 0 if the strings are the same. This could confuse you because 0 is also the value of FALSE.
Sources and Citations
Article Info
Categories: C Programming Languages
In other languages:
Español: Cómo comparar dos cadenas en programación C, Italiano: Come Confrontare due Stringhe nel Linguaggio C
Thanks to all authors for creating a page that has been read 261,129 times. | http://www.wikihow.com/Compare-Two-Strings-in-C-Programming | CC-MAIN-2014-52 | refinedweb | 140 | 66.13 |
import "gopkg.in/webhelp.v1/whgls"
Package whgls provides webhelp tools that use grossness enabled by the github.com/jtolds/gls package. No other webhelp packages use github.com/jtolds/gls.
The predominant use case for github.com/jtolds/gls is to attach a current request's contextual information to all log lines kicked off by the request.
Bind will make sure that Load works from any callstacks kicked off by this handler, via the magic of github.com/jtolds/gls. It is worthwhile to call Bind at the base of your handler stack and again after attaching any useful values you might want to include in logs to the request context.
Load will return the *http.Request bound to the current call stack by a Bind handler further up the stack.
SetLogOutput will configure the standard library's logger to use the provided logger that requires a context, such as AppEngine's loggers. This requires that the handler was wrapped with Bind. Note that this will cause all log messages without a context to be silently swallowed!
If whmon.RequestIds was in the handler callchain prior to Bind, this logger will also attach the Request ID to all log lines.
The benefit of this is that the standard library's logger (or some other logger that doesn't use contexts) can now be used naturally on a platform that requires contexts (like App Engine).
App Engine Example:
import ( "net/http" "gopkg.in/webhelp.v1/whgls" "google.golang.org/appengine/log" ) var ( handler = ... ) func init() { whgls.SetLogOutput(log.Infof) http.Handle("/", whmon.RequestIds(whgls.Bind(handler))) }
Package whgls imports 7 packages (graph). Updated 2017-06-03. Refresh now. Tools for package owners. | https://godoc.org/gopkg.in/webhelp.v1/whgls | CC-MAIN-2018-26 | refinedweb | 282 | 57.98 |
C:\acbooks\QPack2008\NetbeansNotes.fm 3/7/11 rob.r 1
Setting up Netbeans initiallyNetbeans 6.9.1 Notes (2011-02-08)
Netbeans 6.9.1 Notes (2011-02-08)
[Note: Netbeans is a Sun-Oracle IDE (integrated development environment) open source product
almost 10 years old by now (2011). These are all free downloads. The latest release is 6.9.1 which
is pretty solid. This is the version I recommend because it works well for Java and other languages
(C, C++, Ruby, Python). There is a newer Beta version, but not the right plugins are available for
this version yet and it requires Java 7.0 early access. So, stick with 6.9.1. (There is a whole lot more
to NB then my notes suggest, so an instructor will need to elaborate as they learn more).
These notes cover the following configuration for the Java/NB suite.
1.Setting up Java, and Java class file documentation,
2.Setting up Netbeans,
3.Installing XML and UML plugins to NB
4.Netbeans productivity hints.
1.Editing the template Java class file(s) to edit in boiler plate code, such as automatic file
name, user name, date, and Javadoc ‘@’ tags
2.Set up code macros so that typing a mnemonic will be expanded to desired code. That is, I
have set mine up so that typing the 4 characters ‘sout’ and hitting space bar results in
System.out.println(“ “); with the cursor between the quote marks. (Students are really
annoyed if I don’t show them this option early on)!!
5.Extending NB with additional Plugins beyond XML and UML
The basic NB framework can be augmented with plugins. Among the hundred and sixty or so avail
-
able, I use the XML plugin and the UML plugin, plus a few others. The XML plugin allows XML
editing, DTD/XML-Schema editing, and document validation, as well as XSLT editing and trans
-
formations. I have used these features in both XML (IT 408) and Java classes (IT 307, IT 407, CST
100, 200) for several years now and they work. The UML plugin allows diagrammatic round-trip
engineering. Very cool, and very essential for modern software development.
Setting up Netbeans initially
(For a Windows box, there are Mac version available too) Copy from instructor supplied flash
drive to your hard drive:, (don’t install from the flash drive!) Or, you can download all of this soft
-
ware from the java.sun.com site as well as mozilla.org.
The java.sun.com, netbeans.org, mozilla.org sites have these downloads
1.jdk1.6 update 23(or later) -- This is the SE (standard edition) desktop software distribution.
jdk means Java Development Kit’. JRE means Java Runtime Environment which allows Java
code to run but no development tools.
2.jdk 1.6 docs ( jdk-6u23-docs.zip this is a zip file that can remain zipped. Download from the
same java.sun.com site). This contains all the Java class file Javadocs I will show you how to
include this in your netbeans distribution later in these notes)
C:\acbooks\QPack2008\NetbeansNotes.fm 3/7/11 rob.r 2
Setting up Netbeans initiallyNetbeans 6.9.1 Notes (2011-02-08)
3.Netbeans 6.9.1 (get the most comprehensive version as it includes the application server
glassfish). If you download yourself, be sure to get this most comprehensive version. Don’t
get the combination distributions, do them as I indicate here.
4.Firefox browser distribution from Mozilla.org
O.K, next---:
1) First, install jdk 1.6, update 2x since Netbeans requires a Java distribution (not the JRE, but rath
-
er the JDK), take the defaults, this should place the distribution within the ‘Program Files’ folder
(some windows OS require it be installed elsewhere, check on this).
2) Next, install Netbeans 6.9.1 , you can customize this product to take less memory and time since
we won’t be using Ruby, Groovy, C++, JavaFX, or Java ME
If you want to add UML and / or XML-Schema capabilities, see the plugin installation instructions
below:
Setting up the UML and XML Modules in Netbeans 6.9.1 (2011-02-08)
Follow the instructions below and the module will be automatically be downloaded for you as a
consequence of the plugin update process.
Steps to install the UML module ( assuming you have installed NB 6.9.1 )
Go to Tools>Plugins>Settings>’add dialog’
In the ‘add’ dialog box, give this site a name like ‘UMLModule’ and type in the following URL
click OK, and NB should immediately start to search and then download plugins from this site.
Now check Available Plugins( ) , you should see one more plugin in the available plugins. Scroll
down to find and install the ‘uml’ plugin.
Activating Your Module
You might need to make your uml module active, so you should check it’s setting as shown below:
(Notice the Show Details box is checked so you can see the individual statuses as below). Check
C:\acbooks\QPack2008\NetbeansNotes.fm 3/7/11 rob.r 3
Setting up Netbeans initiallyNetbeans 6.9.1 Notes (2011-02-08)
the box and an option to activate or deactivate will be presented to you..
XML and XML-Schema Setup
To add in XML-Schema editing support you will need to add in another plugin. As in the UML
plugin instructions above, you will need to add another URL site to download the plugin. The plu
-
gin name is -- XML Schema and WSDL.
For NB 6.9, the URL suggested is:
Installing the Java API docs so that NB can display Java class documentation
Given that you have NB 6.9.1 up and running, you can set up to access the Java api for all Java
classes by doing the following:
1.Copy the Java Doc zip file to the Java distribution folder. In my case, the distribution folder is
jdk1.6.0_21. Notice that I simply copy jdk-6u23-docs.zip into that top folder, don’t unzip it.
C:\acbooks\QPack2008\NetbeansNotes.fm 3/7/11 rob.r 4
Setting up Netbeans initiallyNetbeans 6.9.1 Notes (2011-02-08)
Now tell NB where to find the Java API docs.
Go to: Tools>Java Platforms >javadoc tab
In the Java Platforms window, click on the Add Zip/Folder tab and navigate to your
jdk-6u23-docs.zip file.
C:\acbooks\QPack2008\NetbeansNotes.fm 3/7/11 rob.r 5
Setting up Netbeans initiallyNetbeans 6.9.1 Notes (2011-02-08)
From now on, when you are in a Java source code program, and you see a Java class of interest,
just right-click on the class name and a browser window will open showing the Javadocs for that
class. For example, here is some source code and I right clicked on the Java class System and in
-
voked the Show Javadoc command.
And here is a fragment of the Javadoc displayed in the browser window:
C:\acbooks\QPack2008\NetbeansNotes.fm 3/7/11 rob.r 6
Learn to create projectsNetbeans 6.9.1 Notes (2011-02-08)
Learn to create projects
File>New Project> java.java application
then type in a name of your choice for the project. Over-type the
default package name and Main class. type 'finish'
Go to main menu and Run>Run Main Project
just to see that it runs, with no output.
Code in a System.out.println("Hello World") inside of your main method ( see handout) and run
again...
4. Learn to use the javadoc tags. I will expect EVERY program from next week onward to have
javadoc comments as a matter of course.
The extent of the comments will emerge as we learn more.
5. When you ask for a new file, as when you right click on the package
name,
New>Java Class> type in a name of your choice > 'finish'
what you see is the template for that file type.
C:\acbooks\QPack2008\NetbeansNotes.fm 3/7/11 rob.r 7
Learn to create projectsNetbeans 6.9.1 Notes (2011-02-08)
5.5 To edit that template to say what you want it to say next time you create a new Java Class file,
do the following:
Tools>Templates>java folder> Java Class >Open in Editor
( use the file below as a model of what to edit )
5.7 To create the doc-files folder that will hold your graphics,
right click the package name > New>Other>Other>Folder
(You need a Folder and it is usually included in the 'Other' miscellaneous file types) Name it 'doc-
files' and copy your graphics into it..
6. Create productivity macros
tools>options> editor> code templates> type in a nickname
then type in what the expanded code should look like.
decide how it should be invoked ( space, tab, enter, . . )
Editing the Program File Templates
The Template - Java Class File
***** An edited Java Class File. ( The Java Main Class file will be
almost exactly the same except for how you want to edit the main()
method.
***********************************
******Edited Java Class File
********************************************
/* ${package}.${name}, ${user}, ${date} */
<#if package?? && package != "">
package ${package};
</#if>
/**${name} shows . . .
*<p>
*<!-- uncomment start/end comment tags for graphics display
* <img src="doc-files/yourGraphic.jpg" alt="graphic"/>
* <a href="doc-files/YourPdfDocTxtFile.pdf" >myFile link </a>
* 'doc-files' must be a sub-folder of your package folder
* -->
*</p>
* @author ${user}
* @version 1.0 ${date}
* @see ""
*/
public class ${name}
{
}//end class ${name}
C:\acbooks\QPack2008\NetbeansNotes.fm 3/7/11 rob.r 8
Literate ProgrammingNetbeans 6.9.1 Notes (2011-02-08)
5. When you ask for a new file, as when you right click on the package
name >new>Java Class
what you see is the template for that file type.
5.5 To edit that template to say what you want it to say:
tools>Templates>java folder> Java Class >Open in Editor
Create productivity macros
Tools>Options> Editor> Code Templates> type in a nickname
then type in what the expanded code should look like.
decide how it should be invoked ( space, tab, enter, . . )
Literate Programming
To improve your standing with your clients, it’s always helpful to show them something extra, to
delight them, to tantalize them with intimations of more to come. Part of this push comes from
learning how to provide first rate documentation that is both explanatory and interesting. For our
Java programs we have a built-in process to provide such documentation, Javadoc. With Javadoc,
you can insert comments into your Java program that will be extracted and hypertext linked to other
parts of your package or program as well as including links to other documents and graphics.
Productivity Hint -- Undock Windows
NB has a nice feature so that you can see multiple windows at once. Here is how I do it (2011-02-
10):
1.open up a project
2.open up all the files I might want (use either edit or open command). They will now be in tabs
across the top of your editing pane
3.click on one of the files shown in the pane.
4.go to Windows>Undock Window
5.now you have an undocked window and can move it where you like.
6.If you want to see more than 2 windows, then open up another tabbed window and do the
Undoc Window again
7.You should be able keep multiple windows open and by resizing them, some part will always
show so that you can bring it to the front of the editing pane.
8.
Submission Project Formats
When you email projects to me, zip them and name them as follows:
InitialsProjectNameDate(yyyymmdd).zip
C:\acbooks\QPack2008\NetbeansNotes.fm 3/7/11 rob.r 9
Literate ProgrammingNetbeans 6.9.1 Notes (2011-02-08)
For example, here is a zipped project that starts with my initials, the project name, and the date, in
military format- yyyymmdd
RRHeronFormula20110209.zip
Log in to post a comment | https://www.techylib.com/en/view/cabbagepatchtexas/netbeans_6.9.1_notes_2011-02-08 | CC-MAIN-2017-34 | refinedweb | 1,996 | 66.23 |
On 13 Aug 2004 07:15:14 -0700, beliavsky at aol.com <beliavsky at aol.com> wrote: > One of the most commmon reasons programmers cite for not trying Python > is that indentation determines the program flow -- they think its > weird. I think programmers who actually try Python adapt quickly and > do not find the indentation rules to be a problem. > > I wonder if there is a way to remove this initial barrier. Could an > alternate source form be defined, so that there are matching if-endif > and for-next constructs instead of significant indentation? The > alternate source form and the current form would result in exactly the > same .pyc file. Luckily, the time machine has already been used to implement this. At the end of an 'if' statement, you can put a "#endif". And in a for loop, you can put a "#endfor" at the end. The '#' is to indicate that it's not the preferred form. In all seriousness - people who bounce off Python because of the indentation are probably just not willing to learn a new language, or else they're incredibly bigoted towards whatever language (often C) that they're used to. Their loss. | https://mail.python.org/pipermail/python-list/2004-August/253247.html | CC-MAIN-2014-15 | refinedweb | 197 | 64 |
Through this article I want to present readers with an ODBCManager class that allows user to
have a list of ODBC Drivers installed in his/her system. Also this class gives the users all system as well as user
DSNs.
ODBCManager
(Experienced readers can ignore/skim through this section. I have lifted most of the
following stuff from the Internet)
About DSN: DSN is an acronym for Data Source Name. It's a simple and standard way to describe how
to connect to a data source (database) using an ODBC driver. More importantly, using a DSN means we can
change the location of our data by updating the DSN, no update to our application required. But we have to
keep in mind that DSN's only describe ODBC connections, not OLEDB connections.
There are three types of DSN's; system, user, and file.. System and user DSN's are windows registry based, while File DSN's are stored in the file
system. We normally create and administer DSN's through the ODBC Data Source Administrator, found in
Control Panel on NT/9x machines, or in Administrative Tools for Win2K machines. However, there is nothing
magical about editing DSN's. We can use regedit to view/modify user or system DSN's, and notepad works fine for file DSN's.
Most information about DSN's is stored in the registry.
ODBC.INI has two other subkeys, "ODBC Data Sources" that contains a list of all\ODBC.INI.
Choosing which type of DSN to use, depends on how our application works. In almost all cases a system
DSN works. If we use a user DSN, then we'll have to do some extra work to make sure the DSN gets created
when a user new to that machine logs in for the first time.
About ODBC Driver: An ODBC driver acts as a “translator” between an application and a database.
There are drivers available for many databases like Oracle, MS Access, SQL Server, Foxbase etc. Main use
of these drivers is, without having a client program supplied by the vendor of the data base, these drivers
allow us to interact with
databases. For example, let us suppose we have a Oracle Database which has some tables in it. Now If we have
a Oracle ODBC Driver installed in our machine, then we don't need to have the Oracle S/W (Expensive) to talk with that
database. But We have write our own routines to talk to the database using ODBC provided by C++/C# or
whatever language we want to use (That support ODBC Driver API).
ODBCManager class is defined in 'ODBCMngr' namespace. This class is present in the DLL
ODBCMngr.DLL. This class has all static methods. So no instance needs to be created
(In fact users can't create one, since the class is following singleton pattern). Apart from the
ODBCManager, the DLL has following other classes ODBCDriver and
ODBCDSN.
ODBCMngr
ODBCDriver
ODBCDSN
This ODBCManager class has following static methods.
public static ODBCDriver[] GetODBCDrivers();
public static ODBCDriver GetODBCDriver(string driverName);
public static ODBCDSN[] GetSystemDSNList();
public static ODBCDSN GetSystemDSN(string dsnName);
public static ODBCDSN[] GetUserDSNList();
public static ODBCDSN GetUserDSN(string dsnName);
public static RegistryKey OpenComplexSubKey(RegistryKey baseKey,
string complexKeyStr, bool writable);
Except for the method 7 signatures of the above methods are self explanatory. I added method 7
to the class, since I don't find any method '.Net framework Registry class' that gives a
RegistryKey for a nested key. For example to get the "Software" subfolder in
HKEY_LOCAL_MACHINE root folder of registry following method call can be used.
RegistryKey
HKEY_LOCAL_MACHINE
RegistryKey fianlKey = (Registry.LocalMachine).OpenSubKey("Software");
Now if we want the key for "Software\ODBC\" in HKEY_LOCAL_MACHINE root folder of
registry following method calls can be used.
RegistryKey fianlKey = (Registry.LocalMachine).OpenSubKey("Software");
fianlKey = fianlKey.OpenSubKey("ODBC");
Now my method (7) can eliminate multiple calls to OpenSubKey() method as done above. So using (7)
OpenSubKey()
RegistryKey finalKey = ODBCManager.OpenComplexSubKey(
Registry.LocalMachine, "Software\ODBC\", false);
Note: Last parameter is a boolean flag that tells the 'OpenComplexSubKey'
method to create a sub folder if it is not present.
boolean
OpenComplexSubKey
Since this is a DLL that has methods we can call, I don't really see the use of writing a client
program. So I am not writing any program using the above DLL. Please note that this is version - I
of the DLL. I will try to add more related stuff to this DLL in future. If I do so, I will update again.
I hope I explained all the things that are need to be explained. If any one of you feel I did some thing
terribly wrong or not clear, please let me know. I will try to correct and/or | http://www.codeproject.com/Articles/5836/An-ODBC-DSN-Driver-Manager-DLL-written-in-C-Versio | CC-MAIN-2013-20 | refinedweb | 793 | 64.1 |
Disappearing cros section in sweep
On 23/02/2016 at 09:35, xxxxxxxx wrote:
Hi guys!
I'm working on an object plugin that has a sweep inside. Via a link field I specify the cross section spline, that should go inside sweep. When I convert the plugin object to editable something weird happens.
When the linked Spline is above the plugin object in the objects panel the cross section disappears from the sweep. When it is below the plugin object everything works out as expected.
Has anyone experienced something similar or has any idea why this happens?
On 24/02/2016 at 02:02, xxxxxxxx wrote:
Hello,
I guess you are creating a generator and the "sweep inside" is a virtual sweep object created in your GetVirtualObjects() function?
Can you post some code how exactly you access and use the cross section spline from your link?
Best wishes,
Sebastian
On 29/02/2016 at 03:44, xxxxxxxx wrote:
For testing purposes I boiled it down to this:
def GetVirtualObjects(self, op, hh) :
sweep = c4d.BaseObject(c4d.Osweep)
spline = c4d.SplineObject(2, c4d.SPLINETYPE_BEZIER)
spline.SetPoint(0, c4d.Vector(0, 0, 0))
spline.SetPoint(1, c4d.Vector(1000, 0, 0))
crossection = op[c4d.T_LINK].GetClone()
spline.InsertUnder(sweep)
crossection.InsertUnder(sweep)
return sweep
Still with the same effect.
On 29/02/2016 at 09:20, xxxxxxxx wrote:
Hello,
there seem to be some issues with this specific use case. You could try to use the child objects of your generator as arguments (with the flag OBJECT_INPUT set). This would be more like the typical Cinema 4D workflow. Or you could try if the same happens with a Python Generator object and links defined as user data.
Best wishes,
Sebastian
On 02/03/2016 at 03:50, xxxxxxxx wrote:
Thanks for the suggestions. I was hoping to avoid having to use child objects, but I might try it.
Thanks again. | https://plugincafe.maxon.net/topic/9369/12515_disappearing-cros-section-in-sweep/2 | CC-MAIN-2020-10 | refinedweb | 319 | 65.62 |
Copying file in Java
In Java copy file tutorial, we show how to copy a file in Java. We copy files with
built-in classes including
File,
FileInputStream,
FileOutputStream,
FileChannel, and
Files.
We also use two third-party libraries: Apache Commons IO and Google Guava.
File copying is the creation of a new file which has the same content as an existing file. File moving is transferring a file from one location to another.
The file to be copied is called the source file and the new copy is called the destination file.
Java copying file with FileInputStream and FileOutputStream
With
FileInputStream and
FileOutputStream we
create streams for reading and writing to a
File. When
the file is not found,
FileNotFoundException is thrown.
File is a representation of a file or directory in Java.
package com.zetcode; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; public class CopyFileStream { public static void main(String[] args) throws IOException { File source = new File("src/resources/bugs.txt"); File dest = new File("src/resources/bugs2.txt"); InputStream is = null; OutputStream os = null; try { is = new FileInputStream(source); os = new FileOutputStream(dest); byte[] buffer = new byte[1024]; int length; while ((length = is.read(buffer)) > 0) { os.write(buffer, 0, length); } } finally { if (is != null) { is.close(); } if (os != null) { os.close(); } } } }
The example represents the classic Java way of copying files.
It copies a file using
FileInputStream,
FileOutputStream,
and
File.
File source = new File("src/resources/bugs.txt"); File dest = new File("src/resources/bugs2.txt");
These are the source and destination files.
is = new FileInputStream(source); os = new FileOutputStream(dest);
We create instances of
FileInputStream and
FileOutputStream.
byte[] buffer = new byte[1024];
We will be copying chunks of 1024 bytes of text. This is done for better performance.
while ((length = is.read(buffer)) > 0) {
The
FileInputStream's
read() method reads the specified
number of bytes from the input stream and stores them into the buffer array.
It returns the total number of bytes read into the buffer, or -1 if there is no more
data because the end of the stream has been reached.
os.write(buffer, 0, length);
The
FileOutputStream's
write() method writes the bytes
stored in the buffer to the output stream. The first parameter is the data, the second
is the start offset in the data, and the last is the number of bytes to write.
Java copying file with FileChannel
FileChannel is a channel for reading, writing, mapping, and manipulating a file.
FileChannel is an alternative way to the classic Java IO stream API.
It is located in the
java.nio package.
package com.zetcode; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.nio.channels.FileChannel; public class CopyFileChannel { public static void main(String[] args) throws IOException { File source = new File("src/resources/bugs.txt"); File dest = new File("src/resources/bugs2.txt"); FileChannel sc = null; FileChannel dc = null; try { sc = new FileInputStream(source).getChannel(); dc = new FileOutputStream(dest).getChannel(); dc.transferFrom(sc, 0, sc.size()); } finally { if (sc != null) { sc.close(); } if (dc != null) { dc.close(); } } } }
The example copies a text file with
FileChannel.
sc = new FileInputStream(source).getChannel();
The source channel is created from the
FileInputStream with
the
getChannel() method.
dc.transferFrom(sc, 0, sc.size());
The
transferFrom() method transfers bytes from the source
channel into the destination channel. The first parameter is the source
channel, the second is the starting position of the transfer in the file,
and the third is the maximum number of bytes to be transferred.
Java copying file with Files.copy
Java 7 introduced the
Files.copy() method, which provides
an easy way of copying a file. The copy fails if the target file exists,
unless the
REPLACE_EXISTING option is specified.
Files.copy()
takes an optional third copy options argument.
The options parameter may include any of the following:
REPLACE_EXISTING- if the target file exists, then the target file is replaced if it is not a non-empty directory.
COPY_ATTRIBUTES- attempts to copy the file attributes associated with this file to the target file.
ATOMIC_MOVE- moves the file.
NOFOLLOW_LINKS- symbolic links are not followed.
The first three options are available in
StandarCopyOption; the last one in
LinkOption.
package com.zetcode; import java.io.File; import java.io.IOException; import java.nio.file.Files; import java.nio.file.StandardCopyOption; public class CopyFileJava7 { public static void main(String[] args) throws IOException { File source = new File("src/resources/bugs.txt"); File dest = new File("src/resources/bugs2.txt"); Files.copy(source.toPath(), dest.toPath(), StandardCopyOption.REPLACE_EXISTING); } }
The example copies a file with
Files.copy(). It replaces the destination if it already exists.
Java Copying file with Apache Commons IO
Apache Commons IO is a library of utilities to assist with developing IO functionality.
It contains the
FileUtils.copyFile() method
to perform copying.
FileUtils.copyFile() copies the contents of the specified source
file to the specified destination file preserving the file date. The directory holding the destination
file is created if it does not exist. If the destination file exists, then this
method will overwrite it.
<dependency> <groupId>commons-io</groupId> <artifactId>commons-io</artifactId> <version>2.5</version> </dependency>
For this example, we need the
commons-io artifact.
package com.zetcode; import java.io.File; import java.io.IOException; import org.apache.commons.io.FileUtils; public class CopyFileApacheCommons { public static void main(String[] args) throws IOException { File source = new File("src/main/resources/bugs.txt"); File dest = new File("src/main/resources/bugs2.txt"); FileUtils.copyFile(source, dest); } }
The example copies a file with Apache Commons'
FileUtils.copyFile().
Java copying file with Guava
Google Guava is an open-source set of common libraries for Java.
It includes
Files.copy() for copying a file.
package com.zetcode; import com.google.common.io.Files; import java.io.File; import java.io.IOException; public class CopyFileGuava { public static void main(String[] args) throws IOException { File source = new File("src/main/resources/bugs.txt"); File dest = new File("src/main/resources/bugs2.txt"); Files.copy(source, dest); } }
The example copies a file with Guava's
Files.copy().
In this tutorial, we have shown several ways how to copy a file in Java. We have used built-in tools and third-party libraries. You might also be interested in the related tutorials: Java file tutorial, Java Unix time, Java create directory, Java file size, Creating file in Java, Reading text files in Java, Apache FileUtils tutorial, Java Swing tutorial, Java tutorial, Displaying image in Java. | http://zetcode.com/java/copyfile/ | CC-MAIN-2019-26 | refinedweb | 1,101 | 53.58 |
Leveraging iPads for Data Collection
Our latest post is from special guest and Engine Yard partner Jimmy Thrasher of Terralien. Jimmy works with clients to help them build the technology for their businesses. Terralien has been building Rails applications for clients since 2006, and was super excited when Engine Yard came online as one of the first Rails-focused managed hosting providers. Having a strong technology partner made it easier early on to convince clients to use this new technology called "Ruby on Rails." As someone who's been using dynamic languages since before they were “cool”, Jimmy's primary focus these days is crafting full stack mobile+web experiences. He lives in and works from Efland, NC, excels at esoteric analogies, and always tries to have something cooking on the side to feed his entrepreneurial aspirations.
Imagine this scenario
You've just won a contract to build a form heavy app for a medical practice with reams of paper forms to convert. There's a patient evaluation form, a treatment form, an insurer form and a dizzying array of other information they need to gather.
They know the iPad will give them instant credibility with their patients. And they are expecting you to be the magic working developer who can make it happen.
Getting started is easy but if this was you, you'd hit a wall really fast. You'd be faced with a sticky ‘trilemma':
- You could hand code each form - but that will take forever
- You could create the forms in Interface Builder – but that will make changes really difficult and it will still take forever
- You could implement a form layout framework for iOS – but that won't be portable and will take forever too
Instead of thinking “if only I could use HTML forms” and figuring out how to get out of your newly won deal, you should consider a fourth idea that might not be as obvious.
A new idea
Mobile and web - two technologies that were made for each other like peanut butter and chocolate. They both have strengths but there's an underlying weakness in each too:
- iOS is great at enabling simple and usable apps. Try doing an app heavy on data entry, though, and you'll face some steep technical hurdles.
- Web apps are extremely flexible, portable and make form building a cinch. That said, getting the kind of flair and snappiness a client wants can be a challenge.
In this post, I'll discuss a technique I'm using at Terralien to construct a hybrid application – one built to make the iPad an excellent data entry device without losing its sleek, simple interface. While I'll be focusing on iOS, the techniques used here should be portable across other smartphone platforms – that's actually a big part of the appeal with this approach.
General Approach
The approach I use is fairly simple: use a web app for forms, and a combination of the native app and a RESTfulAPI for the rest. The iOS app is effectively partitioned along the two UI lines of implementation, native UI interaction and form rendering and interaction.
Structure of the iOS App
There are three primary components involved in getting this working in an iOS app: ObjectiveResource, a special UIWebView category I call PlatformIntegration, and some corresponding Javascript on the web site to enable the platform integration. Of course, there are the actual HTML forms, and native UI for the iOS app, but those are covered many other places and we won't go in to them here.
ObjectiveResource
The role ObjectiveResource plays is to provide the native app with access to the relevant application data. How ObjectiveResource works is outside the scope of this post, but I'd encourage you to read up on it yourself: ObjectiveResource.
UIWebView+PlatformIntegration
I'll explain more in a bit, but the purpose of this piece is to provide interaction with the content in the UIWebView, e.g. calling code on the page, receiving events, and the like.
For code, see: UIWebView+PlatformIntegration snippet___ __
This is the content/server side of the equation. It provides some simple hooks to observe form changes, submit the form, etc.
For code, see: platform_integration.js snippet
Interacting with the Forms
Since the native app + ObjectiveResource/REST API should be fairly straightforward, I'll focus on explaining the form interactions. In all my travails, I've only needed two things: to be able to execute code on the webpage, and to be able to receive events from the webpage.
Executing Code on the Page
This is fairly simple. In fact, UIWebView already provides stringByEvaluatingJavascriptString: and Android's WebView can be beaten into submission by calling loadData with a ‘javascript:' URI. Most of the work, then, is involved in making the code into a usable API. For example, it's much nicer to say, for instance,
[webView hideElementWithId:@"ye_form"];
than to say
[webView stringByEvaluatingJavascriptString:@"$('ye_form').hide()"];
Making these simpler facade methods gets me most of the way there, but for code that is more involved, I use the platform_integration.js code I mentioned. It's not much more than a namespaced set of functions that simplify the client side work.
Receiving Events
My client code needs to know when the form is changed, so I can add a helpful ‘*' next to the title, and so I can prompt for confirmation should the user choose to close the form. This is a little more tricky, perhaps even kludgey, but the fundamental technique is reliable and commonly used.
The core of the technique centers around the fact that a UIWebViewDelegate is given the responsibility of determining whether a given URL should be processed as is (see UIWebViewDelegate's webView:shouldStartLoadWithRequest:navigationType:). Our web page can emit URIs of various kinds, some ‘http:' and some ‘platformintegration:'. If our code sees a ‘platformintegration:' URI, it processes it itself, and leaves all other URIs to load normally. Let's look at some details.
If you take a look at the platform_integration.js snippet, you'll notice the following line:
window.location = 'platformintegration:formchanged';
This is our event. When the form change event happens, we execute that line, our UIWebView hackery receives the event, and processes it accordingly. In my case, I call:
if
([delegate respondsToSelector:@selector(webViewFormChanged:)]) [delegate webViewFormChanged:self];
Closing, Limitations
You may've noticed that all this depends on being online the whole time. For an iPad user in an office, this is a reasonable expectation, but for a field iPad user (our friend the DA ‘enforcer'), the implementation needs to handle sketchy or nonexistent data connections. I've not solved this problem, since I haven't needed to, but I imagine something combining HTML5 offline storage and a simple data caching layer may be able to do the trick. This, though, is a problem for another day.
Aside from that, it provides a relatively simple, sane, and extensible bridge between your native app and the forms on your web app. Each platform does what it is best at, and you, the developer, are left with a comfortable feeling that you're not wasting your client's valuable time or money.
Share your thoughts with @engineyard on Twitter | https://blog.engineyard.com/2011/leveraging-ipads-for-data-collection | CC-MAIN-2015-48 | refinedweb | 1,204 | 59.03 |
On date Tuesday 2010-04-27 16:32:12 +0200, V?ctor Paesa encoded: > Hi, > > On Tue, Apr 27, 2010 at 00:38, Stefano Sabatini wrote: > > On date Monday 2010-04-26 23:49:08 +0200, Michael Niedermayer encoded: > >> On Mon, Apr 26, 2010 at 11:40:02PM +0200, Stefano Sabatini wrote: > >> > On date Monday 2010-04-26 01:16:39 +0200, Stefano Sabatini encoded: > >> > > --- > >> > > ?libavformat/file.c | ? ?2 +- > >> > > ?1 files changed, 1 insertions(+), 1 deletions(-) > >> > > > >> > > diff --git a/libavformat/file.c b/libavformat/file.c > >> > > index d42a678..8873d5f 100644 > >> > > --- a/libavformat/file.c > >> > > +++ b/libavformat/file.c > >> > > @@ -53,7 +53,7 @@ static int file_open(URLContext *h, const char *filename, int flags) > >> > > ?#endif > >> > > ? ? ?fd = open(filename, access, 0666); > >> > > ? ? ?if (fd == -1) > >> > > - ? ? ? ?return AVERROR(ENOENT); > >> > > + ? ? ? ?return AVERROR(errno); > >> > > ? ? ?h->priv_data = (void *) (intptr_t) fd; > >> > > ? ? ?return 0; > >> > > ?} > >> > > >> > Ping. > >> > >> it does look ok, i hope it wont have the sideeffects of your last > >> errno patch (issue1894) > > > > Applied. > > > > Sadly issue1894 is due to Cygwin not implement strerror_r(), and we > > having dropped the explicit printing of the description for ENOENT, > > since we're assuming it will be managed by strerror_r(). > > I have not compiled SVN-r22960 yet, but the issue must be other, as even > old Cygwin 1.5.x implements strerror_r(): > > $ fgrep -r strerror_r /usr/include > /usr/include/cygwin/version.h: 71: Export strerror_r > /usr/include/string.h:char *_EXFUN(strerror_r,(int, char *, size_t)); > > $ uname -a > CYGWIN_NT-5.1 localhost 1.5.25(0.156/4/2) 2008-06-12 19:34 i686 Cygwin Please could you check and report, it may be that he compiled against a very old version and / or forgot to re-configure after updating FFmpeg. Regards. -- FFmpeg = Foolish and Fierce Mastering Picky Evanescent Gadget | http://ffmpeg.org/pipermail/ffmpeg-devel/2010-April/081685.html | CC-MAIN-2016-26 | refinedweb | 284 | 59.09 |
This is the mail archive of the cygwin mailing list for the Cygwin project.
Greetings, Gary Johnson! > Recent releases of the Cygwin Vim package (starting with 7.4.1179-1, > 2016-01-29) have included Red Hat's or Fedora's /etc/vimrc, which is > loaded first when starting Vim. That file contains a BufReadPost > autocommand to do what you observe. > I don't like it, either, so I have this in my ~/.vimrc: > " Remove the (annoying) /etc/vimrc autocommand that positions > " the cursor " to the location it last had when the file was > " closed. > " > if exists("#fedora#BufRead#*") > au! fedora BufRead * > endif > if exists("#redhat#BufRead#*") > au! redhat BufRead * > endif > For Cygwin, you need only one of those, but I'm at home, my Cygwin > installation is at work, and I don't remember whether Cygwin uses > the Fedora or the Red Hat version of /etc/vimrc. > You may want to take a look at /etc/vimrc and see if it makes any > other settings you find undesirable and undo them in your ~/.vimrc > as well. It may be worthwhile to do this only for certain names of files. Overall, I find having editor remember where I have been in the code useful. -- With best regards, Andrey Repin Monday, February 15, 2016 00:21:34 Sorry for my terrible english... -- Problem reports: FAQ: Documentation: Unsubscribe info: | http://cygwin.com/ml/cygwin/2016-02/msg00219.html | CC-MAIN-2018-43 | refinedweb | 227 | 66.84 |
Since free wxPython interface to a publicly available data source (USDA Nutrient Database). I was hoping it would run without modification, but it failed on a line that used Windows-style back-slashes in paths rather than forward slashses -- as prefered by linux. After changing 4 such lines, it ran. I was surprised that the fancy OpenGL graphics didn't cause any problems, but it did segfault on the About box, the simplest dialog in the entire app (go figure). I haven't got to the bottom of that yet, but when I do, I will release a Linux version. Here's a screenshot of Food File running under Ubuntu:
I don't have any experience building a Linux package. If the lazyweb would like to help me with that, it would be appreciated!
I think it was this project that started my pie chart fetish. I wonder if there is a support group or something...
So now you know why os.path.join is there, and why you should use it!
If you're interested in seeing your app packaged in Ubuntu, your best bet is probably to just do the python distutils stuff as normal and then talk to some Debian developers about getting it into Debian. Ubuntu syncs off of Debian at least twice a year, and they'll do all of the packaging work for you.
If you poke a developer who uses Launchpad PPAs (or makes repositories using native tools), it is also possible that a temporary repository can be set up to provide packages for folks who want to experiment before the Ubuntu release cycle has run its six-month course.
Theres a showmedo video of how to package a Python program for Debian/Ubuntu
The button order is reversed though.
to fix the segfault change this :
class DialogAbout(wx.Dialog):
def __init__(self):
p = wx.PreDialog()
self.PostCreate(p)()
to this:
class DialogAbout(wx.Dialog):
def __init__(self):
p = wx.PreDialog()()
self.PostCreate(p)
You still get an error, which I haven't looked into yet, but no segfault.
See a screen shot of it at
I forgot to mention that once you close the error box, the about dialog does open up.
[...] asks Hoosgot, [...]
FYI, foodfileonline.com is no longer working...
Steve, noted. Although something that has always bothered me about os.path.join is that if you join a Windoze path with backslashes with a path with forward slashes, it doesn't normalize the path separators. And Windows sometimes doesn't like paths with mixed separators. Its a simple fix , but if os.path.join did it for me, it would be one less thing to worry about!
Nick, Peter, thanks for the tips!
fdgdfg, what buttons?
Keith, thanks for the debugging! | http://www.willmcgugan.com/2008/07/12/food-file-on-ubuntu/ | crawl-002 | refinedweb | 461 | 73.88 |
I have implemented for myself the below described command-line argument and related task, do
you think it could be useful and hence submitted to ant?
---
I was looking for a way in which ant could perform a build on an antfile where some tasks
(which are not needed for the desired build) have dependencies on tasks which are not present
in the antfile. The motivation was that I have an <import file="..." optional="true"/>
in the antfile and the antfile to import is being downloaded by invoking a task in the main
antfile (containing the import). So during the first invocation to download the antfile to
import there may be some tasks in the main antfile which depend on tasks in the imported antfile
which is not available at the beginning of the invocation, only as a result of it.
I didn't find anything related in documentation and I received no response from the user mailing
list, so I concluded that this is currently not possible and looked into the source code of
ant (1.7.1) to find out that this is very easy since the (redundant) control of dependencies
of tasks not involved in the current build is clearly divided from the rest of the dependency
checking (there is a detailed comment on that in Project.java in one of the toposort methods).
So I added a commandline switch (-ignore-missing) to overcome this. So this is first step,
do you think this could be useful to submit?
Second step is that I don't want to say "ant -ignore-missing" each time this is needed, so
I thought about "declaring" somehow in an antfile that when performing build using the antfile,
this option should be turned on. This is actually easy, I just wrote a simple anttask <config
ignoreMissing="true"/> which can be used outside of targets and gets executed before the
actual checking of missing targets. This task just sets a flag on Project instance according
to its attribute. It could even be extended so that you can declare options for Project, which
are now only controlled by commandline options, in antfiles that need them. What do you think
about that? Is it useful (for me it is essential) and is it worth submitting to ant?
David | http://mail-archives.apache.org/mod_mbox/ant-dev/200902.mbox/%3Cc0585f96ef25428695ba9db70f181677@e5e63feb953c4271a219a84977ae571d%3E | CC-MAIN-2015-32 | refinedweb | 383 | 64.75 |
Archives
xUnit.net RC2 Released
public class DatabaseFixture : IDisposable
Understanding AOP in .NET
In my previous posts I have talked a bit about Inversion of Control (IoC) containers with respect to Interception and Aspect Oriented Programming (AOP). It's not only important to understand the uses and strategies for implementing your solutions using it, but also how interception and AOP works deep down in .NET. Instead of a long, drawn out post, I think I'll just include some articles and posts that do a very good job of explaining some of the ideas behind it....
IoC and Unity - Configuration Changes for the Better
namespace UnitySamples
FringeDC March 2008 Video Now Online - Haskell and XMonad Extensibility
As I've discussed before with my dive into functional programming and F#, there is a user group of language geeks that specialize in Haskell, Lisp, Scheme, OCaml, Erlang and so on, within the Washington DC area called FringeDC. Brent Yorgey, well known in the Haskell community and contributor to XMonad, presented an introduction to Haskell and explained a bit about extending XMonad. Fortunately for those who couldn't attend like myself due to scheduling conflicts, Conrad Barski recorded this session and posted it to Google Video. The slides have also been made available as well here. For those not aware of XMonad, it's a tiling window manager for X that is extensible in Haskell. Unfortunately, the opening talk by Philip Fominykh on The Zipper, a purely functional data structure in Haskell for manipulating the location of structure instead of the data, was not recorded.
If you want to get your language geek on, come check it out for their next informal meeting on May 10th over a beer or two. More details on the site here. Until next time...
IoC and Unity - The Basics and Interception
namespace UnitySamples
ALT.NET Thinking From The Outside
As I've noted before, Dave Laribee was recently interviewed by Scott Hanselman on Episode 104 of Hanselminutes. The reaction that I've seen has been pretty positive from what I've seen. It's great to see the ALT.NET message being spread outside the core believers group. Many people can be turned off after a few discussions on the altdotnet mailing list and not get the real gist of what the group is about.
Dave did a great job explaining the core principles of ALT.NET which are:
- Use the right tool for the right job
- Look outside the .NET community for new and different ways of solving problems
- Get involved with the community through teaching and teaching
- A good emphasis on agile methodologies
- Design patterns and principles
But, how do we convey that message to the development community as a whole. That was a part of the conversation that was interesting. And to me, I think we should have that "street kit" which includes such bare essentials as a manifesto (that we'll probably get to in Seattle), frameworks, design patterns, ways of spreading the message, etc.
Christopher Bennage had a good wrapup of the show as well here. I'd tend to agree that ALT.NET isn't about convincing, it's about conversing, having that conversation about what pains them and working through on a solution. It's about spreading the community. But, a direct command to learn Ruby, meh... I think Scala has a few more things to offer right now which is why I'm chomping at the bit to get to more of it.
A post by Leon on community though caught my eye recently. What he says is pretty accurate. I tend to think that what ALT.NET is preaching is what many communities such as the Ruby on Rails and Java communities have been doing for years with regards to design patterns, TDD and so on. A lot of the innovation such as TDD frameworks, design patterns and such just hasn't come from the .NET community. Many people wait on Microsoft to provide these things such as TDD frameworks (MSTest), Logging (Enterprise Library), O/RM (Entity Framework) and won't pay attention to the OSS world which I find an utter shame. Instead, what I'd like people to do is take those frameworks and look what's available from the community as a whole and compare them, much as I have with Unity and some other IoC containers. Yes, many people worry about licensing issues and that's something for your legal team to work out.
But, to his point, I'm glad he's learned Ruby on Rails and is happy. In fact, I think it's great that he is expanding his horizons outside of C# which I think most developers ought to know a few languages and not just C#, VB.NET or Java. For example, this past year I spent time learning Ruby and F#. I plan on taking up Scala soon as well and maybe a couple of other languages. In the past I was a Java, PHP and C++ programmer, so I've run the gamut. You can take some of these practices back to your other languages and learn from the successes and the failures of each community. It only makes you a better developer over time. I think many of the innovations that happen in the .NET space should come from the outside, and not just from Microsoft.
Do I think it's having an effect? Absolutely! If you look at such frameworks as Unity, there is a lot of feedback being provided, the ASP.NET MVC framework, same way. This willingness on both sides to engage is a wonderful thing and maybe to the point where "ALT" isn't the alternative anymore and instead the de facto standard.
Adventures in F# - F# 101 Part 6 (Lazy Evaluation)
#light
ASP.NET MVC Source Code Now Available
As of yesterday, the ASP.NET MVC Release 2 source code has been made available on CodePlex. ScottGu made the source drop announcement earlier this morning. Congrats to Phil Haack and the ASP.NET MVC Team for shipping the source code. It's worth noting, it's not Open Source in the way that it's just a zip file and no outside patches are to be accepted, unlike IronRuby. The plan going forward is to make incremental drops of the source code going forward.
As always, check out Jeffrey Palermo's MVCContrib project for contributions to the code base, which is open source.
DC ALT.NET March Meeting Wrapup
Another month and another highly successful DC ALT.NET meeting. I want to thank Kevin Hegg for hosting the event as he was a very gracious host. We had a better than expected turnout which was very cool. It's good to associate names to faces after chatting, emailing and whatnot. I also want to thank Phil McMillan for stepping up to the plate at the last moment to backfill for the lack of the scheduled speaker. It's even more refreshing to not have any Death By PowerPoint (DBPPT) (TM). I appreciate Phil's talk even more due to the fact that he had a laptop meltdown the night before, so we talked about concepts and implementations without showing any real code.
What Did We Talk About?
Our format that we follow is that we have one hour for our scheduled topic and the rest is Open Spaces. Bring a topic and talk about it. So, for the first hour, Phil led the discussion around interception facilities in Castle Windsor in regards to handling a Unit of Work pattern for a custom written WPF application. There is a lot of headache that comes with undo logic in WPF controls, so using interception and the unit of work pattern can get around this, although not the cleanest code written to man. Also, we talked about the headaches of registration inside IoC containers whether it be in code or in XML. We talked about Binsor and whether that was an answer to the registration headaches caused by massive XML config files. Craig Andera just loves bringing up Lisp and Lisp macros as they solve all programming problems ever invented by man.
The second hour was an open spaces discussion where we had pretty lively debate about:
- Dynamic Language Runtime (DLR) and its uses and extensibility model
- Design by Contract
- Functional Programming with Lisp/Scheme, Functional Javascript, Erlang, and F# and the value proposition it has
- Finding the right developer for your organization
- TDD/Test First Development
- ALT.NET Open Spaces, Seattle topics
Like I said before, we tend to be different than most user groups in the Washington DC area due to the fact that we're an Open Spaces event, for at least half of it. We don't really do PowerPoint presentations, instead a more intimate environment where everyone participates. I don't think anyone stayed silent during the meeting. Instead of being lectured to, you're part of the conversation. We want passionate developers to attend, those who are looking for a better way. It's even effective when not looking at code, nor slides for any given product. I feel we can augment any discussion from any user group in the DC area, and not here to compete, instead compliment them with a more intimate and passionate discussion.
Where We Go From Here
After the March meeting, we're looking to hold the next meeting the week after ALT.NET Open Spaces, Seattle. That should bring some lively discussion and wrapup from the event. We also look forward to having Jay Flowers make it to the event to discuss Continuous Integration and CI Factory. Stay tuned for details on our next meeting. April is going to be a busy month for at least me with the CMAP Code Camp on April 12th, speaking at RockNUG and ALT.NET Open Spaces, Seattle as well as our own DC ALT.NET Meeting.
Wrapping It Up
If you're interested in a better way, to discuss .NET or related topics and you're in the ALT.NET mindset, then come and join the conversation. We're always looking for passionate individuals to come and join and be a part. Join our mailing list and find out more here.
Adventures in F# - FringeDC User Group
During my Adventures in F# series that I've been posting, I've always wondered where the interest in these languages come from. Sure, we have a lot of user groups in the Washington DC area, just to name a few that I've been to or belong to:
- DC ALT.NET User Group
- Capital Area .NET User Group (CapArea.NET)
- Rockville .NET User Group (RockNUG)
- Central Maryland .NET Professionals (CMAP)
- Microsoft Integration and Connected Systems User Group (MICSUG)
- Northern VA SQL Server User Group (NoVASQL)
- Northern Virginia Ruby User Group (NoVARUG)
- Northern Virginia Java Users Group (NoVAJUG)
- Washington DC XP Users Group (XPWDC)
Looking at DSLs in .NET
As I've mentioned in recent posts such as here, here and here, I've been very interested in Domain Specific Languages (DSLs), especially with regards to F# and the DLR as well. I recently re-listened to Software Engineering Radio Episode 52 with Obie Fernandez discussing DSLs in Ruby. One of the things that attracted me to Ruby for this was the flexibility of the syntax for closures, mixins, etc. Anyhow, it's a good listen and if you're new to the subject, you should give it a go. Also, there is a slide deck of DSLs in Ruby which accompanies this episode which can be found here.
So, of course this gets me excited about the possibilities of seeing such things in IronRuby. After seeing John Lam's presentations at MIX08 and listening to him on various podcasts, I'm excited that they are making such progress and hopefully get it into our hands soon.
But, before we get too deep into things, I just want to take a step back and look quickly at what DSLs are.
Internal and External DSLs?
So, what are DSLs? Well, to put it succinctly, it's a small language that's used for a very narrow task. You can think of these as languages specific to a domain such as medical claims processing, stock trading and so on that only have meaning there. These languages mean very little outside their problem domain and probably wouldn't make sense to anyone outside. I'm very well aware of such things as I've worked in the medical claims processing industry and their terms, calculations and so on are very specific and to solve the problem well, it's best to suit the language best for expressing solutions.
Martin Fowler wrote an article entitled "Language Workbenches: The Killer-App For Domain Specific Languages?" in which he talks about the history of DSLs especially in the Lisp world, but until now really haven't caught on. Martin argues that XML structures such as configuration files, and so on qualify for that status, due to the fact that it is readable by a human and probably a domain expert as well. But Lisp is well know for the Lex/Yacc parsing and expression trees and so on.
Now the real interesting part comes in when we talk about internal versus external DSLs...
External DSLs, quite simply, are those languages that are not in the same language as the main application itself. This means that I could be free to write any free-form code I wish in order to suit my domain specific need. This means that you need to write parsers and then ultimately would need to have a translation boundary between your DSL and your application. This is where I think something like the Dynamic Language Runtime (DLR) could come into play. What I mean by that is that if you write your language parser for the DLR, and I'll get into that shortly. There is a bit of overhead with this of course, plus a good debugger and IDE, but with time and patience things like this can be overcome. Extending such things as #Develop to encompass those pieces is feasible.
Internal DSLs, on the other hand, are the little languages you can create inside your current language of choice. Now languages such as Lisp, Ruby, Scala, Boo, and F# seem a bit more suited for these than the mainstream languages of C++, C# and Java. Of course one of the bigger obstacles is the pesky curly brace which Ruby allows you to discard. F# doesn't have a concept of this either, and instead the indentation scopes the values and functions and so on. Martin has an interesting DSL written in Java that's interesting and could be better applied in different languages.
Thinking About The DLR
As I said before, I'm pretty excited about the DLR and the flexibility it can give me as a software engineer looking for new and better ways to solve my customer's problems. Not only that, but I'm a language geek at heart, what can I say? I've posted several items on building on the DLR in the context of external DSLs as well as writing custom compilers for .NET. Projects such as Irony also appeal to me in that way.
If you want to play around with the DLR, you can get it in one of two places, the IronPython download on CodePlex or on RubyForge with the IronRuby project.
Martin Maly, a member of the DLR team has continued his posts about Building on the DLR. He took some time off to work on some DLR related issues and now is back with some more posts. Let's continue where we left off last time:
- Answering Some Questions
Martin talks about Static and Dynamic Nodes on DLR Trees
- Variations on Trees
Martin talks about DLR trees and LINQ Expression trees
- More questions
Martin talks about implementing a Print method that acts differently per incoming data type
- Extension Methods
Martin talks about adding extension methods to the ToyScript sample
DSLs In Boo?
Oren Eini, aka Ayende, has been working on a book about DSLs called "Building Domain Specific Languages in Boo". Recently, he posted about some sample chapters now available online with the source code. I highly recommend that you at least give it a look. You now have access to the Early Access Edition, and of course you can buy it online. It'll be interesting to see Ayende at ALT.NET Open Spaces, Seattle to see if he wants to cover more of this stuff.
If you're not familiar with Boo, it's one of Ayende's preferred languages. Such tools as Binsor (The DSL for Windsor) were written in Boo. If you're not familiar with the language, it has very similar syntax to Python and formats very nicely. This easily fits Martin Fowler's category as an external DSL. #Develop has some support for Boo to make it a first class language in the .NET family. It also ships as part of the Castle Project. Anyways, a quick sample of Binsor makes it look like a nice DSL for type registration in Castle Windsor in Boo Script:
Check out the first chapter of Ayende's book which is available free online and explore it yourself for DSLs.
DSLs in F#?
Another part that had me intrigued was the possibilities of not only Boo to do this, but F# as well. Robert Pickering covers this in his book, Foundations of F#. If you pay attention to Chapter 11, he covers DSLs in F# and gives a few examples of how you can do so. To me, it's pretty powerful because you have a lot of the built-in features of a functional programming language such as lists, pattern matching and so on. Such examples as given are such things as the arguments parser in F# that is described in the Arg class in Microsoft.FSharp.Compatibility.OCaml namespace. This allows you to parse well known data structures as first class citizens. Martin Fowler also gave such an example from the article I quoted from above. F# lends itself quite well to DSLs in regard to support for lambda expressions.
Don Syme also covers these topics in his book Expert F# in Chapter 9. This covers more language oriented programming techniques, but you can scan some information about building DSLs in F#. Some interesting parts of this come down to Active Patterns which I covered partially yesterday. In the coming weeks, I hope to post some of my forays into this, taking some samples from the Ruby community and applying some of the same functionality in F#.
Conclusion
There is still much yet to be covered in this topic of DSLs in .NET languages. We can go on and on with regards to internal and external DSLs and argue about which language is suited for each. But in the coming weeks, I hope to take some samples and show how they can apply cleanly in F#, and probably run into some language problems where it might not be the best fit. But, that's the fun part about it.
Reminder - DC ALT.NET Meeting March 19th
Just a reminder, we will be holding it tomorrow, March 19th from 7-9PM. The meeting this month will bring ALT.NET to Arlington, Virginia. I want to thank Kevin Hegg for hosting this event. Unfortunately, Jay Flowers will not be able to attend, so instead we will have myself and Phil McMillan presenting IoC containers and Interception with Castle Windsor.
At our last meeting, Stelligent hosted our event in which we discussed a lot of great topics. You can read a wrapup of our last meeting here..
Adventures in F# - F# 101 Part 5 (Pattern Matching)
#light
CMAP Code Camp April 2008 Registration Open
As mentioned in my previous post about my speaking schedule, I am helping organize the ALT.NET track at the CMAP Code Camp. I plan to be speaking on a few topics and will get that posted when the schedule is finalized. Either way, it should be a great time and bringing ALT.NET ideas to a new audience is always a good thing. I feel there is a lot of momentum around the movement right now with the help of the "What is ALT.NET?" MSDN Magazine article by Jeremy Miller and Dave Laribee on Hanselminutes.
Anyhow, back to the topic at hand. Registration is now open for the CMAP April 2008 Code...
Upcoming Speaking Schedule for April 2008
While I'm finishing up my F# post on pattern matching, I thought I'd throw out my speaking schedule for April. It's going to be a busy one with code camps, user groups and conferences. Some time I'm sure I'll find some time to sleep and get my own work done. Below is my current schedule as of right now:
- RockNUG - April 9th
Decouple Your Applications with Dependency Injection and IoC Containers
- CMAP Code Camp - April 12th
Heading up the ALT.NET track at the CMAP Code Camp to talk about ALT.NET topics such as IoC containers, TDD/BDD, O/RM frameworks, etc
- DC ALT.NET - April 16th
Inversion of Control Containers for Cross-Cutting Concerns
- ALT.NET Open Spaces, Seattle - April 18th-20th
Design by Contract panel discussion (Proposed). No guarantees since it is Open Spaces
Why I'm Excited About ALT.NET Open Spaces, Seattle
Update: Catch Dave Laribee on Hanselminutes discussing ALT.NET here.
It's almost a month away until ALT.NET Open Spaces, Seattle and things are coming along nicely. As you may have noted, we filled up rather fast while keeping some spots open for some pre-invites. We have a great crowd of people not only from inside Microsoft, but outside as well. We've put a bit of effort into getting this off the ground, and I can admit I've spent a bit of time doing so. But to see names like Ward Cunningham, Jim Shore, Martin Fowler from the Agile spaces, folks from Microsoft such as Scott Guthrie, Scott Hanselman, Phil Haack, John Lam, Jim Hugunin, Brad Abrams, Charlie Calvert, Brad Wilson, P&P, Microsoft Research folks such as Rustan Leino and Peli, the CodeBetter guys, the Israeli crowd (Ayende, Osherove, Dahan) just warms my heart. To give you an idea, I'll put the list at the end.
In case you missed it, Jeremy Miller had a great article in the latest MSDN magazine called "What Is ALT.NET?" which sums up my thoughts exactly on the topic. Very nice stuff! And I think Ayende might be onto something with these ALT.NET logos here. Something tells me t-shirts need to be made.
But where will we go from here? Dave Laribee and others, myself included, have been kicking around the idea of a RailsConf, QCon, Spring Experience, No Fluff Just Stuff kind of conference. I really do like that idea and I want an active learning conference where we in the ALT.NET community can learn from each other, but also spread the message outside. Dave set four basic criteria that I think were well worth noting for parameters for such an event:
- It would be longer: four or five days.
- It would start 2-3 days of workshops or classes upfront on advanced topics: DDD, T/BDD, Agile, Patterns, SOA/Messaging, etc.
- The final days would lead into a kind of "dream conference" with talks given by well-known speakers.
- It would cost money, not a lot, but some...
It's hard not to when you see names like these:
Jonathan de Halleux, Trevor Redfern, Russell Ball, Jonathan Wanagel, Ayende Rahien, Brad Abrams, Shawn Wildermuth, Anil Verma, James Franco, Wendy Friedlander, David Pehrson, Scott Hanselman, James Shore, Donald Belcham, Eric Holton, Michael Bradley, Joey Beninghove, Greg Young, Jesse Johnston, Tom Opgenorth, Harry Pierson, Anand Raju Narayan, Justin-Josef Angel, Chris Sells, Matt Pisut, Jeff Olson, Martin Fowler, Rustan Leino, Oliver, Roy Osherove, Rob Reynolds, Brian Donahue, Alan Buck, Jeff Certain, Sean Solbak, Dave Laribee, Dennis Olano, Owen Rogers, Bertrand Le Roy, Jarod Ferguson, Douglas Schroeder, Terry Hughes, Simon Guest, Rod Paddock, Jean-Paul S. Boodhoo, Dustin Campbell, Eric Ness, David Airth, Aaron Jensen, Wade Hatler, Adam Dymitruk, Chris Salahub, Charlie Poole, John Lam, Ben Scheirman, Brandon Lang, Miguel Angel Saez, Dave Woods, Ashwin Parthasarathy, Matt Hinze, James Kovacs, Alex Hung, Joe Ocampo, Alvin Lee, Steven "Doc" List, Kevin Hegg, D'Arcy Lussier, jakob Homan, Pete Coupland, Rob Zelt, Tom Dean, Joseph Hill, Arvind Palaniswamy, Chris Sutton, khalil El haitami, Kelly Leahy, John Nuechterlein, Troy Gould, Kyle Baley, Rhys Campbell, Joe Pruitt, Ronald S Woan, Michael Nelson, Matthew Podwysocki, Piriya Thongtanunam, Howard Dierking, Pete McKinstry, Dan Miser, Eli Lopian, Raymond Lewallen, Neil Blake, Jacob Lewallen, Mike Stockdale, Kirk Jackson, Brad Wilson, Eric Farr, Jeff Brown, Ian Cooper, John Quach, Cameron Frederick, David Pokluda, Charlie Calvert, Shane Bauer, Rajiv Das, Jeff Tucker, Phil MCmillan, Udi Dahan, Bil Simser, Martin Salias, Bill Zack, Chris Patterson, Greg Banister, Osidosi, Gabriel Schenker, James Thigpen, Phil Haack, Ray Houston, Colin Jack, Robert Smith, Sergio Pereira, Brian Henderson, Michael Henderson, Chantal Laplante, Dave Foley, Ward Cunningham, Bryce Budd, Chris Bilson, Scott Guthrie, Robin Clowers, Craig Beck, Phil Dennis, Jeffrey Palermo, Robert Ream, Carlin Pohl, Glenn Block, Tim Barcz, Dru Sellers, Scott Allen, Jeremy D. Miller, Grant Carpenter, Chris Ortman, Drew Miller, Weston Binford, Buchanan Dunn, Rajbeer Dhatt, Justin Bozonier, Jason Grundy, Greg Sangha , david p buchanan , Don Demsak , Jay Flowers , Adam Tybor , Scott C Reynolds , Chad Myers , Nick Parker , John Teague , Daniel , Jim Hugunin , Scott Koon , Justice Gray , Julie Poole , Neil Bourgeois , Luke Foust
Still working on my F# posts and IoC container posts, so stay tuned. Until next time..
DC ALT.NET Meeting - March 19th
I've held off recently announcing the DC ALT.NET meeting due to scheduling issues. Anyhow, that has been resolved and we are good to go. We will be holding it on March 19th from 7-9PM. The meeting this month will bring ALT.NET to Arlington, Virginia. I want to thank Kevin Hegg for offering his office as our get together.
At our last meeting, Stelligent hosted our event in which we discussed a lot of great topics. You can read a wrapup of our last meeting here. This time, we're going to have Jay Flowers to discuss Continuous Integration and CI Factory. It should be a great discussion as it's been weighing on my mind lately..
Singularity - C# OS Released on CodePlex
Update: If you want the .iso I used for the VPC, check it out here on my SkyDrive.
During my research and posts about Design by Contract and Spec# and my interactions with folks from Microsoft Research, I came across Singularity OS, an operating system written in an offshoot language based upon C#. In that time, I realized that the Singularity team extended Spec# and the Design by Contract and static verification pieces of it into a new language called Sing#.
Fast forward to last Tuesday. Almost five years after the start of development, it has finally been released onto CodePlex as an open source non-commercial academic license and can be found here. After reading about it and talking with some Microsoft Research folks about it, I had to give it a shot. That's one of the things I love about working at Microsoft is the fact that I can interact with people like these on a periodic basis.
History of Singularity
During my long commute to and from work, I have the pleasure of listening to many podcasts. Although I like the ones in the .NET space with Hanselminutes and DotNetRocks, I also like to venture into the Ruby and outside community where I'm pretty comfortable as well. So, one of my absolute favorites is Software Engineering Radio for the serious talk and geeking about languages and architecture. Lo and behold, the latest episode, Episode 88, covers Singularity with Galen Hunt where he talks with Markus, the host about the history and features of the OS. I suggest you listen to that before we go any further. Also, a good overview can be found here in PDF format.
If you think about most operating systems we run today, the essence of what they are is dated back in the 1970s and C and Assembly based. Back in 2003, Galen and team started this effort to write an operating system in managed code. Over 90% of the system is written in a language called Sing# which is an extension of Spec# which I will get into shortly. But, Singularity consists of three major parts, Software Isolated Processes (SIPs), contract-based channels, and manifest-based programs.
SIPs are interesting parts of Singularity. They provide a sandbox as it were for program execution free from meddling from outside processes. This includes its own memory space, threads and so on. In fact, memory and threads cannot be shared from one SIP to the other, so the vectors for malicious code are cut way down.
Contract-Based Channels are another interesting aspect of Singularity. It's a built-in feature of the Sing# language which I will get to in the next section. In short, what it provides is a quick and verifiable way of communicating between processes with messages. To support this, the Spec# language had to be extended to support this.
Lastly, manifest based programs are interesting because it defines the code that runs within the SIP and its behaviors. In Singularity, there really is no such thing as Just In Time Compiling (JIT) as all code needs to be loaded into memory and statically verified before it can be executed, which is something a JIT cannot do. But on the other side of this, it makes dynamic languages and late binding impossible as well. So, to work around this, they devised a plan called Compile Time Reflection, so you know your dependencies beforehand and uses Dependency Injection in a way to inject the appropriate dependencies. Really slick stuff!
Sing#
Rustan Leino and others in Microsoft Research had already begun an effort called Spec# to provide Design by Contract features to the C# language and a static verifier to prove that code is in fact working as the contracts were written. Just a quick aside, we're going to be lucky enough to have Rustan at ALT.NET Open Spaces, Seattle to talk about it and Design by Contract (Shameless Plug). Anyhow, back to the topic at hand. Spec# didn't have enough for the static verification that needs to happen. So, instead, Sing# brings us Contract Based Channels for creating message declarations and a set of named protocol sets. Any communication that crosses processes must use contract based channels. These messages that it passes have declarations that state the number and types of arguments for each message and an optional message direction. Each state specifies the possible message sequences leading to other states in the state machine.
I just want to dig through some code to see exactly what that looks like:
class DirectoryServiceWorker
{
private TRef<DirectoryServiceContract.Exp:Start> epRef;
private DirNode! dirNode;
private DirectoryServiceWorker(DirNode! dirNode,
[Claims] DirectoryServiceContract.Exp:Start! i_ep)
requires i_ep.InState(DirectoryServiceContract.Start.Value);
{
epRef = new TRef<DirectoryServiceContract.Exp:Start>(i_ep);
this.dirNode = dirNode;
base();
}
If you notice from above, you can see some Spec# goodness in there including NonNull types using the ! keyword and also requires preconditions. It's pretty well written and a lot of fun to dig through. If you want to learn more about compilers and operating systems, now is the time to sift through the source code and get your geek hat on.
Building the Image
If you want to actually run Singularity, the team has provided as part of the zip file, a way to build the operating system. You'll simply need the following:
- Windows Debugging Tools
- .NET Framework 1.1
- Virtual PC 2007
- MSBuild
I was able to get the results in about 10 minutes or so for the build process. Then again, if you're running Vista, you need to be sure to launch the configure.cmd as an elevated process in order to kick things off properly. That was the first hurdle. But once I got that going, the rest was easy. And I got a pretty cool result as well when I ran the VPC image. Look at the goodness:
I have played with it just yet all that much. I'm figuring what I can do with it next. But, that's part of my copious spare time which doesn't seem to exist much anymore.
Conclusion
I've done well with my learning plan this year to keeping to what is on my plan and not deviating from it. Luckily languages such as Spec# and Sing# still fall into that category. It's pretty fascinating stuff and great to get my hands on an operating system using managed code. It's pretty impressive from the things I've read and the code I've read. I'm only hoping that research projects such as this make a significant impact on future versions of Windows, let alone future versions of most operating systems. Until next time...
Videos and Interviews from MIX08
Well, I've had the urge to find all the videos I could and watch them to find out all the goodies I missed while not at MIX08. If you missed any of the main sessions, you can find out more about them here. Note that there are 88 sessions recorded here, so it's a lot of good viewing material.
Best of all are Scott Hanselman's MVC Videos can be seen here. He also covers the MVC Mock Helpers which better allow for unit tests using various Mock frameworks including Rhino Mocks, TypeMock.NET and Moq.
Dave Laribee was great on Twitter to make sure we were all kept up to date with all the good things that were happening. Brendan Tompkins supplied Dave with a video phone so that he could capture impromptu videos and such. But, best of all they were broadcasted live. He was able to talk to guys like Rob Conery, Phil Haack, Steve Harman, Miguel, John Lam, Scott Hanselman and Josh Holmes. Very cool stuff! They were pretty good and entertaining, although the video wasn't always superb and sometimes you needed motion sickness pills. But, the sessions of note are:
- Phil Haack interview
- Capturing Hanselminutes
- Rob Conery and Steve Harman interview
- Miguel de Icaza interview
- Pablo Castro interview
- John Lam interview
- Microsoft Surface demo
- Josh Holmes interview
RockNUG Meeting 3/12/2008 - Refactoring in C#
The Rockville .NET User Group (RockNUG) will be holding their next meeting on Wednesday, March 12th, 2008 from 6:30PM-9:00PM. This month, they'll be having a pretty interesting topic on refactoring in C# with Jonathan Cogley. I've had my refactoring and agile boots on lately, so I can definitely relate. I don't know what I would do though without my Resharper 4.0 Nightly Builds... I've had a few issues here and there, but nothing to discourage me from continuing usage.
Anyhow, here are the details:
Location:
Montgomery College, Rockville
Humanities Building - Room 103
Refactoring in C# - Bad code to better code
presented by Jonathan Cogley!).
Jonathan Cogley is the founder and CEO of thycotic - a software
development company operating in the Washington DC Metro Area with
offices in Vienna, Virginia. Jonathan has worked for many interesting
companies over the last decade as a software consultant in both the UK
and the USA. His company also a columnist and editor for
the popular ASP.NET Web site, ASPAlliance. He.
The schedule for the event is as follows:
Hope to see a great crowd there! I'm looking forward to it.
IoC Container, Unity and Breaking Changes Galore
IUnityContainer container = new UnityContainer();
ASP.NET Team Releases for Mix 2008
For all those interested in the information and the latest bits from the ASP.NET Team, here are the latest links.
Downloads:
- ASP.NET MVC Preview 2
- Silverlight tools including ASP.NET Server Controls
- ASP.NET 3.5 Extensions Preview from December
ASP.NET Updates:
- ASP.NET Home Page Announcement
- ASP.NET 3.5 Extensions Download Page
- ASP.NET 3.5 Extensions Quickstarts
- ASP.NET Preview 2 (MIX) readme
- ASP.NET Updated Forums
- ASP.NET Server Controls for Silverlight Forum
- ASP.NET 3.5 Extensions Videos
I've been playing with the bits for a little bit lately and I must admit it's a lot better now. But, I'm noticing that it seems that the ASP.NET team wants us to use more of the Supervising Controller/Presenter Pattern and less of the Passive View Pattern. Brad Wilson also notes that here. It hasn't dampened my usage of it yet as I have adapted my designs since then. After all, you have to be a little flexible when using a CTP.
Adventures in F# - F# 101 Part 4
#light
Live From Mix08
No, I'm not at Mix08 right now, but I'm busy paying attention to every detail. I'm missing a lot of really cool things such as:
- Silverlight downloads at 1.5 million a day
- IE 8 preview with Firebug?
- SQL Server Data Services
You can too by paying attention to the following places:
- Live streaming video from Mix from Microsoft and some short videos on:
- IE 8
- Scott Guthrie
- Ray Ozzie
- Dean Hachamovitch
- CodeBetter's live stream by Dave Laribee which features short snippets from the event.
- Josh Holmes is covering the event and has noted about Ray Ozzie's keynote as well as other things.
- John Lam will be at Mix as well and will be tweeting throughout the conference with his Twitter name john_lam. I know I'm following it now...
IoC Containers, Unity and ObjectBuilder2 - The Saga Continues
namespace UnitySamples
Coming to Terms with Behavior Driven Development
A while ago, I posted about Behavior Driven Development (BDD) while using the NBehave, and I think I went too far into the tool without going into the whole thought process instead. I've had a series of these blog posts in my head but have been fighting writers block in order to get them out the door.
BDD Introduction
Anyhow, there has been a lot of discussion around BDD lately on the altdotnet mailing list around the definition and applicability of BDD in regards to Test Driven Development (TDD). Subsequently, this led to forming a new group on Google Groups about Behavior Driven Development. It's great to see the community start to gain momentum and talk about it more. I've been following Dan North, Joe Ocampo, Scott Bellware, JP Boodhoo and Dave Laribee on this for a while, but now to come to a centralized place for that knowledge sharing has been invaluable. I've seen too many times that there is a high noise to information ratio out there and we need to clarify a few things before it can really take hold.
Getting back to the subject at hand, if you're unfamiliar with BDD, you should check out Dan North's explanation here. There are a good number of links inside to whet your appetite. To put things succinctly, BDD aims to bridge the gap between Domain Driven Design and Test Driven Development.
Dave Astels, also has a great video on Google Video on BDD you can find here. It's a great video which talks about how TDD differs and evolved from BDD. It also delves into the subject of rSpec, the BDD framework in Ruby. Very worth your time to check it out.
Dave's summation of BDD comes down to the following bullet points:
- Don't talk about Units in regards to Unit Testing, instead talk about Behaviors
- All software we write has behaviors
- There should be no correlation between public methods on a class and test classes
- Structure your tests around the behavior of your application
- Put emphasis on behaviors (How do I get it to do what I want it to)
- Get rid of state based testing and look at interactions instead
- Get rid of tests and instead use specifications of behavior (specs)
- Get rid of assertions and instead set up expectations
I agree with Jimmy Bogard, that going to TDD to BDD in one fell swoop by just renaming your tests. Instead, we should focus on those interactions between the systems and less on the physical implementations of the code. We should also focus on the expectations inside our code as well. Mocking and the use of Rhino Mocks or your other mocking framework will do nicely in here. Brian Donahue also has some nice stabs at BDD as well here, here and here. If you're up in the Philly area soon, Brian will be making the rounds doing BDD presentations...
Dave Laribee has also put some thought into BDD as well with a particular set of classes he has written to help with BDD that you can check out here. Also if you've paid attention to the BDD mailing list on Google Groups, you will note that Scott Bellware also has a framework up on Google Code called SpecUnit which is an extension to NUnit to support naming conventions of BDD inside of the xUnit type frameworks. Very cool ideas coming out!
Wrapping It Up
I encourage you to join the BDD list, read the links, and learn more. I find it's a more intuitive way of proving the behavior of your application (Note that I didn't say test). I find that it bridges the gap between Domain Driven Design and Test Driven Development quite handily especially in regard to using the ubiquitous language. It's important that naming and ubiquitous language comes into play when using BDD, because you can share your specs and they should be able to read them as well. It's a great gap between user stories and the code you write. If you need help with user stories, check out Mike Cohn's User Stories Applied book. Anyhow, I hope you found this useful as an introduction to some of my many upcoming BDD posts. | http://weblogs.asp.net/podwysocki/archive/2008/03?PageIndex=2 | CC-MAIN-2015-22 | refinedweb | 7,083 | 70.43 |
On Tue, Apr 14, 2009 at 6:38 AM, Marvin Humphrey <marvin@rectangular.com> wrote:
> On Mon, Apr 13, 2009 at 09:43:06AM -0400, Michael McCandless wrote:
>
>> > Because Lucy's Doc objects will be hash based, there will *never* be a case
>> > where the same field has two "values" per se within the same doc.
>> >
>> > However, it's fine if we support compound types via specific FieldType
>> > subclasses, e.g. Float32ArrayType, or StringArrayType.
>>
>> I see -- does KS support multi-valued (compound) types today?
>
> No. There hasn't been a pressing need for them. (IMO, the fact that Lucene
> allows multiple "values" per field is a misfeature. Effectively, *all* fields
> in Lucene are compound types, which is limiting.)
I think compound types are important (eg "author"), though "compound"
is a bit too powerful sounding (eg a "struct" is a compound type, but
we're not going there, I hope). Maybe we can call them "arrays" or
"lists" or "multi-valued".
Maybe you mean Lucene's weak typing (of multi-valued types, in
particular) is the misfeature here?
> Nevertheless, I'm up for supplementing scalar types with compound types in
> Lucy. The "tags" use case in particular might be more elegantly handled with
> a StringArrayType. Or maybe a FullTextArrayType, if it was important for the
> field to be analyzed.
>
> Right now, you can fake up a "tags" field in KS using a dedicated Tokenizer
> pretty easily, but the scoring is kind of messed up because of length
> normalization.
Another EG might be a product that comes in three sizes (S, M, L) and
your current search is filtering by "size == S", that's hard to
emulate well w/o compound types (you could do substring search, but
that scales poorly).
>> For which "types"? And I imagine for such types, "sortable" is not allowed
>
> There's an inherent confusion in how fields that can "hit" in multiple ways
> should sort. On one hand, you might want to sort by the value that "hit". On
> the other hand, you might want to sort by the first value in the field.
>
> In the face of that confusion, I think it makes sense to just disable sorting
> for compound types.
Or allow custom comparator, or custom "ValueSource". Hmm, I wonder
whether ValueSource should make it possible to eg return multiple ints
for a single doc.
>> (yet "sortable" is set at the top FieldSpec, right?)?
>
> Sure, but subclasses of FieldType can override Set_Sortable() to throw an
> error and avoid it as a constructor arg.
Ahh, right, you can "subtract" functionality from the base. OK.
>> > It's also important to distinguish between "multi-valued" and the
>> > "multi-token" FullTextType. FullTextType fields are tokenized within the
>> > index, but in the context of the doc reader, they only have one string
>> > "value". Note, however, that you cannot sort on a FullTextType field in KS.
>>
>> So if I want to index & sort by "title" field, I make 2 separate fields?
>
> Hmm. Good point, that's a waste and shouldn't be necessary.
>
> That behavior is an artifact of using Lexicon data to build the sort cache.
> Once we move to a dedicated SortWriter/SortReader, though, we'll be building
> the sort cache at index time from the full field value, and that problem goes
> away.
>
> So, I think it makes sense to allow sorting on FullTextType fields after all.
OK that sounds right. Lucene won't be able to do this until we have
CSF, or, if we also write sort caches at index time, which does make
sense.
>> >> * Open vs closed (known set of values) enums
>> >
>> > It would be nice to add this later. I don't think it's a high priority, since
>> > it's an optimization.
>>
>> You mean you'd start with "open" enums?
>
> I meant no enum type right now.
OK, since at index time we can basically deduce ourself it it's
"relatively" enumerated and act accordingly (or simply treat all as
enums for now, as you've suggested).
>> >> * Sortable
>> >
>> > I think this belongs in the base class -- that's where KS has it now. That
>> > way, we can perform the following test, regardless of what the type is.
>> >
>> > if (FieldType_Sortable(field_type)) {
>> > /* Build sort cache. */
>> > ...
>> > }
>>
>> Yeah... except multi-valued (compound) types would disable this, I
>> guess. Though Lucene users seem to hit this limitation enough to make
>> it relaxable... and customize how SortCache gets created.
>
> In the abstract, that sounds like a can of worms, but we can revisit after the
> sort cache writer (SortWriter?) gets a provisional implementation.
OK.
>> >> * nulls sort on top or bottom
>> >
>> > This would be individual to each sort comparator. Note that we might want to
>> > use a different sort comparator for NOT NULL fields for efficiency's sake,
>> > which complicates making the comparator a method on FieldSpec.
>>
>> Yes, we're iterating on this now in LUCENE-831. Though I wonder if
>> this ought to be the realm of source code specialization...
>> multiplying out all the combinations of "single comparator or not",
>> "scoring or not", "track max score or not", "string index may have
>> nulls or not", in Lucene's "true" sources (vs generated sources)
>> starts to get crazy. Soon we'll also multiply in "docIDs guaranteed
>> to arrive in order to the collector, or not" as well.
>
> Actually, you know what? The vast majority of our sort costs come at
> index-time, when we build the ords array. At search time, the only time we
> have to worry about the cost of the comparator is when comparing values across
> segments. So: we can afford to have NULL checks in the default comparator
> routines.
I think the search time optimizations add up... not having to break
ties on docID is a good gain, for example, if the sort has ties.
I'm seeing sizable gains by specializing the source code (in Java, at
least). Though, a good chunk of that is pushing random-access filters
down low, so that's a low hanging fruit for the true source code.
>> > My general inclination is to have NULLs sort towards the end of the array.
>> >
>> >> * Omit norms, omit TFAP
>> >
>> > I'm putting this off for now. It will be addressed when we refactor for
>> > flexible indexing.
>>
>> OK. These would seem to live nicely under FullTextType... oh actually
>> maybe not, because presumably I can index single-valued fields (the
>> equivalent of NOT_ANALYZED in Lucene).
>
> Yes. Right now in KS, StringType fields -- which are single-valued -- can be
> indexed.
OK
>> EG an Int32Type may in fact be indexed, and I would at that point want to
>> put omit norms/TFAP there. Hmmm, cross cutting concerns. Maybe sub-typing
>> is needed...
>
> Right now in KS, norms are stored in the postings files, a la the original
> "flexible indexing" design that Doug, Grant and I hashed out a while back.
> It's inefficient and needs refactoring.
>
> However, I plan to wait on that until after the next dev release.
OK
>> >> * Term vectors or not, positions, offsets
>> >
>> > Term vectors are unique to FullTextType, since it is the only multi-token
>> > field. Right now in KS, it's a boolean member var in FullTextType.
>>
>> Single-token indexed fields might want term vectors too?
>
> I dunno, is that necessary? I guess it's not a big deal to move it down into
> FieldType.
>
> Right now in KS, there's only one flag, "vectorized", and start offsets and
> end offsets are always included. That's because the only significant use case
> is highlighting. (I've always regarded MoreLikeThis queries based on term
> vectors as fatally flawed.)
Why flawed?
> I've often wondered whether or not to call that flag "highlightable" rather
> than the obtuse "vectorized".
> IMO, it's important to have a high quality
> highlighter/excerpter in core, and perhaps the API should be adjusted to
> reflect that priority.
+1
> If you really need "term vectors" per se, you can
> either go with a dedicated plugin or specify "highlightable" and exploit the
> fact that it's a term-vector based implementation.
Yeah, maybe. Besides highlighting, MoreLikeThis and maybe
clustoring/categorizing , I don't have a good sense of what
else term vectors are "typically" used for.
>> >> * CSF'd or not
>> >
>> > Right now, I'd say keep this out of core.
>>
>> OK, and, merge with sort cache somehow. For most types they are one
>> and the same.
>
> Yeah, I think that's right. The only difference is the extra deref in cases
> where high levels of uniqueness suggest a pure array would be ideal.
Right.
>> >> * I will use RangeFilter on this field
>> >
>> > The "sortable" boolean member var fills this need, no?
>>
>> They are different? Eg you'll add aggregates (Trie*) to your index
>> for fast range constraints, but for sorting you just need a sort cache
>> computed.
>
> I haven't really looked at the TrieRange stuff yet...
>
> In KS, range queries are implemented to just look up a term number in the
> Lexicon for both the lower and upper terms before scoring commences, then see
> if the ord value from the sort cache falls between them for each document.
Ahh got it. Lucene recently added that approach (using our FieldCache
to check inclusion in the range). We now have too many RangeQueries.
Trie simply aggreates big ranges at indexing time (logically
equivalent to, 0-10, 20-20, then next trie 0-100, 100-200, etc.), ie
each range is new term on the doc, and then at search time you can
pick a much smaller set of terms to iterate.
>> > FWIW, the current implementation of Boilerplater only supports two level
>> > namespacing (with nicknames). Outside of core, fully qualified code would
>> > look like this:
>> >
>> > lucy_StandardAnalyzer *analyzer = lucy_StdAnalyzer_new();
>> > lucy_Inversion *inversion = Lucy_StdAnalyzer_Transform_Text(charbuf);
>>
>> What are the two levels here? Level 1 is "StdAnalyzer", and Level 2
>> is "new" and "Transform_Text"?
>
> Level 1 is "lucy_". Level 2 is "StdAnalyzer_".
OK.
>> > If we readonly that Hash, we can't add subclasses to it -- and therefore we
>> > won't be able to retrieve their deserializers.
>>
>> I guess it's only subclasses implemented in C where this is important?
>>
>> Because a hosty subclass's deserializer is using/relying the host's
>> namespace to find classes by name.
>
> Within Schema_deserialize, Lucy will have to be able to track down
> deserializers for custom subclasses of Analyzer and FieldType. Same thing
> with custom Query subclasses and remote searching.
>
> We either deal with that need in the Lucy core or punt back to the host.
Seems like if the subclass is in the host, the host's namespace should
locate it (and its deserializer method). The global hash that expands
at runtime to include all known named things in the universe still
doesn't quite sit right w/ me... but I agree based on deserializer's
needs, and lack of namespaces in C, it seems to solve those needs.
Mike | http://mail-archives.apache.org/mod_mbox/incubator-lucy-dev/200904.mbox/%3C9ac0c6aa0904140540s17c24039k5c7a31d389192c5d@mail.gmail.com%3E | CC-MAIN-2018-13 | refinedweb | 1,797 | 73.37 |
First off, some setup. I'm doing the final course project for my C++ class, and this is the first time I've had trouble. The things I'm supposed to be doing in this assignment seemed a lot simpler before I started working on this, and now I'm just hitting walls.
The assignment is to design a program that loads records from a file, and the records contain the names of movies, the two main actors for those movies, the year of release, and the length in minutes (a list of DVDs the user supposedly owns and information about each movie). It's supposed to contain, in a class file, methods for adding new DVDs, editing information on those DVDs, and for removing a DVD. Also in a class file, it's supposed to store the DVD information that is saved and loaded from file.
I really am struggling with loading and saving from files. What I assume is that I need a data structure to hold the information and then I need to pass the structure to my main to save. The problem is that we didn't go that in-depth when we learned this, and I'm not sure how to do it. How I'm trying to do it is not working. There are tons of problems.
Here is my main.cpp file:
#include "dvdinfo.h" #include<iostream> #include<string> #include<fstream> using namespace std; void displayMenu(); void mFileIn(); struct Movie { string sTitle, sA1, sA2; int sYear, sTime; }; int main () { DvdInfo dInfo; Movie thisDVD; int mChoice; bool doExit = false, doSave; fstream movieFile("movielist.dat", ios::out | ios::binary); cout << "Welcome to your Electronic DVD Library" << endl << endl; while (!doExit) { displayMenu(); cout << "[?] Choice: "; cin >> mChoice; while (mChoice < 1 || mChoice > 7) { cout << "\n\n[!] Invalid option." << endl; cout << "[?] Choice: "; cin >> mChoice; } cout << endl; switch (mChoice) { case 1: cout << "No functionality yet." << endl; break; case 2: if (dInfo.setInfo()) { thisDVD = dInfo.passInfo(); movieFile.write(reinterpret_cast<char *>(&thisDVD), sizeof(thisDVD)); } break; case 3: cout << "No functionality yet." << endl; break; case 4: mFileIn(); break; case 5: cout << "No functionality yet." << endl; break; case 6: cout << "No functionality yet." << endl; case 7: doExit = true; } } system("pause"); return 0; } void displayMenu() { cout << "\n|===============================================|" << endl; cout << "[ 1 ] Review DVD Library" << endl; cout << "[ 2 ] Add a new DVD" << endl; cout << "[ 3 ] Remove a DVD" << endl; cout << "[ 4 ] Add DVDs from a file" << endl; cout << "[ 5 ] Purge DVD library" << endl; cout << "[ 6 ] Save your list" << endl; cout << "[ 7 ] Exit" << endl << endl; } void mFileIn() { fstream dvdFile; string fName, fOut, iMov, iA1, iA2; int iYear, iTime, search, isAt = 1; cin.get(); cout << endl; cout << "Please input the name of the file you want to import from." << endl; cout << "[?] File name: "; getline(cin,fName); dvdFile.open(fName, ios::in); //See if the file will open. if (dvdFile.fail()) { cout << "[!] Error! File not found." << endl; } //Get the line for output. while (dvdFile) { getline(dvdFile, fOut, '$'); cout << fOut << endl; } }
And here is my class header file, dvdinfo.h
#ifndef DVDINFO_H #define DVDINFO_H #include<string> using namespace std; class DvdInfo { private: static int dvdCount; struct Movie { string sTitle, sA1, sA2; int sYear, sTime; }; Movie thisMovie; bool isCorrect, doSave; char yesno; public: DvdInfo () { thisMovie.sTitle = "empty"; thisMovie.sA1 = "empty"; thisMovie.sA2 = "empty"; thisMovie.sYear = 1900; thisMovie.sTime = 20; } DvdInfo (string t, string a1, string a2, int y, int l) { thisMovie.sTitle = t; thisMovie.sA1 = a1; thisMovie.sA2 = a2; thisMovie.sYear = y; thisMovie.sTime = l; } Movie passInfo() { return thisMovie; } bool setInfo() { isCorrect = true; yesno = 'Y'; cin.get(); cout << endl; cout << "Please input the information for the DVD you wish to add." << endl; cout << "[?] Title: "; getline(cin, thisMovie.sTitle); cout << endl << endl; cout << "[?] Lead Actor: "; getline(cin, thisMovie.sA1); cout << endl << endl; cout << "[?] Supporting actor: "; getline(cin, thisMovie.sA2); cout << endl << endl; cout << "[?] Year of release: "; cin >> thisMovie.sYear; while (thisMovie.sYear < 1900 || thisMovie.sYear > 2015) { cout << "\n\n[!] Invalid year. (Please choose 1900 to 2015)" << endl; cout << "[?] Year of release: "; cin >> thisMovie.sYear; } cout << endl << endl; cout << "[?] Length (in minutes): "; cin >> thisMovie.sTime; while (thisMovie.sTime < 20 || thisMovie.sTime > 300) { cout << "\n\n[!] Invalid length. (Please choose 20 to 300)" << endl; cout << "[?] Length (in minutes): "; cin >> thisMovie.sTime; } cout << endl; cout << "\n|===============================================|" << endl; cout << thisMovie.sTitle << " (" << thisMovie.sYear << ")" << endl; cout << "Starring " << thisMovie.sA1 << " and " << thisMovie.sA2 << endl; cout << thisMovie.sTime << " minutes." << endl; cout << "|===============================================|" << endl << endl; cout << "Is this correct?" << endl; cout << "[?] (Y)es or (N)o: "; cin >> yesno; while (toupper(yesno) != 'Y' && toupper(yesno) != 'N') { cout << "\n\n[!] Please enter 'Y' for yes or 'N' for no." << endl; cout << "[?] (Y)es or (N)o: "; cin >> yesno; } switch (toupper(yesno)) { case 'Y': cout << "Saving the new title to the file." << endl; bool doSave = true; case 'N': cout << "Returning to the main menu." << endl; bool doSave = false; } return doSave; } }; #endif
Obviously, a lot hasn't been done. I got stuck pretty early in and now I don't know what to do. I work all this week and I won't have a lot of time, and it's due on Sunday. | https://www.daniweb.com/programming/software-development/threads/442875/lots-of-problems | CC-MAIN-2017-39 | refinedweb | 838 | 78.04 |
Microsoft's Internet Security and Acceleration (ISA) Server 2004 provides new features and functionality and a greatly improved user interface. These enhancements bring changes in the way you perform routine firewall and Web proxy management tasks.
We discussed basic configuration of the ISA Server in an earlier article in this series, titled "Configuring a new ISA Server 2004 installation." In this article, I'll get into the step-by-step details of creating access rules, publishing your internal servers to the Internet, and creating cache rules.
You perform routine tasks via the ISA Management Console. To open the console, click Start | All Programs | Microsoft ISA Server | ISA Server Management, or type the path to the ISA Server program files, followed by \msisa.msc in the Run box.Author's note: The instructions in this article apply to ISA Server 2004 Standard Edition (SE). At the time of this writing, ISA Server 2004 Enterprise Edition (EE) was still in private beta testing.
Creating firewall policies
The emphasis in ISA 2004 is on its firewall functionality, and the most common and most important tasks performed by the ISA administrator involve creating and managing firewall policy. There are two basic types of administrator-created rules that make up firewall policy:
- Access rules control what traffic is allowed (or not allowed) through the ISA firewall.
- Server publishing rules control incoming requests to your internal servers and make them available to external users over the Internet.
In addition, firewall policy includes system policy rules, which control traffic emanating from or terminating at the firewall itself. System policy rules are applied before any administrator-created rules. ISA Server 2004 includes a set of built-in system policy rules that can be enabled, disabled, and edited.
Creating access rules
When you initially install ISA Server 2004, it has a single default access rule that denies access to and from all networks. This rule is called Last Default rule. It can't be changed or deleted. It will always be last in the firewall policy rules order. When there is no matching rule above it that applies to particular traffic attempting to go through the firewall, the Last Default rule will be applied (and thus the traffic will be blocked).
Because of the Last Default rule, the newly installed ISA Server essentially "locks down" the network. No inbound or outbound traffic will be able to go through the ISA Server firewall until you create other rules to allow it. This is based on the "deny all" security philosophy (also called the Principle of Least Privilege), where you make exceptions for the traffic you want to allow.
In order for any traffic to go through the firewall, you must create at least one access rule. It's easy to create new access rules with the New Access Rule Wizard. For example, suppose you want to allow users on your internal network to access only specific Web sites that they need in order to do their work. First, open the ISA Management Console (msisa.msc). In the left pane, expand the server name (in this case, W2K3SE) and click Firewall Policy, as shown in Figure A.
As you can see in the figure, there's already one access rule in addition to the Last Default rule (it's a rule to allow HTTP traffic to and from all networks for administrators only).
In the right pane, click the Tasks tab and, under Firewall Policy Tasks, click Create A New Access Rule. This starts the New Access Rule Wizard.
On the first page of the wizard, give your new rule a name. In our example, we'll call it Workers Web Access. Click Next. The Rule Action page of the wizard asks if this is to be an Allow or Deny rule. We want to allow access to certain Web sites, so we click Allow and then click Next. (In keeping with the "deny all" philosophy, the default here is "deny.")
On the Protocols page, you can select which protocols the rule will apply to. Because we want to allow access to Web objects, click Selected Protocols in the drop-down box (the default is All Protocols). Then click the Add button, expand Web in the Protocols list, and double-click HTTP (or click once and then click the Add button). This adds it to the list of allowed protocols, as shown in Figure B.
Click Close in the Protocols list box, and then click Next. (Note that you might also want to add the HTTPS protocol if workers will need to access secure Web sites.)
On the Access Rule Sources page, you can specify which originating sources the rule applies to. In our example, we want to apply the rule to users on our internal network, so we click the Add button. In the Network Entities box, we expand Networks and double-click Internal (or click once and click the Add button). Click Close on the Network Entities box, and then click Next.
On the Access Rule Destinations page, specify the destination Web servers or sites you want to allow. Click the Add button. In this case, we want to allow access to an entire domain, that of the official State of Texas Web site, so we click New and select Domain Name Set. We create a name for the set, called State of Texas, then click New to add a domain name to the set. Because we want to allow access to any Web servers in that domain, we'll use a wildcard (*) to represent the Web server name. You can also add an optional description, as shown in Figure C. Click OK.
In the Network Entities box, expand Domain Name Sets and you should now see your new set (State of Texas). Double-click it (or click once and click the Add button), then click Close in the Network Entities box. Click Next.
On the User Sets page, specify to which users this rule will apply. By default, it applies to all users. If that's not what you want, click Add to specify a different set of users.
In the User Sets box, select from the user sets that have already been created, or click New to create a new one. Clicking New invokes the New User Sets subwizard, where you give the user set a name (such as the name of a Windows group) and then select from Windows, RADIUS, or SecurID namespaces. In our example, we selected All Authenticated Users. You should then click All Users, Remove, and Next.
The last page of the wizard summarizes your selections. You can click Back to make changes, or click Finish to create the new access rule. Your new rule will now show up in the Firewall Policy list, as shown in Figure D.
Before your rule will take effect, you must click the Apply button at the top of the middle pane in the ISA MMC.
Note that, by default, your new rule appears just above whatever rule you had selected prior to running the New Access Rule Wizard. In ISA 2004, rules are applied in the order in which they're shown in the list. You can reorder rules by selecting a rule, right-clicking it, and selecting Move Down or Move Up from the context menu.
In general, it's best to arrange your access rules in the following order: anonymous deny rules, anonymous allow rules, authenticated deny rules, authenticated allow rules. Machines that can't authenticate, such as servers, should be included in the anonymous allow and deny sets even though they aren't completely anonymous, since their connections must source from the IP address(es) for which you allow access to the rule.
Web and server publishing rules can be placed anywhere in Access Policy; however, I prefer to segregate publishing rules by putting them at the top of the firewall policy list. This makes it easier to distinguish the publishing rules from the access rules.
Publishing servers
Publishing your internal servers (such as Web servers, mail servers, FTP servers, SQL servers, etc.) through the ISA Server firewall makes them available to users on the Internet. Publishing Web and mail servers are relatively complex procedures that require planning and considering many factors. ISA Server 2004 includes separate Web publishing, secure Web publishing, and mail server publishing wizards, as well as a special wizard for publishing an Outlook Web Access (OWA) server. Going through the many steps involved in each is beyond the scope of this article. For our example, we'll publish an FTP server, which is a relatively simple procedure.
ISA Server 2000 allowed you to publish FTP servers only on the traditional TCP port 21. With ISA 2004, you can publish FTP servers on alternate ports.
To publish a server other than a Web server, mail server, or OWA server, select the Create A New Server Publishing Rule option under Firewall Policy Tasks after selecting the Tasks tab in the right pane of the ISA MMC. This starts the New Server Publishing Wizard.
The first step is to give the publishing rule a name. Let's call it FTP Server. Click Next. On the Select Server page, enter the IP address of the server you want to publish. You can also click the Browse button to find the server by name and select the IP address. Once you've entered the IP address using either method, click Next.
On the Select Protocol page, choose the server's function in the drop-down box. (We'll select FTP Server.) If you want to change from the default port, click the Port button and enter the alternate port(s). You can also use this dialog box to limit server access to traffic from a specified range of source ports. Click Next.
On the IP Addresses page, check the box for the network IP addresses on the ISA Server that should listen for requests for the published server (external, internal, local host, quarantined VPN clients, VPN clients, all networks and local host, or all protected networks). You can check more than one box. If you select external, internal, or local host, by default ISA will listen on all IP addresses in the selected network. You can click the Addresses button to change this and specify addresses.
The last page of the wizard summarizes your selections. You can click Back to make changes or click Finish to create the new server publishing rule. Your new rule will now appear in the list of Firewall Policy rules. Remember to click the Apply button to make it effective.
You can disable, enable, or edit your rules after creating them by double-clicking the rule, by right-clicking and selecting Properties, or by highlighting the rule and clicking Edit Selected Rule in the right Tasks pane. Any of these three procedures will display the rule's properties dialog box, as shown in Figure E.
Editing system policy rules
System policy rules are used to control traffic that originates with or terminates at the local host network, which includes all addresses bound to all interfaces on the ISA firewall computer. For example, if you want to allow Web access from the ISA Server computer (although this isn't recommended for security reasons), you'd need to edit the system policy rules to allow HTTP traffic from the local host network.
To do this, go to the right Tasks pane, look under System Policy Tasks, and click Show System Policy Rules (they're hidden by default). Scroll down to the system policy rule named Allow HTTP Traffic From ISA Server To All Networks (for CRL download). This should be rule 26.
Double-click the rule, and on the General tab, check the Enable check box. Click OK. By enabling rule 29, you can also allow HTTP traffic to selected computers only for Content Download jobs if you have caching enabled and want to schedule content download jobs. Also note that by default, HTTP traffic is allowed from the ISA Server to the Microsoft error reporting sites, via rule 23. Finally, you can allow HTTP traffic from the ISA computer to selected sites by adding those sites in rule 17. The system policy rules are shown in Figure F.
Creating cache rules
When you install ISA 2004, the Web proxy components are enabled, but caching is disabled by default. Before you can create cache rules, you must enable caching by defining a cache drive.
In the left pane of the ISA MMC, expand the server name and then expand the Configuration node. Click Cache. In the right Tasks pane, click Define Cache Drives (enable caching).
In the Define Cache Drives dialog box, select a drive formatted in NTFS, set a maximum cache size greater than 0 MB, abd then click Set, as shown in Figure G. Click OK.
To disable caching, click Disable Caching in the right Tasks pane, set all cache drives manually to 0, or click the Reset button on the Define Cache Drives dialog box.
Now click Create A Cache Rule in the right Tasks pane to start the New Cache Rule Wizard. On the wizard's first page, you'll be asked to give the rule a name. In our example, we'll create a rule to prevent the caching of a particular Web site. We'll call it No Cache shinder.net. Click Next.
On the Cache Rule Destination page, specify the network entities that this rule applies to content requests. For our example, we'll click Add and create a new URL set called shinder.net, which we'll then add to the rule. Click Next.
On the Content Retrieval page, you can control how objects in cache are retrieved when requested. In this case, we don't want the object ever retrieved from cache. However, that isn't one of our choices, so we select the most restrictive option ("Only if a valid version of the object exists in the cache. If no valid version exists, route the request to the server"). Click Next.
On the Cache Content page, we select when the content should be stored in the cache. In this case, we want to prevent the content from being cached, so we select "Never, no content will ever be cached." Click Next.
The last page of the wizard summarizes your selections, as shown in Figure H.
Just the beginning
The most common tasks performed by ISA Server administrators involve working with rules: access rules, server publishing rules, system policy rules, and cache rules. In this article, I've taken you through the process of creating each type of administrator-defined rule and editing system policies. Later articles in this series will demonstrate how to perform more complex tasks, such as publishing a Web server, monitoring your ISA Server 2004 firewall, and backing up the ISA Server configuration.. | http://www.techrepublic.com/article/solutionbase-how-to-perform-routine-tasks-with-isa-server-2004/ | CC-MAIN-2017-17 | refinedweb | 2,485 | 70.02 |
On 06/28/2013 07:22 PM, Dwight Engen wrote:
> On Fri, 28 Jun 2013 17:39:13 -0400
> Brian Foster <bfoster@xxxxxxxxxx> wrote:
>
>> On 06/28/2013 04:28 PM, Dwight Engen wrote:
>>> On Fri, 28 Jun 2013 14:50:24 -0400
>>> Brian Foster <bfoster@xxxxxxxxxx> wrote:
>>>
>>>> On 06/28/2013 11:11 AM, Dwight Engen wrote:
...
>>
>> To be honest, there aren't any real users of the eofblocks command
>> from userspace that I'm aware of at the moment. I added it originally
>> for a poc quota implementation I was working on for gluster, but the
>> primary use case for the scanning mechanism is to allow background
>> clean up of files such that post-eof speculative preallocation
>> doesn't hang around for too long.
>
> ... and there are likely to be scenarios where waiting for the timer
> would be too long?
>
Well one can adjust the timer via the /proc file if necessary. Our use
case was along the lines of ensuring prealloc was cleared up at certain
points where we wanted to track space usage (using a cluster of XFS
project quotas to represent a higher level quota), iirc. It's been a
while since I've looked at that code... ;)
>>> Maybe this permission stuff should be a separate change since it
>>> isn't really related to user namespace stuff? I just happened to be
>>> in the vicinity and am happy to help :)
>>>
>>
>> Sounds reasonable to me. :)
>
> If you want me to code up either option, let me know.
>
Feel free to. :) I agree that it's separate from the userns work.
I'll put it on my todo list if you don't get around to it.
Brian
>> Brian | http://oss.sgi.com/archives/xfs/2013-07/msg00005.html | CC-MAIN-2017-43 | refinedweb | 282 | 76.76 |
In this section, I’ll show you how to turn your source file, containing various types, into a file that can be deployed. Let’s start by examining the following simple application:
public class App { static public void Main(System.String[] args) { System.Console.WriteLine("Hi"); } }
This application defines a type, called
App. This type has a single static, public method called
Main. Inside
Main is a reference to another type called
System.Console.
System.Console is a type implemented by Microsoft, and the IL code that implements this type’s methods are in the MSCorLib.dll file. So, our application defines a type and also uses another company’s type.
To build this sample application, put the preceding code into a source ...
No credit card required | https://www.safaribooksonline.com/library/view/applied-microsoft-net/9780735642126/ch02s02.html | CC-MAIN-2018-30 | refinedweb | 127 | 59.8 |
Throwing exceptions in expressions in C# 7.0
January 15, 2018 Leave a comment
C# 7.0 makes it possible to throw exceptions with ternary and null-coalescing operators.
Here’s an example where we throw an exception if the divisor is 0:
private double Divide(double what, double withWhat) { return withWhat != 0 ? what / withWhat : throw new ArgumentException("nono"); }
If the divisor is not 0 then we return the result otherwise we throw an exception.
Another place where we now can throw exceptions is with null-coalescing operators. Here’s a Dog class with a constructor where we want to throw an exception if the Dog name is null:
public class Dog { private string name; public Dog(string name) => this.name = name ?? throw new ArgumentNullException("Dog name"); }
View all various C# language feature related posts here. | https://dotnetcodr.com/2018/01/15/throwing-exceptions-in-expressions-in-c-7-0/ | CC-MAIN-2018-47 | refinedweb | 136 | 55.64 |
Implicit Implications (part 2): Implicit Conversions
Last week, I covered implicit parameters, Scala’s mechanism for implementing type classes and context passing.
This week, I will cover the other form of implicits supported by Scala, called implicit conversions. This is a bit more of a controversial feature of the language. It can be (and has been) abused to make code less type-safe and / or confusing. However, it has some killer use cases that make it an essential tool for the advanced Scala developer. It is primarily a tool for adapting code that you don’t own to make it source-code compatible with your preferred interface. This can be useful if you want to separate dependencies into separate artifacts without forcing source code to explicitly convert the types they are using to adapt to the interface changes. So let’s get into the nitty gritty of how it works…
Implicit conversions
Scala will trigger an implicit lookup in one other situation, called implicit conversion. If you attempt to access a value or method on an object whose type does not provide that member, the compiler will search for a method or function that takes a value of that type and produces an object with the member you are attempting to access. In addition, the compiler will also look for an implicit conversion when attempting to call a method by passing an argument of type
A when it expects type
B. The compiler will search in scope to find an implicit function or method from
A => B.
This feature enables the following language semantics:
- Type Conversion
- Extension Methods
Both type conversion and extension methods are mechanisms of altering the syntax or semantics of a library that you do not have control over. In the case of Scala, this is very important for Java interoperability.
For example, you will often want to convert between Java collections and Scala collections. It turns out that type conversion is actually not a great mechanism for this (I’ll explain later), but because it is still part of the standard library, I will demonstrate how this works:
package some.awesome; class Awesome { public static <T> void method(List<T> items) { // something super useful goes here } } import some.awesome.Awesome object ScalaAwesome { import scala.collection.convert.WrapAsJava._ def coolStuff[T](items: Seq[T]): Unit = { Awesome.method(items) // items is implicitly converted from a scala Seq to a java List // do other stuff, potentially calling other methods that you need to convert from Scala collections to Java } }
This is pretty straight forward. It allows you to pretend that you are operating with the same interface as you would if you were programming with Java, except you can do it in Scala using simple Java wrappers.
Implicit Danger
The problem arises when you consider the many ways one can abuse implicit conversions. For example, this is a Scala puzzler that Martin Odersky brought up at Scala Days 2017 in his talk on implicits:
implicit val colors: Seq[String] = Seq("red", "blue", "green") object Printer { def print(s: String) = println(s) } Printer.print(42)
And what does this code do? Why throw an exception of course!
java.lang.IndexOutOfBoundsException: 42 at scala.collection.LinearSeqOptimized.apply(LinearSeqOptimized.scala:63) at scala.collection.LinearSeqOptimized.apply$(LinearSeqOptimized.scala:61) at scala.collection.immutable.List.apply(List.scala:86) ... 29 elided
This is because
Seq[T] extends Int => T, which is the precise signature that Scala needs to convert the Int 42 into a String, so it checks the index 42 of the implicit function named colors and BOOM!
The best practice here is to never define implicit conversions on primitive or collection types. In fact, Scala has deemed that implicit conversions are so dangerous, they require you to import
scala.language.implicitConversions to use them (if you have the
-feature compiler flag turned on).
The Scala standard library developers decided to follow this newfound best practice and implemented an alternative (and preferred) way to convert Scala collections into Java. This is using an extension method. Extension methods are a way to add methods or values to an object after it has been instantiated with a fixed type.
So basically, instead of converting directly from a Scala
Seq[A] to a Java
List<A>, you import an implicit conversion from
Seq[T] => { def asJava: java.util.List[T] } and then call
.asJava on your
Seq[A]:
import some.awesome.Awesome object ScalaAwesome { import scala.collection.JavaConverters._ def coolStuff[T](items: Seq[T]): Unit = { Awesome.method(items.asJava) // Now you call .asJava explicitly on the collection // do other stuff, potentially calling other methods that you need to convert from Scala collections to Java } }
To see how this is implemented with extension methods, we will look at implicit classes.
Implicit Classes
Many languages have some way to extend existing types with extension methods (for example C#, Kotlin, and Rust), but Scala goes one step further by allowing you to define a new type and mixin traits (late-trait inheritance) as well as add single methods. This is really just a special case of implicit conversion.
trait Closable { def close(): Unit } implicit class LateTraitOperations(sys: ActorSystem) extends Closable { override def close(): Unit = sys.stop() def extensionMethod(): Unit = { println(“You can combine trait inheritance AND extension methods”) } }
This is a very powerful pattern that avoids some of the nastier edge cases of implicit conversions, so it has been given its own syntax, called
implicit class. There are some restrictions to
implicit class. For example, you can only define it inside of an
object,
package, or
package object. It cannot live by itself. Additionally, this syntax does not require importing
scala.language.implicitConversions because, in general, it is much safer. You have to reference a method or value explicitly to trigger the conversion.
implicit class RubyInt(value: Int) { def times(block: => Unit): Unit = { for (_ <- 1 to value) { block // execute the given function } } } // implicitly convert Int into RubyInt and call the "times" method 2 times { println("Clap!") Thread.sleep(600) println("Hey!") Thread.sleep(1200) println("Hey!") Thread.sleep(600) } 4 times { println("Clap!") Thread.sleep(300) } 8 times { println("Clap!") Thread.sleep(150) } 16 times { println("Clap!") Thread.sleep(75) } println("D-D-D-Drop the base!")
As you can see, we just created a new notation for making Trap music! Awesome!
The compiler will essentially compile that into:
// just a normal class class RubyInt(value: Int) { def times(block: => Unit): Unit = { for (_ <- 1 to value) { block // execute the given function } } } // the implicit conversion implicit def RubyInt(value: Int): RichInt = new RichInt(value) RubyInt(2).times { // ... } // ... and so on ...
Well that’s nice, but we’ve paid for that syntax by instantiating an object for every invocation. Even worse, it has to box the Int primitive.
There is also a way to do this without paying the cost of instantiation using the power of value classes! I won’t go into detail, you can read more about them here.
You just redefine your implicit class by requiring a single
val in the constructor and extending
AnyVal.
implicit class RubyInt(val value: Int) extends AnyVal { def times(block: => Unit): Unit = { // same as above... } }
And now the code desugars into:
object RubyInt { // static method call final def times(value: Int, block: => Unit): Unit = { // same as above... } } RubyInt.times(2, { // ... }) // ... and so on ...
The restrictions for extending
AnyVal can be cumbersome. Specifically, you can only define a value class at the top level or inside of an object singleton.
Okay, so that about wraps up both ways to invoke an implicit conversion.
What are the implications of all this?
Okay, so implicits have their usages and their rough edges. How do I know when to use them?
Implicit conversions are very dangerous. In my view, the only really good use case for implicit conversions is to support extension methods / lazy trait inheritance. If you are making one type “look” like another type, you are making Scala look bad and are probably violating type safety.
Implicits are a distinct feature of Scala that are easy to abuse, but implicits have been given a lot of attention in Dotty, the compiler that will be used for Scala 3. Next week, I will go over the future of Scala and how the rough edges of implicits will be smoothed out and the power and orthogonality of implicits will enable a whole new style of programming in Scala. Stay tuned…
Originally published on engineering.rallyhealth.com | https://functional.works-hub.com/learn/implicit-implications-part-2-implicit-conversions-39c23 | CC-MAIN-2019-51 | refinedweb | 1,415 | 54.73 |
UPDATE 22-12-2014
Instructables user mattpbooth has updated the code and is hosting it on github:...
Thanks Matt!
UPDATE 03-12-2011
Replaced a println with print (derp).
UPDATE 01-12-2011
Remade all code from scratch.
Remade 'ible code section; Now includes a 'Processing COM port config for dummies'
Ladies and gentlemen, I proudly present 8bit pleasure.. yours for the grabbing! Whether you use GNU/Linux, Mac OS X, or Windows the USB NES controller is compatible.
Will this in any way alter the controller?
Nope, the controller will stay the same so you can still use it on a real NES
But I don't have an arduino ;_;
You can use the parallel port:
Buy an arduino:
Or a retrozone NES kit:
Step 1: Ingredients for Some Awesome Controller Soup
You will need:
A NES controller
An Arduino
A USB cable type B
Something you can use as a Casing
and some wire..
Optional: NES port
Arduino software
Processing
Step 2: How to Connect the Arduino to the Nes Controller
With some wire connect the pins according to the texts on both pictures..
You could also use the controller port from a NES (a broken one, don't waste a working one).
You want something vaguely similar to the last picture.
Step 3: Code
UPDATE 22-12-2014
Instructables user mattpbooth has updated the code and is hosting it on github:
Thanks Matt!
Hey guys, I've completely rewritten the code and it should work now flawlessy.
The only adjustment you might need to make is to the Processing Sketch; you need to adjust which COM port it should use.
To do this please follow these steps carefully!
Steps
1 ) Disconnect the Arduino if it's connected.
2 ) Run the Processing sketch, it WILL(!) display an error.
3 ) Check the console (black box with text at the bottom of processing)
4 ) In the console will be a list of active COM ports;
Serial list
WARNING: RXTX Version mismatch
Jar version = RXTX-2.2pre1
native lib Version = RXTX-2.2pre2
[0] "COM3"
End of serial list
5 ) As you can see currently COM3 is active and is the first COM port at the moment (denoted by "[0]")
6 ) If the Processing sketch ran without displaying an error, press the stop button.
7 ) Hook up the arduino.
8 ) Run the Processing sketch again.
9 ) Check the console for active com ports;
Serial list
WARNING: RXTX Version mismatch
Jar version = RXTX-2.2pre1
native lib Version = RXTX-2.2pre2
[0] "COM3"
[1] "COM5"
End of serial list
10 ) As you can see COM5 suddenly appeared in the list after we connected the arduino.
11 ) We now know that the arduino has COM5 and is the second COM port (denoted by "[1]")
12 ) We know adjust our code;
Replace:
arduino = new Serial(this, Serial.list()[?], 9600); // ATTENTION!!!
With:
arduino = new Serial(this, Serial.list()[1], 9600); // ATTENTION!!!
13 ) Save the program.
14 ) Load the arduino sketch unto the arduino.
15 ) Start the Processing sketch!
Step 4: Making a Case
Let your imagination run wild!
I put my arduino into an old printer adapter I found and I think it looks pretty good =)
I did this by gutting the adapter and only saving the 'nipple'.
I removed the 'nipple' from the cable by cutting into one side with a knife, after which the original cable could be pushed out and replaced by my USB cable.
The adapter had a small hole (which I used for the usb cable) and a big hole which I used for the NES controller.
The big hole however wasn't big enough so I cut some away with a saw (very sloppy) after which it was too big, I temporarily fixed this by putting some sticky tape around the controller plug.
I've currently ordered a broke NES to harvest the controller port from in order to make it more.. sexy.
Step 5: It's Alive!
I currently don't have a camera at hand so here is a short desktopmovie of me bashing some buttons on the controls.
If you get an error file saying java wasn't found you'll need to install it (again)
In case anyone is wondering why I made a batch file; I was too lazy to reinstall java and made a small manual fix.
Btw,
to play a NES game on your computer you will need an emulator:
[windows] (If you're running vista, use FakeNes)
[Mac]
[Linux]
And you will need some games(ROMS) ofcourse but these are illegal to download (Yes, even if you own the original) so whatever you do don't download them and especially not from this site because that one is the most illegal of all *GASP*
Step 6: Additional Info
More details
Inside the NES controller is an 8bit shift register.
By putting the latch pin high for a few microseconds I'm telling the chip to start spitting data at me.
When it does this, the first byte becomes available to read over the serial pin.
If I want to receive the next byte I'll have to set the clock pin high for 200 microseconds.
I need to 'flash' the clock pin 7 times to get all bytes
/*
Latch high
Wait 200 microseconds
Latch low
Read serial
Wait 200 microseconds
Repeat 7 times
[
Clock high
Wait 200 microseconds
Read serial
Clock low
Wait 200 microseconds
]
*/
SNES controller
The code I've written can also be used with a SNES controller!
If someone makes a request I can expand this 'ible to also show how to do that
Original code'
and finally..
This is my first instructable, so go hard on me =P (yes hard, not soft =P)
85 Discussions
6 years ago on Introduction
Hello!
I tried this today and it works but i cannot get a response outta the A button and i've tried both my NES controllers.
I have a hard time believing that the same button on both my controllers are broken, especially since my NES never saw much use.
So i'm leaning on an error in the code somewhere, i'm not a programmer and thus have no knowlefe in this stuff, so debugging is out for my part.
Reply 4 years ago on Introduction
Hey, see the reply to Andromorfo above. Your A is first in the cycle and was being skipped with the first clock pulse.
Reply 3 years ago
I have leonardo set to press keys like makey makey and it works fine
On everything but emulator
I don't want to use controller I made foot and fist pads but it won't work on emulator please help
7 years ago on Step 3
thanks for the update and quick reply
i got an error code right away and on this line
import processing.serial.*;
am i doing something wrong
sorry im a newb
Reply 7 years ago on Introduction
still getting error messages and wsalgklgkwsaklgwsalgwsalgklgkwsaklgwsalgwsalgklgkwsaklgkwsaklgws
when trying to use the controller
Reply 4 years ago on Introduction
Hey, those keystrokes are down to the keyboard emulator doing its thing. The processing script was reading a string as individual char at the version I used so was firing text like the above when not touching the buttons. If you swap the Serial communication to use a single byte each time (8 inputs = 2^8 = 256) by using Serial.Write/Serial.Read you'll also save 2 bytes per message and have a fixed message length.
Reply 3 years ago
Question
Reply 3 years ago
Hey lewsidius did you fix that wsalgllgkwsaklg thing because I'm getting it too
3 years ago
I have pins set to print letters on keyboard how can I use this to play games on emulator
For some reason the arduino key presses aren't registering
3 years ago on Introduction
I would also like to see this include the SNES controller. It's a far easier way to attach a controller to an Ardiuno Uno than building a HID controller.
3 years ago
Please help I got everything hooked up and ready and was ready to play some childhood nes games with the real controller instead of a keyboard but all of the sudden it just started saying wsalglgk just like lewsidius and I don't know if it's hooked up wrong or something please help
Reply 3 years ago
Also forgot to say I'm using the arduino uno
7 years ago on Introduction
Hey man thanks for the instructable, i used the NES controler to control my robot arm, but for some reason the button A doesn`t work, and i`ve tested it with different controlers.
here is a video of my robot arm
P.D.- sorry for the awful english :P
Reply 7 years ago on Introduction
i changed some of the arduino code and now it works with all the buttons, i needed to read the first bit before the for cicle and then read the others 7 bits
here´s the code, i hope it helps someone getting the same problem
void ReadNESjoy() {
nes[0]=1;nes[1]=1;nes[2]=1;nes[3]=1;nes[4]=1;nes[5]=1;nes[6]=1;nes[7]=1;
latchlow;
clocklow;
latchhigh;
wait;
latchlow;
nes[0]=dataread;
for (int i = 1; i < 8; i++) {
clockhigh;
wait;
nes[i]=dataread;
clocklow;
wait;
}
}
Reply 6 years ago on Introduction
Doesent work!
Just throws a buncha error messages like "nes not declared in this scope" among other things.
Reply 4 years ago on Introduction
This worked for me:
5 years ago on Introduction
Hi again,
I made it with an atmega standalone inside the nintendo, so i can plug two remote. I used the usbkeyboard librairie but i still have a tiny problem... When i print letter on a txt everything work fine, but on a emulator it seem that the flow of data is not good. My mario is almost not moving at all, and he make very small jump when i keep press.
I tried to configure a "repeat delay" and a "repeat rate", but the result is still the same. I don't anderstand how your usbjoystick library send the data to the computer, do you know any configuration to do about that?
Thanks..
Reply 5 years ago on Introduction
Hi Jeanot1314,
Could you show me the code you've written?
5 years ago on Introduction
thanks for the code ^^ To simplify i tried with the serial reading without processing. This work on actual version of arduino.
void loop() {
output = 0;
ReadNESjoy();
Serial.println(output);
delay(50);
}
void ReadNESjoy() {
latchlow;
clocklow;
latchhigh;
wait;
latchlow;
output += dataread * (1 << 0);
for (int i = 1; i < 8; i++) {
clockhigh;
wait;
output += dataread * (1 << i);
clocklow;
wait;
}
}
If you replace the loop and the setup in the program with this, you can see directly the value in the Serial Monitor. All the buttons are fonctionning, it s necessary to read the first time before the first clockhigh.
THanks again, and now lets play!!!! ^^
5 years ago
you should use an arduino nano and ditch the power cable. it would be smaller and less bulky.just a thought. ..good ible | https://www.instructables.com/id/USB-NES-controller-with-an-arduino/ | CC-MAIN-2019-13 | refinedweb | 1,875 | 65.76 |
Mozilla Announces Web Development Learning Initiative 44."
Oh God... (Score:5, Insightful)
Please, for the sake of my retinas, I hope that something better comes out of this.
Re:Oh God... (Score:5, Informative)
Re: (Score:2) p
Re: (Score:2)
what is? the post I replied to? because
is kinda the opposite of:
so...
Re: (Score:2)
Mozilla websites on the other hand I can't complain about, from the top off my head
Try this page [mozilla.org]...
:-)
Re: (Score:2)),
Re: (Score:2)
Whoops.. I'm talking about youtube there, must have deleted that word when editing sorry.
Re: (Score:2)... (Score:4, Interesting)" - h
Re: (Score:1)
No, it wasn't.
HTML has always been about semantics. What HTML5 does is update them and introduce elements that web developers have been needing.
Without the semantics HTML is meaningless. Stripping off the semantics i
Re: (Score:2)
dev
Re: (Score:1)
Neither did you. You just namedropped XHTML2 and that was it.
It was trying to do it in a bad way through XML namespaces
Re: (Score:2)
Re: (Score:1)
Nice argument, well cited, and highly intelligent. I can't disagree. Oh wait, you didn't actually have an argument.
And it is this right direction that I took issue with.
Re: (Score:3)
Still, I don't even think HTML5 is the right tool for the job anymore, we need a stronger push for something to replace HTML and HTTP that better supports interactive web applications for interactive web applications, HTML at this point would be better left as a document markup language to handle informational documents, whilst applications are built using a new language. There's no reason the two couldn't interoperate well, just have web apps use app:// or whatever and the existing URL scheme can happily handle linking between them. There has been a few attempts at this sort of technology but nothing serious.
Extremely well said, this is something I've wanted to have to some time already. HTML/HTTP has never worked very well for applications, and it's becoming more and more a mess of bubblegum.
Re: (Score:2)
Re: (Score:2)
And today the same people have Facebook pages. Was that really worse?
great (Score:4, Interesting): (Score:1)
Because we haven’t enough "webdesigners" alr (Score:1, Insightful)
I remember the (first)
.com bubble
-
Re: (Score:1)
Above posts contains free hats. Don't tell Valve! ^^
Re: (Score:2)
where PHP became a language of choice, with people writing things like: if (myfunc() == True)
I remember a story about a PHP coder who used things like $jep (Finnish for "yeah") extensively for variable names.
Re: (Score:2)
- where PHP became a language of choice, with people writing things like: if (myfunc() == True)
honest question, I don't use php that much but what's wrong with that expression?
Re: (Score:2)
Re: (Score:2): (Score:2)?
Accept-Language (Score:5, Insightful)
Do you think they could teach the fucktards over at Google what the Accept-Language header is for?
That way they could stop guessing which language I want to see based on where I happen to be at any particular time.
Kthxbye.
Re: (Score:1)
All they know is the User-agent header which they sniff all the time to decide which version of their pages to show you.
They can't even output valid HTML.
"That maker spirit" (Score:2), (Score:2) | https://tech.slashdot.org/story/12/05/23/0514252/mozilla-announces-web-development-learning-initiative?sdsrc=prevbtmprev | CC-MAIN-2017-30 | refinedweb | 578 | 73.58 |
First Program :
This program has no errors, but when i run it in consol it will just let me put in my name and then it will shoot everything up not letting me put in anymore of the numbers. So basically it lets me put my name in then does the whole program itself without any of the other information given.
Heres the screen shot of what im talking about :
Here is the code :
#include <iostream> #include <cstdlib> using namespace std; int main () { cout << " Please enter your name : "; char name; cin >> name; cout << " Please enter hours worked and minutes "; double hours_worked; cin >> hours_worked; cout << " Please enter your hourly wage : "; double hourly_wage; cin >> hourly_wage; int wage; if (hours_worked < 40) { wage = (40 - hours_worked) * (hourly_wage * (hourly_wage / 2)); } else { wage = hours_worked * hourly_wage; } cout << " Employe Name : " << name << "\n"; cout << " Hourse Worked : " << hours_worked << "\n"; cout << " Hourly Wage : " << hourly_wage << "\n"; cout << " Money Earned : " << wage << "\n"; return 0; }
Now to the second program :
This program is giving me errors. I have copied the formula's down from our book where our teacher showed us to do it. But the formula is giving me the errors. It keeps showing "Call of overload 'pow(int&, int)' is ambiguous " ... For the life of me i dont know what is going on. Im just getting into programming and i dont know at all what this means.
Here is the code :
#include <iostream> #include <cstdlib> #include <cmath> using namespace std; int main () { cout << " Please enter a, b, and c (example 5 4 2) : "; int a; int b; int c; cin >> a >> b >> c; cout << " Please enter a, b, and c (example 5 4 2) : "; int a1; int b1; int c1; cin >> a1 >> b1 >> c1; cout << " Please enter a, b, and c (example 5 4 2) : "; int a2; int b2; int c2; cin >> a2 >> b2 >> c2; int root1; int root2; double disc1 = pow(b, 2) - 4.0 * a * c; root1 = (-b + sqrt(disc1)) / (2.0 * a); root2 = (-b - sqrt(disc1)) / (2.0 * a); int root3; int root4; double disc2 = pow(b2, 2) - 4.0 * a2 * c2; root3 = (-b2 + sqrt(disc2)) / (2.0 * a2); root4 = (-b2 - sqrt(disc2)) / (2.0 * a2); int root5; int root6; double disc3 = pow(b2, 2) - 4.0 * a2 * c2; root5 = (-b2 + sqrt(disc3)) / (2.0 * a2); root6 = (-b2 - sqrt(disc3)) / (2.0 * a2); cout << root1 << root2 << root3 << root4 << root5 << root6; return 0; }
If anyone could help me out that would be much appreciated
Thanks, Nathan | http://www.dreamincode.net/forums/topic/256689-help-with-two-programs-need-help-asap/ | CC-MAIN-2017-09 | refinedweb | 405 | 75.13 |
I need some help I have a controller with an action that queries two models.
Now I need to send both of them as json in order to be used on my angular views.
In the example bellow how should I send the "complex" and its "fields" in one json response?
Ex.
def complexes_and_fields
complex = Complex.find(params[:id])
search_params = {complex_id: complex._id}
fields = Field.where(search_params)
if !complex.nil?
render json: ???.to_json, status: :ok
else
render json: { error_description: 'no complex found' },status: :bad_request
end
This is an extremely common requirement in Rails applications. This need is rarely restricted to a single model, or a single location. As a result, a variety of gems exist to provide this kind of functionality (in many cases, without altering the signature of your
render lines substantially).
This post offers a good listing. Personally, I've had a good experience with active_model_serializers and an acceptable experience with grape-entity. It's reasonable to review their documentation and decide which is best for you. | https://codedump.io/share/9pu9YZZkRJ7R/1/how-to-render-two-json-objects-as-response-on-a-rails-controller | CC-MAIN-2018-09 | refinedweb | 169 | 57.98 |
One fine. You have probably found a problem with the application that you are testing when the application is run under load. The next step is trying to figure out what is going wrong with your app.
This post will describe a technique for diagnosing a certain type of error. One common error that I see when running a test under load is the following. A web test will fail and the error is: “Context parameter '$HIDDEN1.__VIEWSTATE' not found in test context”. This error occurs because a request has a form parameter called __VIEWSTATE which is bound to the {{$HIDDEN1.__VIEWSTATE}} context parameter. For some reason the $HIDDEN1.__VIEWSTATE parameter was not added to the test context during hidden field binding.
Let me give a quick description of hidden field binding. While you are recording your web test, we will attempt to determine if any form post parameter being submitted is from a hidden field. If it is, then we will automatically correlate the parameter for you. By correlate, I mean that an extraction rule will be added to the request that has the value for the hidden field and then the form post parameter will be bound to the value from the extraction rule. Here is an example of what this looks like.
__VIEWSTATE is a hidden field which is present in most ASP.net applications. Say our web test has 2 requests. Request 2 has a form parameter call __VIEWSTATE. We will look through each of the previous requests for a hidden field called __VIEWSTATE. If we find one and the one we found has the same value as the one on request 2, then we will perform the correlation.
This works well most of the time. The way the Extract Hidden Fields extraction rule works in VS 2005 is that it will extract all hidden fields from a response and add them to the test context. If none are found, then the rule does nothing. It would be better if the rule actually failed if it did not find any hidden fields to extract. In fact we changed the behavior for VS 2008 to do just this. This rule is only added if at record time we detect it is needed. So at run time, if it does not find any hidden fields, then that is an error. The other reason it would be better if this request fails is that the next request which is relying on the hidden fields to be in the context will always fail if the values are not in the context. And the error that you will receive is “Context parameter '$HIDDEN1.__VIEWSTATE' not found in test context”. This error is valid because the value does not exist in the test context, but this request is not really the problem. The previous request which did not extract any hidden fields is the problem.
Now let’s get back to how this applies to the load test. When a request fails in a load test, you will be able to view the request and response details of the failed request. But again, in this case, you really want to see the request and response of the previous request because that is the one that is behaving differently then when the test is run standalone. But since that request is not failing, you can not see the details for that request. Here is an example. I created a simple web test against a sample shopping site. The test runs successfully by itself, but when run within a load test I get the errors listed below.
When I drill into the error, you can see the “Request failed: Context parameter '$HIDDEN1.__VIEWSTATE' not found in test context” error message.
To really figure out what is going on I need to see the previous request/response. To see that request/response we need that request to fail. From our error message we see that we expected the previous request to have a hidden field called __VIEWSTATE. So one thing we can do is create a simple validation rule which takes a field name as a parameter and validates the field exists in the response. Here is the code for that rule:
using System;
using System.Collections;
using System.Globalization;
namespace RuleExamples
{
public class ValidateFormFieldExists : ValidationRule
{
private string m_name;
public string Name
{
get { return m_name; }
set { m_name = value; }
}
public override void Validate(object sender, ValidationEventArgs e)
{
if (DoesFormFieldExist(e.Response, m_name))
{
e.IsValid = true;
}
else
//this resource does not mention extraction in the text, so it's fine to use here, too
e.Message = String.Format("Did not find form Field with name {0}", Name);
e.IsValid = false;
}
internal static bool DoesFormFieldExist(WebTestResponse response, string formFieldName)
foreach (HtmlTag tag in response.HtmlDocument.GetFilteredHtmlTags("input"))
if (String.Equals(tag.GetAttributeValueAsString("name"), formFieldName, StringComparison.OrdinalIgnoreCase)
|| String.Equals(tag.GetAttributeValueAsString("id"), formFieldName, StringComparison.OrdinalIgnoreCase))
{
return true;
}
return false;
}
}
To add this as a rule to your project do the following:
1) Add a class to your test project
2) Paste this code in the class
3) Compile
Now it is ready for use. Next we need to go to the web test and add the rule to the request which is supposed to be extracting the hidden fields. Typically it is the preceding request, but not always. Add this new validation rule to this request and set the field to look for to __VIEWSTATE. Also set the validation level to Low. By default, load tests will only run validation rules with level set to low. Here is what that looks like.
Then run your test again. As you can see from my errors below, I received the error again.
I also received a validation rule error for the missing field. So this time I can drill into that failure and see the request and response. Here is what that looks like.
As you can see, I am receiving a database deadlock problem. This is a much more informative error and definitely points to a problem that occurs because my app is being run under load. For this particular error, I now know I need to add extra logging to my database to figure out what is happening.
So to review the steps to getting more information into the problem are:
1) Create the validation rule listed above
2) Add the validation rule the request that is supposed to be extracting the hidden fields.
3) Run your test and hopefully the error will occur again.
Also to recap, if you are running VS2008, there are a few differences. First, as I mentioned above the Extract Hidden Fields rule will now fail if it finds no fields to extract. So you may not need to add the new validation rule. There is another option in VS2008 that you might find useful. You can have a web test stop when it hits an error. This property is on the root node of the web test. The reason this is useful, is that it will cut down on errors in the load test and let you focus errors that appear. If you look at the screen shot of the errors after I applied the rule, you will see that there are still errors for not finding the parameter in the context. If I had set the Stop on Error Property to true, then I would not have seen these errors. I would have just seen the validation rule errors and would focus just on those problems. | http://blogs.msdn.com/b/slumley/archive/2007/11/19/debugging-errors-in-load-test.aspx | CC-MAIN-2013-48 | refinedweb | 1,254 | 73.27 |
C++ program to Count Common Subsequence in Two Strings
Counting Common Subsequence in Two Strings
In this article, we will learn how to write a C++ program to count common subsequence in two strings. We will take two strings as an input, then we will 2-D ”cnt[][]” array that will store the count of common subsequence found. Now we will iterate each character of first string and each character of second string from of the string to its end , then if the characters matches we will check if the previous character of both string are same or not if they are same we will assign ”1 +cnt[i][j – 1] +cnt[i – 1][j]” to our 2D else we will assign ”cnt[i][j – 1] + cnt[i – 1][j] – cnt[i – 1][j – 1]” to our 2D array. As the iteration ends we will get our count.
Algorithm:
- Initialize the variables.
- Accept the inputs.
- Create a function to check common subsequence.
- Iterate each character from first string .
- Iterate each character from second string.
- Match these characters one by one.
- If they matches store the count.
- Print count.
C++ Code:-
//Count Common Subsequence in two Strings
#include<iostream> #include<string.h> using namespace std; //Function to count the number of subsequences in the string. int countsequences(char str[], char str1[]) { int l1 = strlen(str); int l2 = strlen(str1); int cnt[l1+1][l2+1]; for (int i = 0; i <= l1; i++) { for (int j = 0; j <= l2; j++) { cnt[i][j] = 0; } } //Taking each character from first string. for (int i = 1; i <= l1; i++) { //Taking each character from second string. for (int j = 1; j <= l2; j++) { //If characters are same in both the string. if(str[i-1] == str1[j-1]) { cnt[i][j] = 1 + cnt[i][j-1] + cnt[i-1][j]; } else { cnt[i][j] = cnt[i][j-1] + cnt[i-1][j] - cnt[i-1][j-1]; } } } return cnt[l1][l2]; } //Main function for printing the result. int main() { char str[100] ,str1[100]; cout<<"Enter the first string: "; cin>>str; cout<<"Enter the second string: "; cin>>str1; cout<<"Number of common subsequence is: "<<countsequences(str, str1); return 0; }
Output: Enter the first string: asdf Enter the second string: asd Number of common subsequence is: 7
Login/Signup to comment | https://prepinsta.com/cpp-program/to-count-common-subsequence-in-two-strings/ | CC-MAIN-2022-21 | refinedweb | 385 | 70.02 |
What is danger JS ?
Danger runs during your CI process, and gives teams the chance to automate common code review chores. It’s an automation checker against any opened pull requests.
Install danger JS
Navigate to the root of your folder and execute:
$ yarn add danger --dev; yarn danger init
yarn danger init yarn run v1.22.4 $ /Users/toninichev/Cloud/workspace/nodeJS/Examples/Sparkjs/node_modules/.bin/danger init Welcome to Danger Init - this will take you through setting up Danger for this project. There are four main steps we need to do: - [ ] Create a Dangerfile and add a few simple rules. - [ ] Create a GitHub account for Danger to use, for messaging. - [ ] Set up an access token for Danger. - [ ] Set up Danger to run on your CI. But before we start, we need one bit of information from you. Is this is for an Open Source or private project? [1] Open Source [2] Private Repo [0] CANCEL 1 ## Step 1: Creating a starter Dangerfile I've set up an example Dangerfile for you in this folder. > cat /Users/toninichev/Cloud/workspace/nodeJS/Examples/Sparkjs/dangerfile.js import {danger, warn} from 'danger' // No PR is too small to include a description of why you made a change if (danger.github.pr.body.length < 10) { warn('Please include a description of your PR changes.'); } // Request changes to src also include changes to tests. const allFiles = danger.git.modified_files.concat(danger.git.created_files) const hasAppChanges = allFiles.some(p => includes(p, 'src/')) const hasTestChanges = allFiles.some(p => includes(p, '__tests__/')) if (hasAppChanges && !hasTestChanges) { warn('This PR does not include changes to tests, even though it affects app code.'); } There's a collection of small, simple rules in here, but Danger is about being able to easily iterate. The power comes from you having the ability to codify fixes for some of the problems that come up in day to day programming. It can be difficult to try and see those from day 1. If you'd like to investigate the file, and make some changes - I'll wait here, press return when you're ready to move on... ↵ ## Step 2: Creating a GitHub account In order to get the most out of Danger, I'd recommend giving it the ability to post in the code-review comment section. IMO, it's best to do this by using the private mode of your browser. Create an account like: SparkjsBot and don't forget a cool robot avatar too. Here are great resources for creative-commons images of robots: - - Sidenote: Holding cmd ( ⌘ ) and double clicking a link will open it in your browser. SparkjsBot does not need privileged access to your repo or org. This is because Danger will only be writing comments, and you do not need special access for that. Cool, please press return when you have your account ready (and you've verified the email...) ↵ ## Step 3: Configuring a GitHub Personal Access Token Here's the link, you should open this in the private session where you just created the new GitHub account For Open Source projects, I'd recommend giving the token the smallest scope possible. This means only providing access to public_repo in the token. This token limits Danger's abilities to just writing comments on OSS projects. We recommend this because the token can quite easily be extracted from the environment via pull requests. It is important that you do not store this token in your repository, as GitHub will automatically revoke your token when pushed. 👍, please press return when you have your token set up... ↵ ## Add to CI You need to expose a token called DANGER_GITHUB_API_TOKEN and the value is the GitHub Personal Access Token. Depending on the CI system, this may need to be done on the machine (in the ~/.bashprofile) or in a web UI somewhere. We have a guide for all supported CI systems on danger.systems: ## Useful info - One of the best ways to test out new rules as you build them is via bundle exec danger pr. - You can have Danger output a lot of info via the --verbose option. - You can look at the following Dangerfiles to get some more ideas: * * * * * * 🎉 And you're good to go. Danger is a collaboration between Orta Therox, Gem 'Danger' Maslen, and every who has sent PRs. If you like Danger, let others know. If you want to know more, follow @orta and @DangerSystems on Twitter. If you don't like something about Danger, help us improve the project - it's all done on volunteer time! xxx Remember: it's nice to be nice. ✨ Done in 1701.50s.
At the end this will create danger.js file in the root of your project.
Setup Github token
Create new Github token and give it “repo” access. This should be enough to allow the Github bot that will use it to post messages on pull requests.
Make sure that you copied the token and save it safely OUTSIDE OF THE PROJECT’S FOLDER, because you won’t be able to see the token again.
Also if you save it in the project’s folder, next time when you push the code Github will invalidate it cause this is considered a security breach.
Link to create new token:
Override the contents of the danger file
import { fail, warn, message, markdown, danger } from "danger" fail("Testing failure message"); warn("Testing warning"); message("Normal message"); markdown("*Markdown* is also **supported**"); const { additions = 0, deletions = 0 } = danger.github.pr; message(`:tada: The PR added ${additions} and removed ${deletions} lines.`); const modifiedMD = danger.git.modified_files.join("\n"); message(`Changed Files in this PR: \n ${modifiedMD} \n`);
Create pull request and test danger JS locally
Before we could do this, we have to export environment variable DANGER_GITHUB_API_TOKEN with the value equal to the tocen that we created in the previous chapter.
$ export DANGER_GITHUB_API_TOKEN="XXXXXXXXXXXXXXXXXXXXXXXX"
And now, test it locally:
$ yarn danger pr
Integrate it with GitHub
Github provides api that we could use to get information about commits and pull requests.
Example of getting all pull requests:
Before we are able to see messages in github we have to txport two more environment variables:
$ export DANGER_FAKE_CI="YEP" $ export DANGER_TEST_REPO='ToniNichev/projects-sparkjs'
Test danger JS. Execute:
$ DANGER_TEST_PR='4' yarn danger ci
And if everything is correct you should see the messages in the pull request:
| https://www.toni-develops.com/2020/05/29/working-with-danger-js-and-integrating-it-with-github/?utm_source=rss&utm_medium=rss&utm_campaign=working-with-danger-js-and-integrating-it-with-github | CC-MAIN-2021-43 | refinedweb | 1,060 | 64.1 |
I am using python 2.7 on Windows 10. Here is a snippet of my code :-
import dns myresolver = dns.resolver xyz = myresolver.query(record, "SRV") for rdata in xyz.response.answer: z = str(rdata) print ("after string " + z) list = z.split() type = "SRV" hostName = list[7]
I am querying the dns server to get the SRV records. I get rdata as RRset values. My aim is to get hostName and use it further in my code. I get hostName as a string when I run my python program on the IDE but peculiarly this is not so when I convert the same python file into an exe file using py2exe.I am getting the output of the dns.resolver.query as HEX in the exe file. My ultimate goal is to have this script run as an exe subtract two columns in a CSV to create a 3rd column "Duration" End-Time - Start_time
I took some python oop lessons, however I have written very little oop myselfI would appreciate if someone guides me to convert the following code into a python class
I have installed both PyCharm and Spyder (from Anaconda2)
In the admin panel, I can add Persons to my CompleteClass modelThere is a M2M relationship between CompleteClass and Person | https://cmsdk.com/python/dns-resolver-query-gives-unexpected-output-in-exe-file-of-the-same-python-script.html | CC-MAIN-2018-30 | refinedweb | 212 | 72.87 |
I'm trying to average 6 grades for two different people for school, I have all the grades for each student in different classes I was wondering
How can I import the numbers that I enter for each students object that I create?
//first class
public class GradesA {
int art;
int math;
int science;
int AddGrades(int a, int b, int c){
art = a;
math = b;
science = c;
return a+b+c;
}}
//second class
public class GradesB {
int english;
int carpentry;
int geography;
int AddGradesB(int a,int b,int c){
english = a;
carpentry = b;
geography = c;
return a+b+c;
}}
//final class
public class Classes {
public static void main(String[]args){
GradesA objGrades = new GradesA();
System.out.println(objGrades.AddGrades(100,85,95));
GradesB objGradesB = new GradesB();
System.out.println (objGradesB.AddGradesB(95,85,75));
}}
Hope I understood what you are looking for
Since
int addGrades(int a, int b, int c){
return and integer
why do not you just divide return number from this function by 3 and get your average that you are looking for.
If you want to have access to data fields
art,
math, and
science values
you need getters and setters like follwing example for
art data filed
setter function is
public void setArt(int art){ this.art = art; }
getter function is
public int getArt(){ return this.art; }
Read More About Setter and Getter | https://codedump.io/share/8K90fqUJVz9j/1/averaging-grades-using-objects-in-java | CC-MAIN-2018-05 | refinedweb | 230 | 50.6 |
Rhodri James wrote: > On Sun, 15 Mar 2009 19:00:43 -0000, MRAB <google at mrabarnett.plus.com> > wrote: > >> Rhodri James wrote: >> [snip] >>> Frankly, I'd much rather fix the locale system and extend >>> the format syntax to override the default locale. Perhaps >>> something like >>> financial = Locale(group_sep=",", grouping=[3]) >>> print("my number is {0:10n:financial}".format(1234567)) >>> It's hard to think of a way of extending "%" format strings >>> to cope with this that won't look utterly horrid, though! >>> >> The problem with your example is that it magically looks for the locale >> name "financial" in the current namespace. > > True, to an extent. The counter-argument of "Is it so much > more magical than '{keyword}' looking up the object in the > parameter list" suggests a less magical approach would be to > make the locale a parameter itself: > > print("my number is {0:10n:{1}}".format(1234567, financial) >)) >> Perhaps the name should be >> registered somewhere like this: >> >> locale.predefined["financial"] = Locale(group_sep=",", grouping=[3]) >> print("my number is {0:10n:financial}".format(1234567)) > > I'm not sure that I don't think that *more* magical than my > first stab! Regardless of the exact syntax, do you think > that being able to specify an overriding locale object (and > let's wave our hands over what one of those is too) is the > right approach? > | https://mail.python.org/pipermail/python-list/2009-March/529010.html | CC-MAIN-2014-15 | refinedweb | 224 | 62.17 |
We like our tools to be lightweight. So what’s with all the bloated XML in IBM’s Jazz?
In other industries, being “heavyweight” is a good thing. Heavyweight means stable, tested, grounded, and reliable. But in software, “lightweight” is the new goal—svelte, fast, efficient, easy-to-learn, and elegant. Products like Spring, GlassFish, and Adobe Air pride themselves on being lightweight. They offer just what you need and no more. Who wouldn’t want that?
One lightweight technology gaining converts is JavaScript Object Notation or JSON. It’s a data language similar to XML—both are self-describing, human-readable, hierarchical formats. So an XML packet like this:
Is equivalent to the JSON:
The JSON has less structural markup. And though modern web browsers understand both XML and JSON, it processes JSON much faster because it uses the already-optimized JavaScript engine. Passing JSON is like passing partially-parsed data. Once I started using it in the browser and saw how fast it was, I dropped XML like a hot potato.
So I wasn’t surprised to see JSON used in IBM’s Jazz architecture. Jazz is an open source server-based platform providing integration between source control, task management, bug reporting, and communication. Think of it as Eclipse for the server. By building a solid base product, making it infinitely extensible, and open sourcing all the code, IBM creates an environment that users flock to, write extensions for, and embrace with gusto.
I’m pretty persnickety about software. I’m not content to kick the tires—I need to dig in and read code and look at the protocols that flow over the wire. If you find elegance there, you find it everywhere in a product. So that’s how I approached Jazz. I fired up the server, opened the admin page in my Firefox browser, opened Firebug, and watched the net conversation:
If you’ve seen enough SOA stuff in your life, this should look somewhat familiar. It’s JSON all right, but it looks like a SOAP packet. And don’t these _equalifiedClassNames look a lot like XML namespaces? Here was evidence that there’s some heavyweight XML processing going on in the Jazz server.
“Whoa!” I thought. Combining the heavyweight with the lightweight—isn’t that like sucking a Nerf ball through a straw? Rather than defining some svelte new JSON-based protocol, they simply borrowed web service protocols and converted them to JSON for the last 10 feet—that is, from the web server to the browser. The idea seemed crazy at first. We all know SOAP and XML are bloated, slow, and committee-driven, right? Wouldn’t it be faster, easier, better to use JSON across the entire data transfer spectrum? Since IBM built Jazz from the ground up, they could’ve easily done that, right?
Data Integration Is Hard
But here’s the thing. You might have a better architecture in the end, but not a lot better. It might be faster, but not a lot faster. When you go down the JSON route, you run into the same issues that XML faced 10 years ago:
Mixing data from two different sources into one JSON packet can cause element labels to bump into each other. Mix up a packing slip and an invoice, and suddenly the From address may mean something quite different. That’s why XML has namespaces.
Converting between different JSON structures would require writing mundane code. A more declarative way to map data would make the job easier. That’s why XML has XSLT.
Describing a JSON packet’s structure—its fields, data types, etc.—is necessary in order for people to hook into your services. It’s essential to have a metadata language for this. That’s why XML has Schemas.
Carrying on two simultaneous client-server conversations takes care. If you ask the server two questions and get one answer back, how do you know what question it answers? That’s why XML has WS-Correlation.
...and so on. The bottom line is this: data integration is difficult. XML is a rich and complex format because it has to be. You can think of it as Robert’s Rules of Order for computer data. Because you can’t govern people’s values and upbringing, the rules must take into account different cultures, sources, and styles of communication that are all valid. So it is with XML.
Mixing data integration into your browser-based app makes it unwieldy. Slicing, dicing, combining, transforming and aggregating data... that’s just not something JavaScript does well. Plus it detracts from the real purpose of your browser app—display and input. So by delegating this job to an XML and SOA infrastructure, you can express your own apps more succinctly.
Take a concrete example: the Google Map API. To use it, you must obtain an application key from Google and use it in each of your requests. You can do this directly in JavaScript, but then you end up coding this key into your application where people can see it. Furthermore, now you have the same key hardcoded in many different application scripts. This is a clear violation of the DRY rule—Don’t Repeat Yourself.
But an SOA server is good at that stuff. You write a proxy there for Google Maps, so your app can send JSON Google Maps-bound data to this proxy, which converts it from JSON to XML, adds the key to each request, and sends it off. In most SOA servers, you can do this with zero code. The magic is performed in XML and XSLT. Why write a JSON mechanism for the same thing?
Discovered Elegance
XML universality adds other benefits. In Jazz, for example, I can examine packets across the wire as I’m doing GUI-based tasks, then replay those web service calls from any web service language. Instant macros! And not just macros but macros that can be called from any language that speaks Web Services... which is to say, any language. If you need an extremely high-performance macro, you can just write it in C++.
“That’s nice,” you might counter, “but it’s still heavyweight.” But even that’s less true nowadays. XML processing is sped up with products like Intel’s SOA Expressway, which does parsing way down in machine language. On top of that, you can build a good SOA infrastructure, which doesn’t necessarily mean a large one. Of course there are huge SOA suites with ga-gillions of features and other-worldly price tags. But there are solid smaller suites too, and many open source options: WSO2, Mule, and GlassFish, to name a few. These products take away a lot of the mundane XML tasks you’d do in code.
So in the final analysis, I think Jazz has the right idea. Use the right tool for the right job. Mold all your data with XML, and give it to the browser in easy-to-digest JSON. A well-balanced, harmonious assembly line... that’s a very elegant approach..” | http://pragprog.com/magazines/2010-03/jsonthe-last--feet | CC-MAIN-2014-10 | refinedweb | 1,185 | 75.2 |
WPF Command Prompt is a command line console that comes with a number of features including:
The basic layout has a message area (RichTextBox) and a command prompt area (TextBox) in a user control. I kept the command prompt at the bottom of the window as there is a resizing issue I have yet to work out. But, after using it for a while, I find I prefer the command prompt at the bottom of the window anyway. The prompt text (e.g. "C:\MyStuff\>") in the command prompt area is protected for being changed or deleted by the end user.
RichTextBox
TextBox
The message area consists of two areas, the message prompt area and the message text area:
The message prompt area contains the text entered from the command prompt. The message text contains text written to the console.
For brevity, not all properties/methods are shown here. The complete MSDN style documentation for WPFCommandPrompt can be found at. See the project demo for examples of most of the functionality. This project can also be downloaded from my web site at.
WPFCommandPrompt
WPF Command Prompt is the end result of a project I started a few months ago when I needed a console app for a project I was working on.
Creating a new command prompt is as simple as:
using WPFCommandPrompt;
WPFPrompt commandPrompt = new WPFPrompt();
commandPrompt.ReadLine += new ReadLineEventHandler(ProcessCommand);
commandPrompt.Show();
private void ProcessCommand(object sender, ConsoleReadLineEventArgs e)
{
// Process commands sent from the console here
}
public void WriteLine(string output)
{
commandPrompt.WriteLine(output);
}
There are two constructors to choose between:
public WPFPrompt() // Uses default style theme: styleThemeIndex = 0
public WPFPrompt(int styleThemeIndex) // The index of the style theme to use
Writing to the console:
// Sends a string to the console.
public void WriteLine(string output)
// Sends a string with specified brush color to the console.
public void WriteLine(string output, Brush foreground)
// Sends a FlowDocument paragraph to the console.
public void WriteLine(Paragraph paragraph)
// Sends a ConsoleWriteLineEventArgs object to the console.
public void WriteLine(object sender, ConsoleWriteLineEventArgs e)
The following basic properties can be set without creating the console window and can be saved/loaded from disk if not setting or using defaults:
// Allow an empty command to be written to the message area. (Default: false).
public bool AllowEmptyCommand
// The window title
public string ConsoleTitle
// The assembly version of the console
public string ConsoleVersion
// Gets or sets the default console height
public double DefaultConsoleHeight
// Gets or sets the default console width
public double DefaultConsoleWidth
// Gets or sets the default prompt string (Default: >)
public string DefaultPrompt
// Gets or sets the delimiter regular expression string.
// Default: ((""((?<token>.*?)"")|(?<token>[\w]+))(\s)*)
public string Delimiters
// Enable or disable the command history (Default: true = enabled)
public bool EnableCommandHistory
// Automatically try to load the style themes on console startup
public bool EnableLoadStyleThemes
// Is the command history managed by the console(auto)
// or by the user(manual) (Default: false = auto)
public bool ManualCommandHistory
// Gets or sets the maximum console height. Default is 0, no max size.
public double MaxConsoleHeight
// Gets or sets the maximum console width. Default is 0, no max size.
public double MaxConsoleWidth
// Gets or sets the maximum allowed font size of the console.
public double MaxFontSize
// Gets or sets the minimum console height. Default is 400.
public double MinConsoleHeight
// Gets or sets the minimum console width. Default is 600.
public double MinConsoleWidth
// Gets or sets the minimum allowed font size of the console.
// Gets or sets the current prompt string
public string Prompt
// Gets or sets the default style theme index number.
public int StyleThemeIndex
// Gets or sets the welcome message. Displayed upon console startup.
public string WelcomeMessage
// Should the console parse commands internally. Default: true.
// If false, the user is responsible for parsing the returned command string.
public bool UserInternalCommandParsing
Style Themes - Any changes to the theme are not changed in the original theme. Call UpdateStyleTheme() to copy any changes to the current theme to the original, or CurrentThemeToNew() to create a new theme from the current theme and any changes. Call SaveStyleThemes() to save to disk after calling UpdateStyleTheme() or CurrentThemeToNew(). Note that the provided style themes look ok but are far from great as I'm far better at making a UI functional than aesthetically pleasing. If anyone creates some nice looking themes, please share them with everyone here!
UpdateStyleTheme()
CurrentThemeToNew()
SaveStyleThemes()
CurrentThemeToNew()
Although I think there's far too much code in some of the classes, it works just fine. I'll think about re-doing things. | http://www.codeproject.com/Articles/247280/WPF-Command-Prompt | CC-MAIN-2015-18 | refinedweb | 750 | 54.32 |
No AOB
Approved.
Editors - pending ChrisF & EricJ - pending Editors - done Editors - done Hugo - done David - done Gudge - done Editors - done Editors - pending PaulC - pending Noah - done Hugo - done Hugo - done Hugo - done
-- RPCTF Frank - agenda item for discussion at f2f. -- Transport binding task force Item 24 is an agenda item for presentation/discussion at f2f. -- Editors Mark & JJ: made various editorial changes to spec. -- Evaluation of Primer proposal Nilo gave overview of second rev. of the Primer proposal. This was accepted as a better 'weight' for a Primer. Nilo will be editor of Primer, and is chartered to generate a primer as outlined. He may borrow text from output of various internal documents of the XML WG. Chuck & Mark will help.
134: Support of XMLBase and relative URI's. Noah gave a summary of his proposed text. This was followed by discussion on possible pushback for not "aggressively supporting a published W3C recommendation". Concerns were raised on interoperability and whether there would be pushback should XMLBase become part of W3C's core XML spec. Another concern was whether many existing SOAP implementations and XML parsers supported XMLBase. To resolve this issue, 3 steps were decided: 1) To ask W3C XML Core group to clarify their intentions on the support of XMLBase. 2) To conduct a survey of XMLBase support in SOAP implementations, XML parsers, and within SOAPBuilders. 3) As a fallback option, we may use Noah's proposed text (with suitable editorial change to last paragraph). The WG was generally in agreement with this text as a reasonable option (no one said they could not live with it). David Orchard will do (1), Chuck (2). 62: mU for extensions. Oisin absent, so not discussed. 63: standard failure for extensions. Oisin absent, so not discussed. 14: SOAP versioning Issue effectively resolved at Dinard f2f by changing the SOAP namespace URI and providing a description of how 1.1/1.2 versioning should be achieved. Martin will send email to Larry Masinter (issue originator), xml-dist-app, and xmlp-comment. The WG considers this issue closed. 66: XMLP revision mechanism This issue is also resolved via the SOAP namespace versioning mechanism. Martin will send email to Oisin, xml-dist-app, and xmlp-comment. The WG considers this issue closed. 19: namespace of Fault children Henrik and Bryan had some mail exchanges and concluded that both mechanisms are reasonable. He proposed to stay with status quo to not break things unnecessarily and to close issue. Had things started from scratch, it could have gone either way. Henrik will send email to Bryan, xml-dist-app, and xmlp-comment. The WG considers this issue closed. 45: faultcodes for RPC Issue resolved. Marc will tighten text to say "when describing faults in Part 1 of this specification". Hugo will send email to Vidur, xml-dist-app, and xmlp-comment. The WG considers this issue closed. 122: Missing reference link Hugo failed to reproduce/identify the issue. He has tried contacting the issue originator who has not responded thus far. Hugo will wait another week for a response, and will close the issue if he receives no response. Issues 71 and 107 not discussed due to lack of time. | https://www.w3.org/2000/xp/Group/1/09/5-minutes.html | CC-MAIN-2016-44 | refinedweb | 533 | 68.06 |
This software is not under development. Latest released version is 1.3. The 1.5 branch has never been released and does not build.
Search Criteria
Package Details: namebench 1.3-1
Dependencies (7)
- python2-dnspython
- python2-graphy
- python2-httplib2
- python2-jinja
- python2-simplejson
- git (git-git) (make)
- tk (tk85) (optional) – gui
Required by (0)
Sources (1)
Pinned Comments
frederik commented on 2016-08-03 09:54
Latest Comments
carlwgeorge commented on 2016-10-14 03:12
This PKGBUILD fails to build in a clean chroot because git is not specified as a build dependency. Please add this line:
makedepends=(git)
frederik commented on 2016-08-03 09:54
This software is not under development. Latest released version is 1.3. The 1.5 branch has never been released and does not build.
frederik commented on 2015-11-03 13:15
Dear tblu,
I've fixed the PKGBUILD by downgrading to the 1.3 branch. Sorry for any inconvenience.
tblu commented on 2015-11-03 05:36
python2 /usr/bin/namebench.py
Traceback (most recent call last):
File "/usr/bin/namebench.py", line 33, in <module>
from namebench.ui import cli
File "/usr/bin/namebench.py", line 33, in <module>
from namebench.ui import cli
ImportError: No module named ui
istalled with all deps
thestinger commented on 2015-01-19 15:37
Please only flag a package as out-of-date if it's actually out-of-date.
spacepluk commented on 2015-01-19 11:12
Hi there, I also needed to rename build() in two packages (python2-graphy2, namebench) to make it work.
sigmundv commented on 2015-01-07 17:53
Please rename the build() function to package(), as a package() function is required (cf)
thestinger commented on 2014-07-19 17:02
Please only flag a package as out-of-date if it's actually out-of-date.
jleclanche commented on 2013-11-15 11:21
No longer builds.
thestinger commented on 2012-12-27 21:59
@R00KIE: Thanks, didn't notice the python-namebench package had been updated to a split package following the naming guidelines (it used to be python2). The namebench setup.py now installs third party libraries if you don't explicitly stop it - so that's why no one noticed. I'll switch to back to using the system libraries and update the dependency.
R00KIE commented on 2012-12-27 21:46
Just wondering if the dependency on python-dnspython shouldn't be a dependency on python2-dnspython.
thestinger commented on 2012-01-16 06:49
@megadriver: Thanks, I adopted the package and made the change (although it seems like jinja could be in optdepends).
megadriver commented on 2012-01-01 13:00
The python-jinja dependency (which pulls Python 3 in) should be replaced by python2-jinja, I think.
intgr commented on 2011-09-05 08:21
I have disowned this package since I don't really use this program. Anyone is welcome to take over maintaining.
intgr commented on 2011-05-21 21:21
Good catch, added tk to dependencies.
michalmiddleton commented on 2011-05-21 16:39
Hi,
I noticed namebench doesn't start GUI on my system. More research showed that it's missing Tkinter (or "python-tk").
Arch provides Tkinter as extra/tk (and extra/tcl as a dependency).
After installing tk manually I got GUI working. Would you mind adding tk as a dependency for your namebench package?
Thanks!
Auguste commented on 2010-10-21 15:27
you are right. sorry for the unnecessary paranoid. ;=)
intgr commented on 2010-10-21 15:12
Are you talking about the files under /usr/lib/python2.7/site-packages/? They aren't executable, so unless you chmod them manually, it makes no difference what shebang line they have. They're only intended to be imported into other scripts. So there's no point in patching their shebang line.
Auguste commented on 2010-10-21 13:45
there are many .py files in the package and many with shebang line #!/usr/bin/env python, shouldn't these files be patched?
and there is one file, something link better_browser.py, has a shebang line ends with some extra [:space:] or something that i can't see.
some files are hard coded to run by /usr/bin/python2.4, i don't know if this matters.
intgr commented on 2010-10-21 12:38
Package updated, namebench now uses python2 instead of python. Thanks for reporting!
Auguste commented on 2010-10-20 14:35
needs patching because of the python3 migration.
intgr commented on 2010-06-28 09:03
Updated to version 1.3.1
intgr commented on 2010-06-05 22:21
Updated to version 1.3 | https://aur.archlinux.org/packages/namebench/?comments=all | CC-MAIN-2017-09 | refinedweb | 785 | 67.45 |
RationalWiki:Saloon bar/Archive131
Contents
- 1 Carl Wieland: Fraud or moron?
- 2 Liberal public school censorship strikes again!
- 3 Dominionism
- 4 Good Lord who fucking cares
- 5 I'm in the weird part of the Internet again.
- 6 Flags in Britain
- 7 Harper just Reagan-smashed the Wheat Board
- 8 Country articles
- 9 why is it so creepy?
- 10 Oh, Herman Cain...
- 11 beautiful video about marriage
- 12 Multiculturalism and stuff
- 13 Just in case you thought "liberal" wasn't a snarl word
- 14 Siri is pro-life (and by extension, Apple is too)?
- 15 Causation, correlation, what? Study finds legalized MJ => lower automobile fatalities
- 16 French AIDS awareness ads
- 17 Skeptical Science Debunking Handbook
- 18 Leveson Inquiry
- 19 Cain ending bid?
- 20 What's wrong with this picture...?
- 21 any of you who are "geeky" and know computer hardware terminology - help!
- 22 Iran riot at the UK embassy
- 23 RationalWiki - in the News (as a source)
- 24 Mobile skins and native apps
- 25 Is there a term for this?
- 26 Someone needs to sign this chap up
- 27 EV
- 28 Herman Cain...
- 29 Frozen Planet censored
- 30 Everyday I'm Science'in
- 31 RationalWikiWiki's down
- 32 Hi
- 33 Kentucky church bans interracial couples.
- 34 Polygamy
- 35 Oh god, I"m getting old.
- 36 Fuck you, Hollywood
- 37 This must be illegal, somehow, no?
- 38 So, why sew not sue?
- 39 Either I'm reading this wrong or...
- 40 Can you crack it?
- 41 Abuse
- 42 Barmaid, a round of beer for every Tolkien fan in here
- 43 Question for you all (at least in the US)
- 44 That's it, we write a Margaret Wente article now.
- 45 Answers Acadamy - Dr Jason Lisle and Ken Ham strike again
- 46 Marriage Debate
- 47 What kind of 'Murrican accent do you have?
- 48 Philsophical Answers Research Jouranal article to review
- 49 F****** Qwest now centurylink
- 50 Wow, this fucking stupid
- 51 In soviet Russia, Google DoS you
- 52 Root races
- 53 Greetings from Rome
- 54 Scam?
- 55 "on hold" music!
- 56 Michele Bachmann Double-Tap
- 57 Artists rendering of vaginas belonging to various public figures.
- 58 One way to cut down on spam....
- 59 Essential reading on cognitive bias
- 60 Jeremy Clarkson and the strikers.
- 61 Thank's Jensen
- 62 Peddling anti-Islamic fear
- 63 Account creation
- 64 Whistlin' Dixie
- 65 Deja vu
Carl Wieland: Fraud or moron?[edit]
I actually came upon this via some of Ken's ramblings on CP. Seems that Carl Wieland, the nutter in chief at CMI has a new book outimg.
The bit that caught my eye is this particular claim:
"In her 1994 book Mutant Message Down Under, Dr Marlo Morgan wrote that Australian Aborigines had an ability to communicate over long distances by telepathy."
apparently this finding:
"ought to rock the evolutionary ‘establishment’ to its core"
Well, since one of the bedrocks of the "evolutionary" mindset is that things ought to be verifiable I went to try and look up these claims. One google for "Dr Marlo Morgan" later, and I found she isn't a doctor of anything, let alone anthropology, her book was self-published and an ADMITTED FRAUD.
I can't figure it out. Is Wieland just an astonishing imbecile who doesn't even do the most cursory of fact checking, or is he just a fraud that will say anything to make a buck? Either seems to fit with creationism, so it's hard to decide.
On the side of dumbshittery there's this, also from the article, said of his wife successfully "guessing" 10 cards in a row:
."
Really, Carl? That's the only explanation. Satan gave your wife psychic powers? Goat in heaven, this guy's a fucking moron. My guess is that, given this was in the context of doing card tricks, your wife was playing a trick on _you_ as turnabout. I wonder if he even bothered to ask? I suppose an alternative is the anecdote is just fabricated, and the whole book is fraudulent.
I'll probably add this to the Wieland article this evening if it hasn't been done already, but I thought it was hilarious, so I'd share it with y'all. Anyone want to send some tips to sceptic bloggers? --JeevesMkII The gentleman's gentleman at the other site 11:38, 27 November 2011 (UTC)
- It's just like Andy, seize upon the slimmest hint of something that you think might be of use to your argument, no matter how crazy or already shown to be false but disregard all sound science because it lends credence to an old-Earth, evolutionary, non-magic explanation. It's hard to say whether it's deliberate fraud or stupidity or just the blindness of a bigot. ГенгисYou have the right to be offended; and I have the right to offend you. 16:18, 27 November 2011 (UTC)
Liberal public school censorship strikes again![edit]
An evil liberal public school principal ordered a poor, defense conservative student to apologize after she tweeted a disparaging message about... oh, wait, it was about Republican Governor Sam Brownback. Nevermind, nothing to see here. MDB (talk) 00:26, 28 November 2011 (UTC)
Dominionism[edit]
This blog is currently running a short 'n sweet, but good overview of dominionist sects. Nebuchadnezzar (talk) 05:57, 28 November 2011 (UTC)
Good Lord who fucking cares[edit]
If obama didnt mention god in the address. Honestly. "Somebody ought to remind Obama (and his speechwriter) that when Americans sit down around a meal today and give thanks, they give thanks to God."... Even the atheists!--il'Dictator Mikalosa (talk) 14:17, 26 November 2011 (UTC)
- Yes, that's not a very good reason to be upset.--. 14:56, 26 November 2011 (UTC)
- "when Americans sit down around a meal today and give thanks, they give thanks to God." And that's why Bush the First thought that atheists shouldn't be allowed to vote, I guess: they're not really Americans. PintOfStout Talk Good people drink good beer. 15:00, 26 November 2011 (UTC)
- Fucking small minded idiots. And it's as if they forgot every fucking other time that Obama mentions god. Endlessly. --GodotSome would use a tautology to describe it ("The way things are done around here is the wa 17:14, 26 November 2011 (UTC)
- I hear that if you play the speech backwards, it says "Allahu Akbar!" Personally, I thank the people who work hard to put food on my
familytable. And the turkey. Nebuchadnezzar (talk) 20:42, 26 November 2011 (UTC)
- Oh yeah, Obama also has more god-cred than Bush. Nebuchadnezzar (talk) 20:48, 26 November 2011 (UTC)
- He only mentions God and Jesus to cover up his Muslim faith; thankfully we have conspiracy theorists and right-wingers who can see through the lies. άλφαΤαλκ 19:18, 27 November 2011 (UTC)
I'm in the weird part of the Internet again.[edit]
I was searching for reasons why some European countries have slightly higher suicide rates than average (some wingnuts actually try to use these statistics for welfare state bashing), so maybe we can include something on that.
Anyways, one of the top results relating to it on the almighty Google is this. It's like men's rights movement on steroids. Anyone see this before? Osaka Sun (talk) 10:36, 28 November 2011 (UTC)
Flags in Britain[edit]
I was musing about the regularity with which my fellow Brits see displays of flags in/on domestic properties (not institutions/government buildings). A house I walk past semi-regularly is usually seen with the Red Hand of Ulster emblazoned on the British flag, then the other day this changed (for some reason) to the Irish football Association logo. This is the only time I've seen flags relating to Northern Ireland in England - usually displays of Ulster unionism in Great Britain are localised to (mostly Western) Scotland, not an English town populated by working-class socialists and students. I occasionally see the odd England or Union Flag when I'm at my hometown, but nothing Northern Irish. SJ Debaser 15:46, 28 November 2011 (UTC)
- I see plenty of St. George's Crosses all over the place (there's a house not far from me that has 3 flagpoles in the back garden, all flying the cross). There was a thing a few years ago about the england flag being "banned" because it's "offensive" (neither of those things are true: the actual story is that a police authority advised some pubs to ban football shirts, including the england one, on the assumption that it'll cause less fights to break out if team support isn't readily advertised) so a lot of people around here love flying them as some kind of defiant gesture. I also see quite a few union flags being flown upside down, which amuses me greatly. X Stickman (talk) 15:56, 28 November 2011 (UTC)
- I know I shouldn't jump to conclusions about people on the such paltry evidence, but I am always auspicious of folk who display the flag prominently outside some special event like the footie or a royal wedding. I am suspicious of all displays of patriotism - it seems to me very unenglish. OF course, the BNP and their ilk have muddied the waters somewhat (i'm choosing to ignore the colonial and empire building that we once indulged in)AMassiveGay (talk) 18:33, 28 November 2011 (UTC)
As an aside[edit]
AMG mentioning displays of Un-Englishness; charming woman has charming opinions. What a fucking embarrassment to white British people. SJ Debaser 20:29, 28 November 2011 (UTC)
- Arrested. SJ Debaser 20:34, 28 November 2011 (UTC)
- Please tell me she's not getting her kid back. -- 20:47, 28 November 2011 (UTC)
Harper just Reagan-smashed the Wheat Board[edit]
While the majority of farmers oppose. There's been so much crap thrown about the CWB being a "protectionist socialist monopoly" and the virtues of the supposed free market that nobody knows what might happen.
But if it's really the worst-case scenario and you have multinational corporations stomping all over the industry, we could possibly have a repeat of 1993 (aka. the Tories might flat-out disappear). And if that occurs... Osaka Sun (talk) 01:27, 29 November 2011 (UTC)
Country articles[edit]
It's alright with everyone that I'm writing the headings for "see also," "external links," and "footnotes" in the country's language, right? Just making sure. Sam Tally-ho! 02:01, 29 November 2011 (UTC)
- Fine by me. Тytalk 02:01, 29 November 2011 (UTC)
- I don't even like them, cause they are some strange blur between funny and serious. but at least that would be really interesting to see. GodotSome would use a tautology to describe it ("The way things are done around here is the wa 02:07, 29 November 2011 (UTC)
- Cool, my foreign language crusade shall continue then. Sam Tally-ho! 02:08, 29 November 2011 (UTC)
- Just google translate, or do you have some familiarity with some/many of these languages. I'm envious of people with a good head for languages.GodotAround, around, around, around, over, and under and through 02:10, 29 November 2011 (UTC)
why is it so creepy?[edit]
this I mean. Scream!! (talk) 04:56, 29 November 2011 (UTC)
- My family has a cat that sits in that kind of position sometimes, but not nearly that upright. I get the feeling, however, that that cat is looking into my soul. Sam Tally-ho! 05:11, 29 November 2011 (UTC)
- Now that's right in the Uncanny Valley. (WARNING: TV Tropes link) Nebuchadnezzar (talk) 05:13, 29 November 2011 (UTC)
Oh, Herman Cain...[edit]
Number five. Osaka Sun (talk) 23:26, 28 November 2011 (UTC)
- Does the DNC have some new hotshot strategists or something? It seems like a waste to dig up this much dirt on a guy who doesn't really stand a chance anyway. Nebuchadnezzar (talk) 23:41, 28 November 2011 (UTC)
- Who says it's the DNC? It could be the Republicans running against him. MDB (talk) 00:05, 29 November 2011 (UTC)
- Didn't Cain complain about Parry's advisors starting it up? Whatever, it's still good comedy. Osaka Sun (talk) 01:29, 29 November 2011 (UTC)
- Dunno. It would make sense, though. The bottom of the barrel pseudo-candidates probably have more incentive to try to out-maneuver each other. Nebuchadnezzar (talk) 05:18, 29 November 2011 (UTC)
beautiful video about marriage[edit]
really nicely done vid on equality. --GodotSome would use a tautology to describe it ("The way things are done around here is the wa 01:59, 29 November 2011 (UTC)
- You are...a douchebag. That's right, a total douchebag. Osaka Sun (talk) 02:29, 29 November 2011 (UTC)
- What? I thought that was very well done. Blue Talk 03:21, 29 November 2011 (UTC)
- Top right. George Takei. :P Osaka Sun (talk) 03:28, 29 November 2011 (UTC)
Multiculturalism and stuff[edit]
Since this little racist rant about the destruction of "white British culture" has gone viral, I've started this debate up. Osaka Sun (talk) 07:56, 29 November 2011 (UTC)
- Would the loudmouth still have been arrested if she had been yelling about the demerits of, for example, pepperoni pizza? ListenerXTalkerX 08:31, 29 November 2011 (UTC)
- I have to question whether arresting her actually does anything to improve the overall situation in the long-term, or if it just creating in her, and those who think like her, a martyrdom/persecution complex. I guess she probably has a lot of anger in her life, quite possibly some mental health issues, and this kind of intervention isn't going to heal that anger or those issues, maybe push it down but just make it worse at the same time. The best cure for racism is positive personal relationships with people of different races/cultures/ethnicities/religions/etc; a visit from the police isn't helping anything. (((Zack Martin)))™ 08:41, 29 November 2011 (UTC)
- I don't suppose the police had much choice in the matter. On the preliminary evidence (the video) she was breaking the law. The police had a duty to arrest her. Ajkgordon (talk) 10:25, 29 November 2011 (UTC)
- The police don't have a legal duty to arrest anyone. If the police choose not to arrest someone, there is no legal recourse (only political recourse). You can't get a writ of mandamus to force the police to arrest someone since the decision to arrest someone is discretionary. (((Zack Martin)))™ 10:35, 29 November 2011 (UTC)
-
- Of course if you believe someone has committed a specific serious crime you can just arrest them yourself. The special power of the constable isn't specifically arrest, but a presumption that the arrest is legitimate. You can even carry hand cuffs for this purpose. Since cuffs aren't a weapon they are perfectly legal to carry, although you should expect to be questioned about why you have them in some circumstances. 82.69.171.94 (talk) 10:55, 29 November 2011 (UTC)
- Don't just consider the women who was arrested, think about the community. If you allow this to be publicised and don't arrest anyone you tacitly accept it, which can be seen as encouragement and sends a very negative message to affected communities. Being arrested just means the police took her away without her having a say in the matter. We don't know what, if any, further action was taken after she'd been arrested and questioned about the incident. An arrest seems like the extent of the message it was necessary to send. "Shouting racist abuse on the tram is not OK". 82.69.171.94 (talk) 10:46, 29 November 2011 (UTC)
- She's been charged. Ajkgordon (talk) 12:17, 29 November 2011 (UTC)
- Yeah I just saw that, and came back to see if someone else had pointed it out. Also, ListenerX, they're using the Public Order Act. That starts out with Section 1, "Riot" (at least 12 specific people, violent uprising, reasonable people fear for their lives, up to 10 years in prison) and works its way down to Section 5 (one person, sustained disorder causes distress, no more than a fine). Yelling about Pepperoni Pizza on a tram and refusing to shut up about it after being asked to stop seems like Section 5 to me if you can show some passengers were distressed by the yelling. Section 5 charges for people who would have been charged Drunk & Disorderly but turn out not to be drunk are not uncommon. 82.69.171.94 (talk) 14:34, 29 November 2011 (UTC)
Just in case you thought "liberal" wasn't a snarl word[edit]
Critics of the Protection of State Information Bill are "liberals working in the interest of the Democratic Alliance." [1] This from the S.A. Communist party chief. Which would make the SACP... conservative? --PsyGremlin말하십시오 15:12, 29 November 2011 (UTC)
- Communism != Liberalism, also It's been done before. Тytalk 15:15, 29 November 2011 (UTC)
-
- EC. No. You're falling into that Andy mode of analysis that reduces all politics to a liberal/conservative dichotomy. Radicals on the left have long gone after liberal (or bourgeois) politics for any number of reasons, most of which have to do with the liberal desire to protect middle-class, as opposed to working-class interests. (There is no meaningful definition of the word "liberal" that does not include some sort of a capitalist economy and private ownership. Communists don't see things that way) PintOfStout Talk Good people drink good beer. 15:16, 29 November 2011 (UTC)
- To the REDSREDSREDSREDSREDSREDS!!!!!!, liberals are worse than fascists. Nebuchadnezzar (talk) 15:25, 29 November 2011 (UTC)
Siri is pro-life (and by extension, Apple is too)?[edit]
This. Makes you wonder if it's the nature of Apple's search application, or if it was deliberately done by an activist programmer. -- Seth Peck (talk) 18:16, 29 November 2011 (UTC)
- Sadly it was probably built that way to avoid upsetting the conservative family values contingent, who have a tendency to boycott products & create other negative publicity when they don't get want they want. WëäŝëïöïďMethinks it is a Weasel 18:28, 29 November 2011 (UTC)
Causation, correlation, what? Study finds legalized MJ => lower automobile fatalities[edit]
This. -- Seth Peck (talk) 21:45, 29 November 2011 (UTC)
- It notes a drop in alcohol use. I believe that cannabis generally compromises reaction time less than alcohol. Therefore, fewer crashes. Either that or probability is just playing a clever prank on potheads. Nebuchadnezzar (talk) 22:06, 29 November 2011 (UTC)
- Also, those who drink get aggressive. They speed, take sharp turns, etc. Smokers get mellow - that's just what the drug does. They are likely to be going too slow (and often get pulled over for that reason), they aren't aggressive at taking turns, or trying to beat the guy next to them, or "jumping out" when green lights change, etc. All those aggressive driving behaviors increase EVEN WHEN THE DRIVER IS LEGALLY UNDER THE LIMIT. Pot smokers are just "safer" (in the sense of how serious accidents will be, or how other drivers would react to them) drivers. GodotAround, around, around, around, over, and under and through 22:13, 29 November 2011 (UTC)
- I wonder (not that it matters) if this is something that could have been predicted (was it?) or if it was something that had to be tested and observed in order to discover. -- Seth Peck (talk) 22:20, 29 November 2011 (UTC)
- Except that we are in an "anti pot" war (not sure why), I think you'll find most experts and lay users have long said it's a far safer drug. People don't beat up their spouses and kids while smoking - though they do when drinking, people are less likely to take advantage, sexually when smoking; they are less likely to pull a gun on a cop, or take personal risks like "let's see if i can cross this train track before the train gets here". The associated behaviors are just less risk-taking, less thrill seeking, and less "out of control emotionally". Unless you consider watching hours of bad comedy and trying to cook something when high to be "risky". heh.GodotAround, around, around, around, over, and under and through 22:33, 29 November 2011 (UTC)
- I understand the differences, I'm certainly no amateur when it comes to alcohol and I know the arguments for MJ/MMJ...I guess my question is, "did anyone argue that 'more pot => less alcohol => fewer accidents'", or was it just a suspicion that "everyone" believed to be true, but until now no evidence corroborated it? -- Seth Peck (talk) 22:39, 29 November 2011 (UTC)
- I feel compelled to point out that there's a definite selective reporting effect going on to. Instances of drunks getting violent and hospitalising people are ten-a-penny (sad but true), but if they've had but one joint on their bender it becomes "cannabis user causes injury" not "alcohol user causes injury". The illegality and novelty of the pot use in the story becomes the headline - and people, particularly politicians who make the laws and the table-thumpers who vote for them, mistake headlines for actual cause-and-effect relationships. Not that the drugs themselves are actually the cause anyway when put next to cultural pressures and expectation effects of course. narchist 02:00, 30 November 2011 (UTC)
French AIDS awareness ads[edit]
Interesting set of AIDS awareness ads in France. Now I just need a way to put these up in my Catholic university. άλφαΤαλκ 00:33, 30 November 2011 (UTC)
- yeah, french AIDES ads are pretty frank. :-) GodotAround, around, around, around, over, and under and through 00:50, 30 November 2011 (UTC)
- Oh I'm not falling for looking at those images again! At least I've never had a recurring nightmare about Goatse and 2 Girls 1 Cup. theist 01:38, 30 November 2011 (UTC)
Skeptical Science Debunking Handbook[edit]
A really excellent little booklet (PDF) about how to debunk global warming myths, from Skeptical Science.--talk 00:48, 30 November 2011 (UTC)
- Nice. I posted the first couple of parts recently but I didn't realize they made it into a booklet. Good stuff -- maybe more people will break out of the "but we've got the facts, how can we possibly lose?" mentality. Nebuchadnezzar (talk) 01:06, 30 November 2011 (UTC)
- Yeah, that gets you nowhere. I find you either have a "rationalist epiphany" or... you just don't. moral 01:23, 30 November 2011 (UTC)
- Worth paraphrasing that into an RW space article? bomination 01:39, 30 November 2011 (UTC)
Leveson Inquiry[edit]
For those keeping an eye on it (just me then, fair enough), McMullan has just finished giving his evidence. For those not in the know, McMullan is the former (and, indeed, form) NotW journalist who believes that there is nothing a journalist can do that is wrong or illegal. After listening to his evidence I'm now in severe need of a brain bleaching. Here's just a couple of his best bits:
- 4.46pm: McMullan finishes his evidence by explaining he does not think the hacking of Milly Dowler's phone was malicious.
He explains what he means by telling Leveson his child went missing recently from his back garden for 20 minutes and he
- 4.22pm: McMullan says he regrets the stories he did on Jennifer Elliott, the daughter of actor Denholm Elliott.
- She became a drug user and started begging following the death of her father and the News of the World exposed this.
- He adds:
- 4.20pm: McMullan is asked to clarify whether he believes that no one should have privacy. He says "yes".
What a shining example of tabloid journalism that piece of shit is. In many ways, I'm rather glad that nobody wants to employ him at the moment.-- Spirit of the Cherry Blossom 17:12, 29 November 2011 (UTC)
And this an absolute fucking cracker this is:
- 2.54pm: McMullan also worked on the "name and shame" paedophile story which he says was one of the Rebekah Brooks's good ideas…
- …2.58pm: Leveson interjects and read backs part of McMullan's statement slowly to make sure he heard correctly.
-- Spirit of the Cherry Blossom 17:29, 29 November 2011 (UTC)
- I thought that "paediatrician = paedophile" story (where people go after a paediatrician and deface the building under the impression that he's a paedophile) was fake? X Stickman (talk) 17:45, 29 November 2011 (UTC)
- No, very real. I remember the campaign at the time, and the glee in the Express and the Mail when the campaign backfired and riots started to happen. My recollection is that they tried to burn the paediatrician out, but to be honest, it was about 15 years ago, so the details are blurring a bit.-- Spirit of the Cherry Blossom 17:49, 29 November 2011 (UTC)
- Ah, 11 years ago, and you're right, the building was vandalised. And additonal linky. Trust it to be Wales.-- Spirit of the Cherry Blossom 17:53, 29 November 2011 (UTC)
- He is a bit of a twat isn't he? </obvious> bomination 17:57, 29 November 2011 (UTC)
- On the otherhand, he does appear to have single-handedly guaranteed that there will be an independent regulatory body, and that the regulations are going to be so tight that the rags aren't going to be able to cope. A new aphorism - every twat comes complete with an enjoyable clit. Not as catchy as clouds and silver linings, but hey…-- Spirit of the Cherry Blossom 18:12, 29 November 2011 (UTC)-- Spirit of the Cherry Blossom 18:12, 29 November 2011 (UTC)
I think overall I actually agree with McMulland about privacy, in fact I think the end of privacy is ultimately unavoidable. But (and these are big caveats) firstly it has to start at the top. If anyone has privacy, it better not be the chairman of a corporation, the head of MI5 or a senior minister. If they're going to watch me walk down the street, I want to know where they are every second of the day. If they want to know who I'm calling, I want to see a transcript of every phone call they make. Secondly it will cause painful changes in society, a cost in human terms that we'd have to confront. For every politician caught getting money under the table, we'll break up a hundred marriages. We will prevent a few bank robberies, but we'll also ruin a lot of surprise birthday parties. A lot more child abuse will be identified and stopped, but a lot more vulnerable people will be targeted by scams. 82.69.171.94 (talk) 17:02, 30 November 2011 (UTC)
- McMullen's comments on privacyare complete arse. His contention that in 21 years of invading privacy, he's never come across anyone doing good. What does that mean? everyone has been breaking the law or more likely, they've breached the NOTW's fucked up sense of moralty. If someone is suspected of paedophilia, you call the police, who are properly regulated and can actually help the victims, not the papers who have no interest in the victim but headlines. Privacy is not the sole reserve of criminals. As the BON above mentions, for every one paedaphile caught, you are going to vilify hundreds more people who have not broken the law but offend sensibilitys of their gossiping neighbours. I believe i would go crazy with an axe if i couldnt shut the door to world and be the person I think I am without having to worry who is watching. I've been couch suffing for last few years, and the lack of privacy a truely damaging AMassiveGay (talk) 19:05, 30 November 2011 (UTC)
Cain ending bid?[edit]
News is reporting Herman Cain is considering ending his bid for the White House now that someone claims she carried on a 13 year long affair with him. He denies the affair, of course, but if he's considering dropping out because of it it sort of sounds like there's probably some truth to it. Furthermore if it is true she's bound to be able to corroborate the story pretty convincingly if it indeed went on for 13 years. This guy was considered the frontrunner not long ago. Weird. DickTurpis (talk) 18:09, 29 November 2011 (UTC)
- You just know there's a book in the works - "How to be a potential Presidential candidate and utterly fuck up your chances". At this rate they're going to be begging random strangers off the street to run.-- Spirit of the Cherry Blossom 18:15, 29 November 2011 (UTC)
- "Dispatches from Ubeki-beki-beki-beki-stan-stan" is the title, I believe. Nebuchadnezzar (talk) 18:40, 29 November 2011 (UTC)
- I remember being told US Presidents are always either Crooks or Shaggers. It seems to me that the American people should prefer Shaggers, and therefore someone with a history of extra-marital affairs would make a good candidate. Am I missing something? 82.69.171.94 (talk) 16:39, 30 November 2011 (UTC)
- I don't know about that, but I have heard it said that Americans are unique (at least among the western-style democracies) in that we care if our leaders get a little on the side. I've even seen that some countries (Italy, France for instance) actually expect their leaders to have mistresses, and wonder if something is wrong when they don't.
- On the other paw, I've heard the argument that a President who fools around shows a lack of personal judgment, and thus his capability to lead is questionable, but on yet another paw, a lack of personal judgment does not necessarily mean he lacks judgment in other regards, and further, the only reason it would show a lack of personal judgment is that we do make such a big deal about it. MDB (talk) 16:51, 30 November 2011 (UTC)
What's wrong with this picture...?[edit]
Let me know if you spot it too or if I'm just going mad. gnostic 18:25, 29 November 2011 (UTC)
- Other than the fact that our congress people are paid 200K AND get life time pay, AND get life time bennies? GodotAround, around, around, around, over, and under and through 18:34, 29 November 2011 (UTC)
- Looks fine to me. You don't want them to go Galt on us, do you (looter)? Nebuchadnezzar (talk) 18:39, 29 November 2011 (UTC)
- Perhaps they scaled it by diameter instead of by area, and hence they are looking at the square of the salaries? If I get a chance, I could make a picture. steriletalk 18:45, 29 November 2011 (UTC)
- Sterile wins the Highly Original Prize. gnostic 18:53, 29 November 2011 (UTC)
- But yeah, it's massively misleading to do it like that and then scale by diameter. Although to be honest, look at the blue circles, they don't seem to match up even by diameter. There is no way the upper-middle income one is only 3.5 times larger - even in diameter - than the middle income one. And I did the calculations on it earlier, they're implying the great green Death Star thing there is closer to $9.8 billion. sshole 18:56, 29 November 2011 (UTC)
- Mind you, it's still a big circle. (And why does the MediaWiki svg renderer have to use such gruesome fonts? Blech.) steriletalk 19:36, 29 November 2011 (UTC)
-
- Yes, it really is still pretty fucking big. narchist 20:18, 29 November 2011 (UTC)
- Another annoying misrepresentation to undermine any good point that could be made. Also, people in Congress don't get life time pay nor benefits. DickTurpis (talk) 20:52, 29 November 2011 (UTC)
- A guy on The Young Turks facebook page, after this was pointed out: "You guys need to get laid. It is a freaking diagram , obviously not to scale" - then please, pray tell, what is the fucking point of it? d hominem 22:17, 29 November 2011 (UTC)
- I lol'd. The point of diagrams is obviously just to draw circles around numbers for no reason. Nebuchadnezzar (talk) 22:25, 29 November 2011 (UTC)
any of you who are "geeky" and know computer hardware terminology - help![edit]
I have a little mini laptop (10 inch screen) that I love. But somewhere along the line, I must have compressed it near the headset/mic jacks, cause there is a small crack there. It's been fine till today when i pulled out my headset, and the entire support jack / holder/female side thingy came out with it. I can plug in the headsets and if i wiggle just right, can make the connection - but clearly that's not a solution. My question is 1) are there USB headsets (I've seen usb speakers), and 2) what terms would I use to google, if i wanted to get just a "converter jack" or something for USB to audio jack so I could plug in the speakers I already own? Any suggestions appriciated.--GodotAround, around, around, around, over, and under and through 19:30, 29 November 2011 (UTC)
- 1. Yes, I've seen some before. Check Newegg.com for some good deals.
- 2. Try 'USB to TRS' or something like that. Flubbertalk to me :D 19:35, 29 November 2011 (UTC)
- Probably your best bet would be a USB Audio Card. Looks like they have lots of options. Hope that helps! (ʞlɐʇ) ɹǝɯɯɐHʍoƆ 19:37, 29 November 2011 (UTC)
- There is a suggestion that these sound cards might even help with teh background noise so common in small laptops, since the electronics are all on top of eachother. Thanks guys! --GodotAround, around, around, around, over, and under and through 19:44, 29 November 2011 (UTC)
- this one is listed with 'gender changers' for some odd reason but fits the bill and is only $20 with 5 eggs. My last pair of headphones were labelled 'USB' but was really just mini connection headphones and came with a similar USB adapter to the one linked. It worked fine, plug n play on win7. TheCheatI run on alcohol 20:08, 30 November 2011 (UTC)
Iran riot at the UK embassy[edit]
Can anyone say Iraq War
II III? Osaka Sun (talk) 22:15, 29 November 2011 (UTC)
- More like Iranian Student Revolution II but without the complications of a puppet Shah, hostages or Oliver North. -- Seth Peck (talk) 22:19, 29 November 2011 (UTC)
- Well, we've apparently been wanting a piece of Iran for ages, but since the cost would be INSANE, they can probably do what they like to the embassy and get away with it. I doubt it'll lead anywhere (also, we've had Iraq War II, sort of). pathetic 22:25, 29 November 2011 (UTC)
- Technically a violation of the Vienna Convention (I think) and could be construed as an act of war (embassies being sovereign). We'll see how this plays. -- Seth Peck (talk) 22:46, 29 November 2011 (UTC)
- Considering all the talk about the IAEA report (and the vast amounts of oil there), I'm wondering if Obama wants to pull a Bush.
- If it comes to that and millions of Iranians (many of whom, as we've seen in 2009, also want the theocracy to go to hell) die, the world might be a different place in a few years. And have we ever written an article about the stupidity that was Mohammad Mosaddegh's coup? Osaka Sun (talk) 22:59, 29 November 2011 (UTC)
- Vienna violation yes (Iran could clearly have prevented this happening and instead encouraged it), sovereign territory no. The embassy buildings are (like the embassy itself) protected by Vienna, and the host nation is supposed to ensure they aren't damaged. But they're still buildings in the host nation, they aren't a tiny enclave of a foreign state. 82.69.171.94 (talk) 16:19, 30 November 2011 (UTC)
RationalWiki - in the News (as a source)[edit]
RW used as a source in the New Statesman. Aceace 01:28, 30 November 2011 (UTC)
- How bizarre, though at least he should have bolded the "when applied correctly" part, that's really the point. pathetic 01:51, 30 November 2011 (UTC)
- Can anyone who knows the British economic situation evaluate this? Osaka Sun (talk) 02:02, 30 November 2011 (UTC)
- I don't think anyone knows what the fuck the situation is. The people who are elected and are paid to know certainly don't. postate 09:00, 30 November 2011 (UTC)
- No they don't but they do seem to be enjoying themselves - whatever it is they are doing. Aceace 09:03, 30 November 2011 (UTC)
- Ooh! ooh! Does that makes us notable? /runs off to WP to write article... --PsyGremlinSiarad! 13:58, 30 November 2011 (UTC)
Google news search. I guess somebody should sign up for alerts (also, using us as a source is sorta like using Wikipedia as a source- but any mention at all does further our mission of refuting pseudoscience. Maybe Ace could volunteer to go streaking at the next All-Blacks game while holding up a banner that says RationalWiki,org? kidding, of course.).--User:Brxbrx/sig 03:54, 30 November 2011 (UTC)
Play pen[edit]
- Why don't you volunteer to fuck off? Aceace 03:57, 30 November 2011 (UTC)
- Jesus, take a joke, will you?--User:Brxbrx/sig 03:59, 30 November 2011 (UTC)
- Jeez Brx, learn to take a joke. Aceace 04:06, 30 November 2011 (UTC)
- The difference is, my jokes don't involve lengthy campaigns of harassment and you can usually tell when I'm joking- in the event you can't, I'm always happy to present my apologies and an explanation.--User:Brxbrx/sig 05:05, 30 November 2011 (UTC)
Aceace 06:07, 30 November 2011 (UTC)
Mobile skins and native apps[edit]
- This discussion was moved to Forum:Mobile skins and native apps. 23:34, 30 November 2011 (UTC)
Is there a term for this?[edit]
Been working on a cognitive anthropology paper and started editing the sources into some of the relevant RW pages, copy-pasted them back into Word with some of the short write-ups and found I've got a pretty decent outline and biblio. (/self-aggrandizement) Fun:Yak shaving plus? Nebuchadnezzar (talk) 05:22, 30 November 2011 (UTC)
- Working on a paper which helps RW articles which helps with the paper? Circular Yak Shaving, surely. Speaking of shaving the old yak, I need to go fix about half a dozen computer and re-do the group website (I do chemistry on my days off, really). gnostic 08:57, 30 November 2011 (UTC)
Someone needs to sign this chap up[edit]
We need members like this bloke. Hopefully he wouldn't want to form a committee, or design an PR voting system for members of a board. DogP (talk) 08:11, 30 November 2011 (UTC)
- I live, like, 50 miles away from there! Nice to know we've got heroes like him hanging around. (They could have got cancer treatment free on the NHS if they were in Britain - just sayin') -- 12:52, 30 November 2011 (UTC)
- Wasn't he on SGU last year or something? We're well too late... Peter talk, or type, or whatever... 23:07, 30 November 2011 (UTC)
EV[edit]
Wow, my bank has finally got round to using an EV certificate on their online banking service, so they're only a few years behind the rest of the internet. Now I can make sure that nice Nigerian prince can transfer the monies into my account securely. CrundyTalk nerdy to me 13:58, 30 November 2011 (UTC)
Herman Cain...[edit]
does he actually understand how elections work in america? Cain: My opponents are trying to assassinate my character, and are evil for it" Your opponents are attempting to destroy your chances by going after your character and history, STOP THE FUCKING PRESSES!--il'Dictator Mikalosa (talk) 19:45, 30 November 2011 (UTC)
- Nope, already outed as a parodist. Nebuchadnezzar (talk) 19:50, 30 November 2011 (UTC)
- Vote Democrat, Obi Wan Kenobi. They're our only hope. -- 20:35, 30 November 2011 (UTC)
- And now this...Dammit, another broken irony meter -- Seth Peck (talk) 21:09, 30 November 2011 (UTC)
Frozen Planet censored[edit]
BBC documentary Frozen Planet has its last episode censored in the USA by the Discovery Channel because the fact of global warming might be upsetting to those Americans who don't like facts. SJ Debaser 21:52, 30 November 2011 (UTC)
- Same link twice, there, dude. pathetic 21:55, 30 November 2011 (UTC)
- Try this one. (ʞlɐʇ) ɹǝɯɯɐHʍoƆ 21:56, 30 November 2011 (UTC)
- Fixed. Although CH's is better than mine. SJ Debaser 21:58, 30 November 2011 (UTC)
- Fuck the Discovery channel. Damn bastards. Fartertalk to me :D 22:00, 30 November 2011 (UTC)
- BBC/Discovery, grow some balls. Osaka Sun (talk) 22:23, 30 November 2011 (UTC)
- Oh FFS. Although I can see the explanation, it's not helped that it's a climate change topic. And to be fair, if Attenborough isn't famous in a particular country it's their loss. moral 23:42, 30 November 2011 (UTC)
- This didn't happen on BBC. They're focused on what they call "balance". In Stargazing Live, for instance:
- Dara O'Briain: "Astrology is bullshit." (Words to that effect)
- Brian Cox: "Since this is the BBC, in the interest of balance, I have to say that, yeah, he's absolutely right." -- 00:22, 1 December 2011 (UTC)
Everyday I'm Science'in[edit]
So. Awesome. Osaka Sun (talk) 22:59, 30 November 2011 (UTC)
RationalWikiWiki's down[edit]
Everyone else getting the internal server error messages at RWW? 68.56.137.137 (talk) 23:35, 30 November 2011 (UTC)
- RWW's default state is down. Тytalk 23:36, 30 November 2011 (UTC)
- (EC)I get 500's 50% of the time I try to load RWW, for the last few weeks. Used to be more sporadic. Blue Talk 23:37, 30 November 2011 (UTC)
- I liked Maratrean's edit to the RWW article on MCWiki that said the site's been replaced with a page saying 500 error. I found it humorous and I chuckled. --User:Brxbrx/sig 02:03, 1 December 2011 (UTC)
Hi[edit]
- pops head in to see how things are going, sees shadow, scampers off*'
HAI GUYZ AND GALZ!
δλερνερ διαλέγομαι | συνεισφέρω 00:05, 1 December 2011 (UTC)
- Hey! Long time no see. How's tricks? WėąṣėḷőįďMethinks it is a Weasel 00:52, 1 December 2011 (UTC)
Kentucky church bans interracial couples.[edit]
Welcome to Kentucky. Please set your clocks back 50 years. PintOfStout Talk Good people drink good beer. 00:20, 1 December 2011 (UTC)
- 00:28, 1 December 2011 (UTC)--
-
- Osaka Sun (talk) 00:37, 1 December 2011 (UTC)
- Stuff like this makes me wonder why or how people consider America to be the greatest nation on Earth. It's sad. Sam Tally-ho! 00:34, 1 December 2011 (UTC)
- Yep, im sure that will make your town, your church, state and country look so much better --il'Dictator Mikal (talk) 01:00, 1 December 2011 (UTC)
- That's not Kentucky, that's Pike County, Kentucky. Pike County is to Kentucky what Mingo County is to West Virginia. Ever see Matewan? Hatfields. McCoys. Snakes... Secret Squirrel (talk) 02:40, 1 December 2011 (UTC)
Polygamy[edit]
Moved to Debate:Polygamy Bad Faith (talk) 14:57, 1 December 2011 (UTC)
Oh god, I"m getting old.[edit]
So it's been a long day, and no i've not eaten much, but I went to lunch and had a margarita. JUST ONE. at a bar where they are probably pretty weak. and after JUST ONE. i'm buzzed. shit. I turned around an the kid's music is noise, the movies are filled with actors i've never heard of, and one drink gets me drunk. I"M OLD.--GodotAround, around, around, around, over, and under and through 21:23, 30 November 2011 (UTC)
- Well, shit. I'm old too then. --★uːʤɱ digital native 21:25, 30 November 2011 (UTC)
- You want old, wait until Saturday, I'll make you feel very old then. Тytalk 21:26, 30 November 2011 (UTC)
- That just sounds weird. SJ Debaser 21:28, 30 November 2011 (UTC)
- Does WfG's husband know about your plans, or...? --★uːʤɱ heretic 21:30, 30 November 2011 (UTC)
- On Saturday I will be old enough to buy my own brandy. Тytalk 21:34, 30 November 2011 (UTC)
- OH god. Get the hell off my lawn. Pouts. PS. My husband is asian. he GETS CARDED still. Sure, he's younger than me, only turning 40 this year... but he fricking gets carded. jerk. GodotAround, around, around, around, over, and under and through 21:37, 30 November 2011 (UTC)
- I find I get ID'd for booze way more regularly when I'm clean shaven. I only shave two or three times a month (if that) so I usually have a stubble/whiskery thing going on which makes me look about 25, whereas when I'm freshly shaven I look about 16. This is why I never bother shaving. SJ Debaser 21:47, 30 November 2011 (UTC)
- I knew I was old the day I bought $100 worth of post-Halloween-night-discounted candie, came home, dumped it on the table, and thought "I'm not really in the mood to eat any of this." (I had a sandwich instead.) Radioactive afikomen Please ignore all my awful pre-2014 comments. 21:35, 30 November 2011 (UTC)
- (EC) Hey, at least drinking's cheap then. Nebuchadnezzar (talk) 21:38, 30 November 2011 (UTC)
- If there was chocolate in that candy, i could never be too old. (course, the flip side is that makes me "too fat" but who's counting".GodotAround, around, around, around, over, and under and through 21:39, 30 November 2011 (UTC)
- The Fat Police. They're always counting... Nebuchadnezzar (talk) 21:42, 30 November 2011 (UTC)
- The fat police can go to hell. I'm an american! it's my right and DUTY to be obese. we hold the record, you know! we have to be good at atleast ONE statistic!! GodotAround, around, around, around, over, and under and through 21:44, 30 November 2011 (UTC)
- Since I stopped drinking about 2-3 months ago my weight has crashed through the floor. :S But now the three glasses of wine I grabbed at a drinks reception (I went for the lecture not the freeloading booze, honest) a couple of hours ago definitely took its toll. d hominem 21:54, 30 November 2011 (UTC)
- One of the things about being obese that "amuses" me is the way other people talk about weight loss. "I don't get what's so damn hard, I lost 20 pounds just giving up soda (alcholo, sugar, etc). Why it's funny to me? Most large women (not men, sadly) have actually already given up all that. The trouble is that a slow life of over eating is virtually impossible to undo. When I'm being "good" (I haven't been good since July... sighs), I get 1400 cals a day. That's 2 eggs whites and a bowl of oatmeal, fruit and veg for snack, a small health sandwhich or 1/2 a less healthy sandwhich (child size hamburger as a treat), a slice of cheese or cup of yogurt for snack, and 1/2 a chicken breast, 1/2 cup of whole wheat pasta, and some oil on a salad. Let me tell you how hungry you are at the end of the day, and none of the diet woo does shit to help. I know way more about diet woo than I should, just cause you think "ok, my mind says lemons can't help, but what the hell, i'll try". ;-) GodotAround, around, around, around, over, and under and through 22:02, 30 November 2011 (UTC)
- Well, diet woo could "work." Nebuchadnezzar (talk) 22:11, 30 November 2011 (UTC)
- Get a decent crack habit. You never see fat addicts. AMassiveGay (talk) 22:29, 30 November 2011 (UTC)
- It's weird if you're actually hungry. You're not supposed to be hungry if you're eating roughly what you should be. For most people the problem isn't that they're hungry but instead they're simultaneously bored (so they eat when they aren't hungry) and lazy (so they eat convenience foods that have high energy density and aren't terribly filling). There is no magic solution, but unless there's something genuinely wrong with you it should be possible to eat enough to trigger the "full, not hungry, do something else" signal while still slowly slimming to a healthy range by picking low energy foods that fill you up. Whatever you do, it has to be something you can do most days for the rest of your life, not just when you're "being good". 82.69.171.94 (talk) 23:33, 30 November 2011 (UTC)
- Trust me, on 1200 - 1500 cals, i'm hungry. If i exercised, I could add 500 cals more, which literally would make "all the difference". That's one extra meal. And yes, I've been doing this for nearly 20 years after I lost my thyroid (no one bothered to tell me then, that you can't eat like a teenager), and yes it's a "lifetime" thing, but if you really look at it, life is not worth living on 1200 cals. :-)
- I know exactly what you mean, Godot, and it annoys the hell out of me just as much as any other time someone over-simplifies a problem. But the converse is also remarkably true; that gaining weight when you're under is equally difficult. I know at least one anorexic who has many many issues that go beyond just food (it's more a symptom in this case, really) and people who are under stress tend to simply crash because they're shutting down. Actually, I'm not convinced that "eating more" would be a solution to that even if you could implement it because if you've fucked your body's ability to digest it then you're just converting calories into poop, rather than body mass. And perhaps on the other hand if you were in a starvation mode from a calorie restricted diet, your intestines would be there squeezing every last ounce they could get out of it if you limit yourself, so to lose weight just through that alone you'd have to under under eat which would undoubtedly make the "starvation mode" even worse. Indeed, this is all why diet woo of all kinds is bullshit, it's fucking with an established equilibrium that takes at least a few years of constant attention to undo. moral 01:34, 1 December 2011 (UTC)
People also oversimplify "virtues." I do at least some running or biking most days, so I must have "discipline." Actually, I'm a bit of an insomniac so I do it to get a good night's sleep. Clearly this makes me morally superior, or something. Nebuchadnezzar (talk) 04:29, 1 December 2011 (UTC)
- Here is probably my single biggest "oh shut the fuck up" to the medical community. "If you exercise, you'll feel better and have more energy". THAT'S BULLSHIT. ((Actually, it probably isn't in the long run, but...) My knees hurt just walking 15 minutes. I do it, but it hurts. And when I add in very basic yoga or weight lifting i ache for days. "it's good pain". yeah, bite me! :-) GodotAround, around, around, around, over, and under and through 04:39, 1 December 2011 (UTC)
- If walking or weight-lifting is painful, you should try swimming. ListenerXTalkerX 04:52, 1 December 2011 (UTC)
- Yoga & weight lifting are for muscle strength & tone, & they will ache is you're not used to them. For weigh loss/general fitness, they're not all that good. Running, walking, swimming & team sports are good general cardiovascular exercises. If you're getting aches in specific places from these, you might need to hone your warm-up technique to make sure you stretch the relevant muscles before starting. WèàšèìòìďMethinks it is a Weasel 08:37, 1 December 2011 (UTC)
- Or just be a fidgety little thing. I often suspected that all the shaking, twiddling, playing with hair, churning teeth and darting my eyeballs around everywhere added up to significant exercise. If the estimates here are right then you're talking about a calorie consumption difference of about 20% at least between people who can and can't sit still. I know people are supposed to fidget less when watching television and it's this that's supposed to explain the old adage about watching TV leading to obesity (among other factors), but I'm pretty sure I fidget more when watching it. Could be a bigger factor than you think, it seems. d hominem 13:38, 1 December 2011 (UTC)
Fuck you, Hollywood[edit]
Just saw a trailer for 'the Thing'. Why does hollywood insist on raping everything good its ever done? AMassiveGay (talk) 22:18, 30 November 2011 (UTC)
- Money. --★uːʤɱ structuralist 22:23, 30 November 2011 (UTC)
- John Carpenters The Thing was perfect. It needed nothing. Those fucking bastards fucked with my childhood. Aceace 22:28, 30 November 2011 (UTC)
- You do realize that John Carpenter's "The Thing" was itself a remake, right? For that matter, "The Thing" was adapted from a classic sci-fi short story, John W. Campbell's "Who Goes There?"
-
- It gladdens my heart when I see remakes bomb. Fucking whoresAMassiveGay (talk) 22:32, 30 November 2011 (UTC)
- I'm waiting for the point where they've done so remakes that they have to go back to silent films. Battleship Potemkin, now with CGI! Nebuchadnezzar (talk) 22:44, 30 November 2011 (UTC)
- "Silent films with 21st century dialogue! Starring the voice talents of Tim Allen and Eddie Murphy!" Ahhhhh GOD! What a horrendous vision! Aceace 22:50, 30 November 2011 (UTC)
- I want to see a shot for shot talkie remake of the A Trip to the Moon. Starring Christopher Walken. And he has to play it straight. --JeevesMkII The gentleman's gentleman at the other site 07:05, 1 December 2011 (UTC)
- First read as "Battlefield Earth" - David Gerard (talk) 13:39, 1 December 2011 (UTC)
Fuck you, Shakespeare. Fuckin' copy cat. Me!Sheesh!Mine! 22:51, 1 December 2011 (UTC)
This must be illegal, somehow, no?[edit]
"Please note that the content of this book primarily consists of articles available from Wikipedia or other free sources online." Fourteen bucks on Amazon. PintOfStout Talk Good people drink good beer. 00:44, 1 December 2011 (UTC)
- making money off other people's work? That's got to be illegal.GodotAround, around, around, around, over, and under and through 00:46, 1 December 2011 (UTC)
- No, seriously. I edited ALL of those articles, some of them quite extensively, and I did so on the assumption that CC/GNU/copyleft, etc, meant I was not doing so for somebody else's financial profit. PintOfStout Talk Good people drink good beer. 00:54, 1 December 2011 (UTC)
- a) Wow! and b) contact wikipedia. See what their fine print is. I don't think they'd like this, cause it will set precedent for everyone to "write" their own for profit book.GodotAround, around, around, around, over, and under and through 00:57, 1 December 2011 (UTC)
- Sadly, you may have a problem. this is from the wp article on gnu ." (emphasis mine)GodotAround, around, around, around, over, and under and through 01:00, 1 December 2011 (UTC)
- Don't "contact Wikipedia" before reading their article on the subject: WP:Books LLC Wikipedia is aware of it & doesn't object. See also, this article. Rightly or wrongly, the publisher claims they are only charging for printing/binding/distribution costs, not for the content. WėąṣėḷőįďMethinks it is a Weasel 01:05, 1 December 2011 (UTC)
- I think this is one of those "long tail" things. Instead of spending ages and lots of cash putting together a book and having to ensure you sell loads to make a profit (say, the Twilight series, or whatever the bollocks-du-jour everyone must read these days), they get a computer program to trawl the net and assemble relevant information on an obscure topic, usually from wikipedia, and sell it print-on-demand for a relatively minute mark-up. The long tail idea is that they can make more money by selling fewer copies of lots of different things than by selling lots of copies of the same thing. One example I recall was a book charting the sale of office chairs in southern India. When people spot them on Amazon it raises an eyebrow of "who the hell would buy this?!?" but the long tail explains it. bomination 01:42, 1 December 2011 (UTC)
- You were fucking retarded then. --145.94.77.43 (talk) 06:43, 1 December 2011 (UTC)
- Exactly. The key thing for the GFDL and the CC licenses (except CC-NC) is the idea of contributing to the common good. Preventing other people from making a living is a tangent, and usually seen as an unhelpful one. I'm going to hope that Godot was being sarcastic when saying "making money off other people's work? That's got to be illegal.". Pay-per-byte network access charges (especially for mobile users) mean some ISPs make money from people visiting Wikipedia too. Countless for-pay articles will have been written in magazines and newspapers using Wikipedia for background or as a springboard. Hopefully you don't think either of these things should be illegal.
- If Books LLC were lying about where the words come from, that would be a different matter. For example there have been numerous outfits that rebadged the GIMP (which I worked on when I was younger) and hide the fact that it's Free Software from their customers/victims. I believe the same happened to Audacity and OpenOffice.org. The projects had to ask eBay to shut these criminals down on many occasions. But people who are open about what they have to offer, that users are free to re-distribute and so on, and the fact that they're charging for convenience and customer support are fine. At the consumer level you can find a market for people who just want a phone number to call when they can't get something to work instead of, say, asking on an unrelated Wiki... 188.220.41.110 (talk) 11:50, 1 December 2011 (UTC)
It's not illegal, but these things are often marketed deceptively - not making clear they're rehashed Wikipedia content, so end up being bought (at stupid prices) by (a) marginally-notable subjects surprised someone's written a book about them (b) Wikipedia editors looking for print sources. See blog post rant - David Gerard (talk) 13:34, 1 December 2011 (UTC)
- Obligatory d hominem 13:48, 1 December 2011 (UTC)
- For people in the EU (where the law is balanced to make distance selling unprofitable if you sell things people realise they didn't actually want) the comment at the end of that blog rant is very appropriate. Return anything which you buy from a web site and realise on arrival isn't what you expected. Don't feel guilty, if it's not what you expected, that's the seller's problem not yours. If they wanted zero returns they'd work harder to make sure you knew what you were buying. 188.220.41.110 (talk) 17:13, 1 December 2011 (UTC)
- Returns are only a viable option when buying from bigtime sellers like Amazon itself, who have an obligation to provide adequate after-sale service. Whereas if you buy something disappointing from an eBay seller & try to return it, you'll get fucked over nearly every time & have very little recourse. If you fight hard for it through the dispute process, you might eventually get eBay to force a refund, but there's no certainty of it. eBay's terrible feedback system doesn't help, as it lets "power sellers" get away with murder. Situation is probably similar with Amazon marketplace, but I can't really say for sure as I only use it occasionally & can't recall any bad experiences. </rant> WéáśéĺóíďMethinks it is a Weasel 00:25, 2 December 2011 (UTC)
So, why sew not sue?[edit]
Hubby was saying something about sewing, and pronounced it "sue". Which makes sense when *every single other word with ew is pronounced" ewe. Anyone have any idea why "to sew" acquired an "oh" sound? or is it just an american thing and brits pronounce it right? Dictionary says it comes from old english sīwian, which seems as if it was once then, "sue" or even a harder "ee" sound. GodotAround, around, around, around, over, and under and through 04:51, 1 December 2011 (UTC)
- You're the resident linguist here aren't you? Nebuchadnezzar (talk) 05:01, 1 December 2011 (UTC)
- yeah, cept you can't chalk this on up to the Great Vowel Shift - so I'm stumped. I've googled. really!GodotAround, around, around, around, over, and under and through 05:07, 1 December 2011 (UTC)
- If you're expecting English pronunciation to be consistent or logical, you are headed for a life of disappointment. Doctor Dark (talk) 06:15, 1 December 2011 (UTC)
- Before English spelling was standardised by dictionaries & such, the word "show" was often spelled "shew". I assume it was still pronounced as we would pronounce "show". ΨΣΔξΣΓΩΙÐMethinks it is a Weasel 08:32, 1 December 2011 (UTC)
- Agree with the Doctor. Also we have bow (weapon), bow (bend) and bow (front of a ship). But why pick on 'sew' when there's 'ough'? ГенгисYou have the right to be offended; and I have the right to offend you. 09:03, 1 December 2011 (UTC)
- Actually "sew/sow" is quite an interesting one. For me the following three words are pronounced the same:
- "sew" with a needle, "sow" seeds in a field and "so" as in "so what?"
- However I pronounce "sow" (female pig) differently.
- Which leaves me with three words which are spelt differently but pronounced the same and two words which are spelt the same but pronounced differently. (And none of them are pronounced like sue.)--BobSpring is sprung! 10:53, 1 December 2011 (UTC)
- "soe", "sau", "seu"... well, your choice of how to represent the vowels may differ, but I believe I pronounce those words roughly the same way as BobM does (((Zack Martin)))™ 10:57, 1 December 2011 (UTC)
- Wow. Nobody here knowns why this is spelled differently? Ok, I'll start at the beginning then. English is linguist bastard made up of three different language families: Celtic, Roman and Germanic. The old English tried to keep the etymology of a word corresponding to it's foreign ancestry (that's why brits write "colour" because it comes from French colour). So "to sew" comes from Old English siwian which comes from Proto-Germanic *siwjanan while "to sue" comes from Anglo-Norman suer (sister) and corresponds with French suivre (to follow). So change in pronounciation made "sew" from "siw" and spelling kept the "u" in "sue". So for many people (including me) they sound the same but are written differently. The only reason that comes to mind why "sew" is pronounced differently from "sue" is because of the different etymology. While "sew" is from Germanic ancestry, a highly in inflexive language family, "sue" is from Roman ancenstry, a language family that is much less inflexive and much more regular in such forms. Looking up the old declinations of these verbs, "siwian" is in Anglo-Roman praterite (past) siwode, siwodest, siwode, siwodon — so possibly the "o" took over as as first vowel after "i" died of British laziness and "sue" kept it's weird "u" because of Roman language polishing kept alive in British English. So they are written differently to tell them apart, while only some people pronounce them differently. Basically the same reason why one writes chocolate (from Nahautl chocolatl) and not chocklette... --★uːʤɱ sinner 12:13, 1 December 2011 (UTC)
- Excellent. Now explain "...ough" which must be the most baffling to non-English speakers. Scream!! (talk) 12:29, 1 December 2011 (UTC)
- The only thing that I can pull out of my ass about that is that it is simply combination of the diphtong "ou" and the digraph "gh". "ou" has 3 sounds (/ʊ/ should; /ɔ/ cough; /ə/ camouflage), while "gh" has 4 sounds and can be silent (/f/, /x/ or /k/, /ɡ/ or /x/, /p/). That means 3x5=15 variants of which 10 are used. Some of those which are possible simply don't make sense to use as I don't need to write ough but can simply write up to produce "ɔp" (hiccough/hiccup). So you end up with 10 used instead of 15 variants. And yes, for non-natives it is a giant pain in the ass. --★uːʤɱ kant 13:06, 1 December 2011 (UTC)
- I'd take some issue with the above. Apart from place-names I don't think there's a lot of Celtic in modern English. There's much "Roman" either - if by "Roman" you mean Latin left behind after the relatively short Roman occupation of the British Isles. There is certainly a load of Latin which came into the language via Norman-French after the Norman Conquest though.--BobSpring is sprung! 15:03, 1 December 2011 (UTC)
- Theres a hell of lot words and place name in the UK with a nordic root left over from all the Viking incursions and DanelawAMassiveGay (talk)
- I don't know if 'nordic' is actually a proper thingAMassiveGay (talk) 18:31, 1 December 2011 (UTC)
- @Bob: Erm, yeah. With Roman I meant the Romance language family — so actually that would not only be Anglo-Norman but also French, Spanish and Italian (Ok, badly worded on my part). The influence of Celtic languages is really not all that big, but it is there, not only in a few words but also in prounanciation. @AMG: Nordic is actually more of a geographical term, or meaning Nordic as in "Northern Germanic". Also Nordic languages aren't Celtic languages. --★uːʤɱ heretic 20:33, 1 December 2011 (UTC)
- The contribution of Celtic is minimal. The page you linked to has a handful of words many of which are archaic. I expect that the Danelaw would have been Old Norse. David Crystal speculates that later merged with Anglo Saxon to produce a language which was less inflected than either of its predecessors. There is obviously no connection between Norse languages and Celtic ones - apart from the fact that they are both indo european.--BobSpring is sprung! 20:40, 1 December 2011 (UTC)
Either I'm reading this wrong or...[edit]
A new timeline by the CBC is saying that Canada is reducing emissions? Osaka Sun (talk) 07:37, 1 December 2011 (UTC)
Can you crack it?[edit]
[2] Any codebreakers here? You can get a job with GCHQ! The code in text format
Running it through a hex-to-text converter gives what looks like an encrypted string:
ë�¯Â¿£ì�1Ɉ�?�þÁuù1Àºï¾Þ���?ÐÁÊ�Š��Š<�ˆ��ˆ<�?þÁuèé\‰ãÃ�?\X=AAAAuCX=BBBB?u;Z‰Ñ‰æ‰ß)Ïó¤‰Þ‰?щß)Ï1À1Û1ÒþÀ���?Š��Š4�ˆ4�ˆ��ò0ö?Š��Š�0Úˆ�GIuÞ1Û‰?ØþÀÍ€èÿÿÿAAAA
Although I'm not sure if the data on the page is wrapped or not. Certainly doesn't look like the result of something simple like Vigenère or Caesar's cipher (which I guess you'd expect), but then what would they be using if they want you to decrypt it without a key? CrundyTalk nerdy to me 11:30, 1 December 2011 (UTC)
- They're probably not interested in people who can break those pre-modern ciphers following instructions from a book. They want the kind of people who can do something new, which means this probably isn't even a (much harder than the toys you suggested) differential cryptanalysis problem because those can be attacked automatically too. The sort of people GCHQ (or their analogues at the NSA) want to hire have noticed that there are three 00 bytes in a row and three FF bytes in a row, and were already wondering what significance that had before they read the next line of text. 188.220.41.110 (talk) 12:08, 1 December 2011 (UTC)
- Ha, I'm an imbecile, you can't try differential crypto here because you need chosen plaintext. 188.220.41.110 (talk) 12:10, 1 December 2011 (UTC)
- Maybe the code above is some kind of compiled app or memory pointers and not ciphertext at all? CrundyTalk nerdy to me 12:31, 1 December 2011 (UTC)
- Oh, just found this. CrundyTalk nerdy to me 12:35, 1 December 2011 (UTC)
My first impressions are that the block seems to be divided in to two sections of 80 bytes. The last block terminated by the 4 octets of 0x41, and the first by the 4 octets 0x42. Looks like some kind of padding to me, and I got kind of excited then I saw the 0x41 (65) might be the length of the "message" bytes in the the block, but that doesn't seem to (64 bytes plus the 9d in the last 8) but that doesn't seem to fit the pattern of the first. I'm fairly sure this 4 octet repetition is important somehow though, and discovering what is probably the key to figuring out the meaning. I'll keep thinking about it. --JeevesMkII The gentleman's gentleman at the other site 13:22, 1 December 2011 (UTC)
- Apart from thinking "it's hex, isn't it?" the first thing I saw when looking at it was whether the two blocks meant you had to do some kind of boolean operation on both of them to make one box of numbers and then start breaking it. Analogous to steganography but they've given you the key to start. moral 13:30, 1 December 2011 (UTC)
- Eh, well, Crundy's link has rather ruined it for everyone now. Apparently it's x86 executable code implementing rc4. The decoded data gives: GET /15b436de1f9107f3778aad525e5d0b20.js HTTP/1.1, which is this compsci 101 homework problem. The only slight thing in the first problem is that there was more data hidden in the PNG file in an iTxt field. How fricking tedious is that? It wasn't even a proper code, it's an exercise in spotting opcodes you're used to reading. I might do the next step to see if there's another phase that's more interesting, but this seems like bullshit to me. --JeevesMkII The gentleman's gentleman at the other site 14:11, 1 December 2011 (UTC)
Abuse[edit]
Wow, Amazon really don't check who are buying their products do they? Yes I'd really like to buy some nitrous oxide chargers and some baloons for unrelated purposes. CrundyTalk nerdy to me 11:55, 1 December 2011 (UTC)
- Seems like it is effectively encouraging safer drug use. Nitrous is relatively safe as drugs go (but hey kids, don't operate heavy machinery), and inhaling single cartridges via a balloon eliminates the scariest "You did that wrong" hospitalisations that occur when idiots play with a whole cylinder and an improvised mask. 188.220.41.110 (talk) 14:38, 1 December 2011 (UTC)
- Steve-O disagrees with you CrundyTalk nerdy to me 16:34, 1 December 2011 (UTC)
- If he'd vomited into a tight fitting mask he'd be in a lot worse trouble -- also given Steve-O is addicted to Cocaine and regularly uses other drugs including Ketamine, who is to say it is the Nitrous that's responsible for being in this state in the picture? (yes I see the empties, but that's circumstantial at best). 188.220.41.110 (talk) 17:44, 1 December 2011 (UTC)
Barmaid, a round of beer for every Tolkien fan in here[edit]
We did it guys! Somebody finally recognized Tolkien's languages as the third most conservative on the world. Cheers! -- DasRationalpersone (Annoy me!) 13:10, 1 December 2011 (UTC)
- Link, please? Is this some remnant from when Tolkiendil was still editing over there? Also, why is this not on Talk:WIGO:CP? ListenerXTalkerX 16:02, 1 December 2011 (UTC)
- Before i realized you meant CP "conservative" i was thinking - well of course it never changes (the definition of conservative), it's not a real language and no one uses it as a first language, duh. But I'm sure andy has his own unique take on linguistics.--GodotAround, around, around, around, over, and under and through 16:41, 1 December 2011 (UTC)
- Click.img Probably not. Because I can't buy all Tolkien fans a drink on Talk:WIGO:CP. -- DasRationalpersone (Annoy me!) 20:26, 1 December 2011 (UTC)
- It has been removedimg now. ListenerXTalkerX 20:34, 1 December 2011 (UTC)
- How can a "dead" language be conservative? GodotAround, around, around, around, over, and under and through 20:37, 1 December 2011 (UTC)
- Traditionalist Catholics probably consider Latin to be "conservative" in the liturgical sense. ListenerXTalkerX 20:49, 1 December 2011 (UTC)
- Presumably a dead language would be the most conservative imaginable. It's certainly highly resistant to change and modernisation. Wouldn't it be perfect?--BobSpring is sprung! 21:40, 1 December 2011 (UTC)
- Still, I'm proud. -- DasRationalpersone (Annoy me!) 20:45, 1 December 2011 (UTC)
- This language was stillborn, lol. It was probably because Reuel was a devout catholic. -- DasRationalpersone (Annoy me!) 20:46, 1 December 2011 (UTC)
Question for you all (at least in the US)[edit]
So I was looking over my car insurance, and it occurred to me that I think I'm getting reamed. I did on online query with Geico and got a quote that was less than half what I'm paying now. I called my current company to see if they could come down in their price, and they basically said no, but also that the quote I got sounded too good to be true (which occurred to me as well). So what do you guys pay for car insurance, for a single car, no collision, injury liability up to $500,000? I'm paying over $600/year, and just got a quote for around $300. Which of those sounds closer to what you're familiar with? And if any of you have Geico is there some fine print or hidden fees I'm overlooking? DickTurpis (talk) 18:25, 1 December 2011 (UTC)
- Because of the laws of each state, it's really hard to compare between states. I pay about 60 bucks a month with State farm. We've had no accidents on our car in 15 years of being with them (which didn't stop them from upping our rates when Colorado inacted the procedure that let them base your rates on your credit score and not your driving, thanks Colorado!), insure only one car, a 10 year old saturn - 2 drivers over 35. Don't know if that helps you or not. GodotAround, around, around, around, over, and under and through 18:48, 1 December 2011 (UTC) PS, I still carry basic collision - like 5,000 bucks or something, to replace my car if it's my fault. That is 2 times blue book, and it's minimual addition - maybe 12 bucks a year, cause it's an old car with no accidents.
- Yeah, different states can make a big difference. Without giving away too much of my sooper seekrit identity, I'm in New York, male, over 30, and have 1 accident a couple years back and no points on my license (I think). Currently I'm with Amica, which I believe is one of the highest rated companies, but hence not the cheapest. DickTurpis (talk) 18:52, 1 December 2011 (UTC)
- Don't you lot have equivalent websites to compare the Meercat (just click to get to Comparethe market.com) Scream!! (talk) 19:02, 1 December 2011 (UTC)
- I have no insurance. I just drive fast enough so I never get caught. --188.10.41.57 (talk) 20:57, 1 December 2011 (UTC)
- I pay 242 every six months with above minimum coverage on medical and liability but not my own car cause it is not worth shit. I have USAA and do practically all my insurance and banking with them. I got access to all their services cause my father served. TheCheatI run on alcohol 22:57, 1 December 2011 (UTC)
That's it, we write a Margaret Wente article now.[edit]
It didn't have to take long for denialism to be centre-stage in Canada.
Simply embarrassing. Osaka Sun (talk) 00:09, 2 December 2011 (UTC)
- Please start using preview--User:Brxbrx/sig 00:16, 2 December 2011 (UTC)
- Sorry, I'm just disgusted that something like this shows up on the second largest newspaper in the country. Osaka Sun (talk) 00:22, 2 December 2011 (UTC)
- Are you done massaging your comment into perfection so that other people can chime in? We don't need a Wente article, but this could fit easily into the climate-change denial article. PintOfStout Talk Good people drink good beer. 00:35, 2 December 2011 (UTC)
- Dime-a-dozen denialist article? Yawn. In 'Murrica, most conservative pundits are deniers or lukewarmers at best. Nebuchadnezzar (talk) 06:00, 2 December 2011 (UTC)
Answers Acadamy - Dr Jason Lisle and Ken Ham strike again[edit]
There is a homestudy courses by Jason Lisle and Ken Ham available HERE. A youtube video of one section is Here Hamster (talk) 01:01, 2 December 2011 (UTC)
Marriage Debate[edit]
Debate:Marriage_should_be_un-governmented Fluckedtalk to me :D 01:14, 2 December 2011 (UTC)
What kind of 'Murrican accent do you have?[edit]
Quiz here. I got Noo Yawk, obviously. Nebuchadnezzar (talk) 07:59, 26 November 2011 (UTC)
- Not that I'm a Merkin, but non-rhotic accents rrrrrrrule... (((Zack Martin)))™ 08:15, 26 November 2011 (UTC)
- That quiz tells me I'm probably from New Jersey, Connecticut or Rhode Island. This is news to me. WeaseloidMethinks it is a Weasel 12:11, 26 November 2011 (UTC)
- What a coincidence: me too! Scream!! (talk) 12:14, 26 November 2011 (UTC)
- Northeast: North Jersey, NYC, Connecticut, Rhode Island. This must be the closest to the London English accent which I actually have. SJ Debaser 12:21, 26 November 2011 (UTC)
- The Inland North apparently. Who knew they speak with such cultured accents there... --PsyGremlinPraat! 12:58, 26 November 2011 (UTC)
- Midland of all places. Тytalk 13:23, 26 November 2011 (UTC)
- Midland too. I still have an American accent though. --★uːʤɱ soviet 13:47, 26 November 2011 (UTC)
- Apparently, I sound like I'm from Chicago.--. 14:37, 26 November 2011 (UTC)
- Inland North apparently, makes sense with all the Finnish immigrants there. Northeast and Philadelphia were over 80% too. Vulpius (talk) 14:57, 26 November 2011 (UTC)
- Strange that you'd sound like you're from Chicago when you grew up speaking French, isn't it Brxbrx? 16:02, 26 November 2011 (UTC)
- I just learned a lot about myself. I grew up in South Central Texas and have the subtle Texas accent (somewhat similar to a southern accent) that's common for city people from around here. It's apparently no accent at all and we may as well be from from southern Ohio, PA, southern Illinois southern Indiana, or Missouri. I don't know why I even bothered taking this highly sophisticated quiz. Everyone knows these accents are basically the same. No twang at all down there on the Ohio. 16:12, 26 November 2011 (UTC)
- Like SuperJosh, I got the north-eastern one too. From the answers being given to get that I assume that's the only part of the US where you pronounce things as they're actually written. Where I come from people actually speak like Tim Healy but I've actually lost most of it since. postate 16:20, 26 November 2011 (UTC)
- Somehow, this test seems to think I'm from California, even though I once had a Californian tell me that I "have a thick Minnesotan accent." How odd. The Symphony of Noise The official spikey-haired skeptical punk 17:12, 26 November 2011 (UTC)
- I rarely hear someone with such a classically Minnesota accent as Goonie. It's not Bemidji and Fargo, but it's so obviously Minnesotan that you have to wonder if the person who thought Goonie was from CA may have been unaware of the joke that basically nobody who lives there is actually from there. It wouldn't surprise me if Angelinos didn't even notice differences between accents anymore. 18:12, 26 November 2011 (UTC)
- And I'm damn proud of my alleged accent, too! The Symphony of Noise The official spikey-haired skeptical punk 22:00, 2 December 2011 (UTC)
- Midland.--Dumpling (talk) 20:03, 26 November 2011 (UTC)
Northeast.... which is odd, considering I'm from the Southeast and have lived in the mid-Atlantic for over twenty years. MDB (talk) 20:08, 26 November 2011 (UTC)
- North Central, otherwise known as the Minnesota accent. ListenerXTalkerX 06:01, 27 November 2011 (UTC)
- Boston?!? BOSTON? This quiz is obviously bunk. Patently false. Without a doubt. I'm a New Yorker, goddammit Blue Talk 06:07, 27 November 2011 (UTC)
-
- ^u^ Haha. I actually have no idea on whether or not I do sound like a 'midland-er'? And considering I don't know many American accents besides the South...I can't say.--Dumpling (talk) 06:39, 27 November 2011 (UTC)
- Fairly accurate here. South meets Inland North, an almost even match. It also says I have a 0% match with Boston, which makes sense since the only airport, including overseas, that I've ever landed at and not understood a single word anyone was saying, was Logan. Secret Squirrel (talk) 14:59, 27 November 2011 (UTC)
- "The West / The Midland" Considering that my mother is from the US west coast, my father is from the deep south, and I grew up with all the weird language patterns, slang, accents on some words, etc. from the various places my parents lived... Plus I grew up near the west coast and in the midwest. I guess it makes sense. Not too shoddy. άλφαΤαλκ 18:38, 27 November 2011 (UTC)
- Interesting. Born in Wales but lived in other parts of the UK after age 13. So I'm not American and nobody would ever mistake me for one but I get - "Judging by how you talk you are probably from north Jersey, New York City, Connecticut or Rhode Island." New York? You're kidding, right?--BobSpring is sprung! 21:19, 28 November 2011 (UTC)
One Part of the Quiz[edit]
asks about "pen" and "pin". I have gotten into heated arguments because I pronounce them identically. I'm so accustomed to them being pronounced identically, I can't even hear the difference. (Well, I can hear it, if someone speaks very clearly. But I can't understand the difference when hearing them, only when reading them.)
A Washington Post columnist once wrote about being disappointed in someone he interviewed for a job, because the interviewee asked for an "ink pen", because that was redundant. Several people wrote him and said, "they must have been from the South -- 'pin' and 'pen' are pronounced indentically, so you specify 'stick pin' or 'ink pen'." MDB (talk) 13:13, 28 November 2011 (UTC)
- Are you a Kiwi, because they have a similar 'problem'. I well remember my Dutch colleague being flummoxed at Auckland airport when he was told to go to the."chicken disk". ГенгисYou have the right to be offended; and I have the right to offend you. 16:52, 28 November 2011 (UTC)
- Nope, I'm from the American Southeast (east Tennessee, to be exact.)
- Another peculiarity of my region's dialect is that all brands of soda are called "Coke". "Pepsi", "Sprite" and "Mountain Dew" are all types of "Coke". The exception is Grape Nehi, which is "grapedrink". One word, almost one syllable. MDB (talk) 17:03, 28 November 2011 (UTC)
- "He maybe did." ŴêâŝêîôîďMethinks it is a Weasel 23:45, 28 November 2011 (UTC)
- Ah, yes, the old Coke/pop/soda question could have pinpointed ones location even further. They also could have asked whether 'coyote' has two or three syllables, "I have" vs "I've got", "needs to be fixed" vs "needs fixed", positive-anymore sentence construction, and whether 'creek' rhymes with freak or brick. Secret Squirrel (talk) 00:15, 29 November 2011 (UTC)
- Yeah, I remember the first time I heard that somebody asked me for a pen and I said "You want a pin? This isn't sewing class," or something stupid along those lines. Much of the rest of the country can't seem to differentiate between the words Mary, merry, and marry either. Learn to vowel, dammit. Nebuchadnezzar (talk) 05:09, 30 November 2011 (UTC)
- I went east and said to someone "you're blinker is on", and they looked at me and said "what the hell are you smoking?". I pointed to their car's light and they said "oh, DIRECTIONAL." I learned about "coke" the hard way. I was a waitress in Texas, when I was 18. "I'd like a coke". "this isn't what I wanted, i wanted a 7-up". huh?????GodotAround, around, around, around, over, and under and through 19:01, 1 December 2011 (UTC)
Philsophical Answers Research Jouranal article to review[edit]
The most recent ARJ article is a philosophy piece. It's not my forte (although I porbably handle it if need be), so if someone more versed is willing, take a stab at it. steriletalk 01:54, 1 December 2011 (UTC)
- Is it just me or does that opening paragraph read more like a parody of academic writing than actual academic writing? moral 13:52, 1 December 2011 (UTC)
- The whole thing has some, erm, interesting assertions in it. steriletalk 17:29, 1 December 2011 (UTC)
- Color me underwhelmed. It boils down to 'you can't prove that the sun will rise tomorrow, therefore God'. Granted, it takes a few more steps than that, but ultimately it claims that cause and effect don't exist without the Christian God. I will counter with 'you can't prove that you aren't a brain in a jar, therefore FSM'. Or the ever-popular 'solipsism, therefore nothing'.--Martin Arrowsmith (talk) 00:35, 3 December 2011 (UTC)
F****** Qwest now centurylink[edit]
So I placed an order to move my phone and internet from my office to my home so we can work from home. Yeah! Cept, the phone and internet were not moved. Boo... I called Qwest and they say "we have no record of that transaction". I say "I have the transaction number here, buddy boy". Oh, you do. The move was to be scheduled for Wed, the 30th. Good. But it's not in our system." Yeah, that's my problem. "Oh, well we'll put it in our system. The earliest we can do it is Dec 7th". Wait, you fucked up, and **I** have to wait. I cannot work, unless I go to village in.... "Yes. it was not scheduled. now it is. anything else?" NO APPOLOGY. NO ADMITTING THEY WERE WRONG. NO discount. NOTHING. I'd drop them like a fly, but i'm under contract and it's 200 bucks per line to drop them. God I can't wait for June when teh contract is up and i go comcast! Corporations are too big, and have too little repercussions for what they do.--GodotAround, around, around, around, over, and under and through 16:32, 1 December 2011 (UTC)
- I was battling cox earlier this week while trying to convince the nut that it was just broken, not a deliberate attempt by them to do... something. Тytalk 16:43, 1 December 2011 (UTC)
- You have to remember, the jerkasses on the end of the phone when you're talking to tech support aren't really jerkasses, but just minimum-wage employees who are tired of listening to people whining/complaining, justified or not. Fluckedtalk to me :D 16:45, 1 December 2011 (UTC)
- (EC2) Yippee! You get to drop one big corporation and sign up with another. ListenerXTalkerX 16:46, 1 December 2011 (UTC)
- Well, yes. but the products are cooler on Comcast. This is for a business, and I've never been able to get a better deal out of anyone but the big guns. the whole "anti monopoly" stuff doesn't work when we are a nation this large. Cause "competition" exists... it's just as evil as every other one of them. GodotAround, around, around, around, over, and under and through 16:51, 1 December 2011 (UTC)
- @LX: Ditto. I hear Comcast blows, but it can't be all that much worse than Time-Warner. Nebuchadnezzar (talk) 16:53, 1 December 2011 (UTC)
- For those who go by the motto, "Don't be evil," with big corporations being defined as "evil," I understand that there are a number of smaller independent phone companies one can sign up with. This was made possible by your friendly anti-monopolists, who forced Ma Bell to allow other companies' equipment to be connected to their system. ListenerXTalkerX 17:08, 1 December 2011 (UTC)
- I've been quite happy with Verizon FIOS. It beats all hell out of Comcast, at least. MDB (talk) 17:22, 1 December 2011 (UTC)
- One of my friends has FIOS and it sucks as well, but I think it might have more to do with his router set-up than the service itself in his case. Nebuchadnezzar (talk) 17:39, 1 December 2011 (UTC)
- Re: small independents - if it's anything like the situation in the UK that helps very little. Most problems (and their solutions) involve the copper (or occasionally fibre) buried in the street and strung overhead. This more or less has to be a monopoly (imagine if there were a dozen telephone poles outside every house? or a dozen street cabinets at every corner), and so the small independent company usually pays the local telco monopoly to provide service. But that service is the same thing Godot is moaning about. So instead of phoning a guy who says he's not going to help, you phone a guy who says he'd love to help, but the big telco are unresponsive. This is not a substantial improvement. The most positive thing that can be said is that telco hardware is boringly reliable, so you will often go months or years without raising your blood pressure by dealing with this stuff. 188.220.41.110 (talk) 17:41, 1 December 2011 (UTC)
- I've actually worked at a tiny ISP before that provided DSL. Because we didn't own the phone lines (Verizon or Sprint or whoever did), we had to deal with them directly constantly. The only thing going with a smaller ISP solves is putting an extra layer of support between you and the people actually fixing problems. (ʞlɐʇ) ɹǝɯɯɐHʍoƆ 17:58, 1 December 2011 (UTC)
- I went with the german T-Mobile, with our cells, cause Vic (Hubby) really liked their service in France (for like 1/10th the cost here...sighs). But now they too are "big evil". How does FIOS (that's a kind of voice over IP, right?) work? would it work for business level (5 lines into one phone, roll overs and all that) too? I can change in June... it doesn't have to be comcast, that's just what i knew. would love to hear other suggestions. (if it matters, we are 80202 area code). I feel so amazingly "inadequate" around you all about computers, techie things, etc. :-) GodotAround, around, around, around, over, and under and through 18:16, 1 December 2011 (UTC)
- FIOS is FIber Optic Service, so it would just be your Internet connection, nothing more (unless they tack other stuff on there). It's much, much faster than DSL or Cable (potentially, at least. I don't know how to what extent in practice).(ʞlɐʇ) ɹǝɯɯɐHʍoƆ 18:40, 1 December 2011 (UTC)
- FIOS can give you phone and TV as well. My limited experience with it is that it doesn't seem all that much faster than cable or DSL, and it has a few annoyances. I believe you need to dial area code with every outgoing phone call, and the TV channels can be all over the place (Comedy Central, one of the few channels I like to watch, went from convenient 36 to annoying 190 when my folks switched from cable to FIOS). Small irritations, to be sure, but coupled with the fact it's usually more expensive, and doesn't seem noticeably better, I'm not sure what the big deal is. Then again, as I said, not much experience with it. DickTurpis (talk) 18:47, 1 December 2011 (UTC)
- Fiber cables send packets using light rather rather than current. The cable can be longer, and sends data faster, I work with a 40Gb/s fiber network sometimes, it's pretty fun. The reason you don't see much of an improvement is that they cut back on the bandwith to prevent flooding the connection as well as to make money. Тytalk 19:46, 1 December 2011 (UTC)
- I do believe battling cox is Cracker's and MDB's purview :D Radioactive afikomen Please ignore all my awful pre-2014 comments. 20:02, 1 December 2011 (UTC)
- CenturyLink was better when it was Embarq and before they merged with Qwest, but it's better than the alternative (Comcrap). Although I have to give both of them kudos for getting rid of trolls. DMorris2 (talk) 22:07, 2 December 2011 (UTC)
Wow, this fucking stupid[edit]
Can't tell if this is a step down or step up for creationism. Aceace 01:10, 2 December 2011 (UTC)
- You mean you don't want a Captain Antagonator costume?? Sam Tally-ho! 02:50, 2 December 2011 (UTC)
- I though this was parody, but then I saw Venomfangx and NephilimFree... WTF? Hm, maybe they duped them or cut their introduction from other videos, this thing can't be serious -- Nx / talk 07:46, 2 December 2011 (UTC)
- I think that it is authentic in that it is a real contest asking for entrees and there will be a winner, but the contest is not to actually prove creationism but to satirize it. TheCheatI run on alcohol 17:02, 2 December 2011 (UTC)
- Entrees? ГенгисYou have the right to be offended; and I have the right to offend you. 21:17, 2 December 2011 (UTC)
- Neph's voice makes my skin crawl. There's something so weird about it. But simultaneously funny. 2:02. SJ Debaser 17:25, 2 December 2011 (UTC)
In soviet Russia, Google DoS you[edit]
Meh, I'm being DoSed by Google. Well, sort of. My ISP seems to be having a serious problem with major packet loss from Google and only from google. No idea why. Of course since it seems that every fucking website uses google this that and the other, almost no sites will actually load. It's also fucking up my webcache. It has a whole bunch of connections piled up using stuck in SYN_SENT state, and it's causing squid to use 100% CPU time. The box now smells like burning solder and I may have to turn it off until this gets fixed. Fuck the google world. --JeevesMkII The gentleman's gentleman at the other site 04:14, 2 December 2011 (UTC)
- Use Bing and boycott Google whereever possible. I started boycotting Google about a year ago and now the only Google service I ever use (not counting Ads by Google, the embedded Google search engine on some websites, and other instances where I have no choice) is YouTube. DMorris2 (talk) 02:53, 3 December 2011 (UTC)
- How is Microsoft better than Google? They're both big, greedy corporations that at at times have very questionable practices and don't give a fuck about the consumer. In fact, pretty much every single corporation that exists is like that, so I just use the best product, regardless of its manufacturer (save for particularly heinous ones). Fuckertalk to me :D 05:30, 3 December 2011 (UTC)
Root races[edit]
Why don't have an article on this - - seems like the kind of thing this site would cover.— Unsigned, by: 120.144.12.131 / talk / contribs
- I don't know why Wikipedia has an article on it. At least not as written. It's pure fiction yet not presented as such. Ajkgordon (talk) 19:10, 2 December 2011 (UTC)
Greetings from Rome[edit]
My children, I have been away from this web site for some time. I'm afraid I've been a little busy lately, but I've got a few days off at Castle Gandoldo before the busy season starts (I'm an old man and I need my rest before saying Midnight Mass, y'know.)
So, is there anything the RCC can do for you godless heathens? We're already working on excommunicating that ASchlafly fellow, but the forms are a mess. We're going paperless here at the Vatican, but the SharePoint site we've set up isn't working yet. I'm probably going to ask The Big Guy to smite Bill Gates sometime soon.
Infallibly yours, PopeBenedictXVI (talk) 14:55, 2 December 2011 (UTC)
- You already smote jobs, at least spare the one that is actually doing good deeds with his fortune O.o TheCheatI run on alcohol 15:42, 2 December 2011 (UTC)
- I had nothing to do with Jobs. We've got a lot of Apple fans here at the Vatican. We were developing an iConfess app for the iPhone, but the project got bogged down when our testers determined it kept classifying jaywalking as a mortal sin, and we just couldn't get the big fixed. PopeBenedictXVI (talk) 19:08, 2 December 2011 (UTC)
- So was the Benetton advert really a photo-shop job or are you actually on kissing terms with a Muslim cleric?--BobSpring is sprung! 17:57, 2 December 2011 (UTC)
- Oh, Mullah Abdul and I go way back. And let me tell you, he doesn't just get down on his knees for prayer, if you know what I mean. PopeBenedictXVI (talk) 19:08, 2 December 2011 (UTC)
- Well, it's good to hear about you coming together like that.--BobSpring is sprung! 19:47, 2 December 2011 (UTC)
Scam?[edit]
I had a letter posted through my door which seems to have been hand posted through everyone's door on my estate. It's from a company called "The Legal Company", and talks about how they are thinking of starting class action against the site developers because... actually I won't bore you with the details. So with my sceptic hat on I went investigating. The domain name (thelegalcompany.co.uk) was only registered in Sept this year, they don't appear to actually be a law firm, as there are no results on the Law Society company search[3] (although they do say on the site "We have access to the country's greatest team of lawyers"), the domain is registered to a sole trader and not a partnership or LLP, and although they claim to be the whole "no win no fee" type, they do say "[You pay] just an administration fee which is paid only when you have an offer of insurance and which the sum is always agreed with you in advance".
The whole thing smacks of advance fee fraud to me. What do you think? CrundyTalk nerdy to me 15:44, 2 December 2011 (UTC)
I would take that letter and go see a local lawyer for an opinion. They should be able to tell you if the proposed class action has merit. You could also approach th "clerk of court" at your local courthouse because in some places misrepresenting yourself as a lawyer is an offense. The website says they have been in business for 30 years. The only thing that raises questions for me is the "insurance" they sell that covers your liability for costs should you lose. Hamster (talk) 16:30, 2 December 2011 (UTC)
- Certainly sounds very suspicious to me.--BobSpring is sprung! 17:58, 2 December 2011 (UTC)
- Send it to your local Trading Standards Office. ГенгисYou have the right to be offended; and I have the right to offend you. 21:20, 2 December 2011 (UTC)
- I want to, but I think I need something a bit more concrete than "this looks 419y". The other thing I thought about is that the complaint itself is frivolous. The complaint is that we bought these houses from all the different developers, and were told that a separate developer is going to build things like a local shop (for local people) and a pub. However, said developer has gone into administration. Therefore which are they going to sue?
- The developer who was supposed to build the amenities? If so then for what? They're in fucking administration!
- The developer(s) who sold us the houses? Why are they liable? They told us these amenities should be built soon and it isn't their fault the company has gone bankrupt
- So the suit itself won't fly, and therefore I'm convinced that this is an excuse to get people's cash via administrative fees and insurance and then just say "sorry, we can't sue (whoever)" and make a dash with the cash.
- People on the estate's facebook page are all talking about it apparently and want in. I want to warn them but I don't have an ArseBook account. CrundyTalk nerdy to me 21:26, 2 December 2011 (UTC)
"on hold" music![edit]
Odd, it's the theme to Doctor Who. at Colorado Unemployment Appeals Commission. really weird, but better than most hold music.GodotBeen on hold 14 minutes already. sheesh 21:16, 2 December 2011 (UTC)
- The old theme or the new theme? (Where? I'm in Denver) -- Seth Peck (talk) 21:22, 2 December 2011 (UTC)
- Oh my god, I"ve been on long enough that they've cycled through the music. It's BACK. I didn't know there was a new theme, so "old' i'm guessing. the only guy i watched was teh curley haired doctor. And this is the music for him. I work in downtown Denver proper, and live in the North metro area. GodotBeen on hold 14 minutes already. sheesh 21:25, 2 December 2011 (UTC)
- Gotcha. The "old" music was basically the theme for the first seven Doctors, didn't really change much, though the Seventh Doctor had a slightly different theme. The newer episodes have a more modern version of the same melody. -- Seth Peck (talk) 21:28, 2 December 2011 (UTC)
Michele Bachmann Double-Tap[edit]
I don't know how I missed these... A gay man can get married...to a woman and Intelligent Design is a Scientific Fact. Granted, I know neither of these are technically "news" but I think they's bare repeatin'. -- Seth Peck (talk) 21:20, 2 December 2011 (UTC)
- "Republican presidential candidate Michele Bachman says it’s fine for a gay man to get married — as long as it’s to a woman." And she would know. (insert rimshot here). GodotBeen on hold 14 minutes already. sheesh 21:27, 2 December 2011 (UTC)
- First of all, do not use Bachmann and the word "tap" in one sentence. Just. Please. Don't.
- Yes, well, man is also free to kill a person ... of course only if that person is yourself. --★uːʤɱ socialist 21:50, 2 December 2011 (UTC)
Artists rendering of vaginas belonging to various public figures.[edit]
I'll just leave this here. Senator Harrison (talk) 23:03, 2 December 2011 (UTC)
- That's pretty tasteless and (as far as I'm concerned), misogynistic in an particularly ugly way. PintOfStout Talk Good people drink good beer. 23:16, 2 December 2011 (UTC)
- I'm with PintOfStout on this. DMorris2 (talk) 23:37, 2 December 2011 (UTC)
- Then here, have the rest. Enjoy (: Senator Harrison (talk) 23:50, 2 December 2011 (UTC)
One way to cut down on spam....[edit]
Would be to make it so that non-autoconfirmed users cannot create new pages, no? PintOfStout Talk Good people drink good beer. 02:00, 2 December 2011 (UTC)
- Good god. so simple. yet so effective. --GodotAround, around, around, around, over, and under and through 02:05, 2 December 2011 (UTC)
- But what about their userpages..? Peter talk, or type, or whatever... 02:16, 2 December 2011 (UTC)
- What about making is so that non-autoconfirmed users can't create mainspace pages, or other popular namespaces?
- Ah, but half the spammers create their userpage, rather than in the mainspace.[4] Peter talk, or type, or whatever... 02:39, 2 December 2011 (UTC)
- Seems like throwing the baby out with the bathwater to me. Why shouldn't new users be able to create new pages? It isn't like the spam thing is unmanageable. I've block two or three myself and deleted their spam, takes about 30 seconds to do. Between us I think we've got it under control. --JeevesMkII The gentleman's gentleman at the other site 04:49, 2 December 2011 (UTC)
- ListenerXTalkerX 04:53, 2 December 2011 (UTC)
- Indeed. It's not like we are drowning in the stuff.--BobSpring is sprung! 06:41, 2 December 2011 (UTC)
- MediaWiki have a few antispam suggestions[5]. I've actually implemented stopforumspam.com on one of my forums and it works great. I had 4 blocked signups this morning alone. Is there a plugin which implements a blocklist like this into the create account page? CrundyTalk nerdy to me 09:19, 2 December 2011 (UTC)
- We also have the edit filter, so if you see a repetitive pattern in the spam, tell one of the techs. E.g. I wrote a filter to stop the loan spam that has been hitting us recently, and it's [[working nicely. -- Nx / talk 10:21, 3 December 2011 (UTC)
Essential reading on cognitive bias[edit]
In the current New York Review of Books, a review by Freeman Dyson of Thinking, Fast and Slow, by Daniel Kahneman. Truly remarkable essay.--talk 02:39, 2 December 2011 (UTC)
- Nice to see Kahneman in the news and spreading the Good Word of Irrationality. The Freud lovefest near the end stuck in my craw, though, and I don't know where he got the idea that Kahneman somehow single-handedly reinvented psychology as a quantitative science (and his late partner-in-crime should be given due as well). Psychometry was created in the late 19th century, but even before that quantitative models were used in psychophysics. Nebuchadnezzar (talk) 05:44, 2 December 2011 (UTC)
- Also, I don't know why he gets on Kahneman's case for not studying religion -- is he supposed to be an expert in everything? Dyson seems to think the study of psychology of religion consists entirely of Freud and James. That's true, if you ignore the rest of the entire field. Now that I think about it, the tail end of the article is just awful. Nebuchadnezzar (talk) 07:53, 2 December 2011 (UTC)
- I liked the essay until this bit:.
- This is just plain wrong, for obvious reasons. Tetronian you're clueless 19:32, 2 December 2011 (UTC)
- The book itself is also very good. Tetronian you're clueless 19:29, 2 December 2011 (UTC)
- Profile of Kahneman in this month's Vanity Fair. Nebuchadnezzar (talk) 02:13, 4 December 2011 (UTC)
Jeremy Clarkson and the strikers.[edit]
Does anyone agree with me that the reaction Jeremy Clarkson's comments on the strike in the UK was a bit hysterical?--BobSpring is sprung! 18:41, 2 December 2011 (UTC)
- Yes. Ajkgordon (talk) 18:51, 2 December 2011 (UTC)
- Wait, so he wants to shoot himself? Osaka Sun (talk) 19:21, 2 December 2011 (UTC)
- Context does clear it up a bit. Though it is Clarkson being Clarkson. No one takes him seriously, except the people who don't like him. gnostic 19:34, 2 December 2011 (UTC)
- Yeah, you'd think by now people would know not to take him seriously. He didn't even advocate violence against strikers, in context he was taking the piss out the Beeb. SJ Debaser 19:54, 2 December 2011 (UTC)
- British liberals seem to love getting wound up over Clarkson. I think that's why he comes out with the stuff he does - he likes to troll the left. Well, that and the fact that he's more comedian than anything else who lives on shock for humour. I often feel like the only liberal who finds him genuinely funny. ONE / TALK 20:09, 2 December 2011 (UTC)
- He's basically the nearest we have to an Ann Coulter. Though I suppose in his favour he's at least not just famous for being famous, he talks about cars too. --JeevesMkII The gentleman's gentleman at the other site 20:16, 2 December 2011 (UTC)
- When you see the whole clip in context it's obviously hyperbole, however, out of context it sounds bad. As Mondy says, those that don't like Clarkson are outraged (like Mrs. K), everyone else (like me) say DFTT. ГенгисYou have the right to be offended; and I have the right to offend you.
- I should point out that I hate Clarkson, but I still don't think he did anything wrong because he was making a comical remark. He first said that the strikes were great and then (as Josh says) said that as this was the BBC and they had to have balance they should be "executed in front of their families". Though to be fair it's the kind of joke you make down the pub and not on national TV. CrundyTalk nerdy to me 21:35, 2 December 2011 (UTC)
- I do not take clarkson seriously, but he is still a prick. AMassiveGay (talk) 22:32, 2 December 2011 (UTC)
- Honestly, what a load of old bollocks. He is responsible for one of the most successful TV shows in the world partly because he's a great self-publicist and partly because he and his team instinctively know what appeals to the show's demographic. Today was the self-publicity bit kicking in. He makes a living out of being an arse. He's trolling. And he succeeded. Probably more than he intended. He makes what is a poor joke (even when seen in context) and what do the union leaders do? Exactly what he wants. I have a suspicion that they're doing it to deflect criticism levelled at them - build up some sympathy. Some of the comments on that article in the Gruniad.... who gives a fuck what you think of Top Gear? What the fuck has that got to do with anything? Fuck me, get a sense of perspective. Who batted an eyelid when some right-on comedian said that bankers ought to be hung drawn and quartered? Are we becoming so sensitive that mildly insensitive jokes are made a sackable offence?
- The man's a dick. A successful dick. He doesn't campaign for throwing out the gypos. He doesn't have an anti-gay agenda. He doesn't rant on about anything in particular (except maybe speed cameras and global warming). He's a harmless buffoon, admits as much, and is a good bellweather against over-sensitive political correctness that simply distracts us from the real issues at large.
- Sorry for the diatribe but I've been drinking. And on that bombshell.... Ajkgordon (talk) 23:15, 2 December 2011 (UTC)
Thank's Jensen[edit]
Whether you're active here or not, I'm sure you like this wiki don't you Jensen? I could just use APNIC, RIPE, or Lookupserver.com, but I think I'll just use Rat-Wiki as my ANI for the IPs of all these proxies. I'm sure they don't mind as it's not like I'm vandalizing anything important or anything. Godspeed!!!!!!!!!!!!!!!!!!! — Unsigned, by: 209.141.61.124 / talk / contribs
- I think I speak for everyone at this wiki when I ask, who the fuck are you and what the fuck are you talking about? --JeevesMkII The gentleman's gentleman at the other site 20:12, 2 December 2011 (UTC)
- I think he (DMorris) means he's going to pwn us real good to figure out the IPs of some open proxies so that he can block them over at CP. Apparently by vandalizing RW and then looking at the IP in Recent Changes or something. Because he's too retarded to type whatsmyip.org into the proxy. -- Nx / talk 21:33, 2 December 2011 (UTC)
- Hooray for pathetic trolling!!! The Symphony of Noise The official spikey-haired skeptical punk 21:40, 2 December 2011 (UTC)
- Nah, I lookupserver.com is my personal preference. I figure if I go on a pathetic vandalism spree here every time Jensen goes on a pathetic vandalism spree at CP he'll realize how stupid and desperate it looks. 74.63.112.139 (talk) 21:44, 2 December 2011 (UTC)
- The only one looking stupid and desperate is you. -- Nx / talk 21:49, 2 December 2011 (UTC)
- The Symphony of Noise The official spikey-haired skeptical punk 21:51, 2 December 2011 (UTC)
I haven't read anything above and can only assume this thread is about Jensen Button. SJ Debaser 01:06, 3 December 2011 (UTC)
- I thought it was RJJensen, which confused me as it isn't really his style. Kid Jensen maybe? Rennie McGreet (talk) 10:50, 4 December 2011 (UTC)
Peddling anti-Islamic fear[edit]
God, probably more than anything other than homophobia, I hate people who peddle "anti islamic fear". I have a facebook friend who posted a scare video of "Muslims behead 9 year old boy". of course not one other site seems to back that up, anywhere. The conversation then involves a girl/women who says "Obama is trying to instill Sharia law in the US". Bad enough, but then she goes into rants about how dangerous Islam is, and how all Muslims want is to make the US sharia, and that both Germany and UK have passed laws making Sharia Law, and we are fighting that in court. She's trying very hard to mix right wing anti obama with anti muslim fear to sell... well just fear, I guess. But upon giving her a google showing there are no such laws in germany or the UK, she says "you are ignorant and i have no time for you". GRRRRRRRRR--Godot Malaka 20:37, 3 December 2011 (UTC)
- A similar argument used by similar people is "I'M RIGHT YOU'RE WRONG!". There was also a study done showing that these people have minds that you cannot change. When you show them facts it makes them believe the opposite even more. Senator Harrison (talk) 21:50, 3 December 2011 (UTC)
- How can you be friends, FB or IRL, with someone that stupid and hateful? PintOfStout Talk Good people drink good beer. 21:53, 3 December 2011 (UTC)
- Can't be as bad as Frank Gaffney -- one of the reigning champions of today's know nothingism and too nuts even for CPAC. Nebuchadnezzar (talk) 22:24, 3 December 2011 (UTC)
- POS, they are generally friends of friends. and i just try to show them the error of their ways, despite my better self. ;-) A year ago or so, I was in a bad place, and played facebook games All. The. Time. an addition. some of these friends are residuals that I didn't even know I had.Godot Malaka 08:28, 4 December 2011 (UTC)
Account creation[edit]
So what're all the new accounts about? Spammer or troll? ГенгисYou have the right to be offended; and I have the right to offend you. 22:24, 3 December 2011 (UTC)
- Most probably spammer. Conservative Punk (talk) 22:25, 3 December 2011 (UTC)
- Spammers. See also Special:AbuseLog for the edits that were rejected by the edit filter. Hit details to view the diff. -- Nx / talk 22:32, 3 December 2011 (UTC)
- Thnx Nx. ГенгисYou have the right to be offended; and I have the right to offend you. 22:36, 3 December 2011 (UTC)
- My word. Now that's pretty cool.--BobSpring is sprung! 22:46, 3 December 2011 (UTC)
- Now, I'm no advertising guru, but I'm struggling to find the logic behind the "Ok, we need to get our name out there, so go to as many random sites as you can, and annoy them by posting random crap about our company" marketing campaign. It's a bit like you coming home and finding "Shop at Walmart" sprayed on your front door. --PsyGremlinParla! 11:14, 4 December 2011 (UTC)
- I'm often tempted to contact these companies with a mesage saying 2i will never buy your stuff because you spammed me" but I'm afarid I'd just get even more spam if I did. I sometimes think there's no human involvement in spam at all - most of them are just skynet realising there's more money in business than war. Rennie McGreet (talk) 11:21, 4 December 2011 (UTC)
- No one thinks advertising like this really works on them, but it does. If you try, I bet you can name at least two or three of the products being advertised by the spammers. And those are just the ones you remember consciously. Research shows that over time, the negative associations we have for such identified products falls away, while you still retain the valuable brand recognition and product awareness. Plus, there's always the tiny chance that someone on a wiki site will click a link and buy a product right away. Alas, it works.--talk 20:13, 4 December 2011 (UTC)
- I was reading somewhere that they do it to increase the number of links to their site so it'll be more prominent on a certain search engine beginning with G. Sam Tally-ho! 22:18, 4 December 2011 (UTC)
Whistlin' Dixie[edit]
Brief but good profile of the neo-Confederate League of the South (LoS) up on AlterNet, showing how these organizations that are ostensibly historical societies are infiltrated and co-opted by extremists and pseudohistorians. The general public seems to think that a number of comments made by the usual suspects on the wingnut circuit (e.g., Obama is racist against white people, slavery wasn't that bad, etc.) are "gaffes", but they really aren't -- they are completely logical within the fundamentalist/neo-Confederate paradigm. LoS has been a primary player in the resurrection of the "theological war" and Christian nation thesis. The religious right legal-educational complex was designed to spit out products like Michele Bachmann. And she's not the only one embracing neo-Confederate nonsense. The religious right's brand of Christianity is as much southern as it is Christian, if not more. Nebuchadnezzar (talk) 22:01, 4 December 2011 (UTC)
- One of the Bachmann links is broken, but there's more good stuff here. Nebuchadnezzar (talk) 22:30, 4 December 2011 (UTC)
Deja vu[edit]
So I finished writing something, got up and walked to pour a cup of tea and I suddenly got a massive rush of deja vu. I thought "I've written this before, and had a massive discussion on this idea and already know what is coming next", and literally stumbled. It was properly WTF deja vu. Then it stuck with a slight epiphany too (if I dare say it). Could the experience be due to you thinking of something faster than you can think about it? As if all the neural patterns in your head corresponding to a thought fire off at the same time - it happens so quick you can't vocalise it to yourself with your internal monologue. So from this you get a feeling that something has happened before because it all hits you at once and you become disorientated as your more "concious" thoughts catch up. I'll look up other explanations and see if there are better ones, but it seemed like this at the time. gnostic 19:17, 4 December 2011 (UTC)
- I don't really follow but it sounds pretty cool. Sam Tally-ho! 22:20, 4 December 2011 (UTC)
- I'm not sure what the jumble of words toward the end means, but planning in the form of prospective memory uses similar processes to actual memory. So you could easily confabulate a false memory for something you planned to do. Nebuchadnezzar (talk) 22:39, 4 December 2011 (UTC)
- Weird deja vu-y feeling is gone, so I'm not sure what I'm talking about anymore either. theist 23:21, 4 December 2011 (UTC)
- I seem to remember reading something that suggested that deja-vu was one of your brain's ways of dealing with extreme situations (which can sometimes misfire). The idea is that when posed with a stressful situation that needs a quick resolution, your brain sifts through thousands of old memories trying to find a match which got you out of a similar situation in the past, which does explain the whole "life flashing before your eyes" phenomenon when having a near-death experience. CrundyTalk nerdy to me 09:32, 5 December 2011 (UTC)
- Now, I only got a minor in Psych, and I often feel outclassed by Neb in these discussions, but I did specialize in memory. We were taught essentially what you just described. Occasionally while making a memory, there's a mis-fire, and you make the memory at the same time you're searching for the memory, trying to see if you've "done this before" and you find it there, happily chilling where you expect it to be (since you're writing it as you're reading it). Quarurabbi - You can't explain that! 12:05, 5 December 2011 (UTC)
- Following the Penn Jillette link above serendipitously led me to this. ГенгисYou have the right to be offended; and I have the right to offend you. 16:21, 5 December 2011 (UTC)
- Sounds like "life flashing before your eyes". But as you said, that sort of thing can misfire occasionally. This must be what a segfault feels like. bomination 19:06, 5 December 2011 (UTC)
- But what about vuja de? Nebuchadnezzar (talk) 19:10, 5 December 2011 (UTC) | https://rationalwiki.org/wiki/RationalWiki:Saloon_bar/Archive131 | CC-MAIN-2022-21 | refinedweb | 20,719 | 71.04 |
Operators are part of every programming language, and C# is no different. When it comes to business logic inside our applications, there are two main types to consider. One is built-in, and the other is custom. In this guide, we will cover built-in types and what types of operators are provided by C#. After this, we will dive deeper into comparison operators.
Built-in ypes fall into five different categories.
These could be expanded into further subcategories, but the most important thing to remember is that they are different in resolution and the amount of space allocated in memory for storing them. There is a neat trick I would like to show you that demonstrates how to allocate the size of a specific instance in memory.
1using System; 2 3namespace Pluralsight 4{ 5 6 public class BuiltInSize 7 { 8 9 public static void Main() 10 { 11 Console.WriteLine($"int has size of {sizeof(int)} bytes"); 12 Console.WriteLine($"double has size of {sizeof(double)} bytes"); 13 Console.WriteLine($"decimal has size of {sizeof(decimal)} bytes"); 14 Console.WriteLine($"char has size of {sizeof(char)} bytes"); 15 Console.WriteLine($"bool has size of {sizeof(bool)} bytes"); 16 Console.ReadKey(); 17 } 18 } 19}
The output should be as follows.
1int has size of 4 bytes 2double has size of 8 bytes 3decimal has size of 16 bytes 4char has size of 2 bytes 5bool has size of 1 bytes
When you are developing any application, you should always use the type closest in allowed size to what your data may become. This reduces the memory footprint and results in a better performing app that is easy to troubleshoot.
The object type is nothing more than an alias for the built-in type of the .NET framework object. Its speciality is that every new object inherits from it and can further expand on the capabilities inherited.
There are some limitations to built-in types as to what kind of information can be stored in them.
C# was written with common sense, so permitted operations on specific types should come naturally after a while. For example, there would be no point in dividing a string with a float or multiplying the true value of a bool variable with a string.
Operators are basically special symbols that take an operand or two and perform specific actions based on the permitted operations of the given type. There are six main categories for these operators on built-in types.
Some operators can be overloaded. The point of overloading them is to imbue their capabilities to work with user-defined types.
When you have an expression, operator precedence and associativity will determine the order of the operations and how they are performed. The jolly joker is the parenthesis, which can override default behavior.
Comparison operators fall into the relational operators category and are supported by all integral and floating point numeric types.
This operator will return true if the left-hand operand is less than the right-hand operand, otherwise it will be false.
Let's look at a small demonstration.
1Console.WriteLine($"5 < 7 : {5 < 7}"); 2Console.WriteLine($"3.0 < 11.99 : {3.0 < 11.0}"); 3Console.WriteLine($"a < b {'a' < 'b'}");
The output should be as follows.
15 < 7 : True 23.0 < 11.99 : True 3a < b True
The following comparisons would result in a compile time error.
1Console.WriteLine("asting" < 'b'); 2Console.WriteLine(true < false);
The reason for this is that the operator does not support string and bool operands.
This operator will return true if the left-hand operand is greater than
The operator will return true if the left-hand operand is less than or equal to the right-hand operand, otherwise it will be false.
1Console.WriteLine($"5 <= 7 : {5 <= 7}"); 2Console.WriteLine($"3.0 <= 11.99 : {3.0 <= 11.0}"); 3Console.WriteLine($"a <= b {'a' <= 'b'}");
The output should be as follows.
15 <= 7 : True 23.0 <= 11.99 : True 3a <= b True
This operator will return true if the left-hand operand is greater than or equal to
This operator will return true if the left hand operand is equal to the right hand operand, otherwise false.
1Console.WriteLine($"5 == 7 : {5 == 7}"); 2Console.WriteLine($"3.0 == 3.00 : {3.0 == 3.00}"); 3Console.WriteLine($"c == c {'c' == 'c'}");
The output should be as follows.
15 == 7 : False 23.0 == 3.00 : True 3c == c True
This operator will return true if the left hand operand is not equal to the right hand operand, otherwise true.
1Console.WriteLine($"5 != 7 : {5 != 7}"); 2Console.WriteLine($"3.0 != 3.00 : {3.0 != 3.00}"); 3Console.WriteLine($"c != c {'c' != 'c'}");
The output should be as follows.
15 != 7 : True 23.0 != 3.00 : False 3c != c False
In this guide, you have learned what operators are and what the most important built-in types are. We took the relational operators and demonstrated all of their functionality on three basic data types. I hope this has been informative to you and I would like to thank you for reading it! | https://www.pluralsight.com/guides/comparison-operators-and-built-in-types-in-c | CC-MAIN-2022-27 | refinedweb | 849 | 65.22 |
hash — hash
database access method
#include
<sys/types.h>
#include <db.h>
The
dbopen()
routine { unsigned int bsize; unsigned int ffactor; unsigned int nelem; unsigned int cachesize; u_int32_t (*hash)(const void *, size_t); int lorder; } HASHINFO;
The elements of this structure are as follows: ndbm(3) are provided, although these interfaces are not compatible with previous file formats.
The
hash access method routines may fail
and set errno for any of the errors specified for the
library routine dbopen(3).
btree(3), dbopen(3), recno(3)
Per-Ake Larson, Dynamic Hash Tables, Communications of the ACM, April 1988.
Margo Seltzer, A New Hash Package for UNIX, USENIX Proceedings, Winter 1991.
Only big and little endian byte order is supported. | https://man.openbsd.org/hash.3 | CC-MAIN-2021-43 | refinedweb | 118 | 55.84 |
Date: Mon, 28 Jun 1999 07:29:37 -0400
From: Darin White <d.w@IBM.NET>
To: BUGTRAQ@netspace.org
Subject: Cognos PowerPlay Web Edition security
WEB SECURITY ADVISORY
-------------
Release Date: 1999-06-25
Application: Cognos PowerPlay Web Edition
Severity: Unauthenticated web users can sniff cube data
Author: Darin White
Operating Sys: Microsoft NT Server
--------------
I. Description
Due to design problems as well as some potential web server
misconfiguration PowerPlay Web Edition may serve up data cubes
in a non-secure manner. Execution of the PowerPlay CGI
pulls cube data into files in an unprotected temporary
directory. Those files are then fed back to frames in the
browser. In some cases it is trivial for an unauthenticated
user to tap into those data files before they are purged.
Cognos has been contacted but does not regard this as a
serious exposure (see appendix B below).
The issues are:
(a) dynamic directory listing
(b) weak temporary filename algorithm
(c) ad hoc parameters to the CGI
II. Details
Identifying PowerPlay sites is quickly accomplished using AltaVista?
pg=q&kl=XX&q=%2Blink%3Appdscgi.exe&search=Search
(join last two lines) which hits all pages containing a link to the
PowerPlay CGI ppdscgi.exe on NT.
Normal authentication for protected cubes occurs when a user selects
a link like:
<A href="/cgi-bin/ppdscgi.exe?XT=EXAMPLE&LA=en&LO=en">Example</a>
At this point the user is prompted for a userid and password.
Beyond this check there seems to be no verification that data
is being fed out to the browser that requested it and was
authorized.
(a) dynamic directory listing
Netscape Enterprise Server 3.5.1 appears to be serving up dynamic
directory listings by default. A known PowerPlay site can be hit
with a request for which will
return something like:
/ppwb/Temp/ -
6/25/99 9:17 AM 17904 1ad6t.htm
6/25/99 9:17 AM 37828 1ad6x.htm
Here we see two temporary files created by one initial cube request.
The suffix 't' in the first filename denotes the PowerPlay toolbar
and 'x' denotes the data content. These files are fed back to the
browser to populate two frames. Clicking on the content filename
will allow any user to browse the current cube view with no
authentication challenge even if the cube has been password-protected.
Once into the cube the user may continue to drill for further data.
(b) weak temporary filename algorithm
Sites that have disabled directory listing may still be vulnerable.
Many sites using PowerPlay offer a mix of protected and unprotected
cubes. Some sites also offer an anonymous user account (let's say
"guest" for example). The PowerPlay CGI uses a common temporary
directory for serving all cubes back to the browser. Using the
guest account or viewing an unprotected cube a user may right-click
the content area and select View Frame Info which will display
the temporary filename. By repeatedly reloading the initial cube
view and viewing frame info a list of temporary filenames may be
generated in order to analyze the filename algorithm. e.g.
Analysis of the filename progression shows:
* the last char is 'x' for the data and 't' for the toolbar
* first n-1 chars are hexadecimal chars only
* the hexadecimal "numbers" comprising the filename are ascending only
* the first char is never 0. e.g. fffx.htm => 1000x.htm
* simple hexadecimal subtraction on the first n-1 chars of consecutive
filenames shows a very predictable pattern (see appendix A)
A user may orient themselves in the namespace (the set of all possible
filenames) by using a guest account or unprotected cube. Once oriented
a set of candidate filenames may be generated and requested from
/ppwb/Temp on the server. Of course this approach assumes valid
users are hitting the cubes at the same time. Once a successful
hit has been made on a temporary file the user may drill further
into the data as described in (a) above.
Alternatively a brute force attack on a server could be attempted
by just submitting requests for all possible filenames. Of course if
you could establish some idea of how long the site has been operational
you might start with 4-char filenames. A very new site with low traffic
(if the owner displays a page counter) might be best approached with
3-char names. This type of attack would present a beat-the-clock
situation as the ~65000 requests (for 4-char) scanned for an existing
file before it was purged from the Temp directory.
(c) ad hoc parameters to the CGI
A variety of parameters to
provide additional information on the PowerPlay server.
* ?ABOUT= will return the version of PowerPlay.
* ?TOC (or no parameter) presents a table of contents list of all
web-enabled cubes on the server. Some sites are using static page
links to hit cubes rather than relying on PowerPlay's generated TOC.
They may not be aware that all cubes are available.
* the hidden parm PPWB in the data contents frame details the unaliased
location of the temporary directory. e.g.
INPUT
III. Solution
(a) dynamic directory listing
Turn this feature off on you web server following the directions
provided by the server vendor. If you are unable to disable this
feature you may create an index.html file in the /ppwb/Temp directory
that will load when a filename has not been specified in the URL.
(b) weak temporary filename algorithm
This is really on Cognos' plate. Watch your error logfile for
a lot of failed requests for /ppwb/Temp/*.htm to at least detect
an attack. Removing anonymous cube access may slow an attack.
(c) ad hoc parameters to the CGI
Just be aware of what is available by altering the parameters.
Don't assume your cubes are hidden because there is no direct
link to the table of contents from the web. Password protect
your cubes.
DW
APPENDIX A
Here's the output of one subtraction run which shows the v6.5
temporary filenames and then the hex delta between adjacent filenames:
Processing test.dat ...
2161x.htm
216bx.htm Ax
2188x.htm 1Dx
2192x.htm Ax
219cx.htm Ax
21a6x.htm Ax
21afx.htm 9x
21b9x.htm Ax
21c3x.htm Ax
21cdx.htm Ax
21d7x.htm Ax
21e0x.htm 9x
21eax.htm Ax
21f4x.htm Ax
21fex.htm Ax
2207x.htm 9x
2211x.htm Ax
221bx.htm Ax
2225x.htm Ax
222fx.htm Ax
2238x.htm 9x
2242x.htm Ax
224cx.htm Ax
2256x.htm Ax
2260x.htm Ax
2269x.htm 9x
2273x.htm Ax
227dx.htm Ax
2287x.htm Ax
2291x.htm Ax
229ax.htm 9x
SUMMARY
diff count
A : 23
1D : 1
9 : 6
out of 31 filenames
Here are some other summaries:
SUMMARY
diff count
203B : 1
DF : 1
13 : 4
A : 10
14 : 3
27 : 1
9 : 1
out of 22 filenames
SUMMARY
diff count
3E : 1
A : 19
9 : 5
out of 26 filenames
Analysis of filenames created under v6.0 of PowerPlay Web Ed. showed:
25bx.htm
25cx.htm 1x
25dx.htm 1x
25ex.htm 1x
25fx.htm 1x
260x.htm 1x
261x.htm 1x
262x.htm 1x
263x.htm 1x
264x.htm 1x
265x.htm 1x
266x.htm 1x
267x.htm 1x
268x.htm 1x
269x.htm 1x
26ax.htm 1x
26bx.htm 1x
26cx.htm 1x
SUMMARY
diff count
1 : 17
out of 18 filenames
SUMMARY
diff count
37E : 1
1 : 491
out of 493 filenames
SUMMARY
diff count
1E7 : 1
1 : 295
out of 297 filenames
SUMMARY
diff count
1 : 1255
out of 1256 filenames
APPENDIX B
1999-06-10 analysis submitted to Cognos
1999-06-11 submission acknowledged
1999-06-18 response from Cognos (below)
-----------------------------
Hello Darin,
Thank you for the descriptive analysis of your problem. I understand that
you have set up anonymous access and therefore you are aware of the security
risk. I agree that the temp file generation is predictable and would suggest
logging an enhancement through our web site.
In the interim you have to weigh what is acceptable in terms of security
knowing that there are other alternatives such as SSL and LDAP. These other
options will of course offer substantially more protection.
In conclusion your analysis is correct, now it is a factor of weighing your
security wants and needs.
Regards,
Michael Bockholt
Cognos Support Specialist
Tel: 1-800-637-7447
-----------------------------
--------------------------------------------------------------------
Darin White
d.w@ibm.net
-------------------------------------------------------------------- | http://packetstormsecurity.org/files/11769/cognos.powerplay.txt.html | crawl-003 | refinedweb | 1,404 | 59.8 |
What's New in Extensions
This page lists the API and manifest changes made in recent releases.
Google Chrome 46
New APIs
- certificateProvider: Use this API to expose certificates to the platform which can use these certificates for TLS authentications.
- enterprise.deviceAttributes: Use the
chrome.enterprise.deviceAttributesAPI to read device attributes. Note: This API is only available to extensions force-installed by enterprise policy.
- instanceID: Use
chrome.instanceIDto access the Instance ID service.
Google Chrome 45
New APIs
- chrome.vpnProvider).
Google Chrome 44
New APIs
- documentScan: Use the
chrome.documentScanAPI to discover and retrieve images from attached paper document scanners.
- printerProvider: The
chrome.printerProviderAPI exposes events used by print manager to query printers controlled by extensions, to query their capabilities and to submit print jobs to these printers.
Google Chrome 43
New APIs
- vpnProvider: Use the
chrome.vpnProviderAPI to implement a VPN client.
- networking.config: Use the
networking.configAPI to authenticate to captive portals.
Google Chrome 40
New APIs
- fileSystemProvider: Use the
chrome.fileSystemProviderAPI to create file systems, that can be accessible from the file manager on Chrome OS.
Google Chrome 39
New APIs
- extensionTypes: The
chrome.extensionTypesAPI contains type declarations for Chrome extensions.
Google Chrome 37
New APIs
- sessions: Use the
chrome.sessionsAPI to query and restore tabs and windows from a browsing session.
- accessibilityFeatures: Use the
chrome.accessibilityFeaturesAPI to manage Chrome's accessibility features. This API relies on the ChromeSetting prototype of the type API for getting and setting individual accessibility features. In order to get feature states the extension must request
accessibilityFeatures.readpermission. For modifying feature state, the extension needs
accessibilityFeatures.modifypermission. Note that
accessibilityFeatures.modifydoes not imply
accessibilityFeatures.readpermission.
- enterprise.platformKeys: Use the
chrome.enterprise.platformKeysAPI to generate hardware-backed keys and to install certificates for these keys. The certificates will be managed by the platform and can be used for TLS authentication, network access or by other extension through chrome.platformKeys.
Google Chrome 35
New APIs
- gcm: Use
chrome.gcmto enable apps and extensions to send and receive messages through the Google Cloud Messaging Service.
Google Chrome 34
New APIs
- desktopCapture: Desktop Capture API that can be used to capture content of screen, individual windows or tabs.
Google Chrome 33
New APIs
- declarativeContent: Use the
chrome.declarativeContentAPI to take actions depending on the content of a page, without requiring permission to read the page's content.
Google Chrome 32
New APIs
- system.memory: The
chrome.system.memoryAPI.
- system.cpu: Use the
system.cpuAPI to query CPU metadata.
Google Chrome 31
New APIs
- tabCapture: Use the
chrome.tabCaptureAPI to interact with tab media streams.
- downloads: Use the
chrome.downloadsAPI to programmatically initiate, monitor, manipulate, and search for downloads.
- wallpaper: Use the
chrome.wallpaperAPI to change the ChromeOS wallpaper.
Google Chrome 30
New APIs
- system.storage: Use the
chrome.system.storageAPI to query storage device information and be notified when a removable storage device is attached and detached.
Google Chrome 29
New APIs
Google Chrome 28
New APIs
- tts: Use the
chrome.ttsAPI to play synthesized text-to-speech (TTS). See also the related ttsEngine API, which allows an extension to implement a speech engine.
- topSites: Use the
chrome.topSitesAPI to access the top sites that are displayed on the new tab page.
- fontSettings: Use the
chrome.fontSettingsAPI to manage Chrome's font settings.
- permissions: Use the
chrome.permissionsAPI to request declared optional permissions at run time rather than install time, so users understand why the permissions are needed and grant only those that are necessary.
- input.ime: Use the
chrome.input.imeAPI to implement a custom IME for Chrome OS. This allows your extension to handle keystrokes, set the composition, and manage the candidate window.
- omnibox: The omnibox API allows you to register a keyword with Google Chrome's address bar, which is also known as the omnibox.
- devtools.panels: Use the
chrome.devtools.panelsAPI to integrate your extension into Developer Tools window UI: create your own panels, access existing panels, and add sidebars.
- browsingData: Use the
chrome.browsingDataAPI to remove browsing data from a user's local profile.
- pageAction: Use the
chrome.pageActionAPI to put icons in the main Google Chrome toolbar, to the right of the address bar. Page actions represent actions that can be taken on the current page, but that aren't applicable to all pages. Page actions appear grayed out when inactive.
- fileBrowserHandler: Use the
chrome.fileBrowserHandlerAPI to extend the Chrome OS file browser. For example, you can use this API to enable users to upload files to your website.
- devtools.inspectedWindow: Use the
chrome.devtools.inspectedWindowAPI to interact with the inspected window: obtain the tab ID for the inspected page, evaluate the code in the context of the inspected window, reload the page, or obtain the list of resources within the page.
- power: Use the
chrome.powerAPI to override the system's power management features.
- devtools.network: Use the
chrome.devtools.networkAPI to retrieve the information about network requests displayed by the Developer Tools in the Network panel.
- proxy: Use the
chrome.proxyAPI to manage Chrome's proxy settings. This API relies on the ChromeSetting prototype of the type API for getting and setting the proxy configuration.
- commands: Use the commands API to add keyboard shortcuts that trigger actions in your extension, for example, an action to open the browser action or send a command to the extension.
- extension: The
chrome.extensionAPI has utilities that can be used by any extension page. It includes support for exchanging messages between an extension and its content scripts or between extensions, as described in detail in Message Passing.
- runtime: Use the
chrome.runtimeAPI to retrieve the background page, return details about the manifest, and listen for and respond to events in the app or extension lifecycle. You can also use this API to convert the relative path of URLs to fully-qualified URLs.
-.
- browserAction: Use browser actions to put icons in the main Google Chrome toolbar, to the right of the address bar. In addition to its icon, a browser action can have a tooltip, a badge, and a popup.
- webRequest: Use the
chrome.webRequestAPI to observe and analyze traffic and to intercept, block, or modify requests in-flight.
- bookmarks: Use the
chrome.bookmarksAPI to create, organize, and otherwise manipulate bookmarks. Also see Override Pages, which you can use to create a custom Bookmark Manager page.
- management: The
chrome.managementAPI provides ways to manage the list of extensions/apps that are installed and running. It is particularly useful for extensions that override the built-in New Tab page.
- privacy: Use the
chrome.privacyAPI to control usage of the features in Chrome that can affect a user's privacy. This API relies on the ChromeSetting prototype of the type API for getting and setting Chrome's configuration.
- notifications: Use the
chrome.notificationsAPI to create rich notifications using templates and show these notifications to users in the system tray.
- i18n: Use the
chrome.i18ninfrastructure to implement internationalization across your whole app or extension.
- idle: Use the
chrome.idleAPI to detect when the machine's idle state changes.
- contentSettings: Use the
chrome.contentSettingsAPI to change settings that control whether websites can use features such as cookies, JavaScript, and plugins. More generally speaking, content settings allow you to customize Chrome's behavior on a per-site basis instead of globally.
- history: Use the
chrome.historyAPI to interact with the browser's record of visited pages. You can add, remove, and query for URLs in the browser's history. To override the history page with your own version, see Override Pages.
- tabs: Use the
chrome.tabsAPI to interact with the browser's tab system. You can use this API to create, modify, and rearrange tabs in the browser.
- contextMenus: Use the
chrome.contextMenusAPI to add items to Google Chrome's context menu. You can choose what types of objects your context menu additions apply to, such as images, hyperlinks, and pages.
- storage: Use the
chrome.storageAPI to store, retrieve, and track changes to user data.
-.
- events: The
chrome.eventsnamespace contains common types used by APIs dispatching events to notify you when something interesting happens.
- pageCapture: Use the
chrome.pageCaptureAPI to save a tab as MHTML.
- types: The
chrome.typesAPI contains type declarations for Chrome.
- windows: Use the
chrome.windowsAPI to interact with browser windows. You can use this API to create, modify, and rearrange windows in the browser.
- alarms: Use the
chrome.alarmsAPI to schedule code to run periodically or at a specified time in the future.
Google Chrome 22
Additions to existing APIs
- Background pages can optionally be non-persistent, using a feature we call
event pages. Event pages run only while they're being used, and will unload when idle to save resources.
Google Chrome 21
Additions to existing APIs
- The types.ChromeSetting.set method now has a
regular_onlyscope.
- The browsingData.RemovalOptions now has an
originTypesproperty.
- The management.uninstall method now has a
showConfirmDialogparameter.
- The contextMenus.create method now allows you to specify unique IDs for each item. This is intended to be used with the new
contextMenus.onClickedevent, to distinguish the clicked item.
- The browserAction.setIcon and pageAction.setIcon methods now accept optional callbacks.
- The privacy.websites namespace now has a
protectedContentEnabledproperty.
- The
indexparameter to the tabs.move method now accepts -1 to indicate that the tab should be placed at the end.
- The
windowIdparameter to the tabs.highlight method is now optional.
Google Chrome 20
Additions to existing APIs
- The chrome.contextMenus contextMenus.create and contextMenus.update methods now have an
enabledparameter.
- The privacy API's privacy.services object now has a
spellingServiceEnabledsetting.
- The chrome.tabs tabs.executeScript and tabs.insertCSS now accept a runAt parameter.
- The
sendRequest()method has been deprecated in favor of the
sendMessage()method for both the runtime.sendMessage and tabs.sendMessage.
Manifest changes
- Manifest version 1 was deprecated in Chrome 18 and will be phased out according to the Manifest version 1 support
Google Chrome 19
Additions to existing APIs
- The window API's windows.Window object now has an
alwaysOnTopproperty and supports the fullscreen state.
- The
chrome.tabstabs.query method now has the
currentWindowand
lastFocusedWindowparameters.
- The browser action API has the following new getter functions: browserAction.getTitle, browserAction.getBadgeText, browserAction.getBadgeBackgroundColor, and browserAction.getPopup.
- The page action API has the following new getter functions: pageAction.getTitle and pageAction.getPopup.
Google Chrome 18
Additions to existing APIs
- The chrome.tabs tabs.create and tabs.update methods now have an
openerTabIdparameter
Manifest changes
- The new manifest version field specifies the version of the manifest that your package requires. As of Chrome 18, you should use manifest version 2.
- The new Content Security Policy (CSP) field is used to define an extension's policies towards the types of content that can be loaded and executed by the extension.
- Most background pages only include a list of script files. For these background pages, you can use the new background.scripts property and Chrome will generate a background page for you.
- The new web_accessible_resources field specifies the paths of packaged resources that are expected to be usable in the context of a web page.
Google Chrome 17
Additions to existing APIs
- The management API's management.ExtensionInfo object now has a
disabledReasonproperty.
- The omnibox API now works in split incognito mode.
Manifest changes
- Permissions can be optional for the content setting API, the web navigation API, and the new web request API.
Google Chrome 16
Additions to existing APIs
- The new tabs.query method gets all tabs that have the specified properties or all tabs if no properties are specified.
- The new tabs.reload method reloads a tab and includes the option to preserve the local cache of the reloaded tab.
- The management API's management.ExtensionInfo object now has an
updateURLproperty.
- You can now limit the supported locales for an external extension by adding the
supported_localesattribute to the
external_extensions.json.
- The methods
getAllInWindow()and
getSelected()have been deprecated. To get details about all tabs in the specified window, use tabs.query with the argument {'windowId': windowId}. To get the tab that is selected in the specified window, use
chrome.tabs.query()with the argument
{'active': true}.
- You are no longer required to specify the
tabIdfor the tabs.update method. When not provided, the tabId defaults to the selected tab of the current window.
- External extension files on Mac OS can now be owned by users within a wheel group (or an admin group).
- Experimental permission for deprecated windows.create panel type.
Manifest changes
- The new requirements field allows you to declare extension requirements up front. For example, you can use this field to specify that your app requires 3D graphics support in order to use features such as CSS 3D Tranforms or WebGL.
Google Chrome 15
Additions to existing APIs
- You can retrieve permission warnings using the new management API methods management.getPermissionWarningsById and management.getPermissionWarningsByManifest.
- The management API’s management.ExtensionInfo object has a new field, offlineEnabled.
- You can now internationalize content script CSS files by using __MSG_messagename__ placeholders.
- The callback for the tabs.update method is passed null instead of the tab details if the extension does not have the tabs permission.
Manifest changes
- The new offline_enabled field lets you specify that your app works well even without an internet connection.
Google Chrome 14
Additions to existing APIs
- An optional drawAttention field in windows.update's updateInfo object lets you specify that the window should entice the user to change focus to it.
- The new bookmarks.getSubTree function lets you retrieve just part of the Bookmarks hierarchy
- The tabs permission is no longer required for tabs.remove and tabs.onRemoved.
Manifest changes
- The new content_security_policy field can help prevent cross-site scripting vulnerabilities in your extension.
- The new nacl_modules field lets you register Native Client modules as content handlers for MIME types.
Google Chrome 13
Additions to existing APIs
- Content scripts can now make cross-origin XMLHttpRequests to the same sites that their parent extension can, eliminating the need to relay these requests through a background page.
- You can now use
@run-atin an imported Greasemonkey script to control when the script is injected. It works the same way as
run_atin content scripts.
Manifest changes
- A new
exclude_matchesitem in the content_scripts field lets you target your content script more precisely. For details, see Match patterns and globs.
- New clipboardRead and clipboardWrite permissions specify capabilities for
document.execCommand().
Google Chrome 12
Additions to existing APIs
- Two new
chrome.extensionmethods—extension.isAllowedFileSchemeAccess and extension.isAllowedIncognitoAccess—let you determine whether your extension has increased access, which the user specifies using the extensions management page (chrome://extensions).
- The windows.create method can now take a
focusedvalue. Previously, all new windows had the keyboard focus; now you can create windows without interrupting the user's typing.
- If the manifest specifies experimental permission, your extension can specify panel as the value of the
typefield in the windows.create method or the windows.Window type.
- The
chrome.contextMenuscontextMenus.create and contextMenus.update methods now let you specify a context value of frame
Google Chrome 11
Additions to existing APIs
- For security reasons, you can no longer call tabs.captureVisibleTab on just any tab. Instead, you now must have host permission for the URL displayed by that tab. To get the previous behavior, specify
for the host permission.
- The management API's management.ExtensionInfo object now has a
homepageUrlproperty.
- The management API now lets you get the icons of disabled apps and extensions. Also, you can now modify the regular icon's URL to get its disabled equivalent. See management.IconInfo for details.
Google Chrome 10
Additions to existing APIs
- The windows.create method now has a
tabIdfield. You can use it to move a tab or panel into a new window.
Manifest changes
- The new background permission extends the life of Chrome, allowing your extension or app to run even when Chrome has no windows open.
Google Chrome 9
Additions to existing APIs
- The tabs.Tab object now has a
pinnedproperty that's reflected in various
chrome.tabsmethods. For example, you can tabs.create a pinned tab.
- The windows.create method can now take a list of URLs, letting you create multiple tabs in the new window.
- The new management.get method lets you get information about the specified extension or app.
Manifest changes
- The homepage_url field lets you specify the extension or app's homepage.
Google Chrome 7
Manifest changes
- Introduced split incognito mode as the default for installable web apps (also available to extensions).
- The tabs API
create()and
update()methods no longer require the tabs permission, removing one common cause of scary dialogs.
Google Chrome 6
Additions to existing APIs
- The extension.getViews method can now return popup views.
- A new windows.WINDOW_ID_NONE constant identifies when focus shifts away from the browser.
- The new tabs.getCurrent method returns the tab associated with the currently executing script.
Manifest changes
- The geolocation permission gives an extension access to the user's physical location.
- Match patterns can now select all schemes or all URLs.
- Access to URLs no longer triggers the access to your machine security warning, but now requires user opt-in from the extensions management page. | https://developer.chrome.com/extensions/whats_new | CC-MAIN-2019-13 | refinedweb | 2,851 | 52.66 |
Have you ever wanted to automatically extract HTML tables from web pages and save them in a proper format in your computer ? If that's the case, then you're in the right place, in this tutorial, we will be using requests and BeautifulSoup libraries to convert any table in any web page and save it in our disk.
We will be also using pandas to easily convert to CSV format (or any format that pandas supports). If you haven't requests, BeautifulSoup and pandas installed, then install them with the following command:
pip3 install requests bs4 pandas
Open up a new Python file and follow along, let's import the libraries:
import requests import pandas as pd from bs4 import BeautifulSoup as bs
We need a function that accepts the target URL, and gives us the proper soup object:
USER_AGENT = "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.157 Safari/537.36" # US english LANGUAGE = "en-US,en;q=0.5" def get_soup(url): """Constructs and returns a soup using the HTML content of `url` passed""" # initialize a session session = requests.Session() # set the User-Agent as a regular browser session.headers['User-Agent'] = USER_AGENT # request for english content (optional) session.headers['Accept-Language'] = LANGUAGE session.headers['Content-Language'] = LANGUAGE # make the request html = session.get(url) # return the soup return bs(html.content, "html.parser")
We first initialized a requests session, we use the User-Agent header to indicate that we are just a regular browser and not a bot (some websites block them), and then we get the HTML content using session.get() method. After that, we construct a BeautifulSoup object using html.parser.
Related tutorial: How to Make an Email Extractor in Python.
Since we want to extract every table in any page, we need to find the table HTML tag and return it, the following function does exactly that:
def get_all_tables(soup): """Extracts and returns all tables in a soup object""" return soup.find_all("table")
Now we need a way to get the table headers, the column names, or whatever you wanna call them:
def get_table_headers(table): """Given a table soup, returns all the headers""" headers = [] for th in table.find("tr").find_all("th"): headers.append(th.text.strip()) return headers
The above function finds the first row of the table and extracts all the th tags (table headers).
Now that we know how to extract table headers, the remaining is to extract all the table rows:
def get_table_rows(table): """Given a table, returns all its rows""" rows = [] for tr in table.find_all("tr")[1:]: cells = [] # grab all td tags in this table row tds = tr.find_all("td") if len(tds) == 0: # if no td tags, search for th tags # can be found especially in wikipedia tables below the table ths = tr.find_all("th") for th in ths: cells.append(th.text.strip()) else: # use regular td tags for td in tds: cells.append(td.text.strip()) rows.append(cells) return rows
All the above function is doing, is to find tr tags (table rows) and extract td elements which then appends them to a list. The reason we used table.find_all("tr")[1:] and not all tr tags, is because the first tr tag corresponds to the table headers, we don't wanna add it here.
The below function takes the table name, table headers and all the rows and saves them as CSV format:
def save_as_csv(table_name, headers, rows): pd.DataFrame(rows, columns=headers).to_csv(f"{table_name}.csv")
Now that we have all the core functions, let's bring them all together in a main function:
def main(url): # get the soup soup = get_soup(url) # extract all the tables from the web page tables = get_all_tables(soup) print(f"[+] Found a total of {len(tables)} tables.") # iterate over all tables for i, table in enumerate(tables, start=1): # get the table headers headers = get_table_headers(table) # get all the rows of the table rows = get_table_rows(table) # save table as csv file table_name = f"table-{i}" print(f"[+] Saving {table_name}") save_as_csv(table_name, headers, rows)
The above function does the following:
Finally, let's call the main function:
if __name__ == "__main__": import sys try: url = sys.argv[1] except IndexError: print("Please specify a URL.\nUsage: python html_table_extractor.py [URL]") exit(1) main(url)
This will accept the URL from the command line arguments, let's try if this is working:
C:\pythoncode-tutorials\web-scraping\html-table-extractor>python html_table_extractor.py [+] Found a total of 2 tables. [+] Saving table-1 [+] Saving table-2
Nice, two CSV files appeared in my current directory that corresponds to the two tables in that Wikipedia page, here is a part of one of the tables extracted:
Awesome ! We have successfuly built a Python script to extract any table from any website, try to pass other URLs and see if it's working.
For Javascript driven websites (which loads the website data dynamically using Javascript), try to use requests-html library or selenium instead. Let us see what you did in the comments below !
You can also make a web crawler that downloads all tables from an entire website, you can do that by extracting all website links and running this script on each of URLs you got from it.
Also, if for whatever reason, the website you're scraping blocks your IP address, you need to use some proxy server as a counter measure.
Read also: How to Download All Images from a Web Page in Python.
Happy Scraping ♥View Full Code | https://www.thepythoncode.com/article/convert-html-tables-into-csv-files-in-python | CC-MAIN-2020-05 | refinedweb | 930 | 60.35 |
Generics in one of the most powerful features of C#, which was introduced in C# 2.0. Before generics, programmers used to use "object" type, to store value of any type, but it would require programmers to remember object type and it leads to various run-time errors. So, C# provides generics to remove the need for casting, improve type safety, reduce the amount of boxing required, and make it easier to create generalized classes and methods.
Generic classes and methods accept type parameters, which specify the types of objects on which they operate. In C#, you indicate that a class is a generic class by providing a type parameter in angle brackets, like this
public class Queue<T> { //members of class here }
Where,
T in this example acts as a placeholder for a real type at compile time. When you write code to instantiate a generic Queue, you provide the type that should be substituted for
T (Circle, Horse, int, and so on).
Let's take a look at an complete example of a Generic class in which we will be creating a class, which can be used for multiple data-types.
using System; public class GenericClassProgram { public static void Main() { GenericClass<int> intClass = new GenericClass<int>(); //passed as int type intClass.DoSomething(4); GenericClass<string> stringClass = new GenericClass<string>(); //passed as string stringClass.DoSomething("44"); } public class GenericClass<T> { public void DoSomething(T item) { Console.WriteLine(item); } } }
Output:
4 44
As you can see in the above code, we are using Generic class, in which we are creating two types of objects one as "int" and another "string".
We are using same class and same method, but with different data type. | https://qawithexperts.com/tutorial/c-sharp/44/generic-class-in-c-sharp | CC-MAIN-2022-40 | refinedweb | 283 | 57.4 |
The Power of Transformation, Part I: An Introduction to DataWeave
MuleSoft's DataWeave allows you to perform a variety of transformations, whether you're working with HTTP, JSON, or SOAP XML.
Join the DZone community and get the full member experience.Join For Free
When you work with the integration of different systems, sooner or later, you will have to transform data. In today’s world, very few systems talk in the same data language. For example, you may have an HTTP server that understands JSON, but it needs to talk to a server that only understands SOAP XML. Even if it understands JSON, the chances of having same JSON schema or format is very slim, so in these cases, you need to do transform the data.
Mule provides a very powerful tool to do these kinds of transformations: DataWeave.
DataWeave (DW)
DW is a new data transformation engine of Mule. DW is the replacement to DataMapper. You may have used DataMapper before; it provided a graphical drag and drop approach to data transformation. Please keep in mind that from Mule 3.7, Mule runtime hasn't had DataMapper and if you want to use it, you need to separately provide the dependencies. From Mule v4, there will be no longer support for DataMapper! So, I highly encourage everyone to either move to DW or convert your DM.
Canonical Data Format
Before we embark on the journey to understand DW, we need to understand that DW is designed in canonical data format standards. In simple terms, canonical data format is a way in which we represent any kind of data or object in a standard format. Any expression we write in DW will be in canonical format.
There are only three data types that can result from a DataWeave expression:
- Simple types (like strings and numbers).
- Arrays.
- Objects.
Each of these can be expressed literally as below:
DataSense and DataWeave
When we work with DW, we get to use the powerful abilities of DataSense. With DataSense, you get suggestions and views of data with which you are working. You should also be mindful of the mime types of the Message data that you have to transform. When this is not set explicitly at design time and you use any of your connectors, this will default to application/Java.
For HTTP requests and responses, Mule will look at the content type header and set it accordingly. You should set the mime type explicitly when you are using the set variable and set payload processors. Failing to set the mime type explicitly for XML content will result in it being interpreted as a mere Java string by the engine.
Variable Reference Expression
Understanding DW is all about understanding how DW engine normalizes your input data and how it is represented by the engine internally whenever references are made to variables, session variables, inbound properties, outbound properties, etc. All these expressions convert the incoming data into the canonical DW format that we discussed above. So, thinking in terms of DW simple types, arrays, and objects will help to write better transformation.
Below is the sample of XML conversion to DW literals. If we change the output type to application/DW, we can see that the conversion is done by the engine of the input XML. Here is how all the elements of XML are normalized as a key:value pair in the object:
In the case of complex element types, the normalized value is itself an object and repeating values are normalized as repeating key:value pairs.
Anypoint Studio
Anypoint Studio supports DW development with a DW editor. In DW editor, you will find three panes.
On the left, DataSense displays the structure of the incoming message along with any example of data you have provided.
On the right pane, the expected outgoing structure is displayed as per DataSense. It will also display the design time result of the transformation that constantly refreshes itself as the expression of transformation is written.
The middle pane is where you write your transformation logic. It is divided into two sections. The header is where the declaration of mime type of transformation output is done, along with some reusable functions and global variables as also namespaces for XML use cases. The mandatory part of the header is the declaration of the DW version (i.e., %dw 1.0 and the output mime type).
Below the dotted line is where you write the transformation expressions. Only one expression is needed for this. There is a number of expression types, but the majority of the transformations can be done with semi-literal expressions of DW objects.
The same DW transformer can produce multiple outputs from the same incoming message. This can be achieved by clicking the plus circle at the bottom right of the transformation pane. With this, you will get another transformation pane in which you can select the output from the drop-down at the top of the transformation pane. The important thing to note is that you can use different flow vars or specify different targets for your transformation.
Output Rendering
The DW engine separates the actual transformation process within the canonical format from the final rendering of the same in the output mime type you defined in the header.
Irrespective of how complex your expression is, if it’s an object with deep-nested structure and expressions and operators which combine expressions, all of these must be executed first and return their value before the outer expression returns its value. It is this final value that is rendered in the output mime type.
Be aware of the choice of mime type, as there will be some limitations associated with them. Arrays will not be rendered in XML. Choose to repeat keys instead. Likewise, repeating keys cannot be rendered in JSON. Generate arrays instead.
To render an object to XML in line with the rule that XML documents may only contain one root element, the object may only contain one key:value pair. Its value can, as we have seen, itself be an object of any complexity.
Conclusion
This was an introduction to DW. I will be creating further videos and blogs related to DataWeave to go more in details of various ways to use DW in your transformation.
Let me know if you have found this blog helpful and informative.
Opinions expressed by DZone contributors are their own. | https://dzone.com/articles/power-of-transformation-dataweave-introduction | CC-MAIN-2022-27 | refinedweb | 1,073 | 62.68 |
I thought about the same. My insights are: You can 'let all relevant symbols with alternative functions or just NIL. Adresses 1 & 2 You might want to change the repl in a way that if for example the symbols car and list are evaluated they return a meaningless number. (It might be possible to calculate the offset and execute arbitrary lisp code.) 1 & 2 And alternative would be to rewrite the picolisp eval function and only let it load Symbols from a certain namespace/symbol to function property list. Regarding 3: the best way to archieve that is putting the execution of this code in a 'later. You can either cancel them after a certain time via kill while your game world goes either increase a counter on each allocation and throw an error if the number of allocations exhausts the virtual machine capacity.
Advertising
Am 28.04.2017 04:18 schrieb "Christopher Howard" < christopher.how...@qlfiles.net>: > > some commands or program something in PicoLisp. > The obvious safety concerns here are: > > (1) You either want to disable disk access, or make it so that disk > access pulls from a virtual disk in the game. > > (2) You don't want the user to be changing memory in the game itself, > only his virtual memory. > > (3) You don't want the user to be able to exhaust memory or blow the stack. > > -- > > > -- > UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe | https://www.mail-archive.com/picolisp@software-lab.de/msg07404.html | CC-MAIN-2018-34 | refinedweb | 238 | 62.48 |
Hello, I've got a dialogue system and I'd like to be able to set the speed at which the letters appear but change this per line of dialogue, my idea was to add numbers in the dialogue itself (IE, "Hello there young adventurer! [0.05]) and then having unity read the numbers within the brackets but not display the brackets nor the numbers on screen?
Is this possible? I've tried experimenting and googling but I've been unable to find anything that helps...
You could simply read from a JSON file.
{ "dialog1": { "text": "Hello there young adventurer", "speed": 0.05 } }
You can easily read this with any JSON Parser like MiniJSON
As @ranch000 mentioned, JSON is the best option for you. But if you really don't want to use it, you should look into regex. It's not easy to get into, but it's the best tool for the job (outside JSON).
Only other option is to parse it manually. You would use methods like Substring to get the string from first index of '[' to first index of ']' and then parse that with double.Parse. This is very error-prone method, but it exists
Answer by Legend_Bacon
·
Oct 29, 2018 at 11:15 AM
Hello there,
As mentioned above, JSON might be an option. However, depending on the amount of tags you want your text to have (bold, italic, display speed, font size, font color etc...) the JSON might get a little big.
Instead, you can try this:
using System.Collections;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using UnityEngine;
public class StringTest : MonoBehaviour
{
public string myInput = "This is a test[>s:0.5s<][>fsize:14fsize<]";
//Define you start and end tags here
public string speedTagStart = "[>s:";
public string speedTagEnd = "s<]";
public string fontSizeTagStart = "[>fsize:";
public string fontSizeTagEnd = "fsize<]";
private void Update()
{
Debug.Log(ApplyDialogueLineTags(myInput));
}
public string ApplyDialogueLineTags(string dialogueLine)
{
//your default values
float speed = 1.0f;
int fontSize = 12;
if (myInput.Contains(speedTagStart))
{
//You might want to add some security (try-catch?) here to make sure the value is correct
speed = float.Parse(ExtractTextInBetween(speedTagStart, speedTagEnd, dialogueLine));
}
if (myInput.Contains(fontSizeTagStart))
{
//You might want to add some security (try-catch?) here to make sure the value is correct
fontSize = int.Parse(ExtractTextInBetween(fontSizeTagStart, fontSizeTagEnd, dialogueLine));
}
//Do what you will with the values
Debug.Log("speed:" + speed.ToString());
Debug.Log("font size:" + fontSize.ToString());
//Remove all the tags from the string and return it
return Regex.Replace(dialogueLine, "\\[>.*?<\\]", string.Empty);
}
public string ExtractTextInBetween(string tagStart, string tagEnd, string input)
{
return input.Substring((input.IndexOf(tagStart) + tagStart.Length), (input.IndexOf(tagEnd) - input.IndexOf(tagStart) - tagStart.Length));
}
}
The code above outputs:
• speed: 0.5
• font size: 14
• This is a test
This code above allows you to have as many tags as you want, as long as you define the Start and End properly. Once all the values have been extracted, it returns the whole string without all the tags so you can display it as it should be.
Please note that I wrote this fast, I didn't include try-catch for invalid values. There may be easier ways to do this, but this should at least give you a lead.
I hope that helps!
Cheers,
~LegendBacon
Thank you for your reply! But I'm not really sure how I'd go about implementing this alongside the code from this video? Esp considering the string/char(?) is written in the inspector per character/object and whatnot?
I didn't watch the whole video, but from what I've seen it shouldn't be too complicated.
Since you already have a reference to the Text component in the IEnumerator TypeSentence(),
you could do sentence = ApplyDialogueLineTags(sentence); before you go char by char. That way you get the sentence without the tags so it outputs properly. Of course, instead of debugging the speed, fontsize etc you would apply it to your Text reference.
sentence = ApplyDialogueLineTags(sentence);
Ok! I'll try to implement it to the best of my ability, thank you.
Check current letter in typewriter textbox?
0
Answers
Dialogue & GUI Text String
1
Answer
Find what word is selected by mouse in GUI.Label
0
Answers
Change alpha color of specific letter in a Text UI with C#
2
Answers
OnGUI and Displaying GUI Features
1
Answer | https://answers.unity.com/questions/1566494/ignoringnot-displaying-textnumbers-in-string-if-su.html | CC-MAIN-2019-09 | refinedweb | 722 | 66.54 |
A workflow is a series of DIPY operations with fixed inputs and outputs that is callable via command line or another interface.
For example, after installing DIPY, you can call anywhere from your command line:
dipy_nlmeans t1.nii.gz t1_denoised.nii.gz
First create your workflow (let’s name this workflow file as my_workflow.py). Usually this is a python file in
the
<../dipy/workflows> directory.
import shutil
shutil Will be used for sample file manipulation.
from dipy.workflows.workflow import Workflow
Workflow is the base class that will be extended to create our workflow.
class AppendTextFlow(Workflow): def run(self, input_files, text_to_append='dipy', out_dir='', out_file='append.txt'): """ Parameters ---------- input_files : string Path to the input files. This path may contain wildcards to process multiple inputs at once. text_to_append : string, optional Text that will be appended to the file. (default 'dipy') out_dir : string, optional Where the resulting file will be saved. (default '') out_file : string, optional Name of the result file to be saved. (default 'append.txt') """
AppendTextFlow is the name of our workflow. Note that it needs
to extend Workflow for everything to work properly. It will append
text to a file.
It is mandatory to have out_dir as a parameter. It is also mandatory
to put out_ in front of every parameter that is going to be an
output. Lastly, all out_ params needs to be at the end of the params
list.
The
run docstring is very important, you need to document every
parameter as they will be used with inspection to build the command line
argument parser.
io_it = self.get_io_iterator() for in_file, out_file in io_it: shutil.copy(in_file, out_file) with open(out_file, 'a') as myfile: myfile.write(text_to_append)
Use self.get_io_iterator() in every workflow you create. This creates
an
IOIterator object that create output file names and directory structure
based on the inputs and some other advanced output strategy parameters.
By iterating on the
IOIterator object you created previously you
conveniently get all input and output paths for every input file
found when globbing the input parameters.
The code in the loop is the actual workflow processing code. It can be anything. For the example, it just appends text to an input file.
This is it for the workflow! Now to be able to call it easily via command
line, you need to add this bit of code. Usually this is in a separate
executable file located in
bin.
The first line imports the run_flow method from the flow_runner class.
from dipy.workflows.flow_runner import run_flow
The second line imports the
AppendTextFlow class from the newly created
my_workflow.py file. In this specific case, we comment this import
since
AppendTextFlow class is not on an external file but in the current file.
# from dipy.workflows.my_workflow import AppendTextFlow
This is the method that will wrap everything that is needed to make a flow command line ready then run it.
if __name__ == "__main__": run_flow(AppendTextFlow())
This is the only thing needed to make your workflow available through command line.
Now just call the script you just made with
-h to see the argparser help
text:
python workflow_creation.py --help
You should see all your parameters available along with some extra common ones like logging file and force overwrite. Also all the documentation you wrote about each parameter is there.
Now call it for real with a text file:
python workflow_creation.py ./text_file.txt
Example source code
You can download
the full source code of this example. This same script is also included in the dipy source distribution under the
doc/examples/ directory. | https://dipy.org/documentation/1.4.1./examples_built/workflow_creation/ | CC-MAIN-2021-25 | refinedweb | 593 | 57.87 |
Building a counter app to know how to start a project with Typescript it’s easy if you follow this guide. Also, learning how to implement React Hooks creating the following project it’s one of the things you’re gonna learn here. And, last but not least, we are going to add testing for React Native.
Welcome to the React Hooks, TypeScript and Redux for React Native blogpost. Here, I will talk about how to use React Hooks with TypeScript and React Native.
For this blog post, we are going to build a counter app. This exercise consists of two buttons that increment or decrement the state of our app. We are going to implement Hooks to see the benefits of using them, and how to integrate TypeScript and Redux. Then, we are going to test with Jest.
Getting started with TypeScript
First, let me tell you what is TypeScript. According to the documentation, it is:TypeScript is a typed superset of JavaScript that compiles to plain JavaScript any browser, any host, and any open-source. Click To Tweet
JavaScript that scales. TypeScript is a typed superset of JavaScript that compiles to plain JavaScript any browser, any host, and any open-source. TypeScript also helps us to create JavaScript code cleaner. It is an object-oriented programming language. And, it requires a TypeScript compiler to convert it into a JavaScript file.
When I started with TypeScript, it was difficult for me to understand it. This was happening because I was using the dynamic typed part of JavaScript. TypeScript forces us to create data types specifics.
TypeScript was designed by Anders Hejlsberg at Microsoft. It is both a language and a set of tools. It is a strongly typed, object-oriented, compiled language. It is a superset of JavaScript compiled to JavaScript. TypeScript is JavaScript with some additional features. It was created to make JavaScript code development safe and it uses all the code found in JavaScript with other coding concepts like classes, modules, interfaces, and types. It also allows developers to detect errors and debug applications easier.
Benefits to use TypeScript:
- It is purely object-oriented programming.
- It can be used for client-side and server-side development equal.
- It offers a “compiler” that can convert to JavaScript-equivalent code.
- It has an API for DOM manipulation.
- It has a namespace concept by defining a “Module”.
- We can create Classes, Interfaces, Generics.
- The compiler is used to convert to JavaScript so it can run on web pages.
- Null checking when you are in development.
- It can use Access modifiers.
- It can use NameSpaces.
- TypeScript has static type checking.
TypeScript is able to point out errors in compilation during development. It also supports JavaScript libraries and API documentation. In TypeScript, the same code can be run on any browser, device or operating system. JavaScript code is TypeScript code. It can be converted into TypeScript just changing the extension of the file from “.js” to “.ts”.
Install environment
Ok, now let’s create our project with TypeScript.
First of all, we need to create our project.
react-native init rnworkshop
cd rnworkshop
Adding Typescript
The next step is to add TypeScript to your project. The following commands will:
1. Add TypeScript to your project.
yarn add --dev typescript
2. Add React Native TypeScript Transformer to your project.
yarn add --dev react-native-typescript-transformer
3. Initialize an empty TypeScript config file, which we’ll configure next.
yarn tsc --init --pretty --jsx react
4. Add an empty React Native TypeScript Transformer config file, which we will configure next.
touch rn-cli.config.js
5. Adds typings for React and React Native.
yarn add --dev @types/react @types/react-native
This package contains type definitions for React.
The
rn-cli.config.js contains the settings for the React Native TypeScript Transformer. These lines will transform the TSX files to JS files, you need to open it and add the following:
module.exports = { getTransformModulePath() { return require.resolve('react-native-typescript-transformer'); }, getSourceExts() { return ['ts', 'tsx']; }, };
Rename the generated
App.js and
__tests_/App.js files to
App.tsx. All new files should use the
.tsx extension (or
.ts if the file doesn’t contain any JSX code). It is the extension of TypeScript.
ReduxRedux is a package that helps us create only one state into our app. You can use it according to your needs.xf Click To Tweet
Redux is a package that helps us create only one state into our app. The only way to change the state is through dispatch actions.
How does it work?
It works as a single store. We can access our application store through the Dispatch function. The Dispatch will call the Actions. The Actions need to be defined to call the Reducers. The Reducers will do changes into the global store.
You can use Redux according to your needs. There are other alternatives such as Flux.
A practical example
The example counter app is good to understand the changes in the state. The example counter is about an initialState that will be called counter. Two functions will change the initialState through the dispatch. We will define the Actions, and then, we are going to change the file App.tsx to use Hooks. We are using Redux because only one state must exist in the app and with Redux we can do that.
Store
One storage holds the state tree of your application. Store is not a class, it’s just an object with a few methods on it.
Store Methods
getState()
This method will return the current state tree from the app.
dispatch(action)
Executes an action type. This is the only way to make changes into the state.
subscribe(listener)
Adds a change listener. It will be called any time an action is dispatched.
replaceReducer(nextReducer)
Replaces the reducer currently used by the store to calculate the state.
If we want to create a store, we need to create a file in the root path called
store.ts. The store is created by two methods
createStore and
combineReducers. Let’s create it.
import {createStore, combineReducers} from 'redux'; import counter from './reducers/counterReducer'; const rootReducer = combineReducers({ counter, }); const configureStore = () = { return createStore(rootReducer); }; export default configureStore;
createStore holds all the state trees of your app.The only way to change this store is with Dispatch Actions.
combineReducers is a helper function from the Redux package that will return an object with all the reducers declared into the combineReducer helper.
rootReducer will return an object with all our Reducers. The Reducers will be explained shortly.
configureStore will return our store with all our Reducers into it.
Actions
Into the Actions we have functions. These functions will be called by the view through the Dispatch. We need to return these functions with two parameters: the type and payload.
Type
They define a file usually called
types.ts into a folder called actions. This name is usually used by convention, but you can use whatever name to define them. For the example counter we are going to need two action types
INCREMENT_COUNT and
DECREMENT_COUNT. We need to export these constants into a file.
// actions/types.ts
export const INCREMENT_COUNT = 'INCREMENT_COUNT';
export const DECREMENT_COUNT = 'DECREMENT_COUNT';
Now, we need to create a new file with the name
incrementer.ts inside the same folder. In this new file we are going to declare the functions. These functions will return the
type and
payload.
// actions/incrementer.ts import {INCREMENT_COUNT, DECREMENT_COUNT} from './types'; export const incrementCount = (counter: number) => { return { type: INCREMENT_COUNT, payload: counter, }; }; export const decrementCount = (counter: number) => { return { type: DECREMENT_COUNT, payload: counter, }; };
We have finished the Actions. Redux knows what
type needs to query.
Reducers
Reducers help us specify how the state will change. They are a response to the actions sent to the store. The actions describe what happened, they do not describe how the state will change. We are going to create the reducer for the example counter. We are going to define the changes that we need in our state.
Usually, Reducers go in the folder “reducers”. The files in the Reducers use the Reducer’s name and prefix
Reducer. For example:
// reducers/counterReducer.ts import { INCREMENT_COUNT, DECREMENT_COUNT } from '../actions/types'; const initialState = { counter: 0, }; const counter = (state = initialState, action: any) => { switch (action.type) { case INCREMENT_COUNT: return { ...state, counter: state.counter + 1, }; case DECREMENT_COUNT: return { ...state, counter: state.counter - 1, }; default: return state; } }; export default counter;
We need to import the action types we defined previously. Then, we define the initial state. This is the state for our example counter.
const initialState = { counter: 0, };
This function is the Reducer’s name. This reducer will need to get the state and the action.
const counter = (state = initialState, action: any) = { switch (action.type) { case INCREMENT_COUNT: return { ...state, counter: state.counter + 1, }; case DECREMENT_COUNT: return { ...state, counter: state.counter - 1, }; default: return state; } };
Now we need to import redux on our
App.tsx component. We need to import the actions too.
mapStateProps: This function returns the global store with the latest changes.
mapDispatchToProps: Here, we can call the dispatch functions. We can modify the global state.
We need to connect our component with the global state with the connect function on react-redux.
export default connect( mapStateProps, mapDispatchToProps, )(App);
Here is the complete example:
Redux is a predictable state container, and an easy way to implement a global store. It is flexible, centralized and debuggable for JS apps. Click To TweetRedux is a predictable state container, and an easy way to implement a global store. It is flexible, centralized and debuggable for JS apps. Click To Tweet
import React from 'react'; import { View, Button, Text, StyleSheet } from 'react-native'; import { connect } from 'react-redux'; import { incrementCount, decrementCount } from '../actions/incrementer'; function App(props: any) { return ( <View style={styles.containerView}> <Text>{props.counter.counter} <Button title="Increment" onPress={() => props.increment(props.counter.counter)} /> <Button title="Decrement" onPress={() => props.decrement(props.counter.counter)} /> <', }, });
In summary, Redux is a predictable state container. It is an easy way to implement a global store. Redux is flexible, centralized and debuggable for JS apps. In this case we are using Redux with React, but you can use Redux with other front end frameworks.
TypeScript in Redux has the potential to bring type safety for Reducers, state, Action creators, and UI components. It is easy to refactor typed code for your React Redux app. Take time to consider the decision to use typescript on your app.
React Hooks
A React Hook is a special function that allows us to use React features. React hooks allow us to take a functional component, manage its state and lifecycle methods. I can say that React Hooks have helped me create a cleaner React code. The tedious way to write
this.state is over with React Hooks. In new files, you can make separate files to logic and view.
React Hooks work on a version higher than 16.8. It is the newest of ReactJS. Without them, we have to bind all classes because the functions must be updated through the render. We have to declare our class component and get all the props into the component. We have to declare our state and update it with a special method of react
this.state.value. Like the example below:
import React, { Component } from 'react'; import { View, Button, Text } from 'react-native' class Counter extends Component { constructor(props) { super(props); this.state = { count: 0 }; this.handleCounter = this.handleCounter.bind(this); } handleCounter(counter) { this.setState({ count: counter }) } render() { return ( <View style={{ margin: 100 }}> <Text>You clicked {count} times <Button title=”Increment” onPress={() => this.handleCounter(this.state.count + 1)} /> <Button title=”Decrement” onPress={() => this.handleCounter(this.state.count - 1)} /> </View> ); } } export default Counter
Now we can use the hook
useState into React. The state is declared within our functional component. We do not have to bind our classes and the way to declare the state is using Hooks to give the values to our initial structure. We can read the values of our state easier only by declaring the state name.
This is the equivalent code of the previous example.
import React, {useState} from 'react'; import {View, Button, Text} from 'react-native'; function Counter() { const [count, setCount] = useState(0); return ( <View style={{ margin: 100 }}> <Text>You clicked {count} times <Button title="Increment" onPress={() => setCount(count + 1)} /> <Button title="Decrement" onPress={() => setCount(count - 1)} /> </View> ); } export default Counter;
Our state is better to read with this React Hook and the code is shorter. React Hooks allow us to create modular and extensible code. In this blog, we will review the basic React Hooks.
The basic React Hooks:
- useState
- useEffect
- useContext
More Hooks:
- useReducer
- useCallback
- useMemo
- useRef
- useImperativeHandle
- useLayoutEffect
- useDebugValue
We can create our own Hooks, it is simple. We will see an example about how to create our own Hooks and you will see the benefits.
Hook useState
The state reflects the values that you need for your render. It can be declared in every .JSX file. You can keep all data types in the state. The state always returns us the most recent changes.
const [value, setValue] = useState(initialState)
On versions previous than 16.8, we read our state declaring it that way:
super(props) this.state = { valueText: '', valueNumber: 0 }
With this code we can read the state by
this.state.valueText. We can update the state in this way:
this.setState({ valueText: 'Lorem Ipsum' })
Now with React Hooks, we declare our state in this way:
const [valueText, setValueText] = useState('')
const [valueNumber, setValueNumber] = useState(0)
const [valueArray, setValueArray] = useState([])
With this code we can read the state by
valueText or
valueNumber or
valueArray. We can update the state on this way:
setState(newState)
For example:
setValueText('Lorem Ipsum')
setValueNumber(9)
setValueArray([1, 2, 3])
useState allows us to use state and other React features without writing a class. useState is an array with two positions. The first position saves the current state. The second position has a method to change the state’s value.
Suppose that we want to add an automatic increment or decrement for our counter example. We need to declare a state into our functional component called automatic. First, we need import the “useState” Hook:
import { useState } from “react”
If we need a Hook, first we have to import it from the React library. Now, we can declare our state. As good practice we need to name our value first in camelCase. The second position needs to be called with the prefix set plus the state’s name.
const [automaticIncrement, setAutomaticIncrement] = useState(false);
const [automaticDecrement, setAutomaticDecrement] = useState(false);
const [stop, setStop] = useState(true);
Our state is ready to accept changes in the values. For this example, we are going to need these three variables because one will increment automatically and others will decrement automatically. Both are with the boolean value false. The third option is to stop the automatic function. It is true because in the view the value is held in zero. Those are the initial values.
We are going to add three more buttons in the view. They change the state to true when we want to use the automatic function.
<Button title="Auto Increment" onPress={() => { setAutomaticIncrement(true); setAutomaticDecrement(false); setStop(false); }} /> <Button title="Auto Decrement" onPress={() => { setAutomaticIncrement(false); setAutomaticDecrement(true); setStop(false); }} /> <Button title="Stop" onPress={() => { setStop(!stop); }} />
We have prepared all to use the
useEffect hook. This hook will allow you to change the value every time that the render is working.
Hook useEffect
useEffect(didUptate)
This Hook works like a combination of componentDidMount and componentDidUpdate.
With useEffect, you can add mutations, subscriptions, timers, logging, fetch and others. To use this Hook, we need to import it from the React library, like this:
import { useEffect } from ‘react’ useEffect(() => { // This is called after every render, by default console.log('render!'); // If you want to implement componentWillUnmount return () => console.log('unmounting...'); }) // If you want implement componentDidMount only add [] at end of useEffect useEffect(() => { // This is called after every render, by default console.log('render!'); }, [])
You can add useEffect more than once to the same file. For the automatic function to counter example we need to declare the useEffect into our functional component. These Hooks will work calling our dispatch and executing the reducer for increment or decrement automatically:
useEffect(() => { if (automaticIncrement && !stop) { setTimeout(() => { props.increment(props.counter.counter); }, 100); } if (automaticDecrement && !stop) { setTimeout(() => { props.decrement(props.counter.counter); }, 100); } });
The three buttons declared previously will change the state of our component. With useEffect we are going to read the values from the state tree. We will be able to activate the increment or decrement option. We are using a setTimeout as you can see for call the dispatch action from Redux depending on the case. If we press the button ‘Auto increment’ or ‘Auto decrement’, we will see the automatic function running. If we press the option stop the auto running will stop. It is a good example on how the
useEffect works. We have the complete example below:
import React, {useEffect, useState} from 'react'; import {View, Button, Text, StyleSheet} from 'react-native'; import {connect} from 'react-redux'; import {incrementCount, decrementCount} from '../actions/incrementer'; function App(props: any) { const [automaticIncrement, setAutomaticIncrement] = useState(false); const [automaticDecrement, setAutomaticDecrement] = useState(false); const [stop, setStop] = useState(true); useEffect(() => { if (automaticIncrement && !stop) { setTimeout(() => { props.increment(props.counter.counter); }, 100); } if (automaticDecrement && !stop) { setTimeout(() => { props.decrement(props.counter.counter); }, 100); } }); return ( <View style={styles.containerView}> <Text>{props.counter.counter} <Button title="Increment" onPress={() => props.increment(props.counter.counter)} /> <Button title="Decrement" onPress={() => props.decrement(props.counter.counter)} /> <Button title="Auto Increment" onPress={() => { setAutomaticIncrement(true); setAutomaticDecrement(false); setStop(false); }} /> <Button title="Auto Decrement" onPress={() => { setAutomaticIncrement(false); setAutomaticDecrement(true); setStop(false); }} /> <Button title="Stop" onPress={() => { setStop(!stop); }} /> <', }, });
Hook useContext
const value = useContext(MyContext)
The React Context API allows you to easily access data on different levels of the component tree, without having to pass data down through props.
Context is mainly used when some data has to be accessible by many components at different levels of nesting. Apply it sparingly because it makes component reuse more difficult.
useContext helps us make our code modular. It allows us to pass properties between screens. For example, If we have a Toolbar. It needs to keep the same styles on all screens. We are going to add a toolbar example to our application. We are going to pass the styles for useContext.
First, we are going to import our useContext Hook.
import React, { useContext } from 'react';
Then, we need to import the react native components for the styles and views.
import { StyleSheet, View, Text } from 'react-native';
The object theme is to save the different toolbar’s styles. For this example, we are going to save two different colors for the toolbar light and dark.
const themes = { light: { background: '#eeeeee', }, dark: { background: '#222222', }, };
We need to create our context using the React Context API. This function will create a context object with all methods. The image below is an example.
const ThemeContext = React.createContext(themes.light);
The provider will pass the value for the tree. We are passing the light value from our theme object. The value only will be read to the component wrapped.
function ToolBar() { return ( <ThemeContext.Provider value={themes.light}> <ThemedToolbar /> </ThemeContext.Provider> ); }
We are going to create our ThemedToolbar functional object. Into this component we are going to call useContext Hook. We pass the ThemeContext declared previously. The image below is an example for the object that it will return.
ThemedToolbar is the functional component for show in the render. Now, we can use the object within the context.
function ThemedToolbar() { const theme = useContext(ThemeContext); return ( <View style={styles.marginView}> <View style={Object.assign( {backgroundColor: theme.background}, styles.viewText, )}> <Text>{theme.title} </View> </View> ); }
We are using the context to pass a style to our view and the toolbar’s title. You can see it in the code above highlighted in blue.
We must export our ToolBar that has the provider property.
export default ToolBar;
This is the style guide used.
marginView>/code> is for using a margin in our app.
textColor has the color for our text into the text component.
viewText is for center the content of our view.
const styles = StyleSheet.create({ marginView: { marginTop: 100, }, textColor: { color: 'blue', fontWeight: 'bold', marginLeft: 60, }, viewText: { width: '80%', height: 40, marginLeft: 30, }, });
In summary, this Hook can be used to pass values into our components.
React.createContext is to wrap the object that you want to make modular. If you want to make changes to the values only you need to modify this object to do it. Provider works to pass values of our context wrapped. Use this hook depending on your needs.
Building your own hook
This is a practical example about how to create our own hook.
import React, { useState } from "react" import { View, Button, Text } from "react-native" function App() { const [count, setCount] = useState(0); function Increment() { setCount(count + 1); } function Decrement() { setCount(count - 1); } return ( <View> <Text>{count} <Button title="Increment" onPress={Increment} /> <Button title="Decrement" onPress={Decrement} /> </View> ); } export default App
First, we need to create a new file called
MyOwnHook.ts. In the new file we are going to return a function with our hook. As good practice all the hooks must start with the prefix
use . In this function we are going to return an array with our functions and state.
import { useState } from "react"; function useCounter(value: number, nextValue: number) { const [count, setCount] = useState(value) function Increment() { setCount(count + nextValue: number) } function Decrement() { setCount(count - nextValue: number) } return [count, Increment, Decrement] } export default useCounter;
Now, our component can take the state value and functions on this way:
import React from "react"; import { View, Button } from “react-native”: import useCounter from "./MyOwnHook"; function App() { const [count, Increment, Decrement] = useCounter(0, 1); return ( <View>{count} <Button onClick={Increment} title=”Increment” /> <Button onClick={Decrement} title=”Decrement” /> ); } export default App;
In this example, we can see that our code reads better and if we need to create complex functions we can keep them separate in other files.
The rules of React Hooks
There are four main usage rules for React Hooks:
1.- Hooks must be called in the same order, at the top level.
2.- Don’t call Hooks inside loops, conditions, or nested functions.
3.- Only call Hooks from React functions.
4.- Custom Hooks should start with the word use and be camel-cased.
There is an ESLint plugin that can help you enforce the rules. You can add this plugin to your project. This plugin was developed by the React core team.
yarn add eslint-plugin-react-hooks
Jest - Running the testing
React Native ships with Jest, so for testing a React Native app with TypeScript, we'll want to add ts-jest to our devDependencies.
yarn add --dev ts-jest
Then, we'll open our package.json and replace the Jest field with the following:
{ "jest": { "preset": "react-native", "moduleFileExtensions": [ "ts", "tsx", "js" ], "transform": { "^.+\\.(js)$": "/node_modules/babel-jest", "\\.(ts|tsx)$": "/node_modules/ts-jest/preprocessor.js" }, "testRegex": "(/__tests__/.*|\\.(test|spec))\\.(ts|tsx|js)$", "testPathIgnorePatterns": [ "\\.snap$", "/node_modules/" ], "cacheDirectory": ".jest/cache" } }
This will configure Jest to run
.ts and
.tsx files with
ts-jest. Now we need to install in our dev dependencies the libraries that help us write and test TypeScript code.
yarn add --dev @types/jest @types/react @types/react-native @types/react-test-renderer
Add this folder in the .gitignore file.
.jest/
Here is an example to run Jest with Redux:
A good practice is to create a file with the exact name of the component that you wish to test with a prefix test. So, in this example we need to create a new file into folder
__test__ called
App-test.tsx.
// __test__/App-test.tsx import 'react-native'; import React from 'react'; import App from '../components/App'; import { Provider } from 'react-redux'; import { createStore } from 'redux'; import placeReducer from '../reducers/placeReducer'; import renderer from 'react-test-renderer'; const store = createStore(placeReducer); it('renders correctly', () => { renderer.create( , ); });
Run testing with command: yarn jest
Add
.jest/ file to
.gitignore before pushing into the repository.
Running on emulator
Run your project with
yarn ios or
yarn android
ConclusionThe reason TypeScript is so loved by JavaScript developers is because adding types to JS allows you to spot errors before running your code. Click To Tweet
React Native is one of the most popular JS libraries for mobile development. If you come from ReactJS it will be easier to learn. The reason TypeScript is so loved by JavaScript developers is because adding types to JavaScript allows you to spot errors before running your code. When we are developing our IDE will help us debug our code automatically.
Learning TypeScript could look intimidating if you think that is a completely new programming language. TypeScript is only a new layer designed to create JS code minimizing the human errors.
React Hooks change class components to functional components. Hooks allow us to organize the logic in a component into reusable files. We have three basic Hooks: useState, useEffect, useContext. We can separate files with our functions and we can use only in one line importing it into the functional component that we want.
There are more advanced Hooks: useCallback, useMemo, useReducer, useRef, useLayoutEffect each one is well explained in the official documentation. You can make your own Hook as you can see in previous examples. You need to respect the rules about the Hooks declared in the documentation.
Jest helps us create our unit and functional tests. We can use it with TypeScript. In summary, we have all the stack to create powerful and beautiful mobile applications. React Native has a lot of documentation. We can read and solve our issues following the community.
Next Steps
Next possible steps for this exercise could be to:
- Add styles for components
- Experiment with advanced Hooks
- Add Enzyme for Jest
Built With
- React Native - The web framework used
- NodeJS - Dependency Management
- yarn - Dependency Management
- Redux - Global Store
Thanks for reading!
@FernandoAmezcua, Software Engineer at MagmaLabs
Bibliography
-
-
-
-
- | http://blog.magmalabs.io/2020/04/02/react-hooks-typescript-and-redux-for-react-native.html | CC-MAIN-2020-40 | refinedweb | 4,344 | 59.4 |
Code: Select all
def test_mesh(self, meshname):
object = Blender.getObject(meshname)
mesh = Blender.getMesh(object.data)
# mesh.enterEditMode()
n_vtx = len(mesh.vertices)
index = 0
for v in mesh.vertices:
for vj in self.joinvtxs:
if (self.is_dist_lt_tol(v, vj)):
mesh.vertices[index] = tuple([[vj[0], vj[1], vj[2]]])
#mesh.setVertexCoordinates(index, ([vj[0], vj[1], vj[2]))
#v[0] = vj[0]
#v[1] = vj[1]
#v[2] = vj[2]
print "%d : (%1.3f,%1.3f,%1.3f)" % (index, v[0], v[1], v[2])
index = index + 1
# mesh.leaveEditMode()
This includes some commented-out detritus from various attempts at rewriting. In the end I couldn't get the vertices to update in either 2.23 or 2.27 so now I'm rewriting for 2.28.
This is part of a script to snap vertices from a series of hand modelled meshes into exact alignment with a template mesh (which has its vertices in self.joinvtxs before the above function is run on each mesh). The is_dist_lt_tol() func simply tests if 2 tuples are closer than a global tolerance value.
I will paste this handy little script back here when it's working.
----------------------------------------
Update
This all works now, except for the PutRaw which says
AttributeError: nmesh vertices must be NMverts
[/code]
Code: Select all
object = Blender.Object.Get(meshname)
mesh = Blender.NMesh.GetRaw(object.data.name)
n_vtx = len(mesh.verts)
index = 0
for v in mesh.verts:
for vj in self.joinvtxs:
if (self.is_dist_lt_tol(v, vj)):
mesh.verts[index] = tuple([[vj[0], vj[1], vj[2]]])
print "%d : (%1.3f,%1.3f,%1.3f)" % (index, v[0], v[1], v[2])
index = index + 1
Blender.NMesh.PutRaw(mesh, object.data.name) | http://www.blender.org/forum/viewtopic.php?t=1886 | CC-MAIN-2015-40 | refinedweb | 283 | 63.86 |
Subject: Re: [boost] program_options: Support for open-end options
From: Joseph Van Riper (fleeb.fantastique_at_[hidden])
Date: 2012-12-27 09:35:42
On Thu, Dec 27, 2012 at 8:43 AM, Joshua Boyce <raptorfactor_at_[hidden]
> wrote:
> On Thu, Dec 27, 2012 at 4:56 AM, ST <smntov_at_[hidden]> wrote:
>
> > Hi,
> >
> > It would be great to implement support for open-end options, something
> > like that:
> >
> > item_1 = 23
> > item_2 = 45
> > ...
> > item_N = 465
> >
> > The idea is to to be able to provide following input:
> >
> > configOptions.add_options()
> > ("item_", value<int>(), "items");
> >
> > now if add_options() sees a key that ends with a "_" it accepts all
> > options with keys that start with item_, no matter what comes after it,
> > and treat all of them as int . Nesting should also be possible - like
> > this: "item_.subitem_.subsubitem_" (item_3.subitem_FOO.subsubitem_34
> > should be a valid option key).
> > I can try to implement it, however only if it will have a chance to be
> > merged into the boost library. Whom should I contact regarding this?
> >
> > Thank you,
> > Simone
> >
> >
> >
> I have a definite use case for the type of open-ended options you're
> proposing here.
>
> It seems you want to get into contact with Vladimir Prus. He's an active
> member of the mailing list, so you should have no issues getting a
> response.
I'll echo that. I have had a need for this support (although I worked
around it).
Sometimes, it isn't good enough to do something like:
variable_name = itemA|itemB|itemC|itemD
maybe because 'itemA' is actually a string of characters over 80 characters
long or requires special characters that make it non-obvious how to
separate the items in the list.
Although I'd probably prefer a signature that used a sort of tag instead of
relying upon the appending '_' character to trigger the list, and I'd
prefer to use a regular expression instead of relying upon the ending. For
example:
namespace po = boost::program_options;
configOptions.add_options()
( "item_.*", po::value<int>(), "items", po::regex );
That would let you use some fairly interesting variable names while
ensuring they have the right type. You shouldn't be able to use the
following signature, though:
configOptions.add_options()
( "item_.*", po::value<int>( &my_var ), "items", po::regex );
And I should think it would get very odd to try to put the variables in a
single container for those cases where someone skipped a number or
something, e.g.:
configOptions.add_options()
( "item_.*", po::value< std::vector< int > >( &my_var ), "items",
po::regex );
- Trey
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk | https://lists.boost.org/Archives/boost/2012/12/199685.php | CC-MAIN-2020-05 | refinedweb | 438 | 62.78 |
Comment on Tutorial - Using read() to read one character at a time from console input By Jagan
Comment Added by : Nitish
Comment Added at : 2013-01-25 04:06:38
Comment on Tutorial : Using read() to read one character at a time from console input By Jagan
package alphabets;
import java.util.Scanner;
/**
*
* @author User
*/
class Alphabets
{
public static void main(String args[])
{
Scanner input = new Scanner(System.in);
char ch1,ch2;
ch1 = input.next().charAt(0);
ch2 = input.next().charAt(0);
System.out.println("Your Frist Character is: "+ch1);
System.out.println("Your Second Character is: "+ch2);
boolean flag = true;
if(ch1 == ch2)
{
System.out.println(flag);
}
else
{
flag = false;
System.out.println("Character did not match ". it helped a lot!
View Tutorial By: lateforbus at 2013-04-25 03:35:24
2. very good
View Tutorial By: pravin gajbhiye, nagpur at 2010-05-24 01:43:30
3. Thank you very much for this tip.
View Tutorial By: Lise at 2011-07-15 13:27:23
4. Thank you so much. You made my day. God bless you
View Tutorial By: Gautam at 2012-09-18 16:24:19
5. Its of the type "Direction"...Enum type
View Tutorial By: Avinash at 2010-10-29 04:53:35
6. Good one.....
View Tutorial By: Ratnam.. at 2012-07-03 07:11:26
7. Hello,
A volatile variable does not
View Tutorial By: aayush at 2009-11-16 07:38:23
8. Hi,
Even if the while loops (in Producer an
View Tutorial By: Pranay at 2012-09-19 19:08:45
9. Actually, looking at the code, it looks as somethi
View Tutorial By: Johnson at 2009-07-28 08:14:38
10. @dodo : Overloading is only for parameter types an
View Tutorial By: sundar at 2010-04-19 02:44:23 | http://java-samples.com/showcomment.php?commentid=38838 | CC-MAIN-2018-34 | refinedweb | 304 | 61.53 |
Regardless!
JavaScript Tips
1 - Unnecessary DOM Manipulation
The DOM is slow. Limiting your interaction with it will greatly increase your code's performance. Consider the following (bad) code:
// anti-pattern for (var i = 0; i < 100; i++){ var li = $("<li>").html("This is list item #" + (i+1)); $("#someUL").append(li); }
This code actually modifies the DOM 100 times, and unnecessarily creates 100 jQuery objects. 100! A more correct approach would be to either use a document fragment, or build up a string that contains the 100
<li/> elements, and then appends that HTML to the containing element. That way, you jump into the DOM a total of once. Here's an example:
var liststring = ""; for (var i = 100; i > 0; i--){ liststring += "<li>This is list item #" + (99- i); } document.getElementById("someUL").innerHTML(liststring);
As noted above, with this technique, we touch the DOM only once, which is an improvement, but it also relies on string concatenation to build a large string. There's a different way that we could approach this, using arrays.
var liststring = "<li>" var lis = []; for (var i = 100; i > 0; i--){ lis.push("This is list item #" + (99- i)); } liststring += lis.join("</li><li>") + "</li>"; document.getElementById("someUL").innerHTML(liststring);
When building large strings, storing each piece of the string as an item within an array element and calling
join() is arguably more elegant than string concatenation. This is one of the fastest and easiest ways to build repetitive HTML in JavaScript without using a template library or framework.
2 - Inconsistent Variable & Function Names in JavaScript
This next item isn't a performance issue, but is extremely important - especially if you are working on code that other people work on, as well. Keep your identifiers (variable and function names) consistent. Consider the following variables as an example:
var foo = "bar"; var plant = "green"; var car = "red";
It wouldn't make sense to add another variable, called
Something. This introduces inconsistency in your variable naming pattern, causing your brain to cognitively flag this variable as being different or special. This is why constants in most languages are traditionally defined with all caps.
You can take this a step further by maintaining similar length, grammatical structure, and explanatory nature when naming functions. For example, consider the following contrived function:
function subtractFive(number){ return number - 5; }
Naming a function that adds five to a given number should follow the same pattern, shown here:
function addFive(number){ return number + 5; }
Sometimes, you might name a function to indicate its return value. For instance, you might name a function that returns an HTML string
getTweetHTML(). You might also prepend a function's name with
do, if the function simply performs an operation and doesn't return a value, eg:
doFetchTweets().
Constructor functions typically follow the tradition of classes in other languages, capitalizing the first letter:
function Dog(color){ this.color = color; }
As a general rule of thumb, you should be descriptive when naming your identifiers. Classify them together with other similar identifiers by maintaining a naming pattern that is readable and offers hints to the nature of a variable or function's purpose.
3 - Use
hasOwnProperty() in
for...in Loops
JavaScript's arrays are not associative; trying to use them as such is frowned upon by the community. Objects, on the other hand, can be treated as hash tables, and you can iterate over an object's properties by using the
for...in loop, like so:
for (var prop in someObject) { alert(someObject[prop]); // alert's value of property }
The problem, however, is that the
for...in loop iterates over every enumerable property on the object's prototype chain. This can be problematic if you only want to use the properties that exist on the actual object.
You can solve this issue by using the
hasOwnProperty() method. Here's an example:
for (var prop in someObject) { if (someObject.hasOwnProperty(prop)) { alert(someObject[prop]); // alert's value of property } }
This version only alerts the values of the properties that directly reside on
someObject.
4 - Comparing Boolean Values
Comparing boolean values in a condition is a waste of computation time. Take a look at the following for an example:
if (foo == true) { // do something for true } else { // do something for false }
Notice the condition:
foo == true. The comparison of
foo and
true is unnecessary because
foo is already a boolean value (or it's a truthy or falsey one). Instead of comparing
foo, simply use it as the condition, like this:
if (foo) { // do something for true } else { // do something for false }
To test for
false, use the logical NOT operator, as shown below:
if (!foo) { // do something if foo is false } else { // do something if foo is true }
5 - Event Binding
Events are a complicated subject in JavaScript. Gone are the days of inline
onclick event handlers (except in some very rare "splash page" cases). Instead, use event bubbling and delegation.
Let's imagine that you have a grid of pictures that need to launch a modal lightbox window. Here's what you shouldn't do. Note: we're using jQuery here, assuming you are using a similar library. If not, the same bubbling principles also apply to vanilla JavaScript.
The relevant HTML:
<div id="grid-container"> <a href="someimage.jpg"><img src="someimage-thumb.jpg"></a> <a href="someimage.jpg"><img src="someimage-thumb.jpg"></a> <a href="someimage.jpg"><img src="someimage-thumb.jpg"></a> ... </div>
The (bad) JavaScript:
$('a').on('click', function() { callLightbox(this); });
This code assumes that calling the lightbox involves passing an anchor element that references the full size image. Instead of binding to each anchor element, bind to the
#grid-container element instead.
$("#grid-container").on("click", "a", function(event) { callLightbox(event.target); });
In this code, both
this and
event.target refer to the anchor element. You can use this same technique with any parent element. Just make sure to define the element that should be the event's target.
6 - Avoid Ternary Redundancy
The overuse of ternary statements is quite common both in JavaScript and PHP.
// javascript return foo.toString() !== "" ? true : false;
// php return (something()) ? true : false;
A condition expression always returns a
true or
false value, meaning you don't need to explicitly add
true/
false as ternary values. Instead, you could simply return the condition:
// javascript return foo.toString() !== "";
// php return something();
PHP Tips
7 - Use Ternary When Appropriate
if...else statements are a central part of most languages. But doing something simple, such as assigning a value to a variable based upon a condition - well, they can junk up your code. Consider the following code:
if ($greeting) { $post->message = 'Hello'; } else { $post->message = 'Goodbye'; }
This code can be reduced to one line, while still maintaining readability by using the ternary operator, like this:
$post->message = $greeting ? 'Hello' : 'Goodbye';
It's clear, concise, and gives you the functionality you need.
As useful as the ternary operator is, the most important guideline is not to over-use it! The goal of coding is not to cramp your logic into as few lines as possible.
8 - Throw Exceptions Instead of Inception-Style Nesting
Let's face it: many levels of nesting is ugly and difficult to maintain/read. The following code is a relatively simplified example, but they get much worse over time:
// anti-pattern $error_message = null; if ($this->form_validation->run()) { if ($this->upload->do_upload()) { $image = $this->upload->get_info(); if ( ! $this->image->create_thumbnail($image['file_name'], 300, 150)) { $error_message = 'There was an error creating the thumbnail.'; } } else { $error_message = 'There was an error uploading the image.'; } } else { $error_message = $this->form_validation->error_string(); } // Show error messages if ($error_message !== null) { $this->load->view('form', array( 'error' => $error_message, )); } // Save the page else { $some_data['image'] = $image['file_name']; $this->some_model->save($some_data); }
That's some nasty code, but you can make it drastically cleaner by using exceptions, like so:
try { if ( ! $this->form_validation->run()) { throw new Exception($this->form_validation->error_string()); } if ( ! $this->upload->do_upload()) { throw new Exception('There was an error uploading the image.'); } $image = $this->upload->get_info(); if ( ! $this->image->create_thumbnail($image['file_name'], 300, 150)) { throw new Exception('There was an error creating the thumbnail.'); } } // Show error messages catch (Exception $e) { $this->load->view('form', array( 'error' => $e->getMessage(), )); // Stop method execution with return, or use exit return; } // Got this far, must not have any trouble $some_data['image'] = $image['file_name']; $this->some_model->save($some_data);
It might be the same number of lines, but it allows for considerably more readable and maintainable code. It also avoids those difficult debugging sessions, where you've missed a possible path through the
if statement. Keep it simple!
Second Opinion: be very, very careful, when using exceptions for flow control. Refer here for additional information.
9 -
False-Happy Methods
Being exception-happy is far more advantageous than being false-happy.
Ruby or Python developers are used to watching for trivial exceptions. While that sound tedious, it's actually quite a good thing. If anything goes wrong, an exception is thrown, and you instantly know where the problem is.
In PHP - and especially when using older frameworks, such as CodeIgniter - you get what I refer to as "false-happy code" (as opposed to exception-happy). Instead of having an exception get all up in your face, it just returns a
false value and assigns the error string to some other property. This forces you to fish it out of the class using a
get_error(); method.
Being exception-happy is far more advantageous than being false-happy. If an error occurs within your code (eg: could not connect to S3 to upload an image, or a value is empty, etc.), then throw an exception. You can also throw specific types of exceptions by extending the
Exception class, like so:
class CustomException extends Exception {}
Throwing a custom exception makes debugging considerably easier.
Tip 10 - Use Guard Clauses
It's common to use
if statements to control a function or method's execution path. It's tempting to test a condition and execute a lot of code when the condition results in
true, only to simply return in the
else statement. For example:
function someFunction($param) { if ($param == 'OK') { $this->doSomething(); return true; } else { return false; } }
This kind of solution, however, represents a potential for spaghetti code. You can make this code easier to read by reversing the condition. Here's the better version:
function someFunction($param) { if ($param != 'OK') return false; $this->doSomething(); return true; }
Isn't that easier to read? It's a simple change that makes a drastic difference in the readability of your code.
Tip 11 - Use
while for Simple Iterations
The
for loop is commonly used when you need, for example, a counter. Here's a simple
for loop:
for (var i = 0; i < x; i++) { ... }
There are some very good reasons to use a
for loop, but a
while loop may be better if you just need something simple, like this:
var i = x; while (i--) { ... }
It doesn't work in every situation, but it is an alternative.
Tip 12 - Keep Methods Maintainable
This is easily one of the most frequent mistakes made by newcomers.
A method is an object's unit of work, and limiting your methods to a maintainable size makes your code easier to read and maintain. Take a look at the following monster method:
class SomeClass { function monsterMethod() { if($weArePilots) { $this->goAndDressUp(); $this->washYourTeeth(); $this->cleanYourWeapon(); $this->takeYourHelmet(); if($this->helmetDoesNotFit()) $this->takeAHat(); else $this->installHelmet(); $this->chekcYourKnife(); if($this->myAirplain() == "F22") $this->goToArmyAirport(); else $this->goToCivilianAirport(); $this->aim(); $this->prepare(); $this->fire(); } } }
Consider breaking this monster method into smaller, descriptive chunks, each being responsible for performing one well-abstracted action. This is easily one of the most frequent mistakes made by newcomers.
class SomeClass { function monsterMethod() { if($weArePilots) { $this->prepareYourself(); $this->tryHelmet(); $this->findYourAirport(); $this->fightEnemy(); } } private function prepareYourself() { $this->goAndDressUp(); $this->washYourTeeth(); $this->cleanYourWeapon(); $this->chekcYourKnife(); } private function tryHelmet() { $this->takeYourHelmet(); if($this->helmetDoesNotFit()) $this->takeAHat(); else $this->installHelmet(); } private function findYourAirport() { if($this->myAirplain() == "F22") $this->goToArmyAirport(); else $this->goToCivilianAirport(); } private function fightEnemy() { $this->aim(); $this->prepare(); $this->fire(); } }
There we go: cleaner, and easier to debug!
Step 13 - Avoid Deep Nesting
Too many levels of nesting makes code difficult to read and maintain. Consider the following:
function doSomething() { if ($someCondition) { if ($someOtherCondition) { if ($yetSomeOtherCondition) { doSomethingSpecial(); } doSomethingElse(); } } }
You can refer to Tip #10 to make this code easier to read by reversing some of the conditions.
function doSomething() { if (!$someCondition) { return false; } if (!$someOtherCondition) { return false; } if ($yetSomeOtherCondition) { doSomethingSpecial(); } doSomethingElse(); }
This code is considerably cleaner and produces the same results as before.
When you find yourself with nested
if statements, closely examine your code; your method may be performing more than one task. Here's an example:
function someFunc() { if($oneThing) { $this->doSomething(); if($anotherThing) $this->doSomethingElse(); } }
In these cases, extract the nested methods into their own method:
function someFunc() { if($oneThing) { $this->doSomething(); $this->doAnotherThing($anotherThing); } } private doAnotherThing($anotherThing) { if($anotherThing) $this->doSomethingElse(); }
Tip 14 - Avoid Magic Numbers and Strings
Magic numbers and strings are evil. Define variables or constants with the values you want to use in your code.
Instead of this:
function someFunct() { $this->order->set(23); $this->order->addProduct('superComputer'); $this->shoppingList->add('superComputer'); }
Specify what those numbers and strings mean, and assign them to a variable with a meaningful name, like this:
function someFunct() { $orderId = 23; $selectedProductName = 'superComputer'; $this->order->set($orderId); $this->order->addProduct($selectedProductName); $this->shoppingList->add($selectedProductName); }
While some might argue that we're needlessly creating variables, the performance hit is negligible. Readability always takes priority. Remember: don't optimize for performance until you can describe why it's necessary.
Step 15 - Use Built-In Array Functions
Use the built-in array functions instead of
foreach().
Not Ideal:
foreach (&$myArray as $key =>$element) { if ($element > 5) unset ($myArray[$key]); }
Better:
$myArray = array_filter($myArray, function ($element) { return $element <= 5;});
PHP offers a variety of array methods. They're confusing at first, but take a day and try to learn as many as possible.
Tip 16 - Don't Overuse Variables
It's easy to overuse variables, but remember that variables are stored in memory. For every variable you create, the system needs to allocate memory for that variable. Look at this code:
public function get_posts() { $query = $this->db->get('posts'); $result = $query->result(); return $result; }
The
$result variable isn't necessary. The following code omits that variable:
public function get_posts() { $query = $this->db->get('posts'); return $query->result(); }
The difference is subtle, but we were able to improve this simple example. We kept the $query variable because it relates to the database, while $result related more to our logic.
General Programming Recommendations
Tip 17 - Rely on the Database Engine
Anything less is a code smell.
A database is designed for working with data; use its tools and abilities to make your application more efficient.
For example, you can avoid redundant database queries in many circumstances. Most plug-and-play user management scripts use two queries for user registration: one to check whether the e-mail/username already exists and another to actually add it to the database. A much better approach is to set the username field to
UNIQUE. You can then use native MySQL functions to check whether or not the record was added to the database.
Tip 18: Properly Name Your Variables
The days of naming your variables
x,
y,
z are over (unless, of course, you're dealing with a coordinate system). A variable represents an important part of your logic. Don't want to type a long name? Get a better IDE. Modern IDEs auto-complete variable names in a blink of an eye.
Always be coding for six months from now. Are you certain that you'll remember what that
$sutvariables refers to a year from now? Likely not: be descriptive. Anything less is a code smell.
Tip 19 - Methods Represent Actions
Mistakes happen; the key is to learn from them.
Name your methods with verbs representing the action they perform. The main concept is the exact opposite of the variable naming scheme. Use a short, but descriptive, name in a large scope (ie: public methods), and use a longer and more detailed name in a short scope (ie: private / protected methods). This helps make your code read like well written prose.
Also avoid any language other than English, when naming your methods. It's annoying to read function names like 做些什麼() or делатьчтото() in your project. It may be impossible for other programmers to understand your intent. While it might seem arrogant, for better or worse, English is the adopted language of code. Try to use it, if we're working on a large team.
Tip 20: Structure Recommendations
Finally, code structure is just as important to readability and maintainability as anything else we've talked about today. Here are two recommendations:
- Indent with four or two space-width tabs. Anything more, such as eight spaces, is too much and will make your code difficult to read.
- Set a reasonable line-width and respect it. Forty characters in a line? We're not in the '70s any more; set your limit to 120 characters, put a mark on the screen, and force yourself or your IDE to respect that limit. 120 characters gives you a nice width without making you scroll.
Conclusion
"I've never made a stupid programming mistake." -- No one, ever.
Mistakes happen; the key is to learn from them. We at Nettuts+ have made, and will continue to make, mistakes. Our hope is that you learn from our mistakes so that you can avoid them in the future. But, to be honest, the best way to learn best practices is to make the mistakes yourself!
Thanks for reading! | http://code.tutsplus.com/tutorials/20-all-too-common-coding-pitfalls-for-beginners--net-27963 | CC-MAIN-2014-15 | refinedweb | 2,956 | 55.44 |
Requirements:
Linux Distribution
Java Development Kit (JDK)
Java Runtime Environment (JRE)
A Shell Interface
My Setup:
Debian GNU/Linux
javac
BASH
Variables are pieces of memory which can hold a value. They are used to
describe changing values of a program.
Primitive Types In Java:
- boolean – a variable which represents either the value true
or false. One bit.
- char – a variable which represents a unicode character
- byte – a variable which represents an 8-bit signed integer
- short – a variable which represents a 16-bit signed integer
- int – a variable which represents a 32-bit signed integer
- long – a variable which represents a 64-bit signed integer
- float – a variable which represents IEEE 754’s floating
point 32-bit float data type
- double -a variable which represents IEEE 754’s floating
point 64-bit double data type
Along with Primitive types, there are non-primitive types.
Non Primitive Types in Java:
- String – a null terminating array of characters that forms words.
(eg. “Hello” is stored as “Hello\0”)
- class – a data type which defines a blueprint to create a new data type.
- enum – a special data type used to define collections of constants.
- array – a collection of objects of the same type There are three types of variables when thinking of a java program:
- instance variables – Variables that are used to describe classes. They
are declared within the class and are coupled to the
object.
- local variables – Variables that are local are declared within methods
to be used for computation.
- static variables – Variables that are labeled static do not require a
class to be instantiated and are coupled to the class
(rather then the object) On top of all these, you have datatype modifiers.
Datatype Modifiers:
- public – visible to the program
- protected – visible to the class and its derived classes
- private – visible only to the class itself
- abstract – a class marked as abstract
- final – a class marked as final can not be extended.
public class variables{ public static void main(String[] args){ int foo; //declares the foo integer . int bar = 5; //declares and defines the bar integer foo = 7; //defining the foo character byte baz = 22; char c = 'c'; //declaring and defining a character using single quote String hello = "Hello"; /*declaring and defining a string using the double quote */ boolean isRunning = true; //defining and declaring a boolean double pi = 3.14159; //defining a double, the natural floating type variable float fpi = (float)pi; //defining a float via casting . } } | https://csprogramming.center/2020/10/07/variables/ | CC-MAIN-2021-25 | refinedweb | 407 | 53.34 |
Game programming with the XNA Framework
Gamepad thumbsticks return floating point values ranging from -1 to 1. It can be tempting to hook these inputs directly up to your physics, writing code like:
turn += gamepad.ThumbSticks.Left.X * turnRate;
But wait! Are you sure this is really what you want? Good analog control has a huge impact on the feel of a game, and massaging your input values can do wonders to make things feel more controllable and responsive.
I like to apply a power curve to my analog inputs:
const float power = 3;
turn += PowerCurve(gamepad.ThumbSticks.Left.X) * turnRate;
float PowerCurve(float value)
{
return (float)Math.Pow(Math.Abs(value), power) * Math.Sign(value);
}
This response curve makes small input values even smaller, allowing for more precise control, but still preserves the full range when you move the stick to an extreme position:
In effect, it makes analog inputs feel even more analog than they normally would. Higher power values make the curve more pronounced, while smaller ones make it more subtle: somewhere around 2 or 3 is usually good.
Setting the power to 1 turns the curve into a no-op, while fractional values reverse the effect, making the controls feel more discrete and digital:
If you would like to receive an email when updates are made to this post, please register here
RSS
Weird title, great advice ...
Here we go again with another weekly update; sorry it is a bit late. But it as been another quiet week
Here we go again with another weekly update; sorry it is a bit late. But it as been another quiet week in the world of XNA, but this week we have seen a few new Bloggers come onto the scene (Lets hope they keep the content flowing). We have also seen | http://blogs.msdn.com/shawnhar/archive/2007/03/30/massaging-thumbsticks.aspx | crawl-002 | refinedweb | 303 | 69.01 |
Learn how to send an email alert with the ESP32 based on a temperature threshold. The ESP32 also hosts a Web Server that shows the latest sensor readings and input fields to change the threshold value, email’s recipient, and the option to arm or disarm the system.
We’ll read the temperature using a DS18B20 sensor and send emails using an SMTP Server. The ESP32 will be programmed using Arduino IDE.
To better understand how this project works, we recommend taking a look at the following tutorials:
- ESP32 Send Emails using an SMTP Server: HTML, Text and Attachments (Arduino IDE)
- Input Data on HTML Form ESP32/ESP8266 Web Server (Arduino IDE)
- ESP32/ESP8266 Thermostat Web Server – Control Output Based on Temperature
Watch the Video Demonstration
To see how the project works, you can watch the following video demonstration:
Project Overview
The following image shows a high-level overview of the project we’ll build.
- The ESP32 hosts a web server that shows the latest temperature readings from a DS18B20 temperature sensor.
- There’s an input field to set up a threshold. When the temperature goes above or below the threshold value, you’ll receive an email.
- You can also set up the recipient’s email address on the web page.
- The system can be activated or deactivated through the web server. If you choose to deactivate the system, you won’t receive email notifications when the temperature crosses the threshold value.
The following image shows an overview of the web server page.
Prerequisites
Make sure you check each of the following prerequisites before proceeding with this project.
1. ESP32 add-on Arduino IDE
We’ll program the ESP32 using Arduino IDE. So, you need to have the ESP32 add-on installed in your Arduino IDE. Follow the next tutorial, if you haven’t already.
2. ESP32 Mail Client Library
To send emails with the ESP32, we’ll use the ESP32 Mail Client library (how to use the library to send emails). Follow the next steps to install the library.
In your Arduino IDE go to Sketch > Include Library > Manage Libraries…
The Library Manager should open. Search for ESP32 Mail Client by Mobizt and install the library as shown below.
3. Create a temporary disabled.
We’ll use a newly created Gmail.com account to send the emails, but you can use any other email provider. The receiver email can be your personal email without any remmeber”.
4. SMTP Server Settings
Before proceeding you need to know the SMTP server settings of the sender email..
5. Async Web Server and DS18B20 Libraries
In this project, we’ll build an asynchronous web server using the next libraries:
These two.
Open your Arduino IDE and go to Sketch > Include Library > Manage Libraries. The Library Manager should open and you can install these libraries:
6. Parts Required
To follow this tutorial you need the following parts:
- ESP32 (read Best ESP32 development boards)
- DS18B20 temperature sensor (waterproof version) – complete Guide
- 4.7k Ohm resistor
- Jumper wires
- Breadboard
You can use the preceding links or go directly to MakerAdvisor.com/tools to find all the parts for your projects at the best price!
Schematic Diagram
Wire the DS18B20 temperature sensor to the ESP32 as shown in the following schematic diagram, with the data pin connected to GPIO 4
ESP32 Code – Email Web Server
Copy the following code to your Arduino IDE, but don’t upload it yet. You need to make some changes to make it work for you. You need to insert the sender’s email address, the recipient’s email address, your default threshold input and your network <AsyncTCP.h> #include <ESPAsyncWebServer.h> #include <OneWire.h> #include <DallasTemperature.h> #include "ESP32_MailClient.h" // REPLACE WITH YOUR NETWORK CREDENTIALS const char* </head><body> <h2>DS18B20 Temperature</h2> <h3>%TEMPERATURE% °C</h3> <h2>ESP Email Notification</h2> > < == "EMAIL_INPUT"){ return inputMessage; } else if(var == "ENABLE_EMAIL"){ return enableEmailChecked; } else if(var == "THRESHOLD"){ return inputMessage3; } return String(); } // Flag variable to keep track if email notification was sent or not bool emailSent = false; const char*Return to Home Page</a>"); }); server.onNotFound(notFound); server.begin(); } void loop() {); // Check if temperature is above threshold and if it needs to send the Email alert if(temperature > inputMessage3.toFloat() && inputMessage2 == "true" && !emailSent){ String emailMessage = String("Temperature above threshold. Current temperature: ") + String(temperature) + String("C"); if(sendEmailNotification(emailMessage)) { Serial.println(emailMessage); emailSent = true; } else { Serial.println("Email failed to send"); } } // Check if temperature is below threshold and if it needs to send the Email alert else if((temperature < inputMessage3.toFloat()) && inputMessage2 == "true" && emailSent) { String emailMessage = String("Temperature below threshold. Current temperature: ") + String(temperature) + String(" C"); if(sendEmailNotification(emailMessage)) { Serial.println(emailMessage); emailSent = false; } else { Serial.println("Email failed to send"); } } } } bool sendEmailNotification(String emailMessage){ // Set the SMTP Server Email host, port, account and password smtpData.setLogin(smtpServer, smtpServerPort, emailSenderAccount, emailSenderPassword); // For library version 1.2.0 and later which STARTTLS protocol was supported,the STARTTLS will be // enabled automatically when port 587 was used, or enable it manually using setSTARTTLS function. //smtpData.setSTARTTLS(true); // Set the sender name and Email smtpData.setSender("ESP32", emailSenderAccount); // Set Email priority or importance High, Normal, Low or 1 to 5 (1 is highest) smtpData.setPriority("High"); // Set the subject smtpData.setSubject(emailSubject); // Set the message with HTML format smtpData.setMessage(emailMessage, true); // Add recipients smtpData.addRecipient(inputMessage); smtpData.setSendCallback(sendCallback); // Start sending Email, can be set callback function to track the status if (!MailClient.sendMail(smtpData)) { Serial.println("Error sending Email, " + MailClient.smtpErrorReason()); return false; } // Clear all data from Email object to free memory smtpData.empty(); return true; } // Callback function to get the Email sending status void sendCallback(SendStatus msg) { // Print the current status Serial.println(msg.info()); // Do something when complete if (msg.success()) { Serial.println("----------------"); } }
How the Code Works
Continue reading to learn how the code works, or skip to the demonstration section.
Libraries
Start by importing the required libraries. The WiFi, AsyncTCP and ESPAsyncWebServer are required to build the web server. The OneWire and DallasTemperature are required to interface with the DS18B20 and the ESP32_MailClient is required to send emails with the ESP32 via SMTP server.
#include <WiFi.h> #include <AsyncTCP.h> #include <ESPAsyncWebServer.h> #include <OneWire.h> #include <DallasTemperature.h> #include "ESP32_MailClient.h"
Network Credentials
Insert your network credentials in the following lines:
// REPLACE WITH YOUR NETWORK CREDENTIALS const char* ssid = "REPLACE_WITH_YOUR_SSID"; const char* password = "REPLACE_WITH_YOUR_PASSWORD";
Insert the sender email – this is the email that will be used to send emails by the ESP32.
#define emailSenderAccount "[email protected]"
Type the email sender password:
#define emailSenderPassword "email_sender_password"
In the next lines, insert the email sender SMTP server settings. We’re using a Gmail account. If you’re using another email provider you need to insert the right server settings.
#define smtpServer "smtp.gmail.com" #define smtpServerPort 465
Insert the email subject on the following line:
#define emailSubject "[ALERT] ESP32 Temperature"
Auxiliar Variables
Next, we have some auxiliar variables to save the values submitted through the form. The inputMessage variable holds the recipient’s email. You can insert the default’s recipient’s email. You can change the recipient’s email later on the form.
String inputMessage = "[email protected]";
The enableEmailChecked variable will tell us whether the checkbox to send an email is checked or not.
String enableEmailChecked = "checked";
In case it’s checked, the value saved on the inputMessage2 should be set to true.
String inputMessage2 = "true";
The inputMessage3 holds the temperature threshold value. By default is set to 25.0ºC, but you can set it to any other default value that makes more sense to you. You can also change it later in the HTML form.
String inputMessage3 = "25.0";
The lastTemperature variable saves the last temperature value to compare with the current value.
String lastTemperature;
HTML Text
Then, we have some basic HTML text to build a page with three input fields: the recipient’s email, a checkbox to enable or disable email notifications and the temperature threshold input field. The web page also displays the latest temperature reading from the DS18B20 temperature sensor.
The following lines display the temperature:
<h2>DS18B20 Temperature</h2> <h3>%TEMPERATURE% °C</h3>
The %TEMPERATURE% is placeholder that will be replaced by the actual temperature value when the ESP32 serves the page.
Then, we have a form with three input fields and a “Submit” button. When the user types some data and clicks the “Submit” button, those values are sent to the ESP32 to update the variables.
>
The first input field is of type email, the second input field is a checkbox and the last input field is of type number.?email_input=value&enable_email_input=value&threshold_input=value
The value refers to the text you enter in each of the input fields. To learn more about handling input fields with the ESP32, read: Input Data on HTML Form ESP32 Web Server using Arduino IDE.
processor()
The processor() function replaces all placeholders in the HTML text with the actual values.
- %TEMPERATURE% » lastTemperature
- %ENABLE_EMAIL% » enableEmailChecked
- %THRESHOLD% » inputMessage3
String processor(const String& var){ //Serial.println(var); if(var == "TEMPERATURE"){ return lastTemperature; } else if(var == "EMAIL_INPUT"){ return inputMessage; } else if(var == "ENABLE_EMAIL"){ return enableEmailChecked; } else if(var == "THRESHOLD"){ return inputMessage3; } return String(); }
Input Field Parameters
The following variables will be used to check whether we’ve received an HTTP GET request from those input fields and save the values into variables accordingly.
const char* PARAM_INPUT_1 = "email_input"; const char* PARAM_INPUT_2 = "enable_email_input"; const char* PARAM_INPUT_3 = "threshold_input";
DS18B20 Temperature Sensor Init
Initialize the DS18B20 temperature sensor.
//);
To learn more about interfacing the DS18B20 temperature sensor with the ESP32, read: ESP32 DS18B20 Temperature Sensor with Arduino IDE.
SMTPData Object
The smtpData object contains configurations and data to be sent via email. These configurations are set later on the sendEmailNotification() function.
SMTPData smtpData;
setup()
In the setup(), connect to Wi-Fi in station mode and print the ESP32 IP address:
Serial.begin(115200); WiFi.mode(WIFI_STA); WiFi.begin(ssid, password); if (WiFi.waitForConnectResult() != WL_CONNECTED) { Serial.println("WiFi Failed!"); return; } Serial.println(); Serial.print("ESP IP Address: Serial.println(WiFi.localIP());
Initialize the DS18B20 temperature sensor:
sensors.begin();
Handle Web Server
Then, define what happens when the ESP3232 receives a request on the following URL:
<ESP_IP>/get?email_input=<inputMessage>&enable_email_input=<inputMessage2>&threshold_input=<inputMessage3>
So, we check whether the request contains input parameters, and save those parameters into variables:"; }
This is the part of the code where the variables will be replaced with the values submitted on the form. The inputMessage variable saves the recipient’s email address, the inputMessage2 saves whether the email notification system is enabled or not and the inputMessage3 saves the temperature threshold.
After submitting the values on the form, it displays a new page saying the request was successfully sent to the ESP32 send an email if necessary.
You’ll send an email alert, if all these conditions are met:
- The current temperature is above the threshold;
- Email notifications are enabled (the checkbox is ticked on the web page);
- If an email hasn’t been sent yet.
if(temperature > inputMessage3.toFloat() && inputMessage2 == "true" && !emailSent){ String emailMessage = String("Temperature above threshold. Current temperature: ") + String(temperature) + String("C"); if(sendEmailNotification(emailMessage)) { Serial.println(emailMessage); emailSent = true; } else { Serial.println("Email failed to send"); } }
The email contains a message saying the temperature is above the threshold and the current temperature.
Then, if the temperature goes below the threshold, send another email.
else if((temperature < inputMessage3.toFloat()) && inputMessage2 == "true" && emailSent) { String emailMessage = String("Temperature below threshold. Current temperature: ") + String(temperature) + String(" C"); if(sendEmailNotification(emailMessage)) { Serial.println(emailMessage); emailSent = false; } else { Serial.println("Email failed to send"); } }
To send emails, we’ve created the sendEmailNotification function that contains all the details to send the email. This function returns true if the email was successfully sent, or false if it failed. To learn more about sending emails via SMTP Server with the ESP32, read: ESP32 Send Emails using an SMTP Server.
Demonstration
Upload the code to your ESP32 board (with the DS18B20 wired to your ESP32 board).
Open the Serial Monitor at a baud rate of 115200 and press the on-board RST button. The ESP32 will print its IP address and it will start displaying new temperature values every 5 seconds.
Open a browser and type the ESP32 IP address. A similar web page should load with the default values (defined in your code):
If the email notifications are enabled (checkbox checked) and if the temperature goes above the threshold, you’ll receive an email notification.
After that, when the temperature goes below the threshold, you’ll receive another email.
You can use the web page input fields to set up a different recipient’s email address, to enable or disable email notifications, and to change the threshold value. For any change to take effect, you just need to press the “Submit” button.
At the same time, you should get the new input fields in the Serial Monitor.
Wrapping Up
In this project you’ve learn how to set a threshold value and send an email notification when the temperature crosses that value. We hope you’ve found this project interesting. Now, feel free to modify the project to meet your own needs. For, example, when the temperature crosses the threshold, you may also want to trigger an output to control a relay.
In this project, we’ve used raw HTML text, to make the project easier to follow. We suggest adding some CSS to style your web page to make it look nicer.
Instead of using a DS18B20, you might consider using a different temperature sensor: DHT vs LM35 vs DS18B20 vs BME280 vs BMP180.
If you want to learn more about the ESP32, try our projects and resources:
Thanks for reading.
38 thoughts on “ESP32 Email Alert Based on Temperature Threshold (change values on web server)”
That’s amazing project. I subscribed to your website because I’m doing my final project with esp32 and also, your projects are really helpful.
I working doing a fall detection system using esp32 and MPU6050 GY-521 sensor. Can you tell me how to see my sensor values in my database while also allow a user to receive an email and/or sms when the sensor exceeds a certain threshold to indicate as a fall?
Unfortunately I don’t have any tutorials on that exact subject, but it’s definitely possible to implement/use that sensor in that application
Hi
How can you change code so,
that when Temperature goes below 6 Celsius i get alarm email?
Best regards
Ahti
Hi
Work this with esp8266?
I don’t have Esp32.
Best regards
Ahti
Hi.
This code is not compatible with ESP8266.
Regards,
Sara
Hi
Some thoughts.
I have little greenhouse.
When temperature goes over 45Celsius .it is orange alert.
I go and open greenhouse’s Door and Window.
When Temperature is 10- 40 Celsius, everything is ok.
When Temperature goes below 5 Celsius,it is red alert,
because heater for some reason doesn’t work.
That’s all folk.
Best regards.
Ahti
hey Rui can you help me
i have some troubleshooting on my wiring cable, when iam took a jumper on there. then when iam get compile
“A fatal error occurred: “Failed to connect to ESP32: Timed out… Connecting…”
i would ask to take on sample picture on sd card – button “capture”
then analyze the picture
iam just thinking how to make it – “algorithm”
can you help me how to fix that
Please follow this Guide “[SOLVED] Failed to connect to ESP32: Timed out waiting for packet header”
Hi @Ahti,
The temperature threshold can be set by the user on the web interface, in the field. The value of this field is set by default within the code with the inputMessage3 variable, but the user can change it by entering another value in the web form.
If you want to define 2 thresholds (a min value and a max value), you would have to add another input field in the form for this 2nd threshold, as well as a default value (for example, as an inputMessage4 variable)… but you will also have to slightly modify the code to take it into account.
Finally, I suppose that this code also works with ESP8266 (I don’t have one to test). But if this was not the case, the modifications would be minor.
Rhaaaaa… damn comment editor…
Too bad you can’t re-edit it if you make a typing error, or when its content is altered by the process that saves it!
I’m redoing a test concerning my first sentence:
The temperature threshold can be set by the user on the web interface, in the <input name=”threshold_input” … /> field.
Sorry for that!
Hi Stéphane.
Thanks for helping out.
Just a minor correction: this code is not compatible with the ESP8266.
Regards,
Sara
Hi Sara,
Yeah, sorry… I didn’t really look into the ESP8266 case because I don’t have one on hand to test or write suitable code that works for sure.
Nevertheless, I guess it is still possible to reimplement an SMTP client quite easily with the ESPAsyncTCP library:
Now, for more simplicity (@Athi) maybe you can take a look at the following tutorial:
ESP32/ESP8266 Send Email Notification using PHP Script
It allows you to more easily deport the mail sending procedure to a PHP server, and simplify the code running on the ESP8266 at the same time.
Here is an adaptation of Rui’s code to manage a minimum and a maximum temperature threshold :
You can even see the difference here:
Hope I haven’t forgotten anything!
Thank you so much for sharing.
This will definitely be useful for our readers.
Regards,
Sara
Hi,
can you reupload your code? it is already down on github and im trying to do the same thing and just new to the microcontroller scene.
Hi,
Sorry, I had to reorganize all my GitHub repositories and change my username.
Here is the new access link:
Thank you so much for this really big help!
Hi
Thank You for help.
I have NodeMcu32S chip. I don’t know what it is exactly.
I managed to load program to chip.
I have ordered this sensor DS18B20 .I don’t have it.
Best regards
Ahti.N
Hello, this is a very clear writedown of a usefull project!
I was wondering: if there is a power interruption, the ESP32 will use the threshold values declared in the code and not the ones who were given by the user through the webpage?
Is there a way to store the values given by the user on the webpage, so that in case of a power outage, the system keeps working, but with the values that were given by the user?
Kind regards,
Christophe
Hi.
Yes. You can save the values on the flash memory. The values saved on the flash memory don’t change even if the ESP32 resets or power is removed.
Take a look at this tutorial to see how it works:
At the beginning of you sketch you need to add some lines to read the value currently saved on the flash memory.
Then, every time you change the values, you should save them on the flash memory (EEPROM)
Regards,
Sara
Hi Sara,
Great tutorials. I love your work. Can you help me write the code for storing email address of recipient in EEPROM.
Tnx,
Best regards
Hi Robert.
I’m sorry, but due to time constraints we don’t build custom projects for our readers.
However, I recommend you read the following tutorial:
This shows how to save values permanently on the ESP32 flash memory using the Preferences library. Take a look at the example that shows how to save and read network credentials—then, adapt to save the recipient email.
I hope this helps.
Regards,
Sara
Hello please need help
I have tried this code but doesn’t work about web server
when entering the IP address the browser shows error
The problem is the browser doesn’t show the page after entering the ip address….although I copy the just edited the wifi ssid and password
Hi.
The browser and the ESP32 need to be on the same network (connected to the same router).
What is the exact error you’re getting?
Regards,
Sara
hello. i copied the sketch above, email alert. everything goes ok except the esp32 wont connect to my home wifi or phones hotspot. what could i be doing wrong?
Hi.
When you say it doesn’t connect, what happens?
You may have a typo in your network credentials.
Regards,
Sara
Thank you for replying.for some reason it won’t connect to my phone’s hotspot but it connects to my home wifi fine. I copied the new file above that has a minimum and maximum threshold successfully. It works perfect just what I need. I would to know how to have it send a email at a specific time every day to show the system is working and connected to the network.
Is there a way to get help to have a soil sensor (which I have working on its own) instead of the temperature sensor to email status of the soil sensor? I’ve tried to switch out all places in the code from where it was “Temperature” to Moisture, and its not compiling too many errors (no matching function for call to ‘String(const char [48], uint16_t&)’
the ‘uint16_t’ is the variable type from the working sketch for the soil sensor, I get readings from it, but when i try to put it into the emailing sketch here, it doesn’t compile in Arduino IDE.
Thanks for any help if you have time.
Hi.
In which line of code are you getting that error?
Regards,
Sara
Thank you, I’ve got it sending through gmail, but I’m not understanding a couple of things.
Im not understanding the logic, it only sending once & not according to the interval of millis.
I also had to change this : around lines 177 in arduino (but I’ve moved things around some, it may be different in your code) can I send the whole code? its close to working I just need help with the frequency & logic (If above threshold, if below, then send or not)
!emailSent. when it was without the ! not symbol it wouldn’t send.
// Check if Moisture is above threshold and if it needs to send the Email alert
if(capread > inputMessage3.toFloat() && inputMessage2 == “true” && !emailSent){
String emailMessage = String(“Moisture above threshold. Current Moisture: “)+
String(capread)+ String(“%”);
if(sendEmailNotification(emailMessage)) {
}
}
}
Serial.println(emailMessage);
else {
Serial.println("Email failed to send");
// Check if Moisture is below threshold and if it needs to send the Email alert
else if((capread < inputMessage3.toFloat()) && inputMessage2 == "true" && !emailSent) {
String emailMessage = String("Moisture below threshold. Current Moisture: ") +
String(capread) + String("%");
if(sendEmailNotification(emailMessage)) {
}
Serial.println(emailMessage);
else {
Serial.println("Email failed to send");
I thought it would send every – const long interval = 5000- that would be every 5 seconds? Ive changed it to 60000 for testing purposes, but I want to check every 4 hrs when its working better.
Hope this is not confusing?
I can present more specifics in smaller pieces of code if thats easier?
I noticed this bool type definition near the bottom of the code
Its not within the braces of void loop() {
}
code here……
bool sendEmailNotification(String emailMessage){
code describing email send….
Its outside the ending brace.
If I put it within the void loop() code would that cause the emails to send as frequently as the interval time? (const long interval = 5000;)
is there a way to have to only one email sent when the threshold has been meet. on mine it keeps sending emails one after another until the alert has cleared . thank you.
i have the new code up and running . the upper and lower thresholds work great. ive been trying for weeks to figure out how to write into the code so it will email me once per day the temperature, kind of like a report to show me that everything is still working. could you please help me with this. thank you.
I built this project and loaded the code with no initial problems, but after about
12 hours the web server drops it connection. It can no longer be accessed
Via Safari or Edge browers. The error message on both browsers is “the web server
Has stopped responding”. I tested it many times over several days with different
Esp32 modules.
I tried the solution suggested by Rui, in this link, but it doesn’t seem to match
The code in this project.
[SOLVED] ESP32/ESP8266 Web Server Drops Connection/Crashes (rntlab.com)
I hope someone can offer a suggestion to solve this problem.
Thanks in advance.
Larry
Hello. How can I use a DHT22 instead of a DS18B20?
Hi.
Replace the DS18B20 code with DHT22 code.
You can take a look at this tutorial to learn how to read from DHT22:
Regards,
Sara
Nice tutorial Sara and Santos. Everything working fine and well explained. Thanks.
Hi.
Thank you for a nice tutorial.
I’m struggling getting this to only send an email when going below the threshold. Could you provide me with a hint? | https://randomnerdtutorials.com/esp32-email-alert-temperature-threshold/ | CC-MAIN-2022-21 | refinedweb | 4,216 | 64.71 |
Each environment is an HTML page that is 210 pixels high, 160px wide (i.e. identical to ATARI ALE simulator dimensions). The top 50 pixels (with a yellow background) contain the task query - a description of what the agent should do in the environment. The environment logic is written in Javascript, which monitors for events and assigns a reward between 1.0 (failure) to 1.0 (success). We think of MiniWoB as an equivalent of the MNIST dataset for visual recognition, in that these environments are small, self-contained, and contain many of the challenges that an agent navigating websites on the internet must overcome.
The tasks in the benchmark contain many common UI elements and range from simple (e.g. "click the Cancel button") to complex (e.g. "search for a flight from SFO to LAX on 12/05/2016 and book the cheapest flight")):
Preview the environments here.
The MiniWoB benchmark contains a set of environments with a train/test split. The ultimate objective is to perform well on the test environments given not too many interaction steps. One may utilize unrestricted amount of pretraining on the train environments. We also plan to release demonstrations for the training environments, as many of them could be very difficult to perform well on with RL alone.
Contribute environments. Since the environments are very small and easy to write in Javascript/HTML/CSS, we encourage the help of the community to contribute to future release versions of the benchmark. The complete MiniWoB source code will be released as a Github repository in the coming weeks and contributions will be possible as pull requests.
These environments are integrated in the OpenAI Universe.
To train RL agents, we adapt the Universe instructions to run the MiniWob environments. The following simplest starter code creates an agent that clicks at random in the 160x160px "game" area of MiniWoB at 5 FPS:
import gym import universe # register the universe environments import numpy as np def forward(ob): """ Takes raw (768,1024,3) uint8 screen and returns list of VNC events. The browser window indents the origin of MiniWob by 75 pixels from top and 10 pixels from the left. The first 50 pixels along height are the query. """ if ob is None: return [] x = ob['vision'] crop = x[75:75+210, 10:10+160, :] # miniwob coordinates crop xcoord = np.random.randint(0, 160) + 10 # todo: something more clever here ycoord = np.random.randint(0, 160) + 75 + 50 # todo: something more clever here # 1. move to x,y with left button released, and click there (2. and 3.) action = [universe.spaces.PointerEvent(xcoord, ycoord, 0), universe.spaces.PointerEvent(xcoord, ycoord, 1), universe.spaces.PointerEvent(xcoord, ycoord, 0)] return action env = gym.make('wob.mini.ClickButton-v0') # automatically creates a local docker container env.configure(remotes=1, fps=5, vnc_driver='go', vnc_kwargs={'encoding': 'tight', 'compress_level': 0, 'fine_quality_level': 100, 'subsample_level': 0}) observation_n = env.reset() while True: action_n = [forward(ob) for ob in observation_n] # your agent here observation_n, reward_n, done_n, info = env.step(action_n) env.render()
We plan to release a collection of human demonstrations. The recordings are a sequence of (768,1024,3) uint8 numpy arrays (which can be cropped to (210,160,3)), and the actions comprise keyboard events and mouse events. Here is a visualization of one recording:
Download human demonstrations. coming soon
December 12, 2016: initial release of the benchmark page.
- The dataset was developed by Andrej Karpathy at OpenAI. Email: karpathy _at_ openai.com
- Jonathan Hernandez contributed a lot of the environments. | http://alpha.openai.com/miniwob/index.html | CC-MAIN-2017-04 | refinedweb | 587 | 56.96 |
[incr\ Tcl]
NAMEdelete - delete things in the interpreter
SYNOPSISitcl::delete option ?arg arg ...?
DESCRIPTION
The delete command is used to delete things in the interpreter. It is implemented as an ensemble, so extensions can add their own options and extend the behavior of this command. By default, the delete command handles the destruction of namespaces.
The option argument determines what action is carried out by the command. The legal options (which may be abbreviated) are:
- delete class name ?name...?
- Deletes one or more [incrTcl] classes called name. This deletes all objects in the class, and all derived classes as well.
If an error is encountered while destructing an object, it will prevent the destruction of the class and any remaining objects. To destroy the entire class without regard for errors, use the "delete namespace" command.
- delete object name ?name...?
- Deletes one or more [incrTcl] objects called name. An object is deleted by invoking all destructors in its class hierarchy, in order from most- to least-specific. If all destructors are successful, data associated with the object is deleted and the name is removed as a command from the interpreter.
If the access command for an object resides in another namespace, then its qualified name can be used:
itcl::delete object foo::bar::x
- delete namespace name ?name...?
- Deletes one or more namespaces called name. This deletes all commands and variables in the namespace, and deletes all child namespaces as well. When a namespace is deleted, it is automatically removed from the import lists of all other namespaces.
KEYWORDSnamespace, proc, variable, ensemble
[ itcl ]
Copyright © 1989-1994 The Regents of the University of California. Copyright © 1994-1996 Sun Microsystems, Inc. | http://docs.activestate.com/activetcl/8.5/tcl/itcl/delete.n.html | CC-MAIN-2018-09 | refinedweb | 278 | 66.13 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.