matches
 -- the FTS4 query 'k', even though the documents stored in the content
 -- table have been modified.
 --
 UPDATE t2 SET b = 'xxx', c = 'yyy' WHERE rowid = 3;
 SELECT * FROM t3 WHERE t3 MATCH 'k';
 -- Following the DELETE below, the query returns one row containing two
 -- NULL values. NULL values are returned because FTS is unable to find
 -- a row with rowid=3 within the content table.
 --
 DELETE FROM t2;
 SELECT * FROM t3 WHERE t3 MATCH 'k';
</codeblock>

 When a row is deleted from an external content FTS4 table, FTS4 needs to
 retrieve the column values of the row being deleted from the content table.
 This is so that FTS4 can update the full-text index entries for each token
 that occurs within the deleted row to indicate that row has been
 deleted. If the content table row cannot be found, or if it contains values
 inconsistent with the contents of the FTS index, the results can be difficult
 to predict. The FTS index may be left containing entries corresponding to the
 deleted row, which can lead to seemingly nonsensical results being returned
 by subsequent SELECT queries. The same applies when a row is updated, as
 internally an UPDATE is the same as a DELETE followed by an INSERT.

 Instead of writing separately to the full-text index and the content table,
 some users may wish to use database triggers to keep the full-text index
 up to date with respect to the set of documents stored in the content table.
 For example, using the tables from earlier examples:
<codeblock>
 CREATE TRIGGER t2_bu BEFORE UPDATE ON t2 BEGIN
 DELETE FROM t3 WHERE docid=old.rowid;
 END;
 CREATE TRIGGER t2_bd BEFORE DELETE ON t2 BEGIN
 DELETE FROM t3 WHERE docid=old.rowid;
 END;
 CREATE TRIGGER t2_au AFTER UPDATE ON t2 BEGIN
 INSERT INTO t3(docid, b, c) VALUES(new.rowid, new.b, new.c);
 END;
 CREATE TRIGGER t2_ai AFTER INSERT ON t2 BEGIN
 INSERT INTO t3(docid, b, c) VALUES(new.rowid, new.b, new.c);
 END;
</codeblock>

 The DELETE trigger must be fired before the actual delete takes place
 on the content table. This is so that FTS4 can still retrieve the original
 values in order to update the full-text index. And the INSERT trigger must
 be fired after the new row is inserted, so as to handle the case where the
 rowid is assigned automatically within the system. The UPDATE trigger must
 be split into two parts, one fired before and one after the update of the
 content table, for the same reasons.

 The [FTS4 "rebuild" command]
 deletes the entire full-text index and rebuilds it based on the current
 set of documents in the content table. Assuming again that "t3" is the
 name of the external content FTS4 table, the rebuild command looks like this:
<codeblock>
 INSERT INTO t3(t3) VALUES('rebuild');
</codeblock>

 This command may also be used with ordinary FTS4 tables, for example if
 the implementation of the tokenizer changes. It is an
 error to attempt to rebuild the full-text index maintained by a contentless
 FTS4 table, since no content will be available to do the rebuilding.
<tcl>hd_fragment *fts4languageid {FTS4 languageid option}</tcl>

The languageid= option

 When the languageid option is present, it specifies the name of
 another [hidden column] that is added to the FTS4
 table and which is used to specify the language stored in each row
 of the FTS4 table. The name of the languageid hidden column must
 be distinct from all other column names in the FTS4 table. Example:
<codeblock>
 CREATE VIRTUAL TABLE t1 USING fts4(x, y, languageid="lid")
</codeblock>

 The default value of a languageid column is 0. Any value inserted
 into a languageid column is converted to a 32-bit (not 64) signed
 integer.

 By default, FTS queries (those that use the MATCH operator)
 consider only those rows with the languageid column set to 0. To
 query for rows with other languageid values, a constraint of the
 form "<language-id> = <integer>" must be added to the queries
 WHERE clause. For example:
<codeblock>
 SELECT * FROM t1 WHERE t1 MATCH 'abc' AND lid=5;
</codeblock>

 It is not possible for a single FTS query to return rows with
 different languageid values. The results of adding WHERE clauses
 that use other operators (e.g. lid!=5, or lid<=5) are undefined.

 If the content option is used along with the languageid option,
 then the named languageid column must exist in the content= table
 (subject to the usual rules - if a query never needs to read the
 content table then this restriction does not apply).

 When the languageid option is used, SQLite invokes the xLanguageid()
 on the sqlite3_tokenizer_module object immediately after the object
 is created in order to pass in the language id that particular
 tokenizer should use. The xLanguageid() method will never be called
 more than once for any single tokenizer object.

<tcl>hd_fragment fts4matchinfo {FTS4 matchinfo option}</tcl>

The matchinfo= option

 The matchinfo option may only be set to the value "fts3".
 Attempting to set matchinfo to anything other than "fts3" is an error.
 If this option is specified, then some of the extra information stored by
 FTS4 is omitted. This reduces the amount of disk space consumed by
 an FTS4 table until it is almost the same as the amount that would
 be used by the equivalent FTS3 table, but also means that the data
 accessed by passing the 'l' flag to the [matchinfo()] function is
 not available.
<tcl>hd_fragment fts4notindexed {FTS4 notindexed option}</tcl>

The notindexed= option

 Normally, the FTS module maintains an inverted index of all terms in
 all columns of the table. This option is used to specify the name of
 a column for which entries should not be added to the index. Multiple
 "notindexed" options may be used to specify that multiple columns should
 be omitted from the index. For example:
<codeblock>
 -- Create an FTS4 table for which only the contents of columns c2 and c4
 -- are tokenized and added to the inverted index.
 CREATE VIRTUAL TABLE t1 USING fts4(c1, c2, c3, c4, notindexed=c1, notindexed=c3);
</codeblock>

 Values stored in unindexed columns are not eligible to match MATCH
 operators. The do not influence the results of the offsets() or matchinfo()
 auxilliary functions. Nor will the snippet() function ever return a
 snippet based on a value stored in an unindexed column.
<tcl>hd_fragment fts4prefix {FTS4 prefix option}</tcl>

The prefix= option

 ^The FTS4 prefix option causes FTS to index term prefixes of specified lengths
 in the same way that it always indexes complete terms. ^The prefix option
 must be set to a comma separated list of positive non-zero integers.
 ^For each value N in the list, prefixes of length N bytes (when encoded
 using UTF-8) are indexed. ^FTS4 uses term prefix indexes to speed up
 [prefix queries]. The cost, of course, is that indexing term prefixes as
 well as complete terms increases the database size and slows down write
 operations on the FTS4 table.

 Prefix indexes may be used to optimize [prefix queries] in two cases.
 If the query is for a prefix of N bytes, then a prefix index created
 with "prefix=N" provides the best optimization. Or, if no "prefix=N"
 index is available, a "prefix=N+1" index may be used instead.
 Using a "prefix=N+1" index is less
 efficient than a "prefix=N" index, but is better than no prefix index at all.
<codeblock>


text:
Nominated for the Governor General's Award for Children's Illustration
Vivid writing and luminous art combine to tell a modern story that introduces young readers to the wonders of bees For city kids like Sophie and Matthew, growing pumpkins is a big thrill.
But they're worried. They know they need bees to make their pumpkins grow. But will the bees find their garden? Are there even bees in the city?
So one day, Grandpa and the children set out to look for bees. They arrive downtown just in time to see something amazing: a buzzing ball of bees hovers from the branch of a nearby tree. And high on the terrace of a towering hotel are four brightly coloured beehives!
For Matthew and Sophie, this is the beginning of an exciting adventure. All summer they tend their plants, eagerly watching as their seeds sprout and turn into shoots, then vines and leaves. But they're still worried. Will the bees come when they're needed?
Finally, the golden pumpkin flowers appear among the leaves. The female flowers will be open for just one day, and Matthew and Sophie arrive at the garden early in the morning to wait and watch. Will the bees arrive in time to pollinate the plants?close this panel

source: HuggingFaceFW/fineweb-edu


JoVE Chemistry
1, 1, 1
1Department of Chemistry, Lehigh University
 Downloads Comments Metrics
 A straightforward procedure for the preparation of samarium diiodide (SmI2) in THF is described. The role of two main additives namely hexamethylphosphoramide (HMPA) and Ni(acac)2 in Sm mediated reactions is demonstrated in the Sm-Barbier reaction.
 Date Published: 2/04/2013, Issue 72; doi: 10.3791/4323
 Cite this Article
 Sadasivam, D. V., Choquette, K. A., Flowers II, R. A. Preparation and Use of Samarium Diiodide (SmI2) in Organic Synthesis: The Mechanistic Role of HMPA and Ni(II) Salts in the Samarium Barbier Reaction. J. Vis. Exp. (72), e4323, doi:10.3791/4323 (2013).
 1. Synthesis of SmI2 (0.1 M)
 1. Flame dry a 50 ml round bottomed flask and flush it with argon. Add a stir bar and cover the flask with septa. Weigh out samarium metal (0.2 g, 1.3 mmol) and add to flask, again flushing the flask with argon.
 2. Add 10 ml dry, thoroughly degassed tetrahydrofuran (THF) followed by iodine crystals (0.254 g, 2.0 mmol). Add an argon balloon through the septum; this keeps a positive pressure of Ar atmosphere on the reaction.
 3. Stir the solution vigorously at room temperature for over 3 hr. As SmI2 is generated the solution passes through a variety of color changes; orange followed by yellow (45 min), and green (1 hr) which eventually turns into blue.
 4. The final navy blue color is indication that singly ionized samarium has formed. In order to ensure full conversion, stir the solution for at least 3 hr before using SmI2 in synthesis.
 2. Samarium Barbier Reaction-hexamethylphosphoramide (HMPA) Addition
 1. To make the SmI2-HMPA complex, take the freshly prepared SmI2 under argon (10 ml, 0.1 M, 1.0 mmol) and add 1.75 ml of HMPA (10 equiv., 10 mmol) through a syringe, dropwise, under argon. A deep purple color forms.
 2. Separately in a clean, dry vial under argon, add iodododecane (0.45 mmol, 110 μl), 3-pentanone (0.45 mmol, 48 μl) and 2 ml of dried THF.
 3. Add the substrate solution mixture dropwise to the SmI2/HMPA complex.
 4. Within 5 min of stirring, the purple color will start to look cloudy, indicating the end of the reaction.
 5. After the reaction is complete, expose the solution to air to quench it; upon stirring the color further changes to yellow.
 6. The reaction is then worked up by washing with saturated aqueous ammonium chloride. Add the solution to a separatory funnel and add diethylether (5 ml). After vigorous shaking remove the top organic layer, add more diethyl ether. Extract from the aqueous layer two more times and then combine all of the organic layers.
 7. Wash the organic layer with a saturated solution of aqueous sodium thiosulfate. Remove the bottom aqueous layer, followed by wash with water and then final wash with brine. Obtain the top organic layer and add magnesium sulfate to soak up any last amount of water present in the solution.
 8. Pass the solution through a plug of Florisil in order to remove excess HMPA.
 9. Concentrate the solution on a rotary evaporator to obtain Barbier product. The product was identified by GCMS and 1H NMR.23
 3. Samarium Barbier Reaction-Ni(acac)2 Catalyst
 1. Weigh out Ni(acac)2 (1 mol%, 0.01 mmol, 0.0026 g) and add to a clean, dry vial containing 3 ml of degassed THF, under argon. Add the Ni(acac)2 solution through a syringe to a freshly prepared solution of 0.1 M SmI2 (1.0 mmol, 10 ml).
 3. Add the substrate solution dropwise to the SmI2/Ni mixture.
 4. Within fifteen minutes of stirring, the blue color will dissipate to form a yellow-green color indicating the end of the reaction.
 5. After the reaction is complete, expose the solution to air to quench it; upon stirring the color further changes to yellow. Work up the reaction by washing with 0.1 M aq. Hydrochloric acid (3 ml). Add the solution to a separatory funnel and add diethylether (5 ml).
 6. Wash the organic layer using the protocol described previously with an aqueous solution of sodium thiosulfate, water and brine, and then dry over magnesium sulfate. Concentrate the solution to obtain Barbier product. The product can be identified by GCMS and 1H NMR.28
 Representative Results
 Figure 1 illustrates the samarium Barbier reaction. With no additives the Sm-mediated reaction takes 72 hr; yielding 69% of the desired product with the remaining being starting materials. With the addition of 10 or more equiv. of HMPA the reaction is nearly quantitative and complete within a few minutes.15,23 With the addition of 1 mol% Ni(acac)2, the reaction is complete within 15 min, with a 97% yield.28
 When HMPA is added to SmI2, the cosolvent displaces the coordinated THF to form SmI2-(HMPA)4. With the addition of even more HMPA (6-10 equiv.), the iodide ions are displaced to the outer sphere (Figure 2).19-21 Mechanistic studies indicate that when HMPA is used in the Sm-Barbier reaction the cosolvent also interacts with the alkyl halide substrate forming a complex which elongates the carbon-halide bond, activating the species making it more susceptible to reduction by Sm (Figure 3). Through this detailed understanding of the roles of HMPA, a mechanism for the Sm-Barbier reaction with HMPA was proposed (Figure 4).23 The alkyl halide-HMPA complex formed in a pre-equilibrium step is reduced by Sm/HMPA to form the radical in the rate determining step. The radical undergoes further reduction to form an organosamarium species which couples with the carbonyl and upon protonation yields the final product.
 In the case of Ni(II) additive, SmI2 initially reduces Ni(II) to Ni(0) preferentially over reduction of either of the substrates. Based on kinetic and mechanistic studies the following mechanism was proposed (Figure 5).28 After reduction by SmI2, the soluble Ni(0) species inserts into the alkyl halide bond forming an organonickel species. Driven by the highly oxophilic nature of Sm(III), transmetallation to form an organosamarium intermediate releases Ni(II) back into the catalytic cycle. The organosamarium then couples with the carbonyl, and upon protonation forms the desired tertiary alcohol. It was also observed that Ni(0) nanoparticles are formed through Sm-mediated reduction of Ni(II), however these particles were found to be inactive and the source of deactivation of the catalyst.
 Figure 1
 Figure 1. Samarium Barbier reaction with iodododecane and 3-pentanone.
 Figure 2
 Figure 2. SmI2-HMPA complex.
 Figure 3
 Figure 3. HMPA and alkyl iodide complex.
 Figure 4
 Figure 4. Proposed mechanism for the samarium Barbier reaction with excess HMPA.
 Figure 5
 Figure 5. Proposed mechanism for the samarium Barbier reaction containing catalytic Ni(II).
 A straightforward procedure for generating SmI2 solution and its application in organic synthesis using two of the most common additives is presented here. The two examples described portray the importance of mechanistic understanding of the reaction to fine tune the reactivity of SmI2. Knowledge of the underpinning of the reaction mechanism allows the use of this reagent to be adapted by synthetic chemists as per the requirements of their reaction.
 This single electron homogeneous reductant is easy to handle and can be purchased from commercial sources. While the above protocol is straight forward when done under inert conditions, some of the common troubleshooting procedures are: (a) make sure the THF is properly degassed and dry, (b) if Sm metal has had prolonged exposure to air it could have an oxidized outside layer, grind the metal with a mortar and pestal to expose the clean metal surface, (c) flame-dry all glassware and cool under argon, (


text:
- 1 Can I use a toothbrush to exfoliate my skin?
- 2 Is exfoliating with a toothbrush bad?
- 3 Can you use an electric toothbrush to exfoliate your face?
- 4 Does toothbrush help acne?
- 5 How can I exfoliate my face without a brush?
- 6 Does exfoliating help eyebrows grow?
- 7 Does brushing your lips make them bigger?
- 8 Does brushing your lips make them pink?
- 9 What is the best way to wash your face?
- 10 How can I exfoliate my face naturally?
- 11 Do face brushes remove blackheads?
- 12 Is baking soda good for exfoliating the face?
- 13 What happens if you never exfoliate?
- 14 Is it OK to dry brush everyday?
- 15 How do you get rid of blackheads in 5 minutes?
Can I use a toothbrush to exfoliate my skin?
And if they look familiar, that's probably because they're very similar to what you see every day on your toothbrush. You can use toothbrushes to scrub away blackheads around your nose —it really works. To exfoliate your skin just like a Clarisonic would, all you need to do is follow Dr.
Is exfoliating with a toothbrush bad?
Brushing your skin with a tooth paste & brush may lead to skin damages, inflammation, abrasion and even sores, because skin is not as hard as your teeth, you need softer things to wash/ scrub your face.
Can you use an electric toothbrush to exfoliate your face?
Yes, you can exfoliate your skin with an electric toothbrush – but, it's not quite as good as a specialist facial brush – and, now, many years later after having finally splashed out on a Clarisonic Mia I can tell you that they also don't make you sneeze!
Does toothbrush help acne?
Dry brushing may work to exfoliate your skin enough to prevent some acne breakouts on your face. There's also reason to believe that it promotes healthy circulation, and it just feels good to run dry bristles over your face.
How can I exfoliate my face without a brush?
So, here I bring some alternatives.
- Honey. Honey is one among those natural ingredients that can help to remove dead cells from the skin.
- Exfoliating gloves. This time give your gloves a try!
- Sponge. Sponge also works as a great exfoliant.
- Body peels.
- Exfoliating body lotion.
- Dry brushing.
- Rolling exfoliators.
Does exfoliating help eyebrows grow?
Exfoliating your eyebrows doesn't just get rid of those pesky flakes. It can also help with growth, giving you the bushy brows of your dreams.
Does brushing your lips make them bigger?
Does brushing your lips with a toothbrush make them bigger? There's no evidence that brushing your lips will make them permanently bigger. Brushing your lips might cause a temporary increase in blood flow. However, brushing your lips for the purpose of trying to make your lips fuller will likely irritate your skin.
Does brushing your lips make them pink?
Removing the dead skin freshens your lips, making them appear more pink and healthy. Exfoliating with a lip scrub or soft bristled brush will increase the blood circulation in your lips. This increased circulation makes your lips appear healthier and gives them a pinker tone.
What is the best way to wash your face?
Face washing 101
- Use a gentle, non-abrasive cleanser that does not contain alcohol.
- Wet your face with lukewarm water and use your fingertips to apply cleanser.
- Resist the temptation to scrub your skin because scrubbing irritates the skin.
- Rinse with lukewarm water and pat dry with a soft towel.
How can I exfoliate my face naturally?
By exfoliating your skin, you can help remove old, dead skin cells to reveal the healthy, new skin underneath. Some popular natural exfoliants include:
- baking soda.
- finely ground sugar.
- coffee grounds.
- finely ground almonds.
- finely ground sea salt.
Do face brushes remove blackheads?
Facial cleansing brushes spin or vibrate across the surface of your skin to exfoliate and give you a really deep clean. And a deep clean is definitely what you need if you're trying to get rid of blackheads.
Is baking soda good for exfoliating the face?
Much like a salt or sugar scrub, baking soda acts as a physical exfoliator when made into a paste or not fully dissolved in water. Exfoliating can be useful, but exfoliating day and night, like you would if you washed with baking soda, isn't recommended.
What happens if you never exfoliate?
Adult skin that's not regularly exfoliated may experience acne and more rapid visible aging. It is often not very vibrant in tone, and easily becomes clogged with dirt, excess oil, and dead skin cells. Blackheads are also more likely to occur.
Is it OK to dry brush everyday?
When should I dry brush? Dr. Engelman suggests dry brushing every day to see results. She recommends dry brushing to her patients, but cautions that it's possible to over-exfoliate if you're using extreme pressure on sensitive skin.
How do you get rid of blackheads in 5 minutes?
5 Safest Home Remedies to Remove Blackheads
- Coconut oil, jojoba oil, sugar scrub:
- Use baking soda and water:
- Oatmeal scrub: Make a scrub with plain yogurt, half lemon juice, 1 tbsp oatmeal.
- Milk, honeycotton strip:
- Cinnamon and lemon juice:

source: openbmb/Ultra-FineWeb


is "no". Time to test Node 5.
 quadfig10.gif
 Figure 10
 [size="3"]Test 4
 This time, the camera is within Node 5's bounding coordinates, so we test its children. I've named Node 5's four children A, B, C and D for clarity. Time to test Node 5's first child. "Is camera within Node A's bounding coordinates?". Looking at Figure 10, we can see that it isn't, so we'll dismiss Node A and its children.
 quadfig11.gif
 Figure 11
 [size="3"]Test 5
 Now let's test Node 5's second child. "Is camera within Node B's bounding coordinates?". Looking at figure 11, we can see that it doesn't, so we'll dismiss Node B and its children.
 quadfig12.gif
 Figure 12
 [size="3"]Test 6
 Right, let's test Node C, Node 5's third child. "Is the camera within Node C's bounding coordinates?". 'Course it's not, so let's just rid ourselves of node C altogether.
 quadfig13.gif
 Figure 13
 [size="3"]Test 7
 Ok, it has to be in Node D. "Is the camera within Node D's bounding coordinates?" "Yes, yes it is." Finally. Now all we have to do is test all of Node D's children (groan). Well, I'm gonna stop here. Think of working the rest out as an exercise :). For your information, there are 16 more tests, resulting in 5 cells being visible. Let's total up the number of tests. 7 + 16 = 23. We've gone from 256 tests to 23 (22 really, as it wasn't worth testing the root. The camera must lie within the root, else nothing would be visible). With a quadtree, we've done approx. 11.6% of the work of the previous method of testing every cell/leaf. By now you should have a firm understanding of the theory of quadtrees, so put on your coding socks, because were going to make one. Not so fast, Sonny Jim. We'll just summarize what we've talked about:
 A quadtree is used to dismiss large chunks of terrain at a time. If an apple is on a tree's leaf, chopping off the branches the apple is nowhere near saves you looking on every leaf.
 [size="5"]Putting it Together: Coding a Quadtree
 Before we go any further, I advise those who are unsure about Indexed Lists to read through my tutorial here.
 So, now we've got the theory under our belt. How do we put it together? We will need:
 - A structure to hold our Quadtree data
 - A function to create the tree
 - A structure to hold triangle datatypedef struct node
 {
 int bType;
 VERTEX vBoundingCoordinates[4];
 unsigned int uiBranches[4];
 unsigned int uiVertexStrip1[8];
 unsigned int uiVertexStrip2[8];
 unsigned int uiVertexStrip3[8];
 unsigned int uiVertexStrip4[8];
 unsigned int uiID;
 unsigned int uiParentID;
 }NODE;
 The variable bType tells us what type this node is. It can either be NODE_TYPE or LEAF_TYPE. If we are drawing our tree (terrain), it is used as a flag to tell the program to either stop and draw some triangles (LEAF_TYPE) or carry on reading through the tree (NODE_TYPE).
 Next is an array of 4 vertices. These hold the node's bounding coordinates. The layout for the structure VERTEX is as follows:
 typedef struct vertex
 {
 float x,y,z;
 }VERTEX;
 Now we have an array called uiBranches. This is an array of four indexes to the quadtree array. These indexes are the 'children' of the node. If the bType is LEAF_TYPE, this isn't used.
 As we said each leaf would hold 16 triangles, we have 4 arrays, named uiVertexStrip1 to uiVertexStrip 4. Each of these arrays holds 4 indexed triangles in the form of a triangle strip. In this tutorial, we won't be using these, so we won't go into detail about them (it also saves me an explanation).
 The variable uiID holds the nodes ID in the quadtree. As I said before, the quadtree is just an array of nodes. The ID is just an index in that array.
 Then we have our last variable, the uiParentID. This is the ID (index) of the parent. This, coupled with the uiBranches array, lets us navigate our way round the tree, by jumping from node to node. At any given node, we can go to its parent or its children, which, if we follow the tree, will take us to the root, or all of the leaves.
 NODE *pNodeList;The line above creates a pointer structure called pNodeList. It can be called anything. Basically, it is our quadtree. Note: we'll use array element pNodeList[0] as our root.
 quadcode1.gif
 Formula 1
 The above formula gives us the number of leaves. The Leaf Width is the number of triangles across in each leaf. As we said each leaf will be one cell by one cell, we also said each cell contains 16 triangles. In our case, seeing as cells are 16x16 triangles, the Leaf Width will be 4. Grid Width is the width of the grid in triangles. As each cell is 4 triangles across, 16 cells x 4 is 64. To find out the total number of nodes in the tree, we call the function CalcNodeNum. Below is the function CalcNodeNum:
 unsigned int CalcNodeNum(unsigned int max,unsigned int min)
 {
 int ctr=0;
 int var = 0;
 while(var==0)
 {
 ctr+=max;
 max=max/min;
 if(max==1)
 {var=1;}
 }
 ctr++;
 return ctr;
 }
 Here, CalcNodeNum takes two parameters: the total number of leaves (max), and the leaf width (min). In our case, the leaf width is 4 triangles. The total number of leaves was obtained in the previous formula. What CalcNodeNum does is keep on dividing the grid by min to get the total number of leaves. Step through the function to understand it better. So, let's get the next bit of code done:
 unsigned int Temp =(GridWidth/4)*(GridWidth/4);
 unsigned int Temp2 = CalcNodeNum(Temp,4);
 pNodeList = (NODE*)malloc(sizeof(NODE)*Temp2);
 Ok. The first line uses Formula 1 to calculate the total number of leaves. The second line stores the total number of nodes in an unsigned integer called Temp2. The third line allocates memory for pNodeList. We typecast the function "malloc" with our structure "NODE". Then, we allocate memory for Temp2 nodes by multiplying the number of nodes by the size of the NODE structure. For more information, check out the "malloc" and "sizeof" functions in your compiler's help file. Now that we've calculated the number of nodes and allocated memory for our quadtree, let's call our quadtree creation function.
 But first, let's lay the foundation knowledge for recursive code. We'll use a number counter as an example. If we want to display the numbers 1 to 10, we could do this:
 void Count(int num)
 {
 cout< }
 void main()
 {
 Count(0);
 Count(1);
 Count(2);
 Count(3);
 Count(4);
 Count(5);
 Count(6);
 Count(7);
 Count(8);
 Count(9);
 return;
 }
 But as you know, that would be tedious every time we wanted to count with numbers. So, the natural progression would be something like so:
 for(int ctr=0;ctr<10;ctr++)
 {
 Count(ctr);
 }
 Although there is nothing wrong with the above code, using it for our quad-tree would be a real nightmare. This would involve having lots of temporary values and it would take a lot of time to get right. You'll understand why once we've coded our quadtree. In the above code, we have actually implicitly called Count 10 times ourselves. If we wanted to call it 20 times, we would have to explicitly tell the 'for' statement 20 times. Recursive code needs only be called once. There is no need for 'for' or 'while' statements. The reason is that we call the recursive function, and it calls itself however many times we tell it to. So, to the code:
 void Count(int num)
 {
 static int ctr = 0;
 if(ctr>num)
 {return;}
 else
 {


t on a different domain?
Sometimes you'll have some files that are on a different domain, and some that aren't. If you have files on the same domain, you certainly wouldn't want to use the iframe hack — it would be completely unnecessary. In my system, I expanded on the previous example by adding a domain-matching check before invoking the proxy. It requires specifying the parent's domain in the querystring for the content iframe. The JavaScript in the content iframe looks like this:
//Get the querystring
var querystring = window.location.href.split("?")[1] || false;
//Create boolean indicating whether domains match.
//If domains match, no need for proxy workaround.
var isSameDomain = (querystring && querystring.contains("domain=" +document.domain));
function setCompletion(result){
 if(isSameDomain && parent){
 top.interactionCompleted(result);
 } else {
 //do what's in the previous example
 }
}
document.domain can be used to find out what the current domain is for security purposes. A simple string search will tell you whether the content frame's domain is found inside the querystring that was passed from the parent.
What if I have multiple actions I'd like to perform using the proxy?
Simple: Just add it to your querystring and build the logic into your proxy.html file's JavaScript. You can make it as simple or complicated as you like!
Disclaimer: I have no affiliation with any real sites that may be located at mylms.com or content.org; these addresses were picked at random and only used for demonstration purposes.
30 Replies to "IFrames and cross-domain security, part 2"
 1. Hi, I tried ur solution, but I dont know how to set the "top." properly, so it doesnt work. Can u send me the sample code so I can get it working?… thx a lot.
 2. Dont worry, I got it working setting the top outside the function
 var top = parent.opener;//(I use a popup window)
 window.onload = function (){ … }
 Thanks anyway for the post.
 3. Great Solution!!!!
 However i have two questions to you, would appreciate if you can answer. My scenario is exactly similar to yours but in my case both 'mylms' & 'content' domains are actually sub-domains under say the same domain say 'myworld'.
 So My first site is at :
 1) _URL_ & the second site is at
 2) _URL_
 Now even though both the sites are under different sub-domains, they are under the same domain of 'myword'. Even in this case I get permission denied errors.
 1) Shouldnt my case actually qualify for a same domain policy? (are browsers so stringent that even subdomains need to match? gr!!!! :))
 2) As a work around to AVOID your hack, can please you let me know the disadvantages of using a reverse-proxy setup at my end to serve the page '_URL_', so that to the browser it appears as if it came from the same domain.
 4. For the question posted on 'September 16th, 2009, 3:26 pm.' – i.e. iframes with different subdomains but on same main domain.
 I got a simpler work around, the trick was to set the documents domain of both documents as that of the main domain.
 Documents are allowed to change from their subdomain to main domain. ex. from yyy.zzz.com you could set your document domain to zzz.com. Now as both iframes have same domain, they can share/communicate easily.
 5. @max XSS hacks should fail in this case, as the querystring simply contains a string that gets examined in a switch statement. There are no eval() statements, JSON syntax, or redirects being used here.
 @Din setting document.domain is great in some situations but will not work for me, as I have completely different domains (not just a subdomain). Reverse proxy setups are also great if you have that level of control on your server(s). I normally have to work with 3rd party servers that I can't control.
 6. Sory I didn't get it.
 You said: "The content iframe, which is loaded from the external domain content.org, contains a function that creates the nested iframe element …".
 May be its a stupid question, but: how can you insert the setCompletion function in a page of another domain loaded into an iframe?
 TIA
 7. Hi, thanks for the detailed explanation.
 Does it work if the second domain is SSL encrypted (and not the first one)?
 In fact, I am trying to find a work around to a problem that may be related to crossdomain : "How to load an iFrame from an non-secured HTML page, and make the iFrame querying over SSL…".
 1. @thierry I've never tried it over SSL.
 Now that I think about it, yes, my main page and proxy are delivered via HTTPS while the iframe is delivered via HTTP. I don't know what affect serving the main page via HTTPS and the proxy via HTTP would have.
 @brian Nice. Unfortunately, I work in an IE6 environment (beyond my control), so I'm unable to rely on HTML5 just yet. Rest assured I'll be doing a little jiggity jig when we lay IE6 to rest!
 8. @paulo
 sorry for not responding sooner, i overlooked your comment.
 this workaround assumes you have authoring rights to the content of both domains. you must prep the external site by adding JS that can work with the proxy file.
 in my case i have authoring rights to both domains, but the browsers don't care and will still prevent the sites from communicating via JS. since i can modify the external site's code, i edited the HTML file to include the setCompletion JS code.
 this cross-domain hack is very specific for my particular situation, and will not work if you don't have the ability to modify the source code in both domains.
 9. Great solution. Finally I was able to resolve my iframe cross site scripting issue. I wish I saw this posting earlier, it would have saved me couple of days. Thanks.
 10. It's a great Solution. But, if in my case the Domain A is facebook, ning or some other third party. I just want to write a simple iframe in DomainA to my webpages from Domain B. In this case DomanA (like facebook, ning, etc..) does not accept to place a proxy file (dummy file) in their server or Domain. But, i want to call a method which i wrote there in DomainA. How can i do that?
 Can you please help me?
 11. Very nice article!
 It helped me to prove that its not possible to do something that customer wanted, to load https page in to the window opened from http ( also same domain, but different ports ) and then to communicate between this 2 windows. To be precise to grab LMS API object that is placed on http page, by course located in popup on https. And I hope that I'm right claiming this 🙂
 Thanks
 Andrija
 12. @andrija
 Thanks. Generally speaking, the Same Origin Policy will prevent URLs with different protocols (https, http) from being treated as the same domain.
 You can check to see if they're considered same domain via JavaScript. If you can read the other page's window.location, you're on the same domain. If it fails (throws an exception), it will be because of cross-domain security.
 13. Thank you very much for your effort. I tried it on my case and it did work perfect. Afterwards I added this article on my post, in Turkish. I hope you wouldn't mind.
 My Post in Turkish
 14. I've read a lot about this crossdomain problem and you wrote the most understandable explanation, it work great ! Thanks a lot !
 15. Hi,
 This looks like a good solution but I'm still trying to digest the details.
 Would it be possible to put a vey simple complete solution so that I can download it. I am currenlty stuck with cross-domain issue for these last 2 days and can't find a decent solution that work.
 Regards
 16. I have implemented your solution but have one more problem I can't seem to solve. Any help will be appreciated.
 In the child frame (domain B) I'm loading a remote script located at the parent domain (domain A), which creates the hidden frame with a source located at domain A.
 When I'm trying to call a function in the script, I get an "object expected" error.
 When I replace the remote script with a local one, I get an "access denied" error.
 I'm using IE7 on XP with ASP.NET files.
 17. It was a nice article. I thought i got somewhere there, but couldn't get it fully


Spinach vs JUnit comparison of testing frameworks
What are the differences between Spinach and JUnit?
Spinach
_URL_
JUnit
_URL_
Programming language
Ruby
Java
Category
Acceptance Testing
Unit Testing, Regression Testing
General info
Spinach is a BDD framework on top of Gherkin
Spinach is a high-level BDD framework that leverages the Gherkin language to help define executable specifications of your application or library's acceptance criteria.
JUnit is an open source Unit testing framework for java
JUnit is useful for developers to write and run repeatable tests. JUnit has been crucial in the development of test driven development and is partof the xUnit family of unit testing frameworks
xUnit
Set of frameworks originating from SUnit (Smalltalk's testing framework). They share similar structure and functionality.
No
Yes
It is an instance of the xUnit architecture for unit testing frameworks.
Client-side
Allows testing code execution on the client, such as a web browser
N/A
Yes
You can test front-end components such as individual classes and functions that create the front-end
Server-side
Allows testing the bahovior of a server-side code
Yes
You can test any server-side behaviour with Spinach
Yes
You can test classes and functions that compose the back-end such as database connections and so on
Fixtures
Allows defining a fixed, specific states of data (fixtures) that are test-local. This ensures specific environment for a single test
No
Yes
JUnit contains a setUp() method, which runs before every test invocation and a tearDown() method, which runs after every test method.
Group fixtures
Allows defining a fixed, specific states of data for a group of tests (group-fixtures). This ensures specific environment for a given group of tests.
No
Yes
You can use setUp() and tearDown() inbuilt functions as group fixtures.
Generators
Supports data generators for tests. Data generators generate input data for test. The test is then run for each input data produced in this way.
Yes
Spinach has inbuilt generator methods
You can use JUnit-quickcheck to generate test data
Licence
Licence type governing the use and redistribution of the software
MIT License
Mocks
Mocks are objects that simulate the behavior of real objects. Using mocks allows testing some part of the code in isolation (with other parts mocked when needed)
Yes
Spinach can access the rspec-mocks methods
JUnit does not support mocking internally but you can use a mock framework like Mockito to generate mock objects.
Grouping
Allows organizing tests in groups
Yes
Spinach Integrates with your RSpec test suite which allows declaring example groups and contexts.
Yes
In JUnit you can create a test suite that bundles a few unit test cases and runs them together. You use both @RunWith and @Suite annotation are used to run the suite test.
Other
Other useful information about the testing framework


text:
Excellence Awards honour best and brightest of Flanders' scientists
The Foundation for Scientific Research has announced the recipients of its Excellence Awards, which recognise outstanding contributions to science every five years
From the stars to our eyes
Three of the Excellence Awards laureates this year are professors at KU Leuven, and two come from the life sciences research institute VIB.
Astrophysicist Conny Aerts (pictured) has won the Excellence Award for Exact Sciences. She is a professor at KU Leuven and a pioneer of asteroseismology, the study of the internal structure of stars. She has developed rigorous mathematical models to detect and identify non-radial stellar oscillations (repetitive movements) within stars.
The FWO award is the icing on the cake of a long string of recognitions for Dr Aerts, including two of the EU's ERC Advanced Grant and the 2012 Francqui Prize, known as the Belgian Nobel Prize. She was the first woman to win the Francqui Prize in its 79-year history. She is also the first woman to win the Excellence Award in Exact Sciences.
Eliminating fossil fuels
Wout Boerjan of the VIB-UGent Center for Plant Systems Biology has won the Excellence Award in Applied Sciences for his ground-breaking research into the structure of lignin, found in plant tissues. His work to engineer plant cell walls that are easier to convert to fermentable sugars has been seminal in advancing the progress of plant biomass, a replacement for limited fossil fuels. This has been instrumental in paving the way to a sustainable bio-economy.
"I am honoured to receive this award," says professor Boerjan, "which would not have been possible without the great efforts of my team and the excellent research environment provided by VIB and Ghent University. In addition, it is great that my team can contribute to achieving a more sustainable society."
We are supported by a good research and biotech climate in Flanders, which can compete with the best in the world
Another VIB-UGent researcher, Bart Lambrecht, was awarded an Excellence Award, this time in the category Fundamental Biomedical Science. Part of the Center for Inflammation Research, professor Lambrecht was recognised for his outstanding work in pinpointing the function of the immune system in various lung diseases such as asthma and viral infections.
Also a physician, Lambrecht is one of few clinicians who bridge the gap between immunology research and applications in patients. In doing so, his work on the basic mechanisms of inflammatory diseases has led to several new drug candidates. Dr Lambrecht is also the winner of an ERC Advanced Grant and the Francqui Prize.
"I am very proud of this award, which is the result of years of hard work by a very dedicated team of colleagues at VIB and Ghent University," he says. "We are also supported by a good research and biotech climate in Flanders, which can compete with the best in the world."
KU Leuven professor Guy Boeckxstaens of the Department of Translational Research and Gastroenterology Disorders has won the Excellence Award in Clinical Biomedical Sciences. The winner of numerous national and international awards, including two ERC Advance Grants, Dr Boeckxstaens has devoted his career to advancing treatment of gastrointestinal disorders.
His research has identified interactions between the nervous system and the immune system in causing disorders in the gastrointestinal tract. His findings have improved diagnosis and treatment for diseases such as gastroesophageal reflux, irritable bowel syndrome, dyspepsia and chronic constipation.
Finally, Johan Wagemans, the chair of KU Leuven's Department of Brain and Cognition, has won the Excellence Award for Humanities and Social Sciences. With a background in both psychology and philosophy, professor Wagemans has contributed invaluable research to the study of visual perception, especially shape, object and scene perceptions.
Dr Wagemans has also studied visual perception in people with autism, schizophrenia and cerebral visual impairments as well as in the field of arts and sport – useful to understanding referee calls.
Launched in 1960, today the Excellence Awards come with a €100,000 prize. Researchers cannot apply for the award themselves but are nominated by peers from Belgium and abroad. An independent jury of international scientists screens the nominations and selects one laureate in each area.
The award ceremony will be held in December in the presence of King Filip. The laureates will then receive their prize money and a unique work of art created especially for the occasion by famous Flemish sculptor Tom Frantzen.
Photos, from top: ©KU Leuven, _URL_ Images Plus

source: m-a-p/FineFineWeb


text:
What is a Towline Conveyor?
A towline conveyor can be used in a wide variety of applications where it is advantageous to carry the product on a mobile cart. Some products are considered "unconveyable" due to their shape, configuration or size. A typical example would be large four-legged furniture items.
The PAC-TRAK™ from PACLINE utilizes mobile carts, normally with a rotating top, onto which the item to be conveyed is placed. A variety of floor-mounted conveyors are used to propel the cart through the process, depending on the loading, speed and preferred configuration.
The Towline Conveyor system can be designed with on-floor or in-floor tracks. On-floor conveyors are attached to the floor surface without trenching. In this case, plant personnel must walk over the track, and forklifts will not be allowed to drive in the area of the conveyor. The drive unit may be situated in a "pit" or mounted above the floor. If mounted above the floor, provisions must be made where the cart crosses the conveyor path.
GET MORE INFORMATION
Other Towline Conveyor Features:
- A Standard 4-wheeled cart is propelled by a drive chain.
- Towline track can be in-floor or on-floor mounted with minimal cross-section height.
- Top platens can be custom designed based on the size, shape and weight of the item being conveyed.
- Platens can be rotated manually or automatically for close packing.
- Reliable conveyor chain used with ball bearing wheels instead of "link" chain to reduce maintenance.
- Finishing lines
- Assembly lines
- Wood industry – for large or awkward items that need to move through the production and finishing process, the Towline cart provides a convenient means of holding, conveying and rotating the wood item.


text:
Fishing quota will be granted for each marine species (18-10-2018)
According to Ministry of Agriculture and Rural Development, the number of fishing vessels, the building of new fishing vessels will be managed, fishing quotas will be granted for each marine species in the coming time.
Deputy Minister of Agriculture and Rural Development (MARD) Mr. Vu Van Tam said at the fisheries statistics seminar held by the MARD in August 11 2018 in Da Nang City that fishing exploitation will be managed and traceability will be implemented in coming time.
Mr. Vu Van Tam also said that in the context of the European Commission (EC) warned yellow card for Viet Nam fisheries, the fisheries sectors should take urgently nine recommendations of the EC into fisheries law and progress towards integration. This is also an opportunity for Viet Nam to shift from an artisanal fishing industry to a responsible and sustainable fishing industry.
According to Mr. Tam, the new fisheries law comes into effect from the beginning of next year, introducing many institutions to management and regulation of fisheries resources. At this point, the authorities will manage and control the fishing capacity and traceability of capture products' origin.


text:
Intro to Survival Skills:
you know what to do in an emergency situation? Where can you find water? Is it safe to drink? How can you create a shelter? Signal for help? Using a compass, and methods of starting a fire. Find wild edibles to eat, and how to prepare them. Cost is $5 NNC members, $10 for non-members This will include time inside and outside on the grounds.
Navarino Nature Center
W5646 Lindsten Rd, Shiocton, WI 54107


text:
The town of Rathkeale is situated about 14 miles from Limerick City, on the N21 that runs from Limerick to Tralee. Together with the town of Newcastlewest, it is one of the two main centres in the west of the diocese. The importance of Rathkeale as a centre can be traced back to the foundation of an Augustinian priory in the town in 1289. Its location on the river Deel added to its influence in the area. The arrival of the Palatines also contributed to the development of Rathkeale.
The Palatines were Lutheran refugees who fled from the Rhenish Palatinate of Germany due to an invasion by the French. They came to the area in 1708-09 under the patronage of Lord Southwell. Approximately twelve hundred Palatines came to settle in the area and their new ideas in farming were a large contributing factor to the development of the town. Rathkeale was also a major market town for the area and held seven fairs throughout the year.
The name Rathkeale comes from the Irish 'Ráth Caola' and it is believed to be derived from Ráth gCaeli, which means "the fort of the Caeli" or "the Rath of Caola". The Caeli were a Celtic tribe who came from this area of Limerick. The parish of Rathkeale is made up of the old parishes of Rathnasaire and Kilcoleman.
The Earls of Desmond used Rathkeale as a base. Castle Matrix was the principal stronghold of the Desmonds in the area and was built in or around 1410 by the Fitzgeralds of Desmond. In October 1580, two famous visitors came to stay at Castle Matrix. They were the poets Edmund Spenser and Walter Raleigh.
Sir Nicholas Malby burned the town of Rathkeale in 1579 after he defeated the forces of John, Earl of Desmond. John and his forces fled to Rathkeale from Manister where Malby had earlier defeated the Irish.
Captain Walter Raleigh ambushed the Irish, who were about to plunder what was left of the English camp once the troops had left. He received the freedom of the town in 1580, as a reward. Raleigh also repaired the castles at Rathkeale (Desmond's) and Matrix. The lands of the Munster Geraldines were in the main divided up amongst Spenser, Raleigh and Edmund Southwell. Raleigh gave some 'Virginia Tubers' as a present to Southwell. Southwell planted the tubers in the land around Castle Matrix and, in 1610, the crop was distributed throughout the province of Munster.
In 1654 Cromwell fixed the town as the place for the election of the counties of Limerick, Cork and Kerry for his parliament. However, Cromwell changed his mind on this point when the town refused to supply his army with sufficient provisions of food.
In the past church appointments were sometimes challenged by the local gentry. In 1748 the parish priest Fr. James Moore died. Henry Southwell lead opposition to the appointment of a number of priests by Dr. Lacy and finally the position of parish priest was successfully held by David Bourke who lived in the parish until his death in 1762.
In 1846 a hoard of coin was discovered in Rathkeale. These
coins were minted during the reign of Edward III (_PHONE_). It is believed
that the coins may have been part of the spoils of the O'Briens victory at
Monasteranenagh in 1370.
The present church in the town is dedicated to St Mary. J.J. McCarthy of Dublin designed the church in a Gothic-revival style during James O'Shea's term as parish priest from 1864 to 1877. However, Fr O'Shea died in 1877 and did not get to see the spire. The tower and spire of the church were completed in 1881 by Archdeacon Halpin, who dedicated them to the memory of his predecessor James O'Shea. The church bell was installed in 1882. The architect of the church, J. J. McCarthy, was also the architect of the church of SS Peter and Paul in Kilmallock, which was built in 1878.
A large marble plaque by the right side door mentions all the donors and their donations to the church. The Magnor family donated the site of the church and the graveyard. Patrick Hartigan and his family donated the Stations of the Cross to the church in 1874.
There are three plaques in the church, one of which commemorates Dean Costello's 70 years as a priest, while the other two are in memory of two former parish priests of Rathkeale; William Molony who died on November 7th 1901 and Archdeacon Halpin who was parish priest from 1877 until his death in 1884, aged 74. At the back of the church on the right there is a mosaic of the Angel Gabriel that was given to the church by General and Mrs. Lloyd of Beechmount. The mosaic was given in memory of their only child T. H. Eyre who was a Captain of the Coldstream Guards. Eyre was killed at Brakeenlaagte; Transvaal, South Africa during the Boer War on October 31st 1901, aged 30.
Inside the church on the left there is a shrine to Jesus on the Cross. A three-sectioned stained glass window was erected in 1973 to commemorate the 100th anniversary of the opening of Rathkeale church. The three sections depict (from left to right) the keys of Heaven, the Holy Spirit and the Body and Bread.
The next stained glass window is also in three sections and depicts the Queen of Heaven, Jesus and an Apostle, and the dove of peace/the Holy Spirit. Underneath the window a plaque asks people to pray for Nora McMahon and her family.
Another stained glass window shows scenes from the Rosary, which shows the Assumption of Mary into Heaven and the Resurrection of Jesus from the tomb in the left panel. The middle panel depicts Jesus on the mountain with Elijah and Moses and Pentecost Sunday. The right panel shows Mary, Queen of Heaven and the Ascension into Heaven. The inscription under the window asks that people pray for Minnie Madigan and her relatives.
Over the Confessional on the left-hand side, there is a large stained glass window that was the gift of a number of families in the parish. Again the stained glass window is divided into three sections. The left section has three levels which depict (from the top) St Matthew and St Mark, St John the Baptist and St Augustine and St Ambrose. The middle section shows St Dominic, St Patrick and St Liguori while the right section depicts St Luke and St John, St Helen and St Jerome and St Gregory.
Near this stained glass window, there are two plaques. The first plaque tells us that Patrick Hartigan and family gave the Stations of the Cross in 1874. There is also a plaque to Dean Canon Costello PP who was a Dean from 1964 until 1989 when he resigned both titles. The plaque also states that Dean Canon Costello celebrated 70 years as a priest on June 20 1995. Dean Costello died on June 17 1996. Over the plaque there is a picture of the Sacred Heart.
There is an altar to Sacred Heart at the top left of the church. Over the altar of the Sacred Heart, there is a stained glass window of Mary, Jesus and Joseph. To the left of the altar there is a stained glass window of the Annunciation and the Sacred Heart appearing to St Margaret Mary.
At the top of the church on the right there is an altar to the Virgin Mary. Also in the church there is an Adoration chapel. At the back of this small chapel there is a stained glass window of the Lamb of God that is to the memory of Dean Thomas Costello PP.
The High Altar depicts the Angel Gabriel visiting Mary, the crowning of Mary and the Nativity. There are a number of stained glass windows in the apse which are (from left to right) St Paula, St Jeanne de Chantal, St Marcella, St Charles Borromeo, the Immaculate Conception, St Thomas Aquinas, St Winifred, St Francis Xavier and St Margaret. Viscount Southwell donated this window
Murals underneath these stained glass windows depict a number of saints: St James the Great, St Francis, St Philip Nero, St Maria of Pisa, St John, St Anne, St Catherine, the Lamb of God with a flag, St David, St Susanna, St Thomas, St Mary Magdalene, St Robert, St Elizabeth and St Charles Borroma. This mosaic work was at the bequest of W. J. Hayes.
There are small stained glass windows to the right of the altar. They depict the Virgin Mary, St James the Greater, St Munchin and St George. Fr James O'Shea PP of Rathkeale donated these windows. There is a small stained glass window of an angel on either side of the altar.
The stained glass windows above the choir gallery show Christ the King in the small centre window with underneath (from left to right) St Patrick, St Bridget, St Bertha the Abbess and St William the abbot. Lord Emly, William Maunsell, donated the window in 1873.
On the right hand side of the church there is a stained glass window showing three scenes from Moses


Creating and Using a DataView Object
Chia sẻ: Tuan Nghia | Ngày: | Loại File: PDF | Số trang:5
0
74
lượt xem
11
download
Creating and Using a DataView Object
Mô tả tài liệu
 Download Vui lòng tải xuống để xem tài liệu đầy đủ
Creating and Using a DataView Object In this section, you'll learn how to filter and sort rows with a DataView object. You create a DataView object using one of the following constructors
Chủ đề:
Lưu
Nội dung Text: Creating and Using a DataView Object
 1. Creating and Using a DataView Object In this section, you'll learn how to filter and sort rows with a DataView object. You create a DataView object using one of the following constructors: DataView() DataView(DataTable myDataTable) DataView(DataTable myDataTable, string filterExpression, string sortExpression, DataViewRowState rowState) where • myDataTable specifies the DataTable that your DataView is associated with. Your DataView will read the rows from this DataTable. The Table property of your DataView is set to myDataTable. • filterExpression specifies a string containing the expression you want to filter the rows by. The RowFilter property of your DataView is set to filterExpression. • sortExpression specifies a string containing the expression you want to sort the rows by. The Sort property of your DataView is set to sortExpression. • rowState specifies an additional filter to apply to the rows; rowState filters by the DataRowView-State of the DataViewRow objects in your DataView. The RowStateFilter of your DataView is set to rowState. Before you create a DataView, you first need a DataTable from which to read rows. The following example creates and populates a DataTable named customersDT that contains rows from the Customers table: SqlCommand mySqlCommand = mySqlConnection.CreateCommand(); mySqlCommand.CommandText = "SELECT CustomerID, CompanyName, Country " + "FROM Customers"; SqlDataAdapter mySqlDataAdapter = new SqlDataAdapter(); mySqlDataAdapter.SelectCommand = mySqlCommand; DataSet myDataSet = new DataSet(); mySqlConnection.Open(); mySqlDataAdapter.Fill(myDataSet, "Customers"); mySqlConnection.Close(); DataTable customersDT = myDataSet.Tables["Customers"]; Let's say you want to filter the rows in CustomersDT to view just the customers in the UK. Your filter string expression would be
 2. string filterExpression = "Country = 'UK'"; Note Notice that UK is placed within single quotes. This is because UK is a string literal. Also, let's say you want to sort those rows by ascending CustomerID column values and descending CompanyName column values. Therefore, your sort expression would be string sortExpression = "CustomerID ASC, CompanyName DESC"; Note ASC sorts in ascending order. DESC sorts in descending order. Finally, let's say you wanted to view only the original rows in the DataView; you therefore set your row state filter to DataViewRowState.OriginalRows: DataViewRowState rowStateFilter = DataViewRowState.OriginalRows; Note The default is DataViewRowState.CurrentRows, which includes rows in your DataView for which the DataViewRowState is Unchanged, Added, and ModifiedCurrent. The following example creates a DataView object named customersDV and passes customersDT, filterExpression, sortExpression, and rowStateFilter to the DataView constructor: DataView customersDV = new DataView( customersDT, filterExpression, sortExpression, rowStateFilter ); You can also create a DataView and set the Table, RowFilter, Sort, and RowStateFilter properties individually. For example: DataView customersDV = new DataView(); customersDV.Table = customersDT; customersDV.RowFilter = filterExpression; customersDV.Sort = sortExpression; customersDV.RowStateFilter = rowStateFilter; A DataView stores rows as DataRowView objects, and the rows are read from the DataRow objects stored in the underlying DataTable. The following example uses a foreach loop to display the DataRowView objects in the customersDV DataView:
 3. foreach (DataRowView myDataRowView in customersDV) { for (int count = 0; count < customersDV.Table.Columns.Count; count++) { Console.WriteLine(myDataRowView[count]); } Console.WriteLine(""); } Note that myDataRowView[count] returns the value of the column at the numeric position specified by count. For example, myDataRowView[0] returns the value of the CustomerID column. You'll learn more about the DataRowView class later in the section "The DataRowView Class." Listing 13.1 shows a program that uses the previous code examples. Listing 13.1: USINGDATAVIEW.CS /* UsingDataView.cs illustrates the use of a DataView object to filter and sort rows */ using System; using System.Data; using System.Data.SqlClient; class UsingDataView { public static void Main() { SqlConnection mySqlConnection = new SqlConnection( "server=localhost;database=Northwind;uid=sa;pwd=sa" ); SqlCommand mySqlCommand = mySqlConnection.CreateCommand(); mySqlCommand.CommandText = "SELECT CustomerID, CompanyName, Country " + "FROM Customers"; SqlDataAdapter mySqlDataAdapter = new SqlDataAdapter(); mySqlDataAdapter.SelectCommand = mySqlCommand; DataSet myDataSet = new DataSet(); mySqlConnection.Open(); mySqlDataAdapter.Fill(myDataSet, "Customers");
 4. mySqlConnection.Close(); DataTable customersDT = myDataSet.Tables["Customers"]; // set up the filter and sort expressions string filterExpression = "Country = 'UK'"; string sortExpression = "CustomerID ASC, CompanyName DESC"; DataViewRowState rowStateFilter = DataViewRowState.OriginalRows; // create a DataView object named customersDV DataView customersDV = new DataView(); customersDV.Table = customersDT; customersDV.RowFilter = filterExpression; customersDV.Sort = sortExpression; customersDV.RowStateFilter = rowStateFilter; // display the rows in the customersDV DataView object foreach (DataRowView myDataRowView in customersDV) { for (int count = 0; count < customersDV.Table.Columns.Count; count++) { Console.WriteLine(myDataRowView[count]); } Console.WriteLine(""); } } } Notice that the rows in customersDV are filtered to those for which the Country is UK, and the resulting rows are then sorted by CustomerID. The output from this program is as follows: AROUT Around the Horn UK BSBEV B's Beverages UK CONSH Consolidated Holdings UK
 5. EASTC Eastern Connection UK ISLAT Island Trading UK NORTS North/South UK SEVES Seven Seas Imports UK
Đồng bộ tài khoản


text:
The drafting of regulations through which a levy on plastic carry bags would become a reality in Namibia is at an advanced stage, and these regulations could be implemented towards the end of 2017. This was announced by Mr. Teofilus Nghitila, Environmental Commissioner in the Ministry of Environment and Tourism, at the ninth After-Work-Talk of the Environmental Economics Network of Namibia, which was staged at the Namibian Scientific Society in Windhoek on 3 August 2017. He was part of seven panellists who each highlighted the topic, The introduction of a plastic bag levy – an option for Namibia? All panellists were in favour of a plastic bag levy, with minor reservations in some cases.
Mr. Nghitila emphasized that some key questions around plastic bags need to be discussed with stakeholders. These would include the banning of all 'problem' plastics entering Namibia that contain Calcium Carbonate (CaCO3), assessing of plastics that are produced locally, the regulation thereof and the reinvestment of the levy revenue into environmental activities. He said locally manufactured plastics can be controlled while most of these are already biodegradable. According to Mr. Nghitila levies on plastics would not be the only solution in curbing pollution. It, however, can be used to change consumer behavior. "If we can change the mind set of consumers, they could start using alternatives."
Mr. Benedict Libanda, Chief Executive Officer of the Environmental Investment Fund (EIF), said the EIF under the auspices of the Ministry of Environment and Tourism is geared towards the collection of levies. He pointed out that the EIF would operate according to its three principles of Accountability (what impact a levy will have), Transparency (that the collection process is transparent), and Earmarking (levy revenue should be used for a specific environmental purpose and not mixed with other levies).
He said they believe in ring fencing revenue generation so that it could be ploughed back into relevant environmental conservation activities. He said environmental levies would serve the purpose of curbing pollution the best. A total ban on plastic bags would have a huge economic impact on the local manufacturing industry as many jobs could be lost.
Mr. Libanda also noted that the EIF has been consulting widely about levies during the past two to three years and conducted studies on how to deal with the environmental challenges caused by the dumping of batteries, computers and lubricant oils. It has developed regulations with the Ministry of Justice and which would now need to get political approval. The EIF has developed investment centres from which SMEs would be helped to utilise and process by-products from the above mentioned dumped items.
The Managing Director of Plastic Packaging, Mr Jaco Venter said his company would have limited objections to a levy on plastic carriers bags. They would support the idea that revenue from levies should directly support environmental activities. He noted that the plastic carrier bag should not be singled out as the only cause of plastic pollution. He referred to plastic bottles in which mineral water is sold, of which 60 percent is being imported from South Africa. He asked what do consumers do with the plastic their meat, fish, vegetables, fruit or frozen productions are packaged in. "If we wipe out carrier bags, we still have an 85 to 90 percent problem." Namibia has an annual usage of around 150 to 200 carrier bags per person per year, compared to 80 bags per person per year in Sweden and France.
According to Mr. Venter, Namibia should consider some best practices such as standardizing its plastic requirements by finding a balance between the thickness and re-usability of plastic bags. Thinner bags pose less of a problem in terms of the carbon footprint, fossil fuels and energy. In addition, 95 percent of carries bags imported are not recyclable while the widespread use of CaCO3, in the manufacturing should be stopped. Unnecessary lamination and excessive printing onto plastics should be avoided. He said recycling should be foremost part in the designing and manufacturing of plastics bags. Consideration of the carbon footprint of articles is necessary. Multi-use bags need to be used 170 times to break even with plastic bags in terms of its carbon footprint and energy requirements. According to him paper uses 150 percent the volume of non-renewable resources to manufacture a similar batch to plastics.
He said the best practices regarding landfill should be that only organic material should be entered. Chemicals used in the manufacturing of canvass or paper bags leech and contaminates underground water resources. Incineration plants could generate energy from combustible waste. The Ohorongo Cement factory north of Otavi uses this technology to produce cement from the generated energy. Mr Venter said the second product life cycle of plastics should be utilised by collecting, sorting, transporting and recycling plastic. Excess recyclable material should be exported. "Ensure that all waste is managed with the aim of recycling first, with the lowest possible volume going to landfills." The recycling of plastics could create more jobs, including the recycling of cans and cardboard. His company, for instance, recycles plastic bags into plastic piping and refuse bags.
Mr. Erwin Stegmann, Group Manager for Sustainability and Utilities Support with Ohlthaver and List Group, said he was heartened by the current developments and supports the notion that levies on plastic carrier bags should exclusively be used for environmental activities. The purpose of retailers selling plastic carrier bags should not be to generate profits for them but to contribute to the environment. "The polluter-pay-principle should prevail according to which the consumer pays for the bags and of which the levy goes back to the environment."
Mr. Festus Nghifenwa, Director of Economic Policy Advisory Services with the Ministry of Finance, said a different approach and practices should be adopted when dealing with the conservation of the environment. Levies should not be the primary option to change human behaviour. He believes awareness about plastic pollution and counter measures should be raised through extensive campaigns. Alternatives to plastics should also be considered.
Dr Chris Brown, Chairman and Chief Executive Officer of the Namibian Chamber of Environment, said pollution 'looks bad for Tourism, which is the second largest contributor to the GDP." Plastic pollution defaces nature and thus negatively affects its attractiveness for tourists. Furthermore, animals and livestock die when they ingest plastic. It also infest the oceans. About 95 percent of all seabirds have plastics in their stomachs, so do turtles and other sea creatures. Fish that ingest plastics in the size of diminutive nanoparticles, gets consumed by humans, which could be the cause of strokes, heart attacks and tumours. Dr. Brown said the NCE would support a ban of CaCO3 in the manufacturing of plastic packaging. He proposed that a 20 percent deposit be levied on plastic water bottles and the revenue be used to clean up the environment from these bottles. They would also be in favour of the proposed levies on carrier bags and that the revenue be channelled back to the environment such as towards SMEs in rural areas where people can sew and sell carrier bags for a nominal fee as their income.
It was concluded that in order to successfully implement plastic levies, extensive work should be done to raise awareness, increase recycling points and ensuring that SMEs in rural areas benefit from the funds collected.


1887
banner image
No data available.
Please log in to see this content.
You have no subscription access to this content.
No metrics data to plot.
The attempt to load metrics for this article has failed.
The attempt to plot a graph for these metrics has failed.
Perfect spin-filter and spin-valve in carbon atomic chains
Rent:
Rent this article for
USD
10.1063/_PHONE_
/content/aip/journal/apl/96/4/10.1063/_PHONE_
_URL_
View: Figures
Figures
Image of FIG. 1.
FIG. 1.
A schematic device model of carbon atomic chains bridging two zigzag graphene nanoribbon leads. The red frame indicates the left leads while the blue one indicates the right leads. The scattering region includes the carbon chain and the surface layers. The direction of electron transport is along the carbon atomic chain labeled as .
Image of FIG. 2.
FIG. 2.
The spin-dependent electron transmission at zero bias. [(a) and (b)] Spin transmission of with the antiparallel/parallel spin orientation of two leads. [(c) and (d)] Spin transmission of with the antiparallel/parallel spin orientation of two leads. [(e) and (f)] show surfaces of the constant spin-resolved local DOS evaluated at the Fermi level.
Image of FIG. 3.
FIG. 3.
The spin-resolved curve of with the parallel/antiparallel spin orientation of two leads. The inset is bias-voltage dependent magnetoresistance.
Image of FIG. 4.
FIG. 4.
(a) TSP and (b) MR as a function of number of carbon atoms in chain at zero bias.
Loading
Article metrics loading...
/content/aip/journal/apl/96/4/10.1063/_PHONE_
2010-01-26
2014-04-20
Loading
Full text loading...
This is a required field
Please enter a valid email address
752b84549af89a08dbdd7fdb8b9568b5 journal.articlezxybnytfddd
Scitation: Perfect spin-filter and spin-valve in carbon atomic chains
_URL_
10.1063/_PHONE_
SEARCH_EXPAND_ITEM


Adrian Rockertsen Falkener
Approximately _PHONE_
Historians would have liked to have known much more about the life of this somewhat mythical character, a man who many genealogists can trace their family back to. Some believe that he was born a decade or two before 1500, and that he was at least 125 years old!
One certain fact is that Adrian was Dutch, and that he initially came to Bergen as a crewman on a merchant ship. Later he settled there, and married a widow. Whether he was an accomplished falconer (training falcons for hunting, in Norwegian his last name suggests this) is quite unclear. What is known about his life is his connection to trade and shipping.
During the 1540s (if not before) he arrived in Trondheim and stayed in the city for the rest of his long life. For the second time he married a widow, and some sources suggest that he had 18 sons and six daughters!
Over time it became common that merchants from abroad acquired central positions in Trondheim. In this respect Adrian was one of the pioneers. The position of mayor was fairly new. While it is not certain that it was a lucrative station, it must undoubtedly have given him influence. Adrian was the mayor of Trondheim from around 1547, first together with Nils Lauritzen, and later with Peder Bartskjær and Peder Småsvenn. In addition to this he was an export and import trader, using his own ships.
He lived in Ila, where Arilds gate [street] is today. Earlier the country retreat Arildsløkken was situated there, and this name is said to be a derivation of Adrians løkke [meadow].
Towards the end of his life it may appear that Adrian fell on harder times. He landed in a dispute with some of his descendants. Adrian had been appointed trustee and had problems with a sum of money that had been left for them.
Rockertsen lived longer than most of his generation, and must have been active in leading the town for 50 years. His time of death is reasonably clear, as he stepped down as mayor in 1594, "due to age and infirmity". The next year, his wife Margrethe is referred to as "widow".
Recommended reading: Henry Ofstad: Glimt: fra borgermester Adrian Rockertzsen Falkeners liv [Glimpses from the life of mayor Adrian Rockertzsen Falkener]. Eget forlag, 2008.
Author: Einar Rædergård


Definition of Achromat. Meaning of Achromat. Synonyms of Achromat
Definition of Achromat. Meaning of Achromat. Synonyms of Achromat
Here you will find one or more explanations in English for the word Achromat. Also in the bottom left of the page several parts of wikipedia pages related to the word Achromat and, of course, Achromat synonyms and on the right images related to the word Achromat.
Definition of Achromat
No result for Achromat. Showing similar results...
Achromatically
Achromatically Ach'ro*mat"ic*al*ly, adv. In an achromatic manner.
Achromaticity
Achromaticity Ach'ro*ma*tic"i*ty, n. Achromatism.
Achromatin
Achromatin A*chro"ma*tin, n. (Biol.) Tissue which is not stained by fluid dyes. --W. Flemming.
Achromatism
Achromatism A*chro"ma*tism, n. [Cf. F. achromatisme.] The state or quality of being achromatic; as, the achromatism of a lens; achromaticity. --Nichol.
Achromatization
Achromatization A*chro'ma*ti*za"tion, n. [Cf. F. achromatisation.] The act or process of achromatizing.
Achromatous
Achromatous A*chro"ma*tous, a. [See Ahromatic.] Lacking, or deficient in, color; as, achromatous blood.
Meaning of Achromat from wikipedia
- An achromatic lens or achromat is a lens that is designed to limit the effects of chromatic and spherical aberration. Achromatic lenses are corrected to...
- wavelengths are), and an achromat made with sufficiently low dispersion gl**** can yield significantly better correction than an achromat made with more conventional...
- costly fluorite gl****es and to very tight tolerances. Photographic lens Achromat Apochromat Herzberger, M., and N. McClure, The design of superachromatic...
- correction of chromatic and spherical aberration than the much more common achromat lenses. Chromatic aberration is the phenomenon of different colors focusing...
- frequency sound reproduction Chasman–Green lattice, common name double bend achromat De Bellis Antiquitatis, a tabletop wargame Dalbandin Airport IATA code...
- 61 cm (24″) achromat Arizona, USA 1896 Halstead Observatory 58.4 cm (23″) achromat Princeton, USA 1881 Chamberlin Observatory 50 cm (20″) achromat Colorado...
- noted as having made the first twin color corrected lens in 1730. Dollond achromats were quite po****r in the 18th century. A major appeal was they could...
- the achromat section, two quadrupole triplets for the adjustment of beam sizes in the long straight sections, and four ****tupoles in the achromat section...
- that the object-gl****es of telescopes must forever remain imperfect, achromatism and refraction being incompatible. This inference was proved by Dollond...
- and 28×. In order to achieve a 28× magnification, five elements in three groups are required: Two cemented achromat doublets and one plano-convex lens...
Loading...


text:
How to Adjust Columns Using the Columns Dialog Box in Word 2007
Once you create columns in your Word 2007 document, you can adjust their width and the space between them using the Columns dialog box. To find this dialog box, go to the Page Setup group in the Page Layout tab of the Ribbon. Then click the Columns button and select More Columns from the drop-down menu.
Here are some points to ponder when working with columns:
You can make specific column adjustments in the Width and Spacing area of the dialog box.
If you want a line between the columns of text, put a check in the Line Between box. (Note: There's no attractiveness guarantee for the line.)
The space between columns is the gutter. Word sets the width of the gutter at 0.5 — half an inch. This amount of white space is pleasing to the eye without being too much of a good thing.
Use the Preview window to get an idea of what the heck you're doing.The Columns dialog box.
The built-in Word feature that you can adjust or disable to automatically correct what Word (or you) considers an error.
Allowing an application to automatically correct what it considers errors, such as spelling and capitalization.
Common line art shapes (such as squares, pointing arrows, and speech bubbles) that are available to be inserted into a Word document for decoration or illustration.
A portion of text that is selected in a document; this can range from a single character to the entire document. By marking off text as a block, you can perform certain actions, or use various Word commands, that affect only the text in that block. You can also copy or move the block of text.
A line that is added above, below, or to either side of a paragraph. A border is useful for setting a block of text apart from surrounding text.
Images, both line art and pictures, available in Microsoft Word for a user to place in documents.
A collection of clip art images, both line art and pictures, that a user is free to use in Microsoft Word documents.
A formatting command that ends one column of text and continues that text in another column.
The Word tool that allows you to embed, hide, and read Comments as a reviewing tool.
The window that appears on the left side of the screen where you review Comments.
The feature in Word 2007 with which you can compare changes in one document against another document.
To make an image smaller by eliminating some of the content, much like cutting an image with a pair of scissors.
The part of a fraction that appears after or below the line. For example, in the fraction, 3/64, 64 is the denominator.
One of the five views in Word 2007. This is the most simple and streamlined view.
A specially formatted letter that appears at the beginning of a paragraph. Word offers two styles of drop caps. The first, and most common, begins the paragraph with a large letter that spills down into the text, displacing the first few lines of the paragraph. The second style places the large first letter in the margin adjacent to the paragraph.
In Mail Merge, an individual piece of information in a record, such as first name, last name, date, address, and phone number. Fields are what make a mail-merged document appear customized.
A placeholder in a Word document that holds variable data (such as a date, or an index tag). Field codes show in gray; toggle their view by pressing Alt+F9.
Text that appears at the bottom of a document page. A footer has its own special area and contains special text, such as the page number, document title, author's name, and date.
The white space between columns of text in a document. Word sets the default width of gutters at ½ inch, although you can change this amount.
Pressing Enter (PC) or Return (Mac) to insert a paragraph symbol and create a new paragraph.
Text that appears at the top of a document page. A header has its own special area and contains special text, such as the document title, author's name, date, and page number.
To adjust horizontal spacing so that text is aligned evenly along both the left and right margins. Justifying text creates a smooth edge on both sides.
Creating a special hyphen in Word that will not allow hyphenated words (such as disability-only services) to break at the end of a line (dis-ability-only services).
A special template file where Word stores all the settings for any new document you create. In Word, all documents are based on the Normal document template.
The part of a fraction that appears before or above the line. For example, in the fraction, 3/64, 3 is the numerator.
The built-in feature of Word where you can search for help about Word.
A number that indicates a position in a series, such as 1st, 2nd, 3rd, and so on. Ordinals are one of the main reasons for using superscripts.
One of the five views in Word 2007. In this view, you can see how the document will print according to its page breaks.
The feature in Word that you can open to see how your document will look after printing.
Checking a document for errors, especially spelling, grammar, and layout.
The feature in Word 2007 with which you can assign or restrict editing rights to a document.
A text box that highlights a quote from the document in which it appears.
A collection of thumbnail presets that you can apply to text. You can use these styles to quickly format your document.
1. (noun) In Mail Merge, a collection of information about a person, organization, or event. A record consists of fields, which are individual pieces of information, such as first name, last name, date, address, and phone number. 2. (verb) To set down in permanent form, such as through writing.
The search pane that opens on the right side of the screen when you right-click a word with a wavy red or green underline and then choose Look Up from the menu that appears.
A panel of tabs representing different functional areas in Word. Each tab contains command buttons and icons, organized into related groups. A new feature of Word 2007, the Ribbon replaces the menus and toolbars from earlier versions of Word.
Typically, a block of supplementary material placed in a text box in a document.
A Microsoft Word feature that lets you add several different types of useful diagrams to your document. The idea behind SmartArt diagrams is to represent a bullet list as a diagram of interconnected shapes.
Manually inserting a new line without creating a new paragraph. On a PC keyboard, the shortcut is Shift+Enter.
A feature in many applications that checks spelling (and often grammar) against a built-in dictionary.
1. (noun) A collection of formatting commands that can be applied to text to make a document look more consistent and attractive. 2. (verb) To make consistent with a formatting convention by applying a certain style.
Words that have similar meanings, such as pink and rosy.
A special type of document file used as the basis for formatting new documents.
A special type of shape designed to place text on your Microsoft Word document without regard to the normal page margins.
The way text is arranged in relation to a picture or image in a document.
An option for arranging text around an image in a document, such as In Line with Text, Behind Text, In Front of Text, or Tight.
The built-in Word feature that offers synonyms and antonyms.
The feature in Word with which you can monitor who adds and deletes what from a document. You can hide Track Changes but still have them enabled.
Abbreviation for Uniform Resource Locator. Used in common speech to mean a Web address, such as _URL_.
Faint or faded words or images that appear in a document behind the text. One common example is a Confidential watermark placed diagonally across the page.
A collection of preformatted watermark options in Word.
A Microsoft Word feature that takes ordinary text and transforms it into a preformatted (and often rather artistic) design.
A collection displaying Microsoft Word's many WordArt options.


text:
by Bob Cramblitt
Small things often sell cars and create brand loyalty: the positioning of the cup holder; how the seat molds to your body; the thunk of the door when it closes. Add to that list how particles – whether they are rain, snow or dirt – disperse across the surface of a car.
Particle behavior in relation to the surface of a car is known in the automotive industry as vehicle soiling, and up until recently, it was nearly impossible to simulate in a computer. But within the last few years, Audi has made major strides in using CFD simulation and visualization to better predict the complex interactions that constitute vehicle soiling.


It occurs to me that my references above to "coherence" should be replaced by "coherence & P(T)=1 & reflective consistency". That is, there exists (if I understand correctly) a P that has all three properties, and that assigns the probabilities listed above. Therefore, those three properties would not suffice to characterize a suitable P for a UDT agent. (Not that anyone has claimed otherwise.)
Reflection in Probabilistic Logic
by Eliezer Yudkowsky 2 min read24th Mar _PHONE_ comments
69
Paul Christiano has devised a new fundamental approach to the "Löb Problem" wherein Löb's Theorem seems to pose an obstacle to AIs building successor AIs, or adopting successor versions of their own code, that trust the same amount of mathematics as the original. (I am currently writing up a more thorough description of the question this preliminary technical report is working on answering. For now the main online description is in a quick Summit talk I gave. See also Benja Fallenstein's description of the problem in the course of presenting a different angle of attack. Roughly the problem is that mathematical systems can only prove the soundness of, aka 'trust', weaker mathematical systems. If you try to write out an exact description of how AIs would build their successors or successor versions of their code in the most obvious way, it looks like the mathematical strength of the proof system would tend to be stepped down each time, which is undesirable.)
Paul Christiano's approach is inspired by the idea that whereof one cannot prove or disprove, thereof one must assign probabilities: and that although no mathematical system can contain its own truth predicate, a mathematical system might be able to contain a reflectively consistent probability predicate. In particular, it looks like we can have:
∀a, b: (a < P(φ) < b) ⇒ P(a < P('φ') < b) = 1
∀a, b: P(a ≤ P('φ') ≤ b) > 0 ⇒ a ≤ P(φ) ≤ b
Suppose I present you with the human and probabilistic version of a Gödel sentence, the Whitely sentence "You assign this statement a probability less than 30%." If you disbelieve this statement, it is true. If you believe it, it is false. If you assign 30% probability to it, it is false. If you assign 29% probability to it, it is true.
Paul's approach resolves this problem by restricting your belief about your own probability assignment to within epsilon of 30% for any epsilon. So Paul's approach replies, "Well, I assign almost exactly 30% probability to that statement - maybe a little more, maybe a little less - in fact I think there's about a 30% chance that I'm a tiny bit under 0.3 probability and a 70% chance that I'm a tiny bit over 0.3 probability." A standard fixed-point theorem then implies that a consistent assignment like this should exist. If asked if the probability is over 0.2999 or under 0.30001 you will reply with a definite yes.
We haven't yet worked out a walkthrough showing if/how this solves the Löb obstacle to self-modification, and the probabilistic theory itself is nonconstructive (we've shown that something like this should exist, but not how to compute it). Even so, a possible fundamental triumph over Tarski's theorem on the undefinability of truth and a number of standard Gödelian limitations is important news as math qua math, though work here is still in very preliminary stages. There are even whispers of unrestricted comprehension in a probabilistic version of set theory with ∀φ: ∃S: P(x ∈ S) = P(φ(x)), though this part is not in the preliminary report and is at even earlier stages and could easily not work out at all.
It seems important to remark on how this result was developed: Paul Christiano showed up with the idea (of consistent probabilistic reflection via a fixed-point theorem) to a week-long "math squad" (aka MIRI Workshop) with Marcello Herreshoff, Mihaly Barasz, and myself; then we all spent the next week proving that version after version of Paul's idea couldn't work or wouldn't yield self-modifying AI; until finally, a day after the workshop was supposed to end, it produced something that looked like it might work. If we hadn't been trying to solve this problem (with hope stemming from how it seemed like the sort of thing a reflective rational agent ought to be able to do somehow), this would be just another batch of impossibility results in the math literature. I remark on this because it may help demonstrate that Friendly AI is a productive approach to math qua math, which may aid some mathematician in becoming interested.
I further note that this does not mean the Löbian obstacle is resolved and no further work is required. Before we can conclude that we need a computably specified version of the theory plus a walkthrough for a self-modifying agent using it.
See also the blog post on the MIRI site (and subscribe to MIRI's newsletter here to keep abreast of research updates).
This LW post is the preferred place for feedback on the paper.
EDIT: But see discussion on a Google+ post by John Baez here. Also see here for how to display math LaTeX in comments.
69