How to make tabs like Nexus one weather/news App?

Question: is anyone have an idea how to make tabs like the nexus one tabs from the weather/news app, and i mean the functionality which by flick the screen you could go to the next tab, Thanks
Video: http://www.youtube.com/watch?v=hIu6kCnZVF0
alt text http://www.gadget.pdamu.com/wp-content/uploads/2010/01/Google-Phone-Nexus-One-weather-apps.jpg
Answer: You can now do this out-of-the-box in the Android Compatibility library with a ViewPager:  http://android-developers.blogspot.com/2011/08/horizontal-view-swiping-with-viewpager.html?m=1
ViewPager slides between Fragments much the same way ListViews scroll up and down with views.
If you're not interested in scrolling the tabs, there's an example in the SDK that uses a TabHost (instead of making the tabs themselves scrollable left-to-right), but you need not use a TabHost.  You could, if you wanted horizontally-scrolling tabs, use a HorizontalScrollView with some buttons in it.
For an approach that doesn't use the compatibility lib, or fragments, see here:  https://github.com/olibye/AndroViews
Answer: its called a Workspaces UI pattern more information about it and how to implement it here http://www.androiduipatterns.com/2011/06/android-ui-pattern-workspaces.html


Magento: how to check if onepage or multipage checkout was used?

Question: I have a trigger attached to completeOrder event, so through the $observer object I can fetch the quote and current order.
The question is - how can I check with 100% accuracy whether the user used onepage checkout or multipage checkout?
If he used multipage then 2 or more orders will be created, and my trigger will run a couple of times.
One way of checking stuff is to check the total number of addresses from quote object
<code>  $quote->getAllAddresses();
</code>
so if it has more than 2 addresses (more than just 1 billing and 1 shipping), then it's multipage, otherwise onepage.
The problem is if through the multipage checkout process one of the orders is virtual, and the other is regular. Virtual orders do not have addresses, so my condition won't work in that case.
Comment: When you say `multipage`, do you actually mean `multishipping` perhaps?
Answer: If you can get current Order, then fetch order quote object.
Then you can use <code>$quote->getIsMultiShipping()</code>


Visual Studio Code - Developer Console

Question: I have been trying to use Visual Studio code over the Developer Console because I understand that this will be the new standard for Salesforce however I find myself using the Developer Console with Visual Studio Code. The reason I use the DC with the VS Code is because while I am writing the  code for the business processes I heavily use the Logs in DC with System Debug statements. My question is can VS Code also show the Logs like the DC? I get that you can create test classes and run it that way but I find using this is rather challenging when programming.
Answer: You can actually stream the debug log into your local computer with VSCode + Salesforce CLI tool.
Assuming you have the Salesforce CLI tool installed. To see debug log without leaving your VSCode, run this command in the terminal tab:
$ sfdx force:apex:log:tail -c | grep '|USER_DEBUG|'

Then, try create a new file within VSCode, type in below
System.debug('Hey!');

and run SFDX: Execute Anonymous Apex with Editor Contents. You'll see the log is streamed to your console.
Check out the documentation.
Comment: From the doc: by default it tails for 30 mins. But you can exit manually: Ctrl + C (Win)
Comment: awesome thank you. I looked for this before but all i found was you needed to create a test class first.
Comment: In order to stop the debugger do you Kill the terminal?
Answer: You can retrieve recent logs with the SFDX: Get Apex Debug Logs... command from the Command Palette, and from there, you can use the Interactive Debugger commands on the log to step through your logic as if it were running in real-time. Many of the commands are not exposed through menu clicks, so using the Command Palette is the preferred way to get at all the available commands.
Answer: As a slightly different answer that does require more setup: there's a good trailhead about debugging your code in VS with checkpoints and the Apex Debugger which presents the ApexDebuggerEvent information through the Streaming API.
I've taken the below information from the trailhead and developer documentation.
First step, you need to create a permission set and assign it to your user record to give  system permission "Debug Apex". Once that's assigned to your user, you can set up Apex Debugger:

Click on bug icon on left side bar

Select create a launch.json file.
Select "Apex Debugger"
This should open a launch.json file that contains at least the following (should auto-populate):

"configurations": [
  {
    "name": "Launch Apex Debugger",
    "type": "apex",
    "request": "launch",
    "sfdxProject": "${workspaceRoot}"
  }
]

Save this file

Now, you can "launch apex debugger" by clicking on that same icon on the left sidebar.

It'll be actively streaming for information and the information will appear in the "Debug console" in the lower half next to "terminal". You can set checkpoints in your code to assist further.

Visual Studio Code - Developer Console


3rd string - G, never the correct chord/note

Question: I recently purchased a beginner guitar. My first tuning I busted the 3rd string like an idiot. Replaced it with 3rd string that was provided and tuner was showing D. Ordered new strings and replaced with new 3rd string and now tuner is showing A... I'm at a loss. HELP!
Comment: How much effort do you put into tuning your newly installed string? Don't expect it to be in tune immediately after you install it. I always have to retune the cheap plastic ukulele at my sister's place whenever I want to play it, and *each* string is generally a semitone or more off.
Comment: Can you post a recording or video of what each open string sounds like. E, A, x?, G
Answer: Each string needs to be under correct tension in order to be at its correct pitch, or "in tune." They are different thicknesses so that each is optimal for sounding the pitch it's meant to play, hence strings are named 1, 2, 3, 4, 5, 6 or Low E, A, D, G, B, High E (for standard tuning.)
The pegs on the headstock (small end of guitar) are turned to tighten or loosen tension on the strings, which raises and lowers the pitch of each string, respectively. A new string's pitch will not be in tune until it has been brought to proper tension. A digital tuner makes finding that pitch easy and they are pretty affordable.
Learn how to tune your guitar from someone who knows how, or go to Youtube and search for one of the many tutorials. I'd suggest you also learn how to change strings properly so that you don't have unnecessary issues with the guitar staying in tune.
Be diligent about playing in tune. Always check your tuning before you play and often between songs or exercises, especially if it sounds "off."  Changes in temperature and humidity, as well as just the act of playing, can cause any guitar to go out of tune, but especially lower quality instruments that most beginners start with. Also realize that newer strings will continue to stretch and lose their pitch at first, while older strings will be more stable and less prone to this but not sound as lively.
Good luck and have fun!
Answer: Is this one of those tuners that detects what pitch the string is?  I expect your newly-installed string isn't even in the right ballpark!  Tune it roughly by ear first.  This video will help.  Or perhaps your tuner also PLAYS notes?


Why aren't any dinosaurs written in the bible?

Question: Did they really exist before men? Or co-existed with man in the early ages? Where did the fossils came from and why isn't it written in the bible?
Comment: Not all Christian denominations believe that all parts of the Bible are 100% historically accurate, and conversely believe that there are parts of history which are not reflected in the Bible. This will affect an answer to your question from their point of view.
Comment: **Mod Notice:** Knock it off guys! Comments are not for debating issues, much less poking fun at each-other. They are for asking for or suggesting improvements to posts. End of story.
Comment: Good question! Though for this site you probably want to narrow it down so it stays within the confines of Christianity and the Bible (and historical scientific observation).
Comment: Welcome to the site. We are glad you decided to participate. For future reference please see the [question types that the community finds acceptable.](http://meta.christianity.stackexchange.com/questions/3409/types-of-questions-or-template-questions-that-the-community-generally-finds-ac) If possible, write all future questions to fit into one of those question types. I hope to see you post again soon.
Answer:
Did they really exist before men?

Yes, undoubtedly. There is ample evidence that dinosaurs ceased to exist around 65 million years ago, long before the arrival of humans.

Or co-existed with man in the early ages?

No, modern humans did not come on the scene until around 200,000 years ago. Even the earliest hominids are dated less than 7 million years old. For example, David Lambert, in The Field Guide to Early Man,  describes AustraIopithecus afarensis, which evolved perhaps 4 million years ago from a late dryopithecine, dying out by 2.5 million years ago. The famous 'Lucy' skeleton was a member of this group, which stood about 1.3 metres tall. Carbon dating can give reliable dates up to only about 50,000 years, but various other methods take us back further. For example, a non-radio-active technique involves amino-acid racemisation, which occurs in organisms after death and can be used with bone to 100,000 years old and more.

Where did the fossils came from?

Dinosaur fossils are found at various depths, sometimes more than a kilometre below the surface. Consistently, the lower the fossil is in the geological column, the more primitive the species. Some argue that the dinosaurs were all killed in the biblical Flood and that the fossils are the remains of this great event, but then we should not see such clear stratification from ancient to more modern species; moreover we should even see human skeletons mixed in with those of dinosaurs.  An alleged print of a dinosaur's footprint and that of a human has been shown to be fraudulent.

and why isn't it written in the Bible?

Dinosaurs are not mentioned in the Bible because the ancients were unaware of them. The Bible does mention two chaos monsters that also featured in the mythologies of other Near Eastern civilisations, but belief in chaos monsters is not the same as awareness of dinosaurs, of which there were thousands of species, large and small. Othmar Keel and Christoph Uehlinger, in Gods, Goddesses, and Images of God, page 43, explains that Baal was acclaimed in Canaan as victor over Litanu / Leviathan, the chaos monster depicted as a reptile. In the Book of Job, we find that God was the victor over Leviathan.
Comment: I would love to know why this answer has been down-voted.
Comment: @gideon marx I think many votes are based on emotion, not logic
Answer: If you read Genesis chapter one you will see that, all of the beasts and man on the sixth day.

Genesis 1:24 through 31  And God said, Let the earth bring forth the living creature after his kind, cattle, and creeping thing, and beast of the earth after his kind: and it was so. 25  And God made the beast of the earth after his kind, and cattle after their kind, and every thing that creepeth upon the earth after his kind: and God saw that it was good. 26  And God said, Let us make man in our image, after our likeness: and let them have dominion over the fish of the sea, and over the fowl of the air, and over the cattle, and over all the earth, and over every creeping thing that creepeth upon the earth. 27  So God created man in his own image, in the image of God created he him; male and female created he them. 28  And God blessed them, and God said unto them, Be fruitful, and multiply, and replenish the earth, and subdue it: and have dominion over the fish of the sea, and over the fowl of the air, and over every living thing that moveth upon the earth. 29  And God said, Behold, I have given you every herb bearing seed, which is upon the face of all the earth, and every tree, in the which is the fruit of a tree yielding seed; to you it shall be for meat. 30  And to every beast of the earth, and to every fowl of the air, and to every thing that creepeth upon the earth, wherein there is life, I have given every green herb for meat: and it was so. 31  And God saw every thing that he had made, and, behold, it was very good. And the evening and the morning were the sixth day.

These websites may be of some help to you:
Ancient Dinosaur Depictions | Genesis Park
Prehistoric Cave Art Depicting Humans Hunting Dinosaurs ...
Alleged Dinosaurs and in Ancient Art
Ancient Dinosaur Depictions


Which is the best exterior polyurethane for furniture?

Question: I'm thinking of using exterior polyurethane for my exterior furnishing. I'm planning to use Minwax Helmsman Spar Urethane Indoor/Outdoor Wood Finish. Is this the best one to use or there are better options within its price range?
Comment: Hi, welcome to StackExchange. *"within its price range"* I'm glad you added that because otherwise the answer to this would be a resounding "YES!". Unfortunately, and rather inevitably, the REALLY good alternatives are in a different price category entirely. I dump on Minwax stuff all the time (it's cheap for a reason, and their tech people seem not to know squat about their own products) but not singling it out for a change — the bald truth is that most consumer-level spar varnishes are not worth the name 'spar varnish' and simply don't hold up well in challenging conditions.
Comment: Just to check, you do know what you're singing up for by finishing exterior projects with varnish? (Strong colour, high gloss, regular upkeep every couple/few years.) Although the refinishing window is greatly extended if you use a proper marine-grade varnish that will hold up well to anything weather can throw at it, you're still looking at touchups or revarnishing periodically, for the life of the furniture, which is not something to take on lightly.
Comment: Hello @Graphus, thank you for your hospitality and for your response. My exterior projects are wooden tables and chairs. I don't have a preference maybe what I need is a durable finish that looks beautiful because it is for our Airbnb. Can you give me an alternative that has a higher price but is not super expensive? I really appreciate you!
Comment: There are numerous optional products and finishing schedules (multi-step, using more than one thing) suitable to exterior furniture, for any given set of variables inc. wood type, climate, full exposure versus partial cover, desired looks and/or feel, and not least, ease of application. Many alternatives have the advantage that they're easier (or downright easy) to apply, much better suited to someone without finishing experience. FYI it's actually quite challenging to apply varnish to a high standard, even with experience (varnish is given as a pro-only finish in some old sources). [contd]
Comment: Given the difficulty in varnishing for the novice, can you reconstruct the research steps that led to the choice of spar varnish in the first place, then Helmsman specifically? Was the latter based mainly or entirely on its price? Direct price comparisons finish to finish can sometimes be of limited use, since higher-priced products (and sometimes MUCH more expensive products) can last 2-3x longer than a cheap alternative, may require fewer coats so you actually use less product, or, innately have better coverage. So choosing a finish for outdoor projects can be a complex, interwoven process.
Comment: I have a bench that sits outside and has for three years coated in that very same spar urethane. When washed, it looks as good as it did after a few months in the sun (a bit of yellowing). It will need sanded and recoated eventually, but you'd have the same problem with any quantity exterior finish.
Answer: welcome to the group.
Some years ago, Fine Woodworking had an article on Door finishes which caught my eye, being in Texas with what seems like a hotter sun than elsewhere.
As others point out, "best" is difficult to assess at times, and maybe not much more than a lot of opinions outside rigorous testing.
To shorten the story, you may dig up the article, but their bottom line was using a penetrating epoxy for one or more base coats, then any Spar Varnish or paint if you wanted.
For me, I refinished my door of three years that had flaking varnish where it had not already sloughed off, using the epoxy (recommended, but no longer available from that company), and a final varnish coat.  I'm just now repeating after 15 years.  (Could be argued I should have done it at 10, but still far longer than the first finish.)  The finish performed far better than any film alone, in my opinion/testing.  Cost is likely cheaper if you factor all your work time, and repeating on a yearly or bi-yearly basis.
The reasoning, in a nutshell, was given that because the epoxy not only seals the pores of the wood, but also provides a consistent elasticity for a base.
Regardless of what you choose, I would strongly suggest looking at marine quality products.  Good luck!


How can I dissuade bears from visiting my garden at night?

Question: I live in the country with a large yard that goes into the woods a decent way away from my house. I have two indoor-outdoor cats, and also regularly set up bird feeders. Recently, I've been having a hard time with a bear at night. Now, I haven't actually seen the animal, but I am guessing that a raccoon isn't the one that bent a sturdy metal bird feeder pole in half. Anyway, so my cats are usually really good about being put outside at night, but recently, they've become spooked and cower when I go to put them out. I want to know if there is a way to deter the bear without using something harmful for my cats. Preferably something not super expensive and not hard to come by.
I'd appreciate any suggestions.
Comment: Where do you live? Which country and state or province at least, county may make a difference.
Comment: Assuming it _is_ a bear, your possible actions might also have legal implications. (e.g. you probably cannot just kill the bear)
Answer: You need to remove your bird feeders from your yard.  It is an easy source of food and that is what is attracting the bear.   You need to remove this food source and the bear will stop coming around.
It is common in areas that have bears to take down bird feeders in the spring and not put them back up until the winter when bears are hibernating.  You also will want to make sure that your garbage is secured properly so that the bear is not getting into that as well.
Comment: I live in the northeast USA. My garage is secure, and we don't keep any trash outside at all. The only thing the bear does is go after the bird feeders. I didn't use to have a problem with bears, though, so I was wondering if there is a good way to deter the animal without killing it. Is taking down the bird feeders the only way?
Comment: In MI, the DNR reminds everyone in bear country to take down their feeders to avoid attracting bears.  I can't tell you why you didn't use to have a problem with them but removing the thing attracting them is the only guaranteed way to stop them coming.  Anything else may not work and in the meanwhile, the bear will be associating humans with easy food and become habituated to hanging around humans.  Then if it gets in any trouble, it doesn't go well for the bear
Comment: Thank you! I appreciate the help!
Comment: Can I ask, why would you set up bird feeders outside of the deep of winter anyway? What I have read so far was always to only put out bird feeders in the harshest of winters to support the local bird population, and preventing them getting accustomed to easy food sources during times where they could and should just go and forage themselves...


How to prevent one app from saving/restoring any Saved State

Question: I want to turn off the restoring of an application window (in my case, iTerm).
How to turn it off, but just for this specific application ?
Answer: There is a specific command to prevent any app from saving state, rather than just locking the state folder…
defaults write com.apple.Preview NSQuitAlwaysKeepsWindows -bool false
If you don't want a permanent switch, just to prevent it on one single occasion, then hold the shift key as you launch the app.
Answer: You could try modifying the permissions on the saved state folder so it cannot be written to.
Take Preview.app for example.
Open Terminal.app from the Utilities folder under Applications and enter:
sudo chmod 440 ~/Library/Saved Application State/com.apple.Preview.savedState/
So you will want to look in the your "~/Library/Saved Application State" folder for the path to the iTerm saved state and modify the command above accordingly.
Answer: I use RestoreMeNot for this purpose. It adds a prefpane where you can toggle restoration on a per app basis.


how restrict view in MS word 2010?

Question: I have a word file containing many paragraph. I have a heading for each paragraph.Also listed all heading in a single page. What i want is, When user click on heading it can view only that paragraph only. he will not able to view other paragraph. To view other paragraph user need to comeback to the page where all headings are listed.
Answer: The way I would try to handle it is to put each paragraph into its own Continuous section and set all of the text as hidden.  On the page where you have your headings, put a checkbox next to each one and in the checkbox properties, you can assign it to run a macro (remember to do this after you write your macros).
Now you just write a number of simple macros (one for each paragraph you have) that will change the font property of that paragraph by turning the hidden setting off, while changing the font properties of every other paragraph by turning the hidden settings on.
Now for your checkboxes, you'll need to set them up so that if one is selected, the rest of them are unselected.  (You may be able to simply use a radio button instead of a checkbox, but I can't remember off the top of my head if radio buttons allow you to run a macro when selected.)
The thing you need to keep in mind is that some people may have their Word settings set up to always show hidden text, which would ruin the point of keeping stuff hidden.  However, I believe you may get around that by adding another macro that turns that setting off as soon as the document is opened.

how restrict view in MS word 2010?


How can you know that your Facebook post has been shared/linked on a web-site?

Question: For example, my Facebook post has been linked in a Quora question or a WordPress blog and also visited several times from there. Can I somehow learn about this?
Answer: Just go to your page and click on "Insights" then click "Posts" on the left
then scroll down to "All Posts Published" and view the Engagement column
Answer: If you click the down arrow in the top right corner of the post, one of the options is an embed link. This will give you a URL of the form, https://www.facebook.com/plugins/post.php?href=https%3A%2F%2Fwww.facebook.com%2Fuser.name%2Fposts%2F1234567890123. Presumably, anyone linking your post will need to use this link or one very similar. You might try searching Google for this link or even just the post number.


netbeans editor loses focus on editor and gives it to the menubar

Question: I am newbie of using Netbeans and i have Netbeans 6.5 on XP. So, here is my problem: when i am working on Netbeans and switch to an another task and then come back later, editor of the Netbeans losts the focus and the menubar gains it. I don't want to press ALT key again to re-focus on the editor. I made some search on help contents of the Netbeans and google and i couldn't find any solution. Have any of you got an idea to solve this problem? By the way, i am sorry about my unfluent English. Have a nice day!
Answer: Try Ctrl-0. It should set the focus to the editor window. There are several focus-related keyboard shortcuts. Look through the Window menu for the shortcuts to the different windows.
Answer: What you're looking for is this thread. I ended up using a different look-and-feel, but updating your JDK might just help, too.
Comment: Also, might want to update his version of Netbeans, 6.5 is around a year old.


How to digitally sign PDF documents in Ruby?

Question: Is there a native library to digitally sign a PDF document?
Comment: What do you mean by native? Do you mean one written in ruby, or one that is native for a particular OS?
Answer: The package here seems to provide an extension for signing PDFs with Ruby. It isn't free, but it looks like it provides a native ruby interface.
Here's how to use if in ruby (after it's been installed):
<code>require 'mypdfsigner'
include MyPDFSigner

inputPath = "/tmp/input.pdf"
outputPath = "/tmp/output.pdf"
location = "Chicago"
reason = "Demo"
contactInfo = "+1 555-555-5555"
certify = false   # not supported yet
visible = true
title = "Signing with MyPDFSigner"
author = "KryptoKoder"
subject = "Ruby Extension"
keywords = "PKCS#12, MyPDFSigner, PDF"
confFile = ""   # defaults to /usr/local/mypdfsigner/mypdfsigner.conf if empty
timestamp = true

puts mypdfsigner_sign(inputPath, outputPath, location, reason, contactInfo, certify, visible, title, author, subject, keywords, confFile, timestamp)
</code>
There's also a command line interface, so you can script it if needed, as well as a desktop app.
Comment: Thank you @cdeszaq. As I can see it is not a common installation like "gem instal mypdfsigner" right? Do you know why it is that way?
Comment: @RicardoAcras - I'm not sure why, but I would guess that it has to do with it not being free, as well as having a desktop app and command-line scripting abilities. You would have to ask the company to be sure.
Answer: I would us an iText as it can construct PDFs and sign them too ...


Determine if a network interface is wireless or wired

Question: I have a program that has two separate sections: one of them should be executed when the network interface is wireless LAN and the other one when it's a wired LAN connection. How can I know that inside of my program? What function should I use to get that information?
Comment: What if there are several network interfaces that are all being used in parallel?
Comment: The wireless part of the code will be executed for those that are wireless and the wired part for those that are wired, in parallel.
Answer: If your device name is NETDEVICE, a check of the existence of the /sys/class/net/NETDEVICE/wireless directory is a predicate you can use. This is a Linux-only approach, though, and it assumes that /sys is mounted, which is almost always the normal case. It's also easier to employ this method from scripts, rather than dealing with ioctl()s.
Answer: You can use the iwconfig command from the command line:
$ iwconfig
lo        no wireless extensions.
eth0      no wireless extensions.

If you need to use it from C, as @opaque's link above explains, get the sources or use strace to see which ioctls() you need to use:
ioctl(3, SIOCGIWNAME, 0x7fff82c0d040)   = -1 EOPNOTSUPP (Operation not supported)
ioctl(3, SIOCGIFFLAGS, {ifr_name="lo", ifr_flags=IFF_UP|IFF_LOOPBACK|IFF_RUNNING}) = 0
write(2, "lo        no wireless extensions"..., 35lo        no wireless extensions.

) = 35
ioctl(3, SIOCGIWNAME, 0x7fff82c0d040)   = -1 EOPNOTSUPP (Operation not supported)
ioctl(3, SIOCGIFFLAGS, {ifr_name="eth0", ifr_flags=IFF_UP|IFF_BROADCAST|IFF_RUNNING|IFF_MULTICAST}) = 0
write(2, "eth0      no wireless extensions"..., 35eth0      no wireless extensions.

) = 35

See SIOCGIWNAME usage:
#define SIOCGIWNAME 0x8B01 /* get name == wireless protocol */
/* SIOCGIWNAME is used to verify the presence of Wireless Extensions.
* Common values : "IEEE 802.11-DS", "IEEE 802.11-FH", "IEEE 802.11b"...

Comment: uhmm... sorry, I'm pretty new here. Can I choose both your answer and opaque's as "the" correct answer?
Comment: Unfortunately not ;) You can upvote them both, but you should accept the one which answers your question best. Its your decision :)
Answer: You can call ioctl(fd, SIOCGIWNAME) that returns the wireless extension protocol version, which is only available on interfaces that are wireless.
int check_wireless(const char* ifname, char* protocol) {
  int sock = -1;
  struct iwreq pwrq;
  memset(&pwrq, 0, sizeof(pwrq));
  strncpy(pwrq.ifr_name, ifname, IFNAMSIZ);

  if ((sock = socket(AF_INET, SOCK_STREAM, 0)) == -1) {
    perror("socket");
    return 0;
  }

  if (ioctl(sock, SIOCGIWNAME, &pwrq) != -1) {
    if (protocol) strncpy(protocol, pwrq.u.name, IFNAMSIZ);
    close(sock);
    return 1;
  }

  close(sock);
  return 0;
}

For a complete example see: https://gist.github.com/edufelipe/6108057
Answer: If you target NetworkManager then take a look at its API, C examples and NMDeviceType.


DateDiff with SQL Query

Question: I'm wondering if anyone might be able to point out the issue with the following code. In particular, the dateDiff part. What I'm trying to do is figure out the difference (in days) between sending an invoice and the deposit date. If the deposit date is null, I want to use today's date. Simple, I'd have thought...
$rs = mysql_query("SELECT i.dateSent
    , i.dateDeposit
    , i.invoiceID
    , i.gstValue
    , i.invoiceValue AS invoiceTotal
    , p.projectValue
    , i.invoiceNumber
    , p.projectName
    , p.projectNumber
    , p.projectID
    , c.clientName
    , c.clientCode
    , c.clientID
    , DATEDIFF(i.dateSent, CASE WHEN i.dateDeposit IS Null Then GetDate() ELSE i.dateDeposit) as numbDays

FROM cms_invoices i

LEFT JOIN cms_projects p ON p.projectID = i.projectID
LEFT JOIN cms_clients c ON p.clientID = c.clientID

ORDER BY i.dateDeposit ASC, c.clientName ASC
");

At this stage the result is no result. The dateDiff line breaks the query. Arg.
Thanks,
@rrFive
Answer: Seems like you're missing an END:
... DATEDIFF(i.dateSent,
    CASE
        WHEN i.dateDeposit IS NULL
            THEN GetDate()
        ELSE i.dateDeposit
     END) AS numbDays

DateDiff with SQL Query


SOQL query for the "Where is this used?" button for a particular field

Question: I am looking for a SOQL query that can display where a particular field is being referenced in Salesforce. Salesforce already has a button called "Where is this used?" for custom fields that displays all the field references. How would I write that function as a SOQL query?
Answer: Related to the previous post here is the sample query you can run in Developer Console with 'Use Tooling API' enabled in Query Editor.
SELECT MetadataComponentType, MetadataComponentName, RefMetadataComponentName, RefMetadataComponentId
FROM MetadataComponentDependency
WHERE RefMetadataComponentId = 'fieldId' AND RefMetadataComponentType = 'CustomField'
ORDER By RefMetadataComponentName

You need some way of getting FieldId though to filter by RefMetadataComponentId.
In SOQL you can't execute it because it doesn't support ToolingApi. In order to do so you need to do HttpRequest to Tooling API.
As an example you can use this post Tooling API usage in salesforce Apex method
Here is a link to documentation https://developer.salesforce.com/docs/atlas.en-us.api_tooling.meta/api_tooling/intro_rest_resources.htm
Use this endpoint /services/data/${API_VERSION}/tooling/query/?q=
UPDATE
thanks Jeff for the Field Query.
You can use this field to get Id for particular field
SELECT Id
FROM CustomField
WHERE FullName = 'Object_Api_Name__c.Field_Api_Name__c'

Comment: If you are looking for references to a Custom Field, you can use the same Tooling API to query the CustomField object to get the Id reference you'll find in the RefMetadataComponentId and MetadataComponentId fields for CustomFields:

select Id from CustomField where FullName = 'Object_Api_Name__c.Field_Api_Name__c'
Comment: thanks, I'll update the answer
Comment: Thank you, this was really useful.
Answer: I believe the object you are looking to query is: MetadataComponentDependency
This is most likely what Salesforce uses behind the scenes with the 'Where is this used?' button. I have not tested this, but according to the documentation you should be able to call this using the Tooling API or Bulk API 2.0
Please note, it says that this is currently a feature in Beta so usage may be limited.
Here is a link to the Dependency API/Field Usage chatter group
If you read through the posts, you can probably get a better idea of how to query and what works / doesnt.
Hope that helps and is what you were looking for!
Comment: Thanks for the reply. You are right, Salesforce does use MetadataComponentDependency in Tooling API for this.


itunes backup password

Question: I was trying to restore a backup from my computer to my iphone , however it's set to be password protected. I do not know the password, as I've never set one. I've tried all the passwords I know, which I've ever used to make sure I didn't set it. Nothing worked. any advises
Comment: but I have Microsoft pc not Mac .thanks
Answer: If you never set one, it then should be the passcode you used to unlock your phone (the 4-6 digit PIN) when you performed the back up.
If that doesn't work, look in your Keychain Access app, in your Utilities folder. Launch it, search for "iphone backup", and chances are you'll get a match. Open the item, click "show password" and enter your Mac system password.

itunes backup password


알았으니까 What does this mean?

Question: I understand this means "okay. I got it". But is this phrase actually an impolite way of saying so? Like when if you are annoyed or frustration with someone telling you the same thing over and over.
Answer: Yes, your understanding is correct.
알았으니까(요) sounds like saying "Okay, I got it (so let's leave it at that)", not wanting to dwell on the subject anymore.  It is often used when you want to dismiss something, like when you're annoyed by what the other person said.
Its base form 알았다 (past tense of 알다, to know) tends to have this implication, because the past tense in this case actually signifies a completion and its resultant state (like present perfect in English), which in this case stresses that the person has understood it and therefore there's no more to talk about it.
If you want to say "I understand" in a more polite way, 알겠습니다 (from 알겠다) is the better choice.  겠 is similar to the modal verbs "could" or "might", but here it gives the sense of "I really seem to grasp it now" in contrast to 알았어's "I already got it".  A lot depends on the tone of speech too though.
Finally, the most polite way would be 잘 알겠습니다 or 잘 알겠어요, where 잘 adds the sense of "fully / satisfactorily". Making it a full independent sentence like this instead of wrapping it in the sentence ending -니까 indicates you pay full attention/respect to the given subject, so it carries a lot more weight.
Comment: Thank you so much for explaining how the tenses change the tone. So, in a way, the sentence I provided can be translated to English as "Ok. I get it already"? Is that accurate?
Comment: Yes, that is correct, but note that what you said corresponds to 알았어.  알았으니까 is used when you say it with another thing, like 알았으니까 그만해 (I already got it so stop it), for example.  -으니까 is like "because ..." or "so ...", with another thing (main clause) following it.
Comment: Thanks again. So how does this sound 알았으니까...제가 생각할 시간을 좀 주세요. I am reading it as "Because I got it already, allow me some time to think". Would you say it sounds annoyed? The context was that, it wasn't something the speaker liked to hear, but they are talking to someone more senior.
Comment: No, it doesn't sound annoyed to me.  You can say it in most situations.  You can also say  알겠는데요 ... 제가 생각할 시간을 좀 주세요 which is about the same in meaning and might sound slightly more respectful.
Comment: Thank you so much for explaining patiently. This will be my last question. Does the sentence "알았으니까...제가 생각할 시간을 좀 주세요" indicate the speaker does not want to talk about it further as compared to "알겠는데요 ... 제가 생각할 시간을 좀 주세요"? Given the presence of 알았으니까 in the former, would you say the speaker is in a haste to put an end to the conversation?
Comment: Rather than putting an end to the whole conversation, it gives the impression of passing over 알았다 quickly.   This is because -(으)니까 is typically used when you decide or suggest an action based on some fact (e.g. 시간이 늦었으니까 집에 가자).  So 알았으니까 제가 생각할 시간을 좀 주세요 is emphasizing the main clause and (comparatively) short-changing the 알았으니까 part.  알겠는데요 has less of this nuance, and making it a separate sentence like 알겠어요, (그런데 ...) puts even more emphasis on it.  However the sentence is not rude or anything as is because 생각할 시간을 좀 주세요 is a reasonable sounding request.
Comment: Thank you. That was very helpful.

알았으니까 What does this mean?


How can two applications read from the same (digital) sound input in Linux/ALSA?

Question: I have a sound card with an AES/EBU input port that I want to access with two applications simultaneously. I want to record the input to a linear WAV file in real-time while also streaming it through IceCast. If I naively try to access the same input device with both applications one tells me that it can't access the device. How can I set up ALSA in order to accomplish this? Or do I have to relay it through some external program, introducing delays?
Answer: You can use the dsnoop plugin to copy the sample data to multiple virtual capture devices.
Put something like this into your ~/.asoundrc or /etc/asound.conf, and use snooped_digital as device name in both applications:
pcm.snooped_digital {
    type dsnoop
    slave {
        pcm "hw:2,1"   # the actual device
        channels 2
        rate 48000
    }
}

Comment: It works, but it doesn't show up on `arecord -l`. Do you know how to make `snooped_digital` show up on `arecord -l`?
Comment: @felipeduque `hint.description "blah"`


What is the biblical basis for the belief that Christians cannot be possessed by demons?

Question: Many Christians believe that Christians cannot be possessed by demons. What is the biblical basis for this belief?

Related: What is the scriptural evidence for Satan "taking hold" of Christians' minds or implanting/whispering thoughts?
Answer: This subject is dealt with succintly and pointedly by a commentator, Greg Boyd. I cannot vouch for his work in general, but this piece caught my attention on this particular topic :

I along with most evangelical scholars and pastors do not believe it possible for a Christian to be "possessed" by a demon or by Satan. Christ in principle defeated Satan, and all who are "in Christ" share in this victory (e.g., John 12:31; Col. 2:13–15; 2 Thess. 3:3; Heb. 2:14–15; 1 John 5:18). Colossians 1:13 assures believers that God "has rescued us from the power of darkness and transferred us into the kingdom of his beloved Son." If we are delivered from Satan's kingdom, we certainly cannot be possessed by the evil spirits of that kingdom. In 1 Corinthians 10:21, the apostle Paul emphasizes that a person is either in one kingdom or the other: "You cannot drink the cup of the Lord and the cup of demons. You cannot partake of the table of the Lord and the table of demons."

Finally, 1 John 4:4 tells us that "the one who is in you is greater than the one who is in the world." Christians have been redeemed from the power of the evil one and are now "possessed" by the Holy Spirit of God. How could they be owned by God and yet at the same time be "possessed" by a demon? Evil cannot dwell in the presence of God. Since we know that a Christian is one in whom the presence of God dwells by the Holy Spirit, we can be assured that no demon would be able to inhabit the body of a believer at the same time. Each believer's body is a temple of God, and God does not share his temple with demons (1 Cor. 6:19–20). Thus, while acknowledging that believers can be tempted, harassed, and even oppressed at times by demons, I cannot accept that a genuine follower of Christ can be possessed by them.

At the same time, I would affirm that Christians can be oppressed by demons to the point that they need to be delivered from them. It's significant to note that the Greek word usually translated "demon possessed" in the New Testament (daimonizomai) is actually best translated "demonized"—which simply means to be under the influence of a demon. Thus, there is no connotation of possession or ownership. Demonized Christians are saved and redeemed members of Christ's body. However, either through evil done to them or through their own choices, a doorway has been opened to the demonic realm.

Here I'd point out passages that indicate the possibility of demonic influence and attack in the lives of individual Christians and the church in general (e.g., 2 Cor. 2:11; Eph. 4:26–27; 6:10–12; 1 Thess. 2:18; 1 Tim. 4: 1; 2 Tim. 2:26; 1 Pet. 5:6–8). Specific biblical examples of the demonization of believers include King Saul (1 Sam. 16:14–23), Ananias and Sapphira (Acts 5:1–3), the Corinthian believer involved in an incestuous relationship (I Cor. 5:1–13), and Judas Iscariot (John 13:27). Perhaps the strongest case is that of the woman in Luke 13:11–16. This woman had been ill for eighteen years with an ailment caused by a demon. Jesus prayed for her, and she was healed. In verse 16, Jesus explains the situation: "And ought not this woman, a daughter of Abraham whom Satan bound for eighteen long years, be set free from this bondage?" By referring to her as a "daughter of Abraham," Jesus indicates her authentic faith—she is a true believer. And yet she was afflicted with a demon until Jesus prayed for her healing and deliverance.

It's also worth noting that many theologians throughout church history, including Martin Luther, acknowledged that Christians could be demonized and in need of deliverance prayer.

Reknew.org
Answer: The biblical basis is very simple.  Being truly possessed by a demon (not merely bothered or oppressed ) means that you are no longer in control of your soul because it is possessed by another being.
This means you are truly a slave to sin.
For the vast majority in the reformed view,  a Christian cannot be a slave to sin.  Yes someone who claims to be a Christian and is believed to be one by others can become a slave to sin but this proves they were never a Christian.
Romans 8:14-15
For those who are led by the Spirit of God are the children of God. The Spirit you received does not make you slaves, so that you live in fear again; rather, the Spirit you received brought about your adoption to sonship. And by him we cry, "Abba, Father."
Judas would be a good example of someone eventually possessed and proving he never believed:
Luke 22:3-4
Then Satan entered Judas, called Iscariot, one of the Twelve. And Judas went to the chief priests and the officers of the temple guard and discussed with them how he might betray Jesus.
It is possible for a demonic to be repossessed if they do not believe in Christ after being freed from their plight as warned by Christ.
One obvious problem with this concept of the Devil being able to defeat an individual in Christ is logically it also means the Devil can theoretically defeat the whole Church as well. This is unthinkable at its very loathsome origin.
These ideas spring from a lack of awareness of the power or God in Christ reconciling the world to himself upon the merits of his own work and plan.  That plan includes the absolute security of every stone used to build his holy temple.  None can stand against any stone of that church.


How do I replace this window trim with tile?

Question: I have a window in my bathroom that is inside the shower/tub area, and the shower head basically directly sprays it. The window trim is wood and is warping like crazy so I'm not sure how the previous owners kept it from breaking. We just had our windows replaced and now water is pooling on the inside window sill, hence the temporary caulking until I replace it with tile.
I'd like to pull out all the wood trim and replace it with simple tiles but I have no idea how to do that. I can watch YouTube videos on how to actually place tiles, but the part that I worry about is what goes behind the tiles. So that's my question, what do I need to do to make sure water doesn't get into the walls?
Image:
Comment: It will be almost impossible to answer this until we know what's behind the wood trim.
Comment: I can't see the warping but wonder if the backside of the trim is protected from water.  Wood trim is usually nailed on, so either the tiles stop at the edge or the trim is on with glue/caulking(tiles don't like nails).  A piece will need to be removed to see.
Comment: It sounds a bit strange, but have you considered an entire shower curtain for that side? If it's getting all kinds of water, then waterproofing it without tearing it apart is going to be really really hard. (I might even say impossible.)
Comment: and here is he again contaminating the whole process
Comment: @ruskes -- who you talking to/about?
Comment: I would do what Jack & RMDman alluded to.  Pull off one of the vertical pieces of trim and see how it mounts to the wall, and where it is relative to the wall tile.  Oh, and take a couple of good closeup pictures and add them to your question.
Answer: Wood in a shower area is not a good idea.
You would be wise to remove all the wood trim around the window.  Examine for any additional damage. The result of that inspection will govern your further tasks.
If all is well and no other issue are present, you should consider installing new trim made of PVC. All pieces should be properly caulked with silicone or polyurethane caulking.
PVC will not rot, swell or discolor from water.  Most big box stores have it in stock, but if you want something more similar to the existing window frame, try shopping a local lumberyard.
If the idea of removing and replacing all the trim if daunting. you should probably interview Carpenters to hire.
If you are set on tile, all window trim should be removed to get an assessment of whether that is feasible.  It may, or it may not be a possibility.
Answer: Don't know if you've gotten this sorted yet, but we had nearly the identical situation in our older home. Our exploration revealed that water had poured into the wall for six decades, and made mush of the drywall behind the shower enclosure and the building sheathing. I easily stuck a screwdriver entirely through the wall, from the drywall through the insulation and the sheathing. It pushed a cedar shingle off as there was little to hold it in place anymore.  Mold everywhere.
Further investigation revealed that the window had been installed completely without flashing or insulation of any kind - they just stuck it into the wall. We live in Iowa, a drafty window in your shower is ... inspirational in winter.  In this case, the "wet" side of the window was entirely inside, as my house has deep eaves and rain never touches this window. Our shower overspray was draining into the wall.
A normal window installation must shed the water that hits the outside of the window, and flashing is installed to direct that water to the outside of the weather barrier in the wall. In this case, the flashing needed to direct the water to the inside of the shower enclosure. So I ended up using window flashing tape wrapped over the edge of the enclosure. Water hitting the window now drains harmlessly into the shower.
But the damage was extensive. We demo'd the entire shower enclosure, removed and replaced the exterior sill plate, patched some studs and rotted sill plates, fresh insulation, used GoBoard to replace the drywall, put a 3-piece shower enclosure in, replaced window with a smaller one mounted higher. We used a composite crank-open style. Trimmed it with PVC.  I like being able to look out the window in my shower without giving the neighbors a free show, and in nice weather I like getting fresh air in.
It was a lot of work, but we did it all ourselves. I was 56 and my husband 70 at the time. And the lingering "old house" smell in that bathroom (from mold) went away, permanently.
Good luck! I hope you don't have nearly the damage we did.


Is there a way to search for unresolved feature requests?

Question: A tag search will find declined, completed and "by design" feature requests but what about feature requests that haven't been declined or accepted yet. This would be a useful view to have.
Answer: This is possible - just search questions tagged feature-request but not status-completed, status-declined, or status-bydesign:

https://meta.stackexchange.com/questions/tagged/feature-request+-status-completed+-status-declined+-status-bydesign

Comment: Remember to also exclude `status-sadpanda`.
Comment: Thanks for that. Ok, so you can do that. But that's rather awkward.
Answer: Well, do the math. There are NINE HUNDRED AND FLIPPIN' TWENTY feature-requests at the time I write this. How many of them do you think are

Reasonable ideas?
Reasonable ideas worth implementing?
No, really, it's worth spending development time to implement this?

I occasionally browse the feature-request list sorted by votes (and by that I mean most votes at the top) and that's about the best we can hope for.
This aspect of the site is very uservoice-y by definition. There are just way more ideas than we could ever implement even if we had twice the team we do now.
(and bear in mind the company has other things we're working on, that are internal priorities, as well)
Comment: Isn't this going off the handle just a bit for a question to find out if we can find unresolved feature requests?
Comment: I'm just pointing out that no search is really necessary to answer this question; all [feature-request]s are pretty much all unresolved and are likely to stay that way for a very long time -- except for those with 10+ votes.
Comment: statistically speaking, that is
Comment: By other priorities, do you happen to mean an API? I ask, because I have noticed the start of an API.
Answer: I tried this search, which seems like it should be correct:
https://meta.stackexchange.com/questions/tagged/feature-request+-status-completed+-status-norepro+-status-declined+-status-bydesign+-status-deferred
There are currently 779 requests in that list, of which 59 are voted 10 or higher.


Use feature as module?

Question: Does anyone have experience with using a feature as a module?
The usage I am talking about is strictly placing hooks inside the .module file.
Can that trigger any sort of bug?
Answer: Of course, you can use a feature like a "normal" module.
Feature use .module file only for include a file, so after this include you could add your custom code.
And obviously you can add more files, directories, etc.
It's a great way to avoid to create too many modules.
Answer: I've used a feature as a "normal" module without any problems. I've found it very convenient.

Use feature as module?


what does 'in transit' mean in the US ESPA form?

Question: I am spending 10 days in the US and 10 days in Canada this summer, flying from the UK. When filling out the ESPA form, it asks if I am in the US 'in transit ' to another country- if I say no, I fill in details of my address while there for 10 days, if I say Yes, then no details are given. Which do I do?? It seems to make sense to fill in more info to allow them to contact me if required than not, but technically I am in transit- aren't I?
Comment: Do you mean ESTA?
Comment: You're not in transit because you're entering for ten days. "In transit" means you are leaving as soon as practical, as a rule of thumb usually (but perhaps not always) within 24 hours.
Comment: @Calchas "perhaps not always": indeed, historically, transit could last for weeks, as might be the case for someone traveling from Canada to Mexico by land.  While such a journey would not normally take weeks today, it could still reasonably require several days.  The more precise test, I think, is whether the traveler has any independent purpose in the country other than to pass through to get to the other destination.
Answer: Nope, transit generally means you're just in the airport - continuing on to another place, so you won't be at any address within the US.
That's why if you say yes, you don't need to give details of an address, because you're not leaving the airport, you're just 'on your way'.
You're actually visiting the US though, before visiting Canada, and as such, you'll have addresses there that you can and should complete.
Comment: A transit traveler can leave the airport.  What transit really means is that the traveler is only in the country for the purpose of traveling to another country.  If such a trip reasonably requires a two-day layover because of flight schedules, or a transfer to another airport, then it's still transit (although the traveler would normally have an address in the former case).
Comment: @phoog indeed, and I've been in 'transit' in Lithuana for 5 hours, but I still left the airport.  Often you'll find these forms cover 95% of passengers to be simple, but there are always exceptions.


Is Russia interfering in Catalonian process?

Question: I heard some months ago that not only did the US congress warn about Russia's interference on Catalonian non-official referendum, but that Russians wanted to use Catalonia as a port for their enterprises on Europe.
I must say I am from Spain and I see the process almost dead. What I heard about Russians is they are not bad tourists: they learn the language quickly and they do not cause troubles on street. But as my holidays region I wonder if that malicious suspicion is grounded.
Comment: Not very clear about the question here.  What is the source of "what I heard some months ago".   What is the source of "Russians are not bad tourists" and what is the relevance of that?
Comment: @James K. I do not find the session where that was told on US Congress, not only for a referendum interference, but for the russian interest on using Catalonia as a port for their entreprises at Europe. Anyhow I doubt this is true because russians are not stupids and they should know our king Felipe VI is a hard one. About russian tourist, this spanish gov page says they are the second with more economical expenditure. Also I do not find again a comment saying at Salou (Catalonia) most of people is more happy with them than with english. https://www.rusalia.com/turistas-rusos/
Answer: Russian state media consistently supported the right of Catalonia to secede from Spain. It supported a "Yes" vote. (source)
This is consistent with the Russian position that Crimea should have the right to secede from Ukraine. It is also consistent with a general Russian policy of supporting disruptive movements: Brexit and Trump for example.
There is little evidence of actual interference in the process of the referendum, or evidence of illegal actions by Russian agents.
Comment: There's usually some realpolitik involved in which independence movements a government supports. Is there a reason, besides bolstering Crimea's case, that Russia would support this movement in particular? I don't think the government is a big fan of Chechnyan separatism or the various other independence movements within Russia, just to begin with.
Comment: @Obie2.0 The realpolitik reasons seems to be exploiting contradictions in western powers - it's position about Kosovo independence, for example - and supporting everything that looks to a) weaken the EU and b) distract EU members from looking eastwards.


How does btrfs scrub work and what does it do?

Question: What exactly does btrfs scrub do? According to the manual page, which is totally unclear, it does some error checking. What kind of error checking? How reliable is it? Is it able to recover some errors? How does it work? Does it work on every btrfs disk?
Comment: Context: BTRFS stores checksums, so it's always able to tell if a file (or metadata) is ok or if it has been corrupted. Almost all other filesystems like ext4 do not have checksumming, so they won't stop you from reading a file that has been corrupted by a bad drive (which is about to die and has already started corrupting data). This is an important data protection feature in BTRFS and this makes scrubbing possible.
Answer: I don't know if it does anything else, but I know that at minimum btrfs scrub does full-disk data scrubbing. Basically, it reads all data* on the disk, recomputes its checksum, and compares the recomputed checksum to the stored one. When the stored and recomputed checksums don't match, the system knows there's corruption.
Once corruption is detected, behavior depends on your disk setup. For example, if you use the RAID 1 (mirroring) feature of btrfs, then btrfs scrub can fix corrupted data by copying an uncorrupted version from another disk. If all copies of some data are corrupted (e.g., multi-disk damage or not having redundant copies in the first place), then there's not much btrfs scrub can do besides warn you.
The reason this is important is that hard drives are only about 99.999999999999% reliable at reading and writing bits. So, every few terabytes of data I/O, there is likely to be an error. Although errors can be and are detected (and fixed, assuming a redundant copy is still valid) during normal disk access, routine full-disk scrubbing is able to find and fix errors before enough accumulate that all copies of the same data are corrupted.
* I'm using "data" instead of "file" to include metadata as well. Btrfs stores files and corresponding metadata (including checksums) in data blocks, all of which are checksummed and checked by btrfs scrub.
See also:

Btrfs -> Checksum tree and scrubbing at Wikipedia: Technical information about btrfs's data scrubbing.
Birthday problem -> Probability table at Wikipedia: Treating "hash space" as "number of data blocks" and "number of hashed elements" as "number of corrupted data blocks", this gives the probability of there being a data block with both copies corrupted in a RAID 1 setup.
Comment: I haven't counted, but I'm willing to guess that your reliability figure is off by a few orders of magnitude. Consumer HDDs are usually spec'd to a UBE rate of 10^-14 bits. In other words, one unrecoverable read error per 10^14 bits read. The problem is that this is for a full sector; you either get the full sector or you get nothing at all (or that's the idea; silent errors is another cup of tea entirely). So the error is amplified by the sector size, which with Advanced Format drives is 32,768 bits. Hence, the *real* error rate is more like 10^-10 to 10^-11 readbit-errors.
Comment: @MichaelKjörling I don't think sectors matter here.... I have records of the last 29 btrfs scrubs of my computer's two internal 1TB hard drives. The amount of data has varied between 270 and 300 GiB (for a total of 1.35*10^14 to 1.49*10^14 bits read for all scrubs combined). There have been 3 errors found during these scrubs. Assuming that non-scrub I/O neither caused nor fixed bit rot, that's only 2 to 2¼ times the expected error rate of "99.999999999999% reliable" drives. Even with only 4096-bit sectors, I think your argument would expect my drives to have had thousands of errors by now.
Comment: @MichaelKjörling So far as I understand manufacturer's spec sheets (Seagate and WD), it's bit errors and not whole sectors that die. And the number of nines in the answer is even optimistic: `100-1/10^14` has 16 nines and the post's has only 14 (corresponding to 10^12).
Comment: @Luc It's good if sector death is less common; dying sectors mean the drive is (maybe) actually failing and might need replacement. Bit errors just lead to silent data corruption, which can be made noisy enough to restore from backups. Math note: The actual calculation is `1-10^n`, which is then converted to percent because humans don't like leading decimals. Also, I neglected to mention in my previous comment that the drives are in RAID 1 (hence the same 270-300 GiB data is on each of them), which fixes another apparent calculation error.
Answer: Expanding on Mark Haferkamp's excellent answer, btrfs scrub reading all data instead of all files is a critical property and is actually what makes it so useful. Remember, btrfs has builtin RAID support. Say you have a btrfs filesystem spanning two drives that you've configured to use RAID1. In this case, when you write to a file, that write is replicated to both disks. (It gets more complicated with a more complex example but for this simple case, this is always what happens.) However when you read from that file, the read will hit only one disk (because it is a waste to read the file in twice unless the first copy is unusable for some reason).
Now say your second btrfs drive is degrading and starting to corrupt data in your filesystem. When you read blocks from this disk, btrfs will notice that the checksum does not match and will restore the block in-band from a known-good copy - the copy on the first drive. It'll return the data to the application calling read() (or whatever) as if nothing happened.
But what if btrfs doesn't decide to read from the second disk? Remember, there's two copies, so it can read from either the first or the second disk. If it reads from the first disk, it won't notice anything wrong. The only time it'll notice anything's wrong is when the first disk degrades, too. Now you're really hosed as it's too late to recover the data - the second disk's copy has been corrupted for a while, and the first copy (which is what you would've used to restore the second disk) is now corrupted too!
This is where btrfs scrub comes in. It reads all data, not all files. This includes metadata, but also secondary copies of files that wouldn't normally be in the read path. When it reads these secondary copies, that creates an opportunity for btrfs's in-band error correction to kick in and restore the data from a redundant copy.
Comment: Are you sure that in RAID1 reading is done only from 1 disk? At least with mdadm RAID this shouldn't be the case. Reading should happen in parallel from both disks, but of different data, meaning it should be twice as fast as reading from one disk. Read performance boost is one of major features of RAID 1.
Comment: @Petr yes, you're correct. individual blocks are only read from one disk.
Comment: @Petr:
To elaborate,

 - under normal use neither MDADM nor BTRFS read both copies of the same data from both disks. They only read one copy.
 - MDADM is able to load-balance and distribute reading across copies to obtain twice the reading speed. (because all copy A go onto disk 1, and all copy B go onto disk 2. As mdadm will use exactly 2 disks).
 - BTRFS has more difficulties. (because copy A and B will go onto whichever 2 disks (out of 2 *or more* disks) happened to have most free space at the moment - i.e.: the 2 copies will get randomly spread among all the present disks)
Comment: and regarding security :

 - both MDADM and BTRFS will try the other copy in case of problem.
 - for MDADM the only problem it can detect is "disk doesn't answer" (because it has no actual idea of the files stored above)
 - for BTRFS it can in addition detect silent data corruption (because the data is checksumed, and so the BTRFS' RAID layer knows if one copy can be trusted or if it must fetch another copy)
Comment: last but not least regarding RAID5/6 :

 - in MDADM it *just works*. (But won't detect silent corruptions)

 - in BTRFS silent corruption for now aren't handled (because it's easier to just fetch another copy (in RAID1) rather than doing the Erasure Coding computation to guess which member of the stripe is corrupt and should be rebuilt from remaining data/parity).

In other words : as of today (august 2017) don't use btrfs' RAID5/6.
Comment: @Petr Last I tested (probably in 2017), two-disk Btrfs RAID1 only uses one disk to read from a given file. So strugee's original answer was correct. Performance-wise, this means that single-app read performance is unchanged, but it __does__ leave the other disk fully available for other reads.
Comment: [All read requests from the same PID go to the same device](https://forums.gentoo.org/viewtopic-t-1010878-start-0.html).
Comment: Related: [Fix mdadm RAID1/5 inconsistencies using btrfs/zfs checksums](https://unix.stackexchange.com/questions/553534/fix-mdadm-raid1-5-inconsistencies-using-btrfs-zfs-checksums)


Prove inequality using Mean Value Theorem

Question:
How would you prove the following inequality using the Mean Value Theorem:
  $$1+2\ln x\leq x^2$$ for $x>0$.
Comment: I don´t know how to use it here because I don´t know how to express "ln(x)" in terms of "x^2" (I have tried Taylor, but the question is about using MVT)
Answer: Let $f (t)=1+2\ln(t)-t^2$ for $t>0$.
for $x>0$ , $f $ is continuous at $[x,1] $ or $[1,x]$ and differentiable at $(x,1) $ or $(1,x) $ thus by MVT, exists $c$ strictly between $x $ and $1$ such that
$$f (x)-f (1)=(x-1)f'(c) $$
$$1+2\ln (x)-x^2=2(x-1)(1/c -c) $$
$$=2 (x-1)\frac {1-c^2}{c} $$
If $x>1$ then $1-c^2<0$ and
if $x <1$ then $1-c^2>0$
thus in all cases
$$f (x)\le 0.$$
Answer: Hint
Use MVT with $f(t)=\ln(t)$ on $[1,x^2]$. You have to separate the cases $x>1$ and $x\in ]0,1[$.
Answer: We need to prove that
$$\ln{x}\leq\frac{x^2-1}{2}.$$
Let  $0<x\leq1$ and $x=\frac{1}{y}$.
Thus, $y\geq1$ and we need to prove that
$$\ln\frac{1}{y}\leq\frac{\frac{1}{y^2}-1}{2}$$ or
$$\ln{y}\geq\frac{y^2-1}{2y^2}.$$
Indeed, for $y=1$ it's obvious. Let $y>1$. Thus, there is $1<\theta\leq y$, for which
$$\frac{\ln{y}-\ln1}{y-1}=\frac{1}{\theta},$$ which says that we need to prove that
$$\frac{y-1}{\theta}\geq\frac{y^2-1}{2y^2}$$ or
$$2y^2\geq(y+1)\theta$$ and since $\theta\leq y$, it's enough to prove that
$$2y^2\geq(y+1)y,$$
which is obvious.
Let $x>1$. Hence, there is $1<\theta\leq x$ for which
$$\frac{\ln{x}-\ln1}{x-1}=\frac{1}{\theta}.$$
Thus, we need to prove that
$$\frac{x-1}{\theta}\leq\frac{x^2-1}{2}$$ or
$$\theta(x+1)\geq2,$$
which is obvious ($\theta\geq1$ and $x\geq1$).
Done!


Ultimaker Cura infill issues (weird vertical pillars due to underextrusion)

Question: I have spent ages debugging this problem but I can't figure out what I am doing wrong.
I have a Wanhao duplicator i3 (Prusa i3 clone) and until recently I used Wanhao's adapted version of the Cura slicer. But it's quite an old Cura version and I wanted to make use of the improved supports in the new Cura.
Unfortunately it seems like I just can't get the infill in the newest Cura to work. I copied all the settings from my Wanhao branded Cura version and printed the same file.
This is the result:

The infill is shaped like many tiny pillars. They are super fragile and while they do support material to be printed on top, they hardly withstand any pressure.
I have gone through quite a few testing cubes each with some setting altered, but nothing seemed to help.
It can't be the printers fault as I have successfully printed test cubes sliced with the old Cura in between (and not only once). Increasing temperature or slowing down the infill didn't help either. Neither did increasing flow rate or switching to triangular infill pattern. Also I have tried printing with all speeds set to 50mm/s and it still failed.
My standard settings (from which I have created many test cubes with each cube having some settings tweaked):
<code>Layer Height: 0.12 mm

Init. Layer Height: 0.10 mm

Wall Line Count: 2

Top Layers: 6

Bottom Layers: 4

Infill Line distance: 5 mm (used to be 20 % in old Cura, but this is very dense in the new Cura)

Infill Pattern: Lines

Infill Overlap Percentage: 20 %

Printing Temperature: 200 °C

Build Plate Temperature: 60 °C

Retraction: Enabled, Distance: 2 mm, Speed: 60 mm/s

Speeds: Print:60 mm/s, Infill: 60 mm/s, Outer Wall: 30 mm/s, Inner Wall: 60 mm/s, Top/Bottom: 40 mm/s, Travel: 100 mm/s, Initial Layer: 20 mm/s

Combing Mode: All
</code>
Comment: Looks like under-extrusion. Have you told Cura you're using 3mm filament? What does it look like at 100% or 80% infill?
Comment: I think the `Layer Height: 12mm` bit must be a mistake because that's not a sensible layer height. Are you printing 0.12mm layers?
Comment: i already had one print finished. the walls and everything else looks perfect, so it's definitely something infill specific. my material settings say 1.75mm and so do the settings in the sidebar. i will try a testcube with 80/100% infill and report back
Comment: Could you post the G-code somewhere so we could see it?
Comment: I have the same printer, and usually go for infill density of 20%, pattern grid, gradual steps 0. What do you mean by > used to be 20% in old Cura, but this is very dense in the new Cura I'm printing right now with 20% and the spacing between sides of the rectangle is around 4mm, right on the order of the 5mm you're using. If you'd like, I can give you all the settings I'm using right now on a successful print (given that it's the same printer, you should get the same results I'm getting, me thinks...), though they are largely Cura's default ones. Good luck!
Answer: This problem is most commonly caused by infill speeds which are too high.
Instead of printing lines, the filament is caught on one of the lines of the previous layer, leaves a blob there and only restarts extrusion when it hits the next line. Instead of extruding continuously the filament comes out in blobs at the locations where there's filament on the previous layer.
You can have good infill up to some layer and suddenly start getting this problem as of some layer. When the problem occurs the next layer is more likely to show the problem. It's snowballing.
Answer: I am using the same printer and stopped trying to upgrade to higher CURA.
To my knowledge the branding of the Wanhao Cura Edition is that this Cura knows the specific firmware of your printer and thus is able to do printer specific tasks like calculating printing times etc.
I assume that copying the settings does only copy the settings and not the firmware info of your printer. If these settings however build on firmware info in the Cura wanhao edition, things could get messed up.
I would try uninstalling Cura, make sure the folder with the settings is deleted, reinstall and set it up from scratch.
If your motivation for the upgrade is feature-richness, you could also take a look at slic3r instead.
Answer: I am using the same printer (v1.2) with some upgrades and have been using the latest Ultimaker Cura (4.1) ever since they came out. For the first few prints I used an imported Ultimaker Cura profile, but after 3-4 bad prints I created a new profile from scratch, using a percentage for infill, with no problems at all.


How can I get a large depth of field at night?

Question: I am new to photography and have a question on aperture. What if I wanted to take a picture with majority of the picture in focus, but at night time, so I can't have the aperture too high, because it's focus would be narrow, but I can't have the aperture too low, because it wouldn't allow much light, resulting in a dark image ? How would one balance this ? Can you balance this ?
Comment: Photography is the art of choosing compromises in a way that reflects your vision.
Answer: Depending on the subject you can add more light, in the case of interior photography. That is what flashes and continuous light are made for.
But on an exterior, you use a slower shutter speed and a tripod. You can also use a higher ISO, but the time the sensor or film is exposed is the basic option.
Answer: Considering aperture alone, the only way to "balance" the tradeoffs aperture changes incur is a technique called hyper-focus; which is a balance of focal length and subject distance to manage the depth of field.
For this example I'll assume you have an APS-C camera. If you have a 50mm lens set to f/16 the hyperfocal distance is ~ 25ft. And if you focus at 25ft everything from 12.5 ft to infinity will be w/in the depth of field (acceptably sharp; not critically sharp). If instead you use f/8, the hyperfocal distance is 50ft and DOF extends from 25 ft to infinity.
Those numbers are just a SWAG using the Focal length as a percentage of itself at f/16... i.e. 50% of 50mm = 25ft @ f/16. If you use a shorter FL the hyperfocal distance is closer. E.g. 40% of 40mm = 16ft. Or even easier, just drop a zero from the FL; e.g. 4x4=16.
If you have a different size sensor you need to start with a different aperture; e.g. f/11 for 35mm/FF, f/22 for M4/3. And because it is a SWAG, and judging focus distance is difficult, you want to error by focusing a little long if the near DOF is important.
You can also use an app on your phone or online to calculate the hyperfocal distances for your lenses at various apertures... I've known some that have put that information on the lens cap for select apertures.
Answer:
How would one balance this? Can you balance this?

You do it by balancing your camera and lens on a stable mount, such as a quality tripod. This allows one to extend the exposure time far longer than would be practical when holding the camera by hand.
You then use a technique to release the shutter that doesn't induce camera movement. I prefer a wired remote shutter release. Some folks prefer wireless remotes. Others use the camera's self-timer or built-in intervalometer, if the camera has one. All have their own sets of advantages and disadvantages.
Answer: There is yet another approach specific to digital photography,stacking.
The idea behind stacking is that multiple (sometimes a whole lot) of pictures are taken and the multiple pictures are digitally aligned stacked and merged into one picture.
Depending on the techniques and algorithms used, stacking can:

Act like a long exposure (without a tripod)
Denoise many high ISO shots to produce an equivalent low ISO result
Stack slightly different focuses to produce a high depth of field result

With DSLR cameras, this requires post processing many images on a computer to produce these stacked results.
Have you ever noticed that friends with high end iPhones seem to be able to take better pictures in low light without even trying? This is because the iPhone is actually taking multiple pictures and stacking them in-camera without you ever even realizing what it's doing.
Answer:
I can't have the aperture too low, because it wouldn't allow much
light, resulting in a dark image

Well, then you just use a longer exposure duration of course (i.e. slow shutter speed) – to allow more light into the camera over time. Or a higher ISO setting – to make the sensor more sensitive to the (low levels of) light coming in.
Exposing correctly at any time requires balancing aperture, shutter speed and ISO against the light levels in the scene. If you have to use a particular aperture value due to other requirements (here, depth of field), then you just use other variables to balance the exposure.
The rule of thumb around shutter speed is as follows... Get the reciprocal of your focal length (e.g. focal length of 50mm, the reciprocal would be 1/50). Now, if your shutter speed reaches 1/50 or longer, this is likely to be too long to hold steady without assistance. So, this is where a tripod (or a beanbag resting on a wall, etc) comes in handy.
There's no rule of thumb necessarily around how high you can set your ISO before noise in the image reaches unacceptable levels. For this, you're going to have to use some trial and error yourself, to see what ISO settings are acceptable for you, or search online for what other users of your particular camera model find acceptable.


Develop extension for magento go platform

Question: i am googling for last 2 hours but can not find any proper documentation about creating extension for magento go. can any one let me know how can i develop, submit and install an extension on magento go?
Comment: This question appears to be off-topic because it is about magento-go which is closed now
Answer: As far as I know it is not possible at this moment to apply for a Magento Go extension.
The development for this extension is the same as any other Magento platform extension. In the past there was a form available to request a review and mark is as a Trusted Extension.
During Imagine last year there was a session about it and they where having problems with the distribution of the extensions for deployment, thats why there are only a few Trusted Extensions at this moment.


(?)の 雑誌ですか。日本の 雑誌です。 (?)no zasshi desu ka. nihon no zasshi desu

Question: Is どこ or 何 the right question word in this exercise or are both possible? I think どこ means "where", so the question would be "where is the magazine from? It's a magazine from Japan/a japanese magazine." Or is it also be right with "何" which means "what kind of'm
Comment: Related:  [Difference between 何の~ and どんな~](https://japanese.stackexchange.com/q/9342/78).
Answer: I would think you'd ask どこの国の雑誌ですか。
If you asked なんの雑誌ですか, I'd understand you be to be asking about what sort of content the magazine typically covered or its title.
Per the comments, you could ask either どこの国の雑誌 or どこの雑誌ですか.
Perhaps I'm reading too much into these different questions.  I'm not a native speaker of Japanese.  But, I imagine these questions are not too different from how they'd be similarly understood in English.
Comment: You are correct about なんの雑誌 but なんの国 is unidiomatic. I would say either どの国の〜 or simply どこの〜 unless I need to be specific that I'm asking for a country.
Comment: I would say どこの国.


Replacement Training wheels for Nakamura Kids Bike Options Needed

Question: I purchased a Nakamura kids bikes and realized after that these bikes have a square box blocking where training wheels would go. These bikes have proprietary training wheels that come with bikes when new. Looks like they click in and out. So now I can't add my own. Any ideas on what I can do?
Comment: Many people recommend not using them.   Consider if you really need them. Removing the pedals to make it a balance bike might be a better starting option.  Useful read. https://bicycles.stackexchange.com/questions/57914/what-are-the-conditions-for-removing-training-wheels
Comment: Could you please add a photo showing the mounting blocks?
Answer: Do the training wheel mounts look like this?

If so, the box can be removed allowing you to use other types of training wheels.
In the picture:

The white training wheels are removed by depressing the retention
buttons and sliding the training wheel arm down.
With the training wheels removed the axle nut will be
exposed allowing you to remove the nut with a socket wrench (pretty
sure it's 15mm).
After removing the axle nut the box can be
removed.

Repeat for the other side.
Answer: The modern view is that training wheels aren't as helpful as they seem.
Instead, take the pedals, cranks, bottom bracket and chain off (or get a balance bike and store the big-kids bike)
Use the bike as a balance bike so the kid can "scooter" around and get used to the idea of balancing.
It may be convenient to occasionally take the child somewhere there's a gentle slope.  A park with a gradient can help provide the roll with less effort, making it more-fun.
Once the kid can roll for a good distance with feet up, while maintaining control, and perhaps expresses a desire to "ride with pedals like Mum" then swap back to pedals.


Login through Instagram in android

Question: Before implementing it I'm studying it and researching information about it but I didn't find any helpful material so that i come here to you respectful guys who can me guide on it how can I perform login through Instagram. There is not any helpful tutorial about it like login through Facebook. Helps from you will be appreciated. Thanks
Answer: This question is not much valuable now, but as instagram grows and becomes irreplaceable, instagram login may have second priority, (first will be always google).
There is no known way from firebase free version  to login through instagram. Currently firebase supports only these many ways:
Email/Password, Phone, Google, Play Games, Game Center, Facebook, Twitter, GitHub, Yahoo, Microsoft, Apple, Anonymous.
You can use firebase Blaze plan for this, and you will not find much support on the internet for this. In this website you will not have to write server side code: Use Instagram Sign In with Firebase https://github.com/firebase/functions-samples/tree/master/instagram-auth
This also may help: https://auth0.com/docs/connections/social/instagram
Comment: Im sorry, it is possible. But you will have to purchase Blaze plan from firebase for this.
Comment: so can't we use Instagram integration in our app?

Login through Instagram in android


Order 12 phrase for trust wallet

Question: I have 12 phrases for trust wallet but he is not arranged in the right way.
What is the solution? Code python with bip39!! How !?
Answer: 12 words have only  12! = 479'001'600 possible orders.
Create a script that

iterates through all possible orders
test whether the 12 words have a valid checksum
if so, generate the relevant output scripts and check whether they have received coins in the past

Preferably iterate the combinations in a way that it will test the ones you consider more likely earlier.

Order 12 phrase for trust wallet


What percentage is grey?

Question: The evenly spaced lines are drawn parallel to the base of triangle.  What percentage of the triangle is grey?
Answer: A visual approach...

 Draw nine lines parallel to each of the other 2 edges.

 Now there are 100 congruent triangles, 45 of which are grey.
Comment: Now this is what I call a perfect answer.
Answer: I believe the answer to be

 45%

Justification:

 Observe that all of the triangles are similar to each other (base angles are equal by alternate angles). Further the $n$th triangle ($n$ corresponds to how many bands the triangle contains) has side length ratio $n:1$ with the top triangle, using the fact that the bands are evenly spaced. We can use the fact that the ratio of areas of similar triangles is equal to the square of the ratio of side lengths to obtain:$$\frac{T_n}{T} = \frac{n^2}{1^2}$$ Where $T$ is the area of the top triangle and $T_n$ is the area of the $n$th triangle. Rearranging yields:$$T_n = n^2T$$ To find the area of the $n$th band from the top we can take the difference of $T_n$ and $T_{n-1}$:$$A_n = T_n - T_{n-1} = n^2T - (n-1)^2A = (2n-1)A$$That is, the area of the $n$th band is equal to $2n-1$ times the area of the top triangle. We can then compute the area of the shaded parts as they are simply the odd bands:$$A_{shaded} = \sum_{i \in \{1, 3, 5, 7, 9\}}A_{i} = \sum_{i \in \{1, 3, 5, 7, 9\}}(2i-1)T = 45T$$We can also compute the area of all regions by summing all the shaded areas:$$A_{all} = \sum_{i = 1}^{10}A_{i} = \sum_{i = 1}^{10}(2i-1)T = 100T$$Then taking the ratio gives:$$\frac{A_{shaded}}{A_{all}} = \frac{45T}{100T} = 0.45$$Giving the answer of 45%
Comment: Obviously, the limit as the number of row-pairs grows large has to be 50%. (I.e. as the triangle grows larger and larer or, alternatively, as we slice a fixed size triangle into thinner and thinner grey-white pairs.)
Answer:
 $(1+5+9+13+17)/10^2 = 5*9\%=45\%$.
Comment: I can see the first equation from the divisions in the visual answer, but don't understand their derivation here. Or how to get to the equivalency in the center. More detail / explanation would be appreciated.
Answer: An approach that avoids having to count lots of tiny triangles:

 Cutting the triangle into 4 subtriangles of identical shape we find that triangles marked 2,3,4 also have the same shading, whereas 1 inverts grey and white bits. Now looking at 2 and 3 (or 3 and 4) together we see that the white to grey ratio is 3:2 in triangles 2,3,4 and 2:3 in triangle 1. Total ratio is therefore (3+3+3+2):(2+2+2+3) = 11:9, i.e. 55% white, 45% grey.

Variation:

 Starting with two copies of the triangle cut off subtriangle 4 from both and rearrange as shown in the bottom panel. Count white and grey stripes and take the percentage.
Answer:
 The parallel lines can be seen as the bottom edges of 10 similar triangles of alternating color, all sharing a common upper corner and stacked one atop another. Since the bottom edges are all evenly spaced, if the largest triangle has height h and base b, the total area is that of the largest triangle ($n$ = 10, counting smallest to largest): $$A_{10} =\frac{bh}{2}$$ and the area of each $n$th triangle is proportional to its fractional height and width of the largest triangle: $$A_n = \frac{(\frac{n}{10}b)(\frac{n}{10}h)}{2} = (\frac{n}{10})^2 *\frac{bh}{2} = \frac{n^2}{100}*A_{10} = n^2 \%$$ The shaded areas then are the exposed bottom strip of only the gray (odd-numbered) triangles, and that strip's area is the difference between the total area of its gray triangle and the area of the next-smaller white (even-numbered) neighbor obscuring it: $$A_{n_{exposed}} = n^2-(n-1)^2$$ Therefore the total shaded percentage is the sum of the exposed gray strips, or $$A_{exposed} = \sum_{n \in \{1, 3, 5, 7, 9\}}n^2-(n-1)^2 = 45$$
Answer: This visual solution is similar to @cap's but generalises with ease to any number n of stripes. n can be even or odd in either case the longest stripe shall be white.
The example has angles 45°,45°,90° for visual clarity but obviously other angles work just as well:

Using two copies of the original triangle joined at their white side we get a parallelogram that can be subdivided into smaller parallelograms as shown. Except for the all-white diagonal these smaller parallelograms are half white, half grey.
As the diagonal comprises 1/n of the total area, the grey fraction is 1/2 x (1 - 1/n) for any  number of stripes n.
Answer: A simple[citation-needed] answer:

 Let the height of each row be $h$ (so the height of the triangle is $10h$).
 Knowing the triangles are similar (AAA) and equally spaced, let the lengths of the bottom sides be $1w, 2w, 3w, \dots, 10w$.

 Using the formula for the area of a trapezoid $A = \frac{a + b}{2} \times h$:
 The area of the whole triangle is $\frac{0w + 10w}{2} \times 10h = 50wh$.
 The area of the first grey row is $\frac{0w + 1w}{2} \times h = 0.5wh$.
 The area of the second grey row is $\frac{2w + 3w}{2} \times h = 2.5wh$.
 Continuing, we get:
$\frac{\textrm{area in grey}}{\textrm{total area}} = \frac{0.5wh + 2.5wh + 4.5wh + 6.5wh + 8.5wh}{50wh} = \frac{22.5wh}{50wh} = \frac{45}{100} = 45\%$
Answer: Another approach which starts the same way as loopy walt's answer.
Divide the whole triangle into triangular quarters as in loopy walt's diagram.
Consider triangles 2 and 3. They have half the total area, and $2/5$ of it is grey, which is thus $1/5$ of the total area.
Consider triangles 1 and 4. Those two triangles have half the total area, and half of it is grey, which is thus $1/4$ of the total area.
So the total grey area $1/5+1/4=(4+5)/20=9/20=45\%$ of the total area."
My point is that you don't need to establish the white/grey proportions in each triangle, merely to see that 1 and 4 have the same division but opposite shading, so they collectively have as much grey as white. Once triangles 2 and 3 are considered together, the resulting stripes are congruent, so the $3:2$ ratio is easier to see there.
Answer: Here is a little Scala program for arbitrary n.
<code>def puzzle(n: Int): Double =
  if (n == 2) {
    1.0/4.0
  } else if (n % 2 == 1) {
    (puzzle(n - 1) * (n - 1) * (n - 1) + (n + (n - 1))) / (n * n)
  } else {
    (puzzle(n - 1) * (n - 1) * (n - 1)) / (n * n)
  }

@main def main: Unit =
  val height = 10
  val percentage = puzzle(height)
  println(s"$percentage")
</code>
which prints
<code>> run
[info] running main
0.45
</code>
Answer: I am not great with calculus and whatnot, but I think this puzzle was within my reach-- Here's what I was able to figure out, and I hope it helps anybody who struggled to understand the math lingo in the other answers:
The answer is

 45%.

This can be seen as

 .. a nested stack of triangles, each one 10% narrower and 10% shorter than the last. This is because if all angles are the same, a 10% reduction in height must create a 10% reduction in base width, or else the triangles would no longer be similar.

The long form, which I'm sure other answers have written in a more compact mathematical format, is as follows:

 Following from the top triangle down-

 ((.1b*.1h)/2) -- Top triangle, 1st grey area

 +(((.3b*.3h)/2)-((.2b*.2h)/2)) --2nd grey area

 +(((.5b*.5h)/2)-((.4b*.4h)/2)) --3rd grey area

 +(((.7b*.7h)/2)-((.6b*.6h)/2)) --4th grey area

 +(((.9b*.9h)/2)-((.8b*.8h)/2)) --5th grey area

 We can strip out the b, h, and even the "/2" portion because these are all in proportion to each other anyway, leaving us with

.1² + (.3²-.2²) + (.5²-.4²) - (.7²-.6²) + (.9²-.8²) = .45

Answer: FYI
Given @cap's clever visualization solution, following recursive formulas:

number $g(n)$ of grey triangles

 $g(n)=n==1$ $?$ $1:g(n-1)+(2*n-1)*(n\%2)$

total number $t(n)$ of triangles

 $t(n)=n==1$ $?$ $1:t(n-1)+(2*n-1)$

confirm $45\%$ for $n=10$
I found no OEIS® entry for grey, white or total series.
The highest amount $n$ of rows with an integer percentage $p$ of grey ones seems:

 $n=50$ with $p=49\%$

Also, if we write $w(n)$ for number of white triangles, then following non-recursive equations hold

 $t(n) = g(n) + w(n) = n^2$

and

 $w(n) - g(n) = (-1)^n * n$

And, if we write $x(n)$ and $y(n)$ for the alternating smallest and biggest one of $w(n)$ and $g(n)$ then

 $x(n) = n * (n - 1) / 2$

and

 $y(n) = n * (n + 1) / 2$
Answer: One other visual approach independent of $n$ ($n=10$ here)

 The biggest one of both areas (white in OP case) can be seen as sum of $n$ areas (colored red green alternating top down here) each one equal to $k$ $(1<=k<=n)$ units. One unit being the 'top' triangle area.

 But then that area equals (by Gauss formula): $n*(n+1)/2$, in this case: $55$

 Similarly smallest one (grey in OP case, but not given a color here) has area: $n*(n-1)/2$, in this case: $45$

As a consequence this also confirms:

 Total area equals $n^2$ units, in this case: $100$ giving both percentages $45$ and $55$.

Required percentages for any $n$ now are easy to express in terms of above for any $n$.

What percentage is grey?


Is necessary existence a property?

Question: If existence is not a property then doesn't it follow that necessary existence is also not a property? If it is then why?
Comment: According to Kant, neither possible existence nor necessary existence are substantive properties (material predicates) anymore than actual existence is. But sometimes we think that if a being is necessary, this is "explained" via things like, "This being has the power to resist being negated by any being, itself or any other," etc. so being necessarily existent would seem to require having special properties nevertheless.
Comment: Within alethic modal logic you can employ free logic with Existence predicate to felicitously express your 'necessary existence' property for either a rigid or non-rigid denoting term as colloquially understood. If you don't believe existence could be a property following Kant, then of course necessary existence is neither a property but modality of some existential truth token or Σ type...
Comment: I recall reading Kant was of the view that to say "god is blue" means "god (*exists* and) is blue". To  argue that "god is blue" and *therefore* (??) "god exists" is then a *circulos in probando*. Kant simply left it as, "exists" adds *nothing* to god in the statement "a blue god exists".
Answer: If necessary existence means being quantified over in every possible world, and quantification is not substantively predicative in the required manner, then necessary existence is not a property as such anymore than being quantified over in merely one world would be. This is somewhat murky, though, insofar as we might not wish to locate certain necessary beings within individual possible worlds, but we might wish to locate them in some sort of hyper-world encompassing or simply beyond the ones we usually deal with.
The question becomes somewhat murkier once we go on to imagine nontrivial iteratability for possibility and necessity (see e.g. Gregory[11] or Betz[09]): if necessary existence is, or is not, a substantive property, what about necessarily necessary existence, necessarily necessary necessary existence, etc.? One almost feels like the more such iterations were to be carried out without collapsing into a single modal prefix, the more one might approach a substantive modal property. But then eventually we will need a sharper theory of properties generally-speaking, of qualitative and non-qualitative properties, etc. Kant would say something like this: visualizing a rock and visualizing a necessarily existent rock are no different as mere visualizations, so there is some lack of descriptive "content" involved in modal attributions. But meaning, content, truth-aptitude, etc., can come apart variously, so we would want to distinguish between saying that modal attributions add no content to a concept, and saying that they add no meaning or do not affect truth-value. They clearly enough affect truth-value, after all, and have some meaning (some use/function).
Selected further reading (from the SEP):

Rigid Designators
Category Mistakes: Semantic Approaches
Hyperintensionality
Transworld Identity
Haecceitism
The Possibilism-Actualism Debate
Nonconceptual Mental Content
Concepts
Properties
Answer:
If it is then why?

My dog exists.
The Unicorn doesn't.
So, existence is a property of my dog, but it is not of the Unicorn.

doesn't it follow that necessary existence is also not a property?

The only necessity is logical necessity: To say that ψ → ξ is true is to say that if ψ is true, then ξ is true.
That is to say, ξ is necessarily true when ψ is true.
Which is why we say that ξ is the necessary condition of the implication ψ → ξ.
Existence is necessary if the existence of y follows from some assumption. For example:

Horses exist and they are mammals, therefore mammals exist

Once you recognise that horses exist and that they are mammals, you have to recognise that necessarily mammals exist. The existence of mammals is necessary if horses exist and are mammals.
Answer: You would be correct, OP, if necessary is a subset of (existence is a subset of nonproperties).
However, if that's not true ...
P. S. Someone should ask the mods to activate LaTex on Philosophy SE.
Comment: The best workaround for the lack of LaTeX here is to do the text up in a word processor (or over on one of the SEs that supports the formatting), screenshot the do-up, crop it, then add it here as an image. Still clunky but it looks nice enough :)
Comment: @KristianBerry, it doesn't make sense for a philosophy forum not have LaTex enabled, since that's necessary for *symbolic logic* and every schoolboy knows *logic* is a subdiscipline of philosophy. QED ■
Comment: I more or less agree, but I don't know what makes updating this SE prohibitive in this regard. I think we have issues with migrating posts to or from various SEs, too, which issues escape me also...
Comment: @KristianBerry, *sequere pecuniam*? How many hits does this subforum get? The Math SE is literally a frenzy of activity, it's LaTex enabled.

Is necessary existence a property?


Include Shipment and Inoices pdf generator in order grid in magento 2.3.2

Question: As in magento 1, there is Shipment and invoice Pdf generator in order grid also.

How can i include that in magento 2 as well.
I want to include and shipment and invoce pdf generator in order grid Action tab as well.
https://prnt.sc/t42n33
Answer: There is NO any "Print Shipment and Invoices" option in Vanilla Magento 1.x. It seems you might have any third party extension or customized code for it. So the solution would be
i) To get the M2 version of the extension you are using for your M1 site
ii) Or Migrate the customized code in M2
Add-On:
Rather there is a "Print All" option available in M1 & M2 which prints invoices & Packing slips unless you do not have a customized print layout, see if it helps you.
Thanks
Answer: Follow this link To add Custom mass action in order grid : https://meetanshi.com/blog/add-custom-mass-action-in-order-grid-in-magento-2/