Fire transaction from contract

Question: I have a contract holding a mapping like this: mapping (address => User) users. How can I get the contract to automatically fire a transaction/event when a certain condition is met? For example, when the user's expiration timestamp reaches a certain value.
Comment: You cannot do it from the contract (or from any other contract for that matter). You can do it using an off-chain service which will execute the transaction. In order to enhance transparency and decentralization, you can implement in the contract all the logic which determines when this transaction can be executed. But initiating it can only be performed by an external service (aka *Oracle*).
Comment: Thank you very much, @goodvibration, I figured this probably wouldn't be possible
Answer: You can do that but there are some subtleties to work out.
It is recommended to use a withdrawal pattern rather than sending a transfer to someone other than msg.sender. There are security concerns talking to more than one untrusted contract at a time, so the safe bet is to just do some accounting rather than intiating a .transfer(). An exception is token contracts you explicitly trust. That should be okay.
Then, you need a data structure that makes it an O(1) (one move) complexity operation to fetch the next work item. For example, if time is the trigger, then a pending queue sorted by trigger time. There are different approaches to that. Below, it uses a self-balancing b-tree to get it done.
Then, you need a way to trigger it.
A simplistic trigger is just relying on an external actor to bang on the contract and check for work to do and pay for the gas. There are ways to avoid that AND ensure that there is no external actor to act as single point of failure.
One way (not the only way) is to use the Amortized Work pattern. In that scheme, anyone who is willing to pay for gas to any mutating function will pay for a little gas to process an item in the queue. You can use a modifier to hook the amortized process into regular functions, or just insert a function call in each case. This approach can even be used to return a correct net value from view functions.
For example:
// in case we are in a view function, this will return the correct result but the changes won't stick.
// if someone is paying for gas then the changes will stick.

function netBalance(address user) private {
  balance[user] = balance[user] + pendingReceipts[user] - pendingTransfers[user];
  // do something with the pendings
  pendingReceipts[user] = 0;
  pendingTransfers[user] = 0;
  _;
}

function balanceOf(address user) public returns(uint) {
  return netBalance(user);
}

Or, use a modifier on a mutating function to process the queue:
function doSomeUnrelatedThing(address user) public amortizedWork {
  // carry on
}

The code sample below uses a b-tree library to sort pending transactions in timestamp order. It uses the amortization pattern to pull one backlogged item off the queue and do something whenever gas is available. If you want to use the b-tree, be sure to review the scaling guidance.
pragma solidity 0.5.16;

import "./HitchensOrderTree.sol";

contract ProcessAmortization {

    using HitchensOrderStatisticsTreeLib for HitchensOrderStatisticsTreeLib.Tree;

    struct Pending {
        uint amount;
        address user;
        uint validTime;
    }

    mapping(bytes32 => Pending) public pendingStructs; // pendingId => pendingStruct
    HitchensOrderStatisticsTreeLib.Tree pendingSorted; // expiry => pendingId

    event LogNewPending(address sender, uint validTime, address user, uint amount, bytes32 key);
    event LogCancelledPending(address sender, address user, bytes32 key);
    event LogProcessedPending(address sender, bytes32 key, uint amount, address user, uint validTime);

    modifier amortizedWork {
        // if there is something to do. CONSIDER handling more than one at a time, but mind the gasLimit.
        if(backlog() > 0) {
            // the lowest time in the sorted list.
            uint first = next();
            // the first pending txn in the group (because multiple txns can have the same pending time)
            bytes32 key = pendingSorted.valueKeyAtIndex(first, 0);
            // process this one
            Pending storage p = pendingStructs[key];
            // send it with p.amount, p.user
            // IT IS RECOMMENDED TO MAKE THIS AN ACCOUNTING FUNCTION RATHER THAN INTERACTING WITH EXTERNAL ACCOUNTS
            // remove it from the queue
            pendingSorted.remove(key, first);
            emit LogProcessedPending(msg.sender, key, p.amount, p.user, p.validTime);
        }
        _;
    }

    function pendingKey(uint validTime, address user, uint amount) public pure returns(bytes32) {
        return keccak256(abi.encodePacked(validTime, user, amount));
    }

    function insertPendingTransfer(uint validTime, address user, uint amount) public amortizedWork {
        bytes32 key = pendingKey(validTime, user, amount); // if you want to allow duplicates, add a nonce
        emit LogNewPending(msg.sender, validTime, user, amount, key);
        pendingSorted.insert(key, validTime); // insert the key into the b-tree, sorted (asc) by validTime
        Pending storage p = pendingStructs[key];
        p.amount = amount;
        p.user = user;
        p.validTime = validTime;
    }

    function cancelPendingTransfer(address user, bytes32 key) public amortizedWork {
        emit LogCancelledPending(msg.sender, user, key);
        Pending storage p = pendingStructs[key];
        pendingSorted.remove(key, p.validTime); // pull the element from the sorted list
        delete pendingStructs[key];
    }

    function next() public view returns(uint nextTime) {
        nextTime = pendingSorted.first();
    }

    function backlog() public view returns(uint count) {
        count = pendingSorted.below(now);
    }

    function whatTimeIsIt() public view returns(uint) {
        return now;
    }

    // it is possible to create all sorts of tree explorers to enumerate the pending transactions queue

}

The OrderStatisticsTree code is over here: https://github.com/rob-Hitchens/OrderStatisticsTree
Hope it helps.

Fire transaction from contract


Question about normal force acting on toppling objects

Question:
Why is the normal force applied from the corner? How can I find the application point of the normal force?
Comment: I'm afraid some information more is needed because the graphic alone is a bit ambiguous. My guess is that it represents a solid standing on a spinning disk and problem is intended at finding if the object topples at a given angular speed, but that is not he only possible interpretation.
Comment: If it is on the point of toppling, then the resultant torque about the bottom right corner = 0. Consider what happens when the distance between N and the corner increases.
Comment: @jamie That's almost an answer. You should edit your text and post an answer. Comments are for questions about the problem or other clarifying statements.
Comment: @Pere your guess is right
Answer: The normal force will be distributed on the base of the solid in a way that it balances all other forces acting in the solid - just the same way that the normal force in any solid at rest balances all the other acting force. By equilibrium in the vertical direction, the magnitude of the normal force equals the weight. Then, with changing angular velocity, the normal force magnitude doesn't change but only its point of application changes - it moves outward as the angular speed increases. However, there is a limit on how far can it move outward: it can move at most to the end of the base, because it's application point must lie in the base.
Then, if the disc is spinning fast enough to be just to topple the solid, the force will be acting in the furthest point in can, as it is shown in the graphic.
Comment: Thanks for help.


Can you re-number the order of artboards in Illustrator CS4?

Question: I use illustrator with multiple artboards to design website layouts. Often I start at the beginning (what I think is the beginning at the time) and get 15 pages deep. Then I realize that I need to add another page at the beginning. I want this page to be page 1. Is this possible to do without physically moving all the elements in a page one by one?
Comment: I am using CS4 and ran into this problem. After reviewing the above answers, I was not able to resolve the issue for whatever reason using the above methods. So, I had 6 pages and needed to add blank page between pages 1 and 2. So I deleted artboards 2-6 but left the artwork in place. When I added the new artboards, number 2 was in the proper place. Make sense?
Answer: It is possible in CS5.1 - late response but was looking for another answer and stumbled on  this question.
In the Artboards panel (Ctrl + SHIFT + O) you can re order the artboards listed by dragging a row up or down to the required position.  This renumbers the artboards.  Great for the purposes of exporting, no more reordering pdf pages each time.

Artboards are given a default name reflecting the initial number but this is just a label - you can rename an artboard either when the artboard tool is active by clicking the label of the actual artboard or using artboards panel options menu.
Moving them around so that they are visually ordered is a bit of a pain - you can use the artboard tool to move them which best done zoomed out but if you stop dragging while over another artboard it will pick up all art work that is under it when you start dragging again (Ctrl + Z to the rescue).
Artboards can also be positioned while the artboard tool is active using the transform panel.
Hope this helps.
Comment: Ctrl + Shift + O didn't seem to work for me, but Windows > Artboards works.
Comment: Oh my god, where has this tip been all my life? In all my years using Illustrator, I never knew you could do this. THANK YOU!
Comment: This should not have so many up votes.  It doesn't answer the question
Answer: this is a very old post, but some users still using CS4, may come across this post in the future...
here's a script I wrote in 2012.
click on the Artboard tool before running, to see the Artboard Indexes. In this scenario, lets pretend we had 3 artboards and we need to add a 4th one, and insert it between 1 and 2, so page 4 becomes 2, page 2 becomes 3, and page 3 becomes 4.

we fire up the script
move artboard 4, underneath artboard 1
press Re Arrange button

the new order is now 1,4,2,3

Download re-Arrange Artboards Script v2
Comment: I was just about to write this script myself, but I stumbled on your post first. And unlike the answer with the most votes;  this actually answers the OP's question.  Nice work!
Comment: It looked very promising. Unfortunately, I get a blank box with no artboard inside : (
Answer: There isn't currently a way to renumber artboards in AI, so you'd have to do some kind of workaround no matter what. Possibly you export to Illustrator PDF then Place the pages on new artboards in a new document, but I don't see that would be faster than simply moving the contents of the artboards.
Comment: Or create a new Illustrator document and drag everything over a page at a time. Or possibly work in InDesign. :)
Comment: Ah thats what I was afraid of!! I love the new features in illustrator, but that is one flaw me for! Thank you guys!
Answer: I've researched this and found no real answer to re-numbering...however you can delete them and re-draw them in the sequence you prefer....Works like a charm!
Comment: This is not an answer.
Answer: If you click on Window - Artboards, a new tab appears at the bottom right hand navigation where 'Layers' is. You can drag and drop to re-order the art boards here.
Comment: Note.. question is asking about **CS4** The Artboard Panel does not exist in CS4.
Answer: I received 12 CS4 files that each had 3 artboards. The majority had the artboard order as 1,2,3. But a couple of the files had the artboards go 1,3,2. When auto updating in my InDesign layout the artboards would import out of order. So I would go into Illustrator, duplicate the last artboard, and delete the original one I just duplicated. That put them back in order. Basically: original order was 1,3,2. Duplicate 2, which is now artboard 4. Delete the original #2 and now the artboards read 1,2,3.
Comment: The only problem I see with this issue is that if you have 15 artboards and the order is `15, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 1` then this will take some time.
Comment: Yep, it works good on a small scale and with some time and organization involved, with 15 artboards also. With that many artboards, I would make good use of layers - they can be a life and time saver.
Answer: i figured it out! by accident.
i had 4 artboards and wanted to add one more at the front, for a total of 5. i started by going to document setup, edit artboards. once there, to visualize, i added a new artboard to the left of artboard 1. this new artboard was labeled 5. reading left to right the boards were numbered 5,1,2,3,4. next, i again clicked add new artboard, labeled 6. this time i positioned 6 directly on top of artboard 1. it now read 5,6,2,3,4.
the next step got weird. i simply deleted artboard 6. artboard 6 renumbered itselt to 5, even though 5 already existed. it now read 5,5,2,3,4.
i then exited the edit artboards menu. when i went back to document setup, edit artboards, the numbers were now 4,5,1,2,3. i repeated the above step of covering artboard 1 with a new artboard and then deleting it.
this simply moved the number 1 artboard to the right each time until it eventually went back to the start and read 1,2,3,4,5 from left to right. and voila, no moving artwork but newly numbered boards.
Comment: if you have more than 5 artboards this will take some time...
Answer: First, you need to click on the right icon within the Artboard Toolbox which shows the bounding box of the artboard. Now that you've identified its location. Hit Escape to close the dialogue box.
Drag the artboard in the toolbox to the numeric position you want. Then, rename that artboard. You may have to add a *.1 extension to the name to differentiate it temporarily. Do the same for each artboard you need to change. The problem is that when it comes to Exporting and naming to Share with colleagues, if you don't get that Artboard order fixed, your Artboards will not be in the order you want. Its a PITA that Devs need to think about a better, cleaner solution. It sucks when you realize that you've got a few pages out of order. I think its a result of auto rearranging.


Category as field value?

Question: Is it possible to populate an entry field with categories? When publishing a Structure page, I'd like to be able to select what category of products to display.
Answer: Yes. WB Category Select is a fieldtype that does just that.
When you create a custom field of this type you can set the category group(s) and whether or not the user is allowed to select multiple categories.
It's a very handy add-on and works great!
Comment: Thanks man. I found that extension on devotee but I'm glad you confirmed it.

Category as field value?


Why did Zod age?

Question: At the beginning, we see a youthful looking Zod's coup result in failure. Then when he arrives on earth, he has visibly aged complete with greyed goatee. But his followers do not seemed to have aged. Why did only Zod age?
Comment: He ran out of Grecian Formula for Kryptonians?
Comment: Perhaps it's the burden of leadership.  He assumed responsibility for everyone elses well being onboard the ship they comandeered, they were light years away from safety with no home to return to.
Comment: I believe it is a misconception that Zod has visibly aged.  If you watch the beginning of the film carefully, he does have a goatee at all.  Thus there is nothing establishing that his goatee wouldn't have been grey then had he grown it.  If you look at Zod's temples and sideburns, neither has greyed over the years either.
Answer: Zod was already elder to rest of his associates and followers when they were exiled.
For e.g. considering equivalent in earth years, assume that the first time we saw him on Krypton, he was 70ish (remember, kryptonians age slower than humans. He could be 70ish and still look that young), and his followers were 30-40 The next we see him during the events of the movie, 33 years have passed (General Zod).
That would make him 103 years old at the least. That would look old even by kryptonian lifespan standards. By comparison, his followers would be 60ish which is comparatively younger considering krptonian standards.
In conclusion, I feel that he looks older than the others only because he already was older than others in the first place. That, plus the responsibility of the entire race upon him, was sufficient to make him look elder than the other survivors.
Comment: we know they were exiled for 33years+ so that might explain zods greying but Faora seems the same as when she was exiled.
Comment: Faora was younger than Zod even before. As I said, if she was in her 30s during the time when they were exiled, ofcourse she would look the same after 33 years because she would be in her 60s, which isn't old by kryptonian standards. Compare this to comparing a human in his/her 30s and early 40s. They don't look that different.
Answer: Zod likely did not age anymore than his fellow insurgents and Phantom Zone prisoners.
The only indication that Zod may have aged more than his other crew members is the addition of greying facial hair that Zod did not have at the beginning of the film.  Without facial hair at the beginning of the film, there is no way to know that the greying would not have been present had he had facial hair then as well.  Apart from the goatee, Zod show no other indications of age.  No additional wrinkles, no greying hairs on his temple, sideburns, or speckled throughout his hair.
Zod's age can be accommodated by explaining that Kryptonians have mastered their own genes to maximize their lifespan.  Alternatively, as their ship includes hibernation and stasis, the crew may have taken shifts within stasis while they wandered the universe.
If we accept the premise of the question and this latter explanation, then Zod's age differential would be readily explained by his spending less time in hibernation than the crew in order to oversee and run things.  As proven by the Earth incursion and his attempt at a coup, Zod is hands-on and leads from the frontline.  He did not sit in his command and have his underlings do his bidding, but instead entrusted the key aspects of his plan primarily to himself.  With that mentality and characterization, it would be difficult for Zod to cede command while in hibernation too often, and thus he would not get the benefit of stasis sleep.
Answer: Followers change. They could be newer, younger soldiers. The burden of responsibility can also grey a person, just look at at U.S.A presidents before and after their term.

Why did Zod age?


Mango plant drying out after rubbing off white small insects

Question: My plant was full of white small insects really small ones and a lot of them in big amount on a small surface of the leaves and branches.. and instead of using soap and olive oil solution i started to remove them with hand by rubbing on the plants surface, and after 3 weeks this happened..see the pic..
i wrapped the lower branches with wet papertowel.. i give the plant yeast containing water , i sprinkle it what else can i do?maybe bigger pot?  I live in zone 8, during winter it is inside from april it is outside, it is Gomera -3 type of mango
Thx for any help. Adam
Comment: Mango plants are not easy to die (unless they are very young ). It's often to me seeing all the leaves falling down because of heavy fungus infestation and not even a single leaf left. Then, after several weeks they grow again. This is just my personal experience growing them with almost no care outside my house. They love rain BTW, it somehow clean them as well.
Answer: If I had to guess Adam I would assume that what your seeing with your mango is a direct result of those bugs sucking the sap from the tree. Give it time and hopefully, with any luck, they won't have killed it. I would change the soil as they tend to infest it and lay their larva in it.


What verbs should I know for level A2 exam?

Question: Is there any page, list or link, etc. where there are all the German verbs for the A2/A1 exam?
Update : I asked the question for the Goethe Institut.
Answer: The Goethe Institute publishes word lists for the different language levels, e.g. the GOETHE-ZERTIFIKAT A2 WORTLISTE:

Unfortunately, it's not only verbs, but all vocabulary.
Answer: You can find lists of words (in general, not only verbs) in some of the textbooks that are available for learning German at level A1/A2 by various publishing houses.
However, as these are not standardized down to the level of single words, these lists are valid especially for these textbooks or course programmes, and perhaps in other textbooks there might be minor difference (some words missing, others in use).
Please understand that the pedagogical concept behind such courses and textbooks is not the learn by heart a certain set of words. Rather, the idea is to lead learners into using the language (pro-) actively, and develop their competences. Competence means here: the ability to cope with unexpected situations and unfamiliar environments by using the tools (knowledge, skills) one actually has in a creative way.
In other words: you should not be concerned with word lists. You should be concerned with reading texts and understanding them, listening to people speaking, and understanding them; practicing speaking with people; practicing writing texts that are adequate in certain situations of everyday life.
What I would do is not learning words from a word list, but: reading the texts in the book; and if I see a word I do not understand, look it up. Then read the text again. And tomorrow again. Thus you will learn the word, but in context.
If you want to look up word lists anyway, please refer to the respective textbooks.
Here is one (of dozens):

Daniela Niebisch et al.: Schritte plus 1. Kursbuch und Arbeitsbuch. Niveau A1/1. Hueber, München 2009 (and following).

A word list is on pages 174-180. [I happen to have the 2016/10 edition]
There are various online offers with teaching materials for free.
One is "Ich will Deutsch lernen" by the Association of German Community Colleges (Deutscher Volkshochschulverband).
Older plattform (content is good, graphics a bit outdated):

www.iwdl.de

New plattform, opened in late 2018 (modern graphics, as for 2019 standards):

https://deutsch.vhs-lernportal.de/
Answer: It is the Common European Framework of Reference for Languages which defines and describes what it means to have A2 level competence in any language. However, the framework does not list vocabulary (in any language) but instead describes the broad language skills that are required for the level, including vocabulary, grammar, understanding of context, listening skills, reading skills, speaking skills and writing skills, etc.
As a consequence, the specific vocabulary list produced by language-teaching and language-testing organizations will vary somewhat from one organization to another. It is therefore desirable to consider where you want be tested and to look at the specific test demands of the testing centre.
To learn what the testing requirements are, rather than simply find an A2 wordlist, you must read a document such as the Goethe Zertifikat A2 Fit in Deutsch 2 Prüfungsziele Testbeschreibung. If you do that, you will save yourself a lot of heartache.
When you consider how words function in a sentence, you will immediately recognize that in order to use the verb beginnen, for example, it is not sufficient to know the infinitive form. Nor is it sufficient to understand that beginnen corresponds in most usages to the English verb to begin. You must also know how to use the word in its correct grammatical form in a sentence. But just how much do you need to know for your A2 exam? That is the critical question faced by an examinee. The answer is given in the Grammatik setion of the Testbeschreibung
<code>Verb
Tempus Präsens aller Verben der Wortliste

       Perfekt aller Verben der Wortliste

       Präteritum der Verben
       haben         Wir hatten keine Lust.
       sein          Wo warst du gestern?
       kommen        Er kam zu spät.
       sagen         Dann sagte sie: …
Modalverben          Ich konnte gestern nicht kommen.

Modus  Indikativ aller Verben der Wortliste
       Konjunktiv II der Verben
       mögen         Möchtest du eine Tasse Tee?
       haben         Ich hätte gern ein Glas Cola.
       können        Könntest du mir bitte helfen?

       Imperativ
       du- und ihr-Form   Geh bitte nach Hause!
                          Kommt bitte mit!

Modalverben
       Präsens von
       können      Kannst du Gitarre spielen?
       wollen      Er will Biologie studieren.
       müssen      Ihr müsst die Hausaufgaben machen.
       möchten     Ich möchte mitkommen.
       dürfen      Darf ich das mal sehen?
       sollen      Was soll ich machen?

Verben mit trennbarem Präfix
                   Kommst du mit?
                   Wann fängt der Film an?
                   Ich muss noch einkaufen.
                   Mach bitte das Fenster zu!
</code>
So at A2 level, you must, for example, be familiar with the infinitive form of all the verbs in the word list and with their present indicative and perfect conjugations, but you do not have to know how to use the Präteritum (simple past) of most of the verbs!
In addition to the documents for Niveau A2 that I've already mentioned, I found the following for A1:

A1: Word list / test requirements

One final thing worth noting. The word lists and test requirements change slightly over the years, so you should obtain the very latest documents from your intended testing centre. The links I have included are to the most recent documents I could find, but they might not actually be the most up-to-date!
Answer: As far I know, there is no such list. Exams are created by German language teachers, and they know enough well, what is really needed for which level of knowledge.
As far I know, Japanese and Chinese school system has a list of their Kanjis what the students need to learn to pass it.
However, on the exam it is not a requirement to know all the verbs, there is a point limit (60% or 70%, as far I can remember) what you need to pass.
Find exams on the net. If you can fill them, here is the time to get also the paper. If not, search for questions about effective learning tips & tricks.
Comment: As another answer points out, there **is** a list (not only verbs)


Failed at adding light kits to fans

Question: I bought a house that has a lot of ceiling fans but none with lights. They're on dimmer switches as well. I decided to add light kits to two of the fans, a Hunter fan and a Hampton Bay fan (sorry don't know model numbers). I easily found and attached the white/white and blue/black on both fans, having to strip the wires inside the fans and using wire connector caps to attach the light kit wires. I was not able to get the lights to turn on after either install, and one of the fans now hums but doesn't spin. I checked the reverse switch to make sure it wasn't in a neutral position. Is it possible the motor broke during install? Is it a capacitor issue? Should I try to salvage the non working fan or replace the whole unit. Is there a secret step I missed when installing the light kits? I know almost nothing about this kind of thing except for what I just learned in this forum and from some YouTube videos. Appreciate the help!
Comment: If it worked before, it's time to rollback your changes and get it to a working state.  It sounds like there is something you are not understanding about the hookup.  Probably our next step is get some photos.
Comment: Check your splice at the wire nut ,may have pushed wire out and not good contact .
Comment: Do the light kits have a pull cord? The dimmer would slow the fan as well as dim the lights....is this what you wanted?
Comment: I revisited the splice by stripping the wires to about 3/4 inch of exposed wire and doing the wire nuts again. Nothing happened, fan goes on, lights do nothing. There is a pull cord on the fan, and another pull cord on the light kit. I've tried every variation of pulling cords while having the dimmer switch on and on the highest setting. Could the fact that there's a dimmer at all make this a more difficult install (ie should I just hire an electrician)?
Answer: Solved. The "light" wire in the base of each fan was not connected to anything. Brought in an electrician who hooked them up, connected the light kits and voila, let there be light. Nothing I read on this forum or others mentioned the possibility that when the fans were installed without lights the electrician could have just left the light wire disconnected. Great to know for the future. Appreciate everyone's suggestions! Glad to know it wasn't anything I did wrong.

Failed at adding light kits to fans


Opened applicatons icons on system tray

Question: Is there a possibility to enable opened applications icons to display on wingpanel tray? Now not even one application is being showed. I have elementary OS 5.1.2 Hera. And my system tray with opened few applications looks like that
Answer: I solved this problem by installing Namarupa

Hat tip to Anderson Laverde from the ElementaryOS Slack Channel

Opened applicatons icons on system tray


I am having trouble when startingup my PC, the processes tab in task manager is swamped by LULnchr.exe

Question: Can anyone please tell me how to remove LULnchr.exe from my pc? Sometimes when pc does not start a message came up "LULnchr.exe Application Error.the application failed to initialise properly.(0x0000142)Click on OK to terminate application" My OS is Windows XP 34bit.
 I saw the text for the same thing but it was for Windows Vista 64 bit,but did not know if it could be used on my system.I hope this info is enough,Regards R.Miller.
Answer: It's the automatic updater for Logitech devices, probably mouse, keyboard, scanner or webcam. Either get an updated version off the web, or un-install anything Logitech from Add/Remove Programs.
Answer: lulnchr.exe is known as Logitech Updater (LU) and it is developed by Logitech, Inc.
You can remove from Start > Control Panel > Add/Remove programs .
Answer: Check Control Panel->Administrative Tools->Services to see if it is set to run automatically; if so you should set it to Disabled.  It if it a program that you can remove, I would just remove it.  You might also want to go to Logitech's website to download the newest drivers for Vista if any.


What is a suitable book to learn general relativity for high school students?

Question: I know all of special relativity but I also know it is not enough to study GR. The mathematics is very complex. I have "Spacetime and Geometry" by S. Caroll. He has described it GR well enough but I do not know some of the maths signs and symbols he uses. So what are the prerequisites I need to have in maths. Is there a book that covers those math topics? Or is ther a book on GR that is simple enough for me to understand? Please help.
Comment: I learned from [Max Born's book](https://archive.org/details/einsteinstheoryo00born) during middle school.  Obviously, it doesn't go into great depth, but it explains the basics at a very accessible level, and introduces the metric in an understandable way.  During high school, I moved on to [Schutz's book](https://smile.amazon.com/FIRST-COURSE-GENERAL-RELATIVITY-INTERNATIONAL/dp/B01E3G2YUK/ref=mt_paperback), which is closer to rigorous, but still doesn't require much mathematical sophistication.  I recommend both highly.
Comment: Hi, can you please suggest some books on special relativity for high school students? thanks!
Answer: High school student here. I've tried reading Carroll as well, and I also found the math to be quite difficult. However, the good news is that not all of the math he introduces is necessary to understand the subject. It is possible to develop an intuitive understanding of GR without formal topology and differential geometry. For this, I recommend Hartle: https://www.amazon.com/Gravity-Introduction-Einsteins-General-Relativity/dp/0805386629. It's much more self-contained and accessible than Carroll. I learned about this book after I spent a year struggling through Carroll to learn GR, but I would have fared much better if I had started with this.
Answer: For a general overview try Robert Geroch: "General relativity from A to B", it uses very little mathematics.
To get into the details you'll need to get familiar with partial differentiation and higher-dimensional calculus. The best book I know is D'Inverno: "Introducing Einstein's Relativity", there is no easier introduction to the mathematical aspects than this.
A book on classical mechanics may be better to start with in preparation for GR.
Answer: Sean Caroll's book is one of the best books available for an introduction in GR. However, in order to trully understand what GR is about you will need to learn some essential things regarding differential geometry. As you may already know, S.Caroll's book "Spacetime and Geometry" covers these mathematical prerequisites in its first chapters, before introducing GR to the reader.
The first thing a physicist should do is try to find and learn only the trully essential elements of differential geometry needed to understand GR. In my opinion, it would be a waste of time to try and master differential geometry as a whole. For that purpose, I believe that the book you mention is very good as it has gathered these essential elements of diff. geometry and nothing additional (by additional I mean that nothing you learn from this book has no use in the study of GR).
Unfortunately, I do not have a better book in mind. The other books and material I know are all more advanced in the mathematics and, thus, harder for a high school pupil to cope with. I hope this helped a little.


WiFi Extender using Belkin and Axess-tel routers

Question: I have a dual band Belkin N600 router. Due to it's location (which cannot be moved), it's not able to broadcast the wifi signal to our entire house. I have an axess-tel MV440 router which is from back when we had cellular wifi. I am wondering if there is a way to use that to pick up the wifi signal from the Belkin router and "extend" the signal to other areas of our home?
Comment: Have you thought about using a Universal WiFi Range Extender, Repeater that works over power line?  I've got the same same situation and was able to resolve it by using [TP-LINK TL-WPA4220KIT](http://www.amazon.com/gp/product/B00HSQAIQU?psc=1&redirect=true&ref_=oh_aui_detailpage_o00_s00).
Answer: I don't think that you will be able to use the MV440 router (or any other router) to extend the wireless. However, there are 'wireless extenders' that are designed to sit in an 'OK' signal strength area of your house and re-broadcast the signal on one or both bands. They are actually quite cheap - for instance the TP-Link 300Mbps Universal Wi-Fi Range Extender (see link).
The other approach is to use a powerline adapter which will broadcast a second (separate) wireless network from anywhere else in your house. That is, I think, what the comment above is suggesting.


How does camping work in Die2Nite?

Question: The latest post on the Die2Nite Facebook page suggests that the English version will soon be getting camping added as a feature.  Based on the versions for other languages, can someone give an overview of how camping works and what benefits it provides?
Answer: Here's what I have been able to decipher from the French wiki
Basics
Camping gives you a chance to survive if you are outside the city during the nightly attack.
Benefits
By allowing you to stay outside and get your AP refreshed, camping makes it easier to reach locations that are farther from the city.  You don't need to have enough AP to reach a destination and return to the city all in one day.
Successful camping also gives you a bonus that applies for the entirety of the next day which makes your searches more likely to succeed.
With the latest version, the first person to successfully camp in a building will receive a random blueprint that allows the town to build a new building.  Many buildings now require a blueprint before they can be built.  Note that each building can only yield one blueprint per game.
Mechanics
There is an additional button when you are in a zone that allows you to inspect the zone for its suitability for camping.  You will be given two sentences in response.  The first sentence corresponds to one of 8 levels of suitability, from terrible to perfect.  The second sentence suggests your chances of surviving the night if you camp there, again distributed in 8 levels from no chance to very likely (90% is the max unless the Hermit class is also added).
You can improve the suitability of a zone for camping by spending AP, up to 10 per day.  This improves the chances for all players who camp in that zone that night.  You can also use defensive objects and some special objects to improve the defenses of your camp.  All camp improvements are destroyed overnight (so defensive objects seems like a huge waste)
Things that impact your chance of survival

The number of zombies in the zone (0 is best)
Whether you are a scout
The number of people camping in the zone (more people = less hiding places = less survival)
Buildings in the zone (various buildings give different bonuses)
The number of consecutive nights of camping (each night decreases your survival chance)
Distance from the city? (It suggests further is better?)
Digging a "grave" (Disables auto-search?)
Answer: The way I understand it (second hand from a coalition member who plays on the German server as well), there are items that you can use to construct a shelter while out in the field, items such as old doors right now that give you the option to install it while outside.
For every item, it adds a % chance of survival outside in the night, to a maximum chance of 90% survival.  However, if you do survive the night, you gain increased digging bonuses the next day.
That is all I know so far.
Answer: The Hermit class increases the max chance to survive to 100%.
I don't know if the addition of camping will include the addition of the Hermit class, or if that might come later.

How does camping work in Die2Nite?


Is it possible to switch from 2D Animation context to General context in Blender 2.8?

Question: I have been looking around the new Blender 2.8 interface now that it is approaching a finished state, and I've noticed that in order to to use the 2D Animation context, you have to actually create a new file specifically in that context. Further, it doesn't seem to be possible to switch from the 2D Animation context to the Modeling, Sculpting, UV Editing, etc. Should I take that to mean that if I wanted to create an animation that blends 3D and 2D--say, a 3D scene populated by 2D characters--that the best way to do that is to create a "General" file and just deal with not having the 2D animation tools quite so easily at-hand?
Answer: If you click the + icon at the end of the row of available workspaces, you will get a drop-down menu with all the other workspaces not currently in the menu.
Answer: There's no reason why the 2D workspace couldn't be added alongside the others, they're just preset window layouts. You can create your own 2D animation layout and customize it to suit your own preferences.
Comment: I started to do as you suggested and I've discovered that if you click that + icon at the end of the row (which I had assumed was just "create a new layout" similar to the "create new tab" icon in most web browsers) you can actually select the other workspaces from a drop-down menu. Thanks for the suggestion that brought me there.
Answer: Another option is to add a grease pencil object in the 3D workspace in object mode.
Go to Add => Grease Pencil => Blank. Then you can switch to draw mode under the ↹ Tab menu. From there you can draw into object surfaces or just aligned with your camera view.
If you want to draw directly onto the face of an object, there's a drop-down menu on the top near where you'll find the usual object transform options:

You can select surface and set a low offset so it's not occupying the same space as the face you're drawing on.
This is a great option for drawing details that you can then convert to curves and from there a mesh that you can solidify. It can also be used for stylized texture painting.


Dicing Hot Tamales (candy)

Question: I wanted to cut up some Hot Tamales candies for cookies, but had a horrible time cutting them.  I couldn't get the candies small enough and they stuck together.  I tried cutting with a knife and a food processor, the candies stuck to the blades.  The hot tamales candy are large and difficult to cut. I wanted pieces about the size of medium chocolate chips. Any suggestions?
Comment: Of interest: http://cooking.stackexchange.com/questions/24620/what-is-the-most-effective-method-to-mince-candied-ginger/40359#40359 The scissor answer might work for you too.
Comment: OK, Hot Tamales are not "red hots"... they're totally different candies. Red Hots are practically hard candies. Hot Tamales are soft candies. "Red Hots" are also called "Cinnamon Imperials". I was trying to figure out why you needed to cut them up because normal red hots are exactly the size you want.
Comment: Sorry, the original recipe called for Red Hots, couldn't find them at Christmas time and I purchased Hot Tamales.  I know I can't exchange them exactly, but thought they would go nicely in a sugar cookie base.
Comment: Fair enough :D I've edited your question to reflect that. If you can't make the hot tamales work, you'll have better luck with the cinnamon imperials. If you look for that name, they should still sell them in most areas. Hopefully they will bake up the same. As I said, the texture is different between the two, so the hot tamales may melt, particularly if they're chopped up, while the imperials will not.
Comment: I was thinking of putting them in a baggie, covering with a dish cloth and lightly smashing with a rolling pin to break through the hard exterior.  If that works, then scissor cutting with sugar.
Answer: Freeze them. After they are frozen, put them in the food processor and you should no longer have the issue of them sticking to the blades. As Dougal mentions below, you can also freeze the blade to help keep the temp down.
Comment: +1 This works for almost any kind of gooey or gelatinous ingredient, even soft fruit.
Comment: Perhaps also put the cutter part of your blender in the fridge/freezer to help keep the temp down.
Comment: ..and depending on final recipe: you could add a pinch of flour to the process to keep them from sticking to each other. I do this when dicing dried fruits for canoli.
Comment: @Dougal I am adding that to my answer as an improvement.
Comment: Also, don't break your teeth trying to eat the frozen candy when you take it out of the freezer!

Dicing Hot Tamales (candy)


Refractometers- Can the traditional prisms be substituted with some other component/s?

Question: Is there any way we can substitute the prism that is used in refractometers? For example, introduce other components like lenses or sensors instead of a prism? An idea which could be tried? Could someone help me out in this direction? Thanks in advance. The purpose is still to measure the refractive index.
Answer: One can use diffraction gratings instead of prisms.
Answer: If you have some coherent light, you could try a lattice or a double slit. The diffraction angle of a double slit is wavelength-dependent. See also Double-Slit experiment. If the light is not coherent, this method also may be used. However, the details are more intricate: Spatial coherence of sunlight and its
implications for light management in
photovoltaics


Alternatives to Regression Analysis

Question: I have done a presentation where I have used regression equation to know the relationship between productivity and profitability. Now to get a certificate, I have been asked to criticize my work and create a one page study on what alternative method I could use to check the relationship other than regression equation. For now Google is not helping me. Can anyone help me suggest something?
Comment: It is sort of an odd question.  In statistics, you generally start with a problem and pick a good statistical method/model to solve it.  Regression is popular for many reasons but it is not perfect.  Before looking into different models, you first need to Identify where and for what reasons your regression model may not be performing well or does not seem ideal.  I.e. non-linearity, outliers, invalid predictions, etc.  Once you have can articulate the problem, it will be much easier to find an alternative method.
Comment: Alternates in what sense? Different loss function (/different error assumption)? Different relationship than linear? something else?
Comment: see e.g. section 5.2, 9.1, 12.3.6 and many other sections of http://web.stanford.edu/~hastie/local.ftp/Springer/OLD/ESLII_print4.pdf
Answer: There are different ways to do a prediction analysis or a regression if you want and maybe the answer to your question is a bit too broad.
You can do a classical regression with linear or non-linear model, which i think is what you have done.

You can do a regression with a Bayesian approach if you want to weight more your "a-priori knowledge":Wiki
You can have a machine-learning approach:Wiki
You can apply non-parametric methods if you don't know the population distribution:Wiki
You can apply robust regression methods:Wiki

I think there is some material here to start investigating your answer

Alternatives to Regression Analysis


People enter Jannah without question answer

Question: Is there any hadith that says that if a person dies in ramadan he will enter Jannah without question answer session and he will enter Jannah for sure?
Answer: Although there is no legitimate or weak hadith that specifically discusses the virtue of dying in Ramadan, there is a hadith in Musnad Ahmad that cites the virtue for those who depart this world while fasting, whether in Ramadan or any other month. According to Hudhayfah, Allah's Messenger (saws) said:

"Whoever says La Ilaaha illallaah, seeking the pleasure of Allah and
happens to pass away in that state, he will enter paradise. Whoever
fasts a day seeking the pleasure of Allah and happens to pass away in
that state, he will enter paradise, Whoever gives charity seeking the
pleasure of Allaah and that was his final action will enter Paradise."
 -Musnad Ahmad-23324

There is no specific virtue of entering Paradise without being questioned mentioned in the preceding hadith. Many other hadiths exist in which the Prophet (saws) discusses various activities that Muslims must undertake in order to join Paradise.
This signifies that if a person performs righteous deeds and this specific deed, such as fasting, was his final deed, he will be admitted to Paradise by Allah's kindness, not only because he died during Ramadan.


What is the name of the hose that comes out of the oil fill?

Question: What is the name of the hose that comes out of the oil fill in a Dodge Ram 1500 V8 5.7L Hemi truck? Mine is disintegrated and leaking oil. I want to replace it, but I can't find a drawing or part number for this hose anywhere online.
Answer: That's the crankcase vent hose. It provides crankcase ventilation by relieving pressure and scavenging fumes from the crankcase then recirculating them through the air filter. A 5/8" or 3/4" (depending on the ID of the original) heater hose should do in a pinch for a replacement but an OEM product seems readily available.

The images above are for a 03-04 Dodge Ram 1500 Crankcase Vent Hose Genuine Factory Mopar New OEM.
Comment: Thank you. Do I just pull the old one off and put this one on? Or is it more complicated than that?
Comment: No more complicated than how you describe. As a 'breather' tube it isn't important to seal the connections with goop or hose clamps so it's a 2 minute operation with no more tools than a glove. Twisting the hose as you pull it off the nipples will ease removal. If it's really stuck and you risk damaging the nipples, split it length-wise with a carpet knife and peel it off the nipples.
Comment: Inside the air cleaner compartment there should be a small piece of loose foam where the vent tube enters from the outside. Its intent is to catch oil 'spit' up through the vent tube. You may want to rinse this in varsol or similar solvent to clean it. It doesn't need replacement unless it is disintegrating.


Passwords via unsecure network

Question: Can the password that one type be compromised if mobile is connected to a compromised router since everything has to go through the router?
Answer: Under most circumstances, if you connect to the site by HTTPS, and you're sure that the URL is correct (i.e., you're not connecting to a phishing site, like gm4il.com instead of gmail.com), and your browser is not showing you any certificate warnings, then most likely it's safe to login to the site using your password.  If you use a password manager, all the better, as this offers the added protection of detecting phishing sites.
However, this answer would not be complete without adding the caveat of fake SSL certificates.  There have been cases where CA's have been breached, and attackers were able to get CA-signed certificates for popular sites such as Gmail.com, etc.  In this case, all of the above indicators would seem to indicate that everything is copacetic, yet an attacker on the network between your browser and the site would be able to intercept your password.  See What are the risks of a Certificate Authority hack for 'the average user'? for more information.  Fortunately, these cases are rare, but it would be remiss to not mention these cases.
Comment: the best protection for gmail specifically is to have TOTP 2fa configured.  SMS is not sufficient - it's relatively easy for somebody to convince the phone company to send your SMS messages to them, and not encrypted, so contraindicated by NIST.  with TOTP your password is not enough to access gmail and the TOTP token is only good one time for 30 seconds.
Comment: A hacked router cannot intercept your password if you connect to the server via https and the server certificate is authentic.
Comment: Yes, it's possible that a hacked router could redirect your request to gmail.com to a fake site purporting to be gmail.com instead of the real gmail.com site.  But, it would be very difficult for the fake gmail.com site to obtain a valid certificate for gmail.com.  That's why it's so important to always connect by https (not http), and to pay attention to any warnings in your web browser pertaining to the certificate.
Answer: All the browsers (And the operative systems, like your iOS) includes the public certificates of the Certificate Authorities (CA). These are organisations that validate the ownership of the domains and grant certificates signed by them as a trust authority. By recognising the signature, the browsers knows it comes from a "chain of trust" and shows a green lock on your browser.
As user mti2935 pointed out, sometimes the certificate authorities might become compromised (By an internal or external actor) and it may issue certificates they may have not properly validated the requisites. Since the efforts to carry on this attacks are high, and if your could get it you could go after bigger bounties, it is very unlikely that a low-medium traffic site would be subject to this attack unless you are being specifically targeted.
The browser also includes a hardcoded list of web sites that requested HSTS by default. The most visited sites are here (For eg. Gmail, Google, Facebook, Microsoft, etc). HSTS stands for HTTP Strict Transport Security. This is a web security policy to help protect your websites against MITM attacks such as as protocol downgrade attacks (HTTPS to HTTP) or cookie hijacking. For the domains on the list the browser will automatically convert any http:// URL to https:// avoiding you to access an unencrypted version of the website and leaking your data in the network (Like your Gmail password). Any specific person can request his site to be included into the HSTS Preload List of the browsers to avoid getting their sites compromised by these methods, each browser maintains its own list but they often replicate each other, you can find more about the HSTS preload list submission here: https://hstspreload.org
Returning to your specific questions, unless the browser (Or OS) is compromised the most probably is that the traffic that is going out of the browser is correctly encrypted with the gmail.com certificate, so your traffic would not be easily read over the network.
The warning your antivirus is giving you means that your router has its administrative ports open to the internet, the antivirus checked your public IP and scanned the open ports to warn you that anyone from the internet may try to hack your router services since they are wide open.

Passwords via unsecure network


Is it important to sanitize inputs in a shortcode that will be used in site that only I will post to?

Question: Is there any security risk in not sanitizing shortcodes in a wordpress site if I am the only one who has access to the admin panel?
Comment: Best practices exist for a reason.  You really don't want to have to go back through and deal with resanitizing everything if down the road you decide to change something.  And really, what extra effort is it?  A few characters?  Just do it.
Answer: You should always sanitize all inputs regardless of who or where they are coming from. Not only is it good practice (which helps ensure that you don't accidentally get comfortable skipping it and miss it elsewhere), but it ensures that that particular feature is secure in the future. For example, you may wish to expand upon your feature in the future or have editors join you. If you forget about fixing your security lapse, you could be in for some big trouble.
Bottom line: Sanitize all the things. It helps and never hurts. Also never trust your users, even yourself!


Does Turn the Unholy work on fallen Celestials?

Question: The description for the Oath of Devotion Paladin feature Turn Unholy mentions fiends and undead, but what about corrupted celestials that still have the celestial type (such as the Radiant Idol in Eberron: Rising from the Last War)? Are they considered fiends for the purpose of the ability?
Answer: As written, Turn Unholy does not work on Radiant Idol.
As you quoted in the question body, Turn Unholy is effective on fiends and undeads:

Each fiend or undead that can see or hear you within 30 feet of you must make a Wisdom saving throw.

Since a Radiant Idol is a celestial, this particular Paladin's channel divinity feature cannot work on this monster.
The description of the monster says:

A radiant idol was an angel that was banished from the celestial realm of Syrania and cast down to the Material Plane.

and

Fallen Angels. The insatiable hunger to be adored can transform a fallen angel, physically and mentally.

Fallen Angel is not a creature type, the Radiant Idol is still a celestial. This is coherent with the description of this monster type in the introduction of the MM (emphasis mine):

Celestials are creatures native to the Upper Planes. Many of them are the servants of deities, employed as messengers or agents in the mortal realm and throughout the planes. Celestials are good by nature, so the exceptional celestial who strays from a good alignment is a horrifying rarity. [...]

A DM may overrule this.
As usual, the DM could rule that Turn Unholy works also on Radiant Idols or other fallen celestials. But I think that this must be properly handled, determining what is a fallen celestial, and just do not let Turn Unholy work also on all celestials.


How to enable zoom in UIScrollView

Question: How do I enable zooming in a UIScrollView?
Answer: Answer is here:

A scroll view also handles zooming and panning of content. As the user makes a pinch-in or pinch-out gesture, the scroll view adjusts the offset and the scale of the content. When the gesture ends, the object managing the content view should update subviews of the content as necessary. (Note that the gesture can end and a finger could still be down.) While the gesture is in progress, the scroll view does not send any tracking calls to the subview.
The UIScrollView class can have a delegate that must adopt the UIScrollViewDelegate protocol. For zooming and panning to work, the delegate must implement both viewForZoomingInScrollView: and scrollViewDidEndZooming:withView:atScale:; in addition, the maximum (maximumZoomScale) and minimum (minimumZoomScale) zoom scale must be different.

So:

You need a delegate that implements UIScrollViewDelegate and is set to delegate on your UIScrollView instance
On your delegate you have to implement one method: viewForZoomingInScrollView: (which must return the content view you're interested in zooming). You can also implement scrollViewDidEndZooming:withView:atScale: optionally.
On your UIScrollView instance, you have to set the minimumZoomScale and the maximumZoomScale to be different (they are 1.0 by default).

Note: The interesting thing about this is what if you want to break zooming. Is it enough to return nil in the viewForZooming... method? It does break zooming, but some of the gestures will be messed up (for two fingers). Therefore, to break zooming you should set the min and max zoom scale to 1.0.
Comment: Excellent answer -- this got me exactly what I needed.  (Plus, I didn't have to go watch a video! ;)
Comment: thanks. most important thing is the second step here, which isn't found in the original answer
Comment: This should be flagged as the real answer!
Comment: There's also a very good tutorial at http://www.appcoda.com/uiscrollview-introduction/ describing how to set the min and max zoom levels programatically, zoom by tapping, etc.
Comment: I don't understand why these controls do not come with all functionality
Answer: Have a read through this Ray Wenderlich tutorial:
http://www.raywenderlich.com/76436/use-uiscrollview-scroll-zoom-content-swift
If you follow through the section 'Scrolling and Zooming a Larger Image' it will get a image up and enable you to pinch and zoom.
In case the link gets altered, here's the main info:
Put this code in your view controller (this sets the main functionality):
override func viewDidLoad() {
  super.viewDidLoad()

  // 1
  let image = UIImage(named: "photo1.png")!
  imageView = UIImageView(image: image)
  imageView.frame = CGRect(origin: CGPoint(x: 0, y: 0), size:image.size)
  scrollView.addSubview(imageView)

  // 2
  scrollView.contentSize = image.size

  // 3
  var doubleTapRecognizer = UITapGestureRecognizer(target: self, action: "scrollViewDoubleTapped:")
  doubleTapRecognizer.numberOfTapsRequired = 2
  doubleTapRecognizer.numberOfTouchesRequired = 1
  scrollView.addGestureRecognizer(doubleTapRecognizer)

  // 4
  let scrollViewFrame = scrollView.frame
  let scaleWidth = scrollViewFrame.size.width / scrollView.contentSize.width
  let scaleHeight = scrollViewFrame.size.height / scrollView.contentSize.height
  let minScale = min(scaleWidth, scaleHeight);
  scrollView.minimumZoomScale = minScale;

  // 5
  scrollView.maximumZoomScale = 1.0
  scrollView.zoomScale = minScale;

  // 6
  centerScrollViewContents()
}

Add this to the class:
func centerScrollViewContents() {
  let boundsSize = scrollView.bounds.size
  var contentsFrame = imageView.frame

  if contentsFrame.size.width < boundsSize.width {
    contentsFrame.origin.x = (boundsSize.width - contentsFrame.size.width) / 2.0
  } else {
    contentsFrame.origin.x = 0.0
  }

  if contentsFrame.size.height < boundsSize.height {
    contentsFrame.origin.y = (boundsSize.height - contentsFrame.size.height) / 2.0
  } else {
    contentsFrame.origin.y = 0.0
  }

  imageView.frame = contentsFrame
}

And then this if you want the double tap gesture to be recognised:
func scrollViewDoubleTapped(recognizer: UITapGestureRecognizer) {
  // 1
  let pointInView = recognizer.locationInView(imageView)

  // 2
  var newZoomScale = scrollView.zoomScale * 1.5
  newZoomScale = min(newZoomScale, scrollView.maximumZoomScale)

  // 3
  let scrollViewSize = scrollView.bounds.size
  let w = scrollViewSize.width / newZoomScale
  let h = scrollViewSize.height / newZoomScale
  let x = pointInView.x - (w / 2.0)
  let y = pointInView.y - (h / 2.0)

  let rectToZoomTo = CGRectMake(x, y, w, h);

  // 4
  scrollView.zoomToRect(rectToZoomTo, animated: true)
}

If you want more detail read the tutorial, but that pretty much covers it.
Comment: Although this is potentially quite a good answer, it is essentially a **"link only"** answer. You should include some information from your links so that if the information behind the links is ever changed/lost, the answer still makes sense. See [this link](http://meta.stackexchange.com/questions/225370/your-answer-is-in-another-castle-when-is-an-answer-not-an-answer)
Answer: Make sure you set your viewController as the scrollViews delegate and implement:
func viewForZooming(in scrollView: UIScrollView) -> UIView? {
    return imageView
}

Answer: I don't think this is working for iOS 5.0 and Xcode 4.3+
Im looking for the same here, I found this its for images but it may help you.
http://www.youtube.com/watch?v=Ptm4St6ySEI
Comment: Although this is potentially quite a good answer, it is essentially a **"link only"** answer. You should include some information from your links so that if the information behind the links is ever changed/lost, the answer still makes sense. See [this link](http://meta.stackexchange.com/questions/225370/your-answer-is-in-another-castle-when-is-an-answer-not-an-answer)
Comment: no need to set content size of scrollview and the above solution runs perfect on Xcode 4.3+ and iOS 5.0 also

How to enable zoom in UIScrollView


What is the meaning of serialization in programming languages?

Question: What is the meaning of serialization concept in programming languages?
when we use Serializable attribute above a class, what is the meaning?
Answer: Say you have two applications that run on two different physical machines. Both of the applications need to exchange data that is commonly used by both applications. These application talk to each other to share the data with some mediums, these mediums could be a file-system, tcp or udp connections or any other suitable network protocol or may be direct in-memory data exchange.  Any of these mediums would only understand data that is described in the form of a series of bits. So when one application needs to send a value 10 to another, the value 10 would be sent as its binary representation 1010 and you would also pass some information that describes 1010. This meta information will also be a series of bits that the other application can easily understand. That was easy though.
Lets take another example, wherein these two apps need to exchange a more complex, non primitive data-type. Lets say they need to exchange the objects of type Book where Book is a custom defined class in your application and both the applications have the definition of type Book.
public class Book
{
    Book() { }

    public long BookId { get;set; }
    public string Author { get;set; }
    public string Title { get;set; }
}

How will you exchange the objects of type book between the two applications? To be able to share the object between two apps, you will need to be able to convert the Book objects into binary representation. This is where serialization comes into the picture.
With the help of Serialization you can define how an object can be converted into its binary representation. The receiving application would do the reverse process, that is De-Serialization, that constructs a Book object from its binary representation.
Comment: This answer does not cover the actual important details behind why serialization is needed. Serialization is not needed because we need a binary representation, it's already in binary! The problem is you just can't do a naive copy and paste of the binary data. This is because of references / pointers (you want actual numbers/values not an address), endianess, and data / metadata that becomes junk because it would have no usefulness out of context. You also have the issue of logically converting the data to the desired serialization format.
Answer: There is no better explanation than the one from wikipedia.

In computer science, in the context of
  data storage and transmission,
  serialization is the process of
  converting a data structure or object
  into a sequence of bits so that it can
  be stored in a file  or memory buffer,
  or transmitted across a network
  connection link to be "resurrected"
  later in the same or another computer
  environment.

http://en.wikipedia.org/wiki/Serialization
Also, the Serializable Attribute cannot be used on methods.
Indicated by the Attribute Usage
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Delegate, Inherited = false)]

Comment: The problem with Wikipedia's explanation is that, technically speaking, aren't data structures and objects already a sequence of bits?
Comment: Oh, you mean, they aren't, when you're looking from a high level programming language perspective :-)
Answer: Serialization is the process of converting an object into a
stream of bytes. Deserialization is the opposite process of
creating an object from a stream of bytes.
Serialization/Deserialization is mostly used to transport
objects (e.g. during remoting), or to persist objects (e.g.
to a file or database).Serialization can be defined as the
process of storing the state of an object to a storage
medium. During this process, the public and private fields
of the object and the name of the class, including the
assembly containing the class, are converted to a stream of
bytes, which is then written to a data stream. When the
object is subsequently deserialized, an exact clone of the
original object is created.
more about this : http://www.allinterview.com/showanswers/20627.html
Answer: Serialization is the process in which data translating data structure or object state into a format that can be stored
Answer: Why do we need a serialization?
In procedural language such as Cobol or C there is no concept of serialization. Why do we then use it in OOP? Let us take Java. You have a class which is instantiating multiple classes called Objects, and you want to pass one of those objects state (current values of variables) over network through Message Oriented Middleware in the form of byte stream, and you need serialization and de-serialization.
If multiple languages agree on this byte stream format, serialization can even provide a way for otherwise incompatible systems to exchange data.


Why is the Km of an enzyme half of Vmax?

Question: Why is the Km of an enzyme half of Vmax?
Comment: We welcome new users to SE Biology, but we expect them to read the [help on asking questions](https://biology.stackexchange.com/help/how-to-ask) before posting, and to look at examples of well-presented questions. Your question, I am afraid does not come up to the mark. You have put half your question in the title, and the rest as a single line. The premise is incorrect in actual fact —  Km is the *substrate concentration* at Vmax/2, and I have no idea what you mean by "any other specific reason". This is why your question has been downvoted.
Answer: $K_M$ is a constant and is not $V_{\mathrm{max}}/2$ as they have different dimensions. But by the Michaelis Menten equation, $V=\frac{V_{\mathrm{max}}[S]}{K_M+[S]}$. So, when $[S]=K_M$, we have $V=\frac{V_{\mathrm{max}}[S]}{[S]+[S]}=\frac{V_{\mathrm{max}}}{2}$. Hence, $K_M$ is the substrate concentration, at which we would have $V=V_{\mathrm{max}}/2$.
Reference: Worthington Biochemical Corporation
Comment: Km is *never* Vmax/2. It is the *substrate concentration* at Vmax/2. I would sort out the question before giving an answer. In this case I would not answer the question because it is so badly presented and shows so little effort on the poster's part. See "[Answer well-asked questions](https://biology.stackexchange.com/help/how-to-answer)" in the Help on answering questions. And the suggestion that a naive user reads a "credible textbook on enzyme kinetics" is, well, incredible. Again, point him to a page online. And if you answer take the trouble to set it out in a readable manner.
Comment: [Edited] I believe your comment and my answer say the exact same thing. I've told the OP that what they've said is false. In my opinion, even if it's a low effort question, the OP deserves to know that they're wrong. If you would like the OP's question to be deleted, then please vote for that. If you take any particular issue with my formatting that suggests my answer isn't readable, please point it out.
Comment: We can also see that $K_M$ can't be identically $V_{\mathrm{max}}/2$ since $V_{\mathrm{max}}$ is dependent on the initial enzyme concentration while $K_M$ isnt.


Soda Bread disaster

Question: I've just tried to make this recipe from the BBC Good Food site: https://www.bbcgoodfood.com/recipes/simple-soda-bread.  The only variation was I used semi-skimmed milk (2% fat) instead of the whole milk specified.  The result on mixing the wet and dry ingredients was a sloppy, gloopy mess, completely unsuited to be "shaped into a ball".  Was it because there wasn't enough fat in the milk, or is there likely to be another cause?
Comment: Was your lemon huge and unusually juicy?  How much juice did you get out of the lemon (ml)?  Did you measure it?
Comment: This is not a complete answer, but I do want to note that this soda bread recipe seems problematic in its use of plain milk. Soda bread usually uses buttermilk, which in addition to being acidic, is quite thick. Milk curdled with lemon juice is acidic, but still much thinner than desired. Using real buttermilk (or even yogurt or kefir!) will make a textural difference.
Answer: The fat in the milk is a red herring here. At best, you would have to be a professional baker who knows the same recipe by feel to be able to notice the tiny difference made by 2% vs. 3.8% milk in that recipe. I would start in very different directions.
First, was it really a disaster? This is a 80% hydration dough, and that with whole flour - I would fully expect it to be sloppy and gloopy. There is nothing wrong with that. If you haven't baked bread of different hydrations before, or no soda bread (which has lower gluten and so doesn't come together as much), you may be imagining something firm and plastic like pasta dough. This is not what the recipe is about. When they say "shape it into a ball", they don't mean a sphere, they mean a boule. It will be certainly wider than it's tall. Just continue working with it.
If it is too extreme - e.g. it becomes a flat disc, or even flows freely - I can think of two possible problems.

maybe you didn't measure correctly. The recipe is given by weight, but if you tried to measure by volume, you might have been off. Or you were not perfectly concentrated and by mistake put in 500 ml milk and 400 flour, or a similar mistake.
maybe you used a different flour than what they have used. While white flour is pretty standardized, whole flours can differ a lot in their absorption ability.
Update: As per J..'s comment, the amount of lemon juice can be significant for that amount of flour. It might be worth using a smaller lemon, or not that much juice. (Or maybe go with real buttermilk instead of creating a substitute on the fly).

In any case, you can try saving the failed recipe by adding a little bit more flour this time (but don't make it as firm as mid-hydration yeast bread dough).
Comment: I **STILL** say bread making is akin to magic! ;-)
Comment: @SteveChambers lovely! This means I'm a wizard! And you are one too. Yayayay!
Comment: It's more than 80% hydration - there's also a lemon.  If OP had a large lemon that provided ~75ml of juice, this would actually be closer to 95% hydration.  A smaller lemon that produced only 40ml of juice would leave the hydration closer to 88%.  Given how wet this dough is already, I think the recipe is excessively sensitive to the variability in the "1 lemon" call.  A small or medium lemon is probably all that is needed and a large lemon would be too much.  The mixture could probably do with a 1-2h rest at room temperature to develop before shaping, also.
Comment: Oddly enough we did some soda bread over the weekend and the result was awfully gloopy and near impossible to knead. **BUT** it came out great, though we use a springform pan so it doesn't spread out too much and turn into Irish Soda FLAT bread.
Comment: @SteveChambers it's not that odd - soda doesn't leaven the same way as yeast does, and cannot work well when the dough is firm. So soda bread doughs tend to be on the wet side, gradually transitioning into batters for savory cakes.
Comment: [Yer' a wizard @rumtscho](https://www.youtube.com/watch?v=YFNsRogBqb0)
Comment: I'm betting on regional flour variations as the culprit here. @OP, where in the world are you located?
Comment: @Alex M England
Answer: Whole milk is 4%, so double the fat. 400ml of 4% has 16ml of fat while 2% has 8ml of fat and 8ml more water. 8ml more water will upset the balance a bit but shouldn't be enough to make the dough too wet. What is most likely happening is that your wholemeal flour isn't as absorbent, or you made some small errors in measuring.
First I would give it 5-10 minutes to sit and absorb, then I would see if it's still too loose. If it is I would add a small amount of flour, just a tablespoon or two, then knead it a bit, adding small amounts until it stiffens enough to go into a ball. You don't want to work soda bread too much, but a bit of kneading isn't going to ruin it. Also, don't be afraid to have a sticky dough, sticky is sometimes what you want.

Soda Bread disaster


How to share videos from Ubuntu touch?

Question: Hi can anyone help me here, when I take a photo on my BQ 4.5 I have options to share from my gallery. When I take a video I can't work out how to share the same options are not available when watching the video.
I like to take video notes, to help remind me of things, I have found that I now use my girlfriends phone more than my own, as with that (HTC android) I just shoot the video straight away I can share on google drive and view it from anywhere & on any device...
Really shouldn't be using someone else's phone when I have my own, there must be an easier way!
Hope someone can help.
~~Edit~~ Ok so worked out you can't share video from "media player" when viewing videos but you can through "photo roll" (or gallery before hitting play) although the video is just a black screen with white play arrow so it's hard to know which video you are sharing. Also it only appears to share through telegram, anything else I can download to share it? I want the video myself on my desktop (iMac) can't work out how to get this at all.
Answer: For sharing videos with dropbox you can use udropcabin. while downloading from udropcabin you have many options for sharing like Notes and Dekko app. by using Dekko you can mail yourself :).
For transferring files and other data you can wifi transfer app.

How to share videos from Ubuntu touch?


is it possible to get products filtered by out of stock by date?

Question: Is it possible to get all products filtered by out of stock by date? This will give the function to see when the products was last in stock, and give us the information to delete product if necessary.
Comment: The question is not clear. From where do you want to delete the products? Orders with products no longer in stock? If that is the case you can simply disable backorders from Admin Panel -> System -> Configuration -> Catalog Tab -> Inventory -> Product Stock Options -> Backorders and stop accepting orders with out of stock products.
Comment: Sorry for not being cleared enough.

I have in total 450 products in my shop, and around 200 are out of stock. Other 250 are in stock. I have chose the option to show only products which are in stock, so my shop displays only in stock products, which is what i wanted. Now my question is related to out of stock products. I would like to delete them from the catalog permanently, but need to know the information when the product was last time in stock. Logically I would delete older out of stock product/s.
Answer: Magento does not save  the stock change date & time in it  Inventory module.
So, you cannot it get  older out of stock products from system.
You can only get out of stock product list.
Comment: is anyway to show out of stock products only for specific category?


How to write subcircuits netlists in Spice with multiplicity factors?

Question: I am trying to port a behavioral device model from Cadence Spectre to Spice. In Spectre it is very easy to instantiate multiple parallel instances of a subcircuit automatically - one just calls the subcircuit - an it works for any subcircuit - with an M factor. I have seen that Spice has this functionality for some components - e.g. capacitors, but I could not find anywhere any documentation on how to do it for my on subcircuits. Does anyone know if it is is possible in Spice and how to enable multiplicity in subcircuits?
Answer: That m is nothing but a convenient shortcut to adding several subcircuits/symbols in parallel. Internally, that's how the circuit is expanded/flattened. If your simulator doesn't have this option, then about the only alternative is to simply add, possibly ad nauseam, several subcircuits and connect them all in parallel. I don't know if m can be a float (as opposed to an int), but if so, then, obviously, you'll have to restrict yourself to a fixed number of subcircuits.
Answer: I figured out how it works in Spice. Some Spice implementations, like LTSpice don't seem to have native support for subcircuit multiplicity, and some like ngspice do (see section 3.2 of ngspice v32 manual). This means that for a portable model the multiplicity in the subcircuit has to be implemented like in e.g. a Verilog-A module - explicitly in your model. In the end the multiplicity factor "m" becomes just a parameter of the model.
Comment: It's possible that `m` is a reserved keyword. In LTspice it isn't, since both `m`, and `n` (which denotes the series multiplier for some elements), can be valid variables, and so they are not restricted. If you think this is the answer to your question, mark it down so that others, in the future, searching for similar problems, will see this answer with an accepted answer.


Alternative to coffee

Question: I'm not really sleep-deprived, but lately I've tried taking coffee before working out. I find that my performance was considerably better than without coffee and that I generally feel good afterwards. I have GERD, however, and I shouldn't really be taking anything with caffeine because it triggers an acid reflux. Are there caffeine-free alternatives to coffee that are safe for those with GERD?
Comment: I don't see how this is getting marked as offtopic nutrition-sans-exercise. He's specifically asking about pre-workout nutrition as it relates to his workouts.
Comment: Decaffeinated??
Comment: The base question is "Are there caffeine-free alternatives to coffee that are safe for those with GERD?". Bit of a fine line, I'll admit, but the part that clinches it for me is it is asking anyone that answers to know what GERD is, and effects of food/medication on that condition.
Comment: I am looking for something that has the same effect as coffee but does not have caffeine.
Answer: There are pre-workout supplements that are non-stimulant (Magnum's Opus comes to mind).
Most pre-workout formulations rely on trying to stave off CNS fatigue (which is not a thoroughly understood topic). CNS fatigue is prevented (in varying degrees) by:

carbohydrates
amphetamines
caffeine

I'd be a little wary of "I drank a cup of coffee before some workouts, and they didn't go well, so coffee before workouts is bad for me." It's terribly anecdotal you're not controlling for other variables.
But if you don't want caffeine, and you're smart enough to not use amphetamines, then you're left with non-stimulant stuff.
You may want to try something with creatine and beta alanine. Beta alanine tends to give people tingles all over their skin which feels a lot like a stimulant (but isn't, that I'm aware of). And creatine actually does help: arguably the most documented safe performance enhancer out there.

Alternative to coffee


How to Include Global Styles in LWC System

Question: I'm working on a customer service system using Salesforce Lightning and the Lightning Web Component (LWC) framework. What's the best way (if any) to include a global stylesheet to create/override styles on the site? Something that will enable control beyond the basic theming, which allows you to change a couple colors and logo, basically.
The closest I've gotten is:

Upload my custom stylesheet through the Setup > Static Resources section
Create a new special lightning web component that is visually hidden (via display:none for example) and used only to load my custom stylesheet static resource through it's javascript file - doing a connectedCallback() { Promise.all([loadStyle(this,lwcStyleResource)... kind of thing.

This seems to work well, with one caveat -- I have to include this component on any page that I want the styles to apply. I want this to be global and thus apply on every page. So is there a way to somehow include this special component on every page? I'm pretty much a noob to the Lightning system, so I don't know how everything is structured, if there's a main page template I could modify, or what.
Answer: Easiest answer would be to wrap your LWC root component within an Aura component and import the style using ltng:require only once, this will automatically cascade the css to all enclosing LWC.


How can I extract blocks of 8 bits data from a plain text file?

Question: I have a plain textfile consisting of 4M numbers (0 and 1's) from the number Pi.
I would like to split this textfile into blocks of 8 bits (ie 8 characters).
I know this can be done with StringTake but my knowledge is too little.
Can anyone please help.
Thanks in advance.
Comment: look up [`StringPartition`](http://reference.wolfram.com/language/ref/StringPartition.html) in the docs.
Answer: You can use StringPartition["string",n] to
partition the input string into nonoverlapping substrings of length n:
StringPartition[ExampleData[{"Text", "Prufrock"}], 24] // Column

Answer: You can read the file 8 characters at a time. Try this code:
pistream = OpenRead["pibinary.txt"] (* use your file name instead *)

to open up a stream of data. You can read in $8$ characters at a time with
ClearAll[c, s]; c = 0; While[
  8 == Length[s[c+1] = Read[pistream, Table[Character, {8}]]], c++];
Close[pistream];

and do what you want with the characters read. Here s[1], s[2], ..., s[c] are lists of $8$ characters each read from the file. This approach is probably too bulky for the large file you have.
Alternatively, you can read the entire text file as a string and then split it. Try this code:
pistring = ReadList["pibinary.txt", Record, RecordSeparators -> {}][[1]];
pistring8 = StringPartition[pistring, 8];

Here pistring8[[1]], pistring8[[2]], ... are the $8$ character strings from the file. If you want to turn these $8$ character strings into lists of $8$ characters you can use Characters@pistring8[[n]] or else StringPartition@pistring8[[n]].
Of course, this asssumes that the only characters in the file are "0" and "1". If there are newlines or space characters, then the code needs some adjustment.
Note that you can always display lists of lists of characters as a matrix using something like
Table[s[n], {n, 8}] // MatrixForm

Comment: This really helped me out, it proved my theory. One more question: how can I list the first 8 sc[] groups in one time? I mean that i have the first 64 bits listed in 8 sequences of 8 bits? thus sc[1] until sc[8] listed in for example a matrix?.


Best ways to address comments?

Question: We've been told that the purpose of comments is to improve posts and that comments are meant to be temporary post-it notes.  My post is getting a lot of comments; what exactly am I supposed to do about that?
Comment: I've answered this, but I definitely welcome other answers.  This isn't meant to be fiat but a discussion leading to guidance.  Thanks.
Answer: You might get several types of comments:

Asking for clarification: edit your post to address whatever was unclear.  After you've done so, flag the comment as obsolete.  (Make sure it really is -- that you have made the edit!)  See more about editing below.
Arguing against your answer: if the objections raised in the comment are ones you can address in the post and you don't think it would be too tangential, consider editing your post to address them.  (See more about editing below.)  If the comment seems to arise out of a misunderstanding (the person thought you said X when you said Y), leave one comment politely pointing out the misunderstanding. Do not get into a long back-and-forth in comments; do feel free to use chat to discuss anything that comes up on the site.
Additional information (e.g. a source for something you said): edit to incorporate if it makes your answer stronger.  It's polite to give credit to the person who suggested it, particularly since the comment will probably be cleaned up at some point.
Comments that aren't constructive or otherwise shouldn't be there: flag.

A word about editing:
Think of posts on The Workplace like Wikipedia articles, not like posts on your blog or an email thread.  That is, the current version of the post should read like a seamless, integrated whole.  Don't append additions with "edit", "edit #2", etc, and there's no need to quote comments in order to respond to them.  Instead, edit the post to take that feedback into account and produce a version that, had you posted it earlier, the comments you're addressing wouldn't have been made.  The full revision history is available, so you really don't need to call out your edits as edits -- just make the post better.  By and large, you are writing for people who will only ever see the final version, not for people who've been following every development along the way.
Thank you for making the effort to improve your posts.  Every improved post makes The Workplace a better site, thus making the Internet better.
Answer: If a comment adds to impact of the answer, I will append it wholesale to the answer, with full attribution to the author. I will also respond to the comment if the comment cries out for a good response. I think of my answer as a total: the original answer plus whatever appropriate comments and responses to comments make the answer more appropriate and compelling. The idea is that the answer plus the comments and the responses to comments all converge toward a single idea,. If they don't converge, then we have an open ended forum discussion on our hands - forums are good and/or great but forums are not answers.
By appending the comments and the response to comments - as long as they converge - into the original answer, I get to enhance the original answer without having to do heavy duty integration and editing work. Yes, I am lazy - I try to get the job done with minimum work :) Plus, it's nice to see how the answer gets enhanced from its original form thanks to the input of my commenters :) I claim there is a method to my madness :)
Of course, if someone comments back to me "your answer sucks because you did not take into account ..." and they've got a good point, I'll edit the body of the body of my original answer to cover up my tracks :) I am not sure that I gave full credit to the last person who did this to me but knowing myself the way I do, I am pretty sure that I didn't - I don't know why, but I never get awards for sportsmanship :)
Comment: Still, in most cases, it's best to just integrate the entire work into your post so it flows as one complete body of work. Otherwise, answers end up looking like the very same comment threads we're all working so hard to clean up. Not saying there aren't boundary cases where this could make sense. Perhaps someone worded something in a way where it's valuable to preserve the exact quote, but if many of your answers follow this format, then you're likely doing it wrong.
Comment: It's okay to give the author of a comment some form of recognition, but we don't want answers to read like they're part of some discussion. Stack Exchange simply isn't a discussion platform, and using answers to try to turn them into one goes against the goals of our site and what the engine was designed for. Hope this helps clarify.
Comment: I believe that if the discussion sharpens the answer, then it does its job. Note that most discussions that I quote don't involve more than two or three comments

Best ways to address comments?


Is there any way to reuse a boat?

Question: I would like to know how to dock or pick up my boat. I've been unsuccessful with this in the past, either breaking the boat on land or just leaving it behind. It would save a lot of time and materials if i didn't have to make 5 boats for a single expedition.
Answer: If you build a dock out of soul sand from The Nether, you should be able to manage even high-velocity docking procedure. Boats, like minecarts, don't disappear when you wander away, so as long as you don't accidentally deconstruct your boat, it should be waiting for you when you return.
In this way you can "dock" your boat simply by getting out of it by the soulsand.
Comment: @DenilsonSá - from what I've read, slowsand is lower than surrounding blocks. This means you just build the edge of wherever you're trying to maneuver your boat out of slow sand. Because its lower, a boat will pass over it, and stop, rather than crash **into** it, and break.
Comment: High-speed non-destructive stops work with wool too. Build the dock at water level (the dock will replace water blocks).
Comment: Sounds like a great technique! Have you tested this?
Comment: Personally, I have not, due to lack of ocean in my current Minecraft world.
Comment: I'd like to see a schematic about this dock. Where should slowsand be placed? Right below water? Around the water? How deep should the water be?
Answer: I usually build a dock similar to this to aid in embarking and disembarking without my boat skipping away to the horizon.
To embark: hop in the boat, open the doors, and sail away. When you return, sail in, close the doors behind you, and hop out. It takes some practice to get out of without landing in the water, but I've never lost a boat with this setup.
Comment: Image is always nice :D
Answer: I don't believe there is any way to pick up an assembled boat.

You can break it, which will give you 3 wood and 2 sticks. If you carry a craft bench with you, this is 3/5 of a boat...
A boat will only break apart if it runs into land at high speed. If you don't have any splash/wake coming off the sides, you're moving at a safe speed. You can then "use" the boat again to disembark (although it's worth noting that jumping off a boat in >1 block deep water can cause it to skid away at high speed and break - I manage to do this often)
Comment: @strix I meant greater than one. Edited. Although it is actually quite common to have water less than one block deep. Place a source block on a flat surface. Each block it spreads, the height diminishes (by 1/7 of a block, I think).
Comment: Isn't all water 1+ deep?
Comment: In current versions (as of 1.3) boats will not break into a boat item if broken by hand. The usual planks and sticks are dropped if they're run into sand.
Comment: This is no longer true.  Could you update your answer?
Answer: Yes you can. I've personally done this several times. You first have take the boat into shallow water, then hit it with a sword (picks and shovels also seem to work, but not axes). It drops as a boat. I don't know if this matters but I'm on 1.4.4
Comment: Aye! Breaking a boat with a tool has yielded a boat-item since [one of the pre-1.3 development snapshots](http://www.minecraftwiki.net/wiki/Version_history/Development_versions#12w27a), so yes, this is a new feature.

Is there any way to reuse a boat?