How to get longest flight time on octocopter that has decent payload already on it?

Question: I want to design an octocopter that will respond to incidences of crime and terrorist attacks. Survey and gather intel and come back to HQ. I have used a 16000mAh 6S lipo battery with no lead, but only can  flight 20mins.
I want this Octocopter to carry radioactive/chemical testing equipment and have a flight time of 45 mins
How likely am i to achieve 45min flight times?
There must be a way of optimizing flight time. I know i can double the amount of batteries but this may make the craft unstable I may need to scale up on motor size to make payload less of an issue..
The larger the craft the more dangerous and costly the craft. So i'm really interested in optimizing it the best i can.
I know there are hydrogen fuel cells, maybe some other sort of alternative battery.
Please help thanks
Answer: Actually the constraints you set of using an Octorotor is already impeding the autonomy of the system. Indeed multi-rotor platforms are a trade-off between on one hand the ability to over and a simple dynamics of the system and on the other hand the flight efficiency and thus higher payload.
My answer to your question

How likely am i to achieve 45min flight times?

is that I think it is very unlikely if you platform weights around 1.5kg and you want to carry around 1kg of payload.
To your question

How to get longest flight time on octocopter ?

lest first review your strategies:

I can double the amount of batteries but this may make the craft unstable

Double the battery is just embedding more energy on board (i.e. reducing the payload) but should not bring you platform to instability as long as your flight controller knows the mass and center of mass of the platform. Note that the more you increase the payload the closer you get to the actuation limits of you motor+propeller, what can happen is then that you use almost all your control authority for weight compensation and that nothing is left to allow attitude control, resulting in unstable behavior.
2.

I may need to scale up on motor size to make payload less of an issue

Scaling up the motor alone is a partial solution. As the thrust is produced by the combination motor+propeller, you can increase the thrust by tunning your motor+propeller combination. As noted by @hauptmech, propeller shape can be optimized to improvement the performances, but this is not trivial due to the aerodynamic at play and the interferences between the different propeller, the relative wind and so on. Note that increasing motor "size" will most likely lead in an increase in current consumption and so you might need to change your ESCs, also it will drain more power so you will need more battery and we are back to the same issue as described above.
3.

I know there are hydrogen fuel cells, maybe some other sort of alternative battery

Hydrogen fuel cells is very new for multi-rotor and seems to not be super mature technologies, so it comes with potentially high development costs.
The idea fuel cells is that the power density of battery is rather low, another approach in the same direction is to have a gasoline motor and an alternator, but then even if you store more energy in the tank the weight of the full machinery doesn't scale for typical multi-rotor size.
Lastly my solution, from a system engineering point of view I would recommend you to start the design from the problem; monitoring which kind of area, is stationary flight required, typical payload weight, typical payload power consumption, desired autonomy, and so on and so fourth. And based on those info choose the more adapted hardware for both your payload and your flying platform.
Answer: Hello I have experience in building rigs for all sorts of uses. If you are from any rescue service I suggest you contact someone proffesionally. Hydrogen fuel cells I think are overkill. Try 20000mah batteryes and make a hexacopter or quadcopter with more powerfull motors to compensate wattage. I am guessing your best bet in flight time is about 30-40 mins since the record is just bellow an hour. I guess you are informed on long range systems and athaurized to fly in urban areas. You should set a budget since this builds get extreemly expensive. Good flight times are achived trying. And about the chemical stuff I don´t think you can fly that over an urban area
Answer: Since you want to keep the mass of the vehicle constant, I suggest you focus on the efficiency of the propellers.
Area 1 to look at is optimizing the propeller shape for the exact speed and thrust you need for your vehicle. (The motors you are using will have an optimal operating point that defines the ideal speed). There are electric helicopter enthusiasts that compete for long duration flights (Which can last more than 60 min for some configurations if I remember correctly); so that is probably a good place to start looking for information.
Area 2: Each propeller you remove from the system will reduce the overhead in mass and system losses. A helicopter is more efficient than a quad or octo copter. Quadcopters are popular because of their mechanical simplicity but you pay for this in efficiency (flight time).
Answer: As much capacity as possible and the same time make the batteries lightweight
Comment: Welcome to *Robotics* Deck. Thanks for your answer but we are looking for comprehensive answers that provide some explanation and context. Very short answers cannot do this, so please edit your answer to explain why it is right, ideally with citations. Answers that don't include explanations may be removed.


My Sites link in multisite is incorrect

Question: Within the network admin, the My Sites link, is not linking to the main parent site. Instead, it links to a child site blog. How can I change this link? Is there a way to rebuild WP menu? I haven't a clue how it became the wrong link.
Answer: I fixed this by deactivating then reactivating the child site under Network Admin > Sites.
Answer: In my case, it occurred through the switch_to_blog() and restore_current_blog() functions in our theme. We called restore_current_blog() at the wrong position.

        <?php foreach ($posts as $post):
            switch_to_blog($post->blog_id); ?>

<?php the_title();?>

            <?php restore_current_blog(); // correct position ?>
        <?php endforeach;?>
        <?php // restore_current_blog(); // wrong position ?>

We have to call restore_current_blog() each time in forearch syntax.

My Sites link in multisite is incorrect


My parachain has not been able to issue a block after submitting the upgrade transaction

Question: network: rococo live
this is my parachain log.
Comment: How did you perform the parachain upgrade? This is a helpful resource: https://docs.substrate.io/how-to-guides/v3/parachains/runtime-upgrades
Comment: I use sudo.sudo.sudoUncheckedWeight(system.setcode) to upgrade my parachain. Instead of using the default compiled file(`xxx..compact.wasm`), I used a compressed version of the WASM file(`xxx.compact.compressed.wasm`).
Comment: AFAIU, that is fine for upgrading a substrate chain, but as far as upgrading a parachain, you want to use the methods defined here: https://docs.substrate.io/how-to-guides/v3/parachains/runtime-upgrades
Answer: It is hard to fully understand the reason from the screenshots but I can see some important details:
Your node is producing the same block again and again (see Imported #8102).
This means there is no issue producing it but the validator is not receiving it or not able to verify it. Let see the possible reasons
Possible issue #1: trouble sending the block
The PoV (Proof of Validity, that needs to be sent to the validator to verify the block) is significant (see lines storage_proof: 1992.018...kb, Compressed PoV size: 1334.125kb). If your network connection with the validator is slow or with high latency (far away from each other), the validator might not receive the block in time and not be able to include it.
This usually auto-resolve by itself once a new (closer/faster) validator(s) is assigned to verify your parachain block.
Possible issue #2: trouble verifying the block in time
The block execution time in your logs are low (see Prepared block for proposing at #8102 (10ms)), which is good, so I would discard this issue in your case. It is very unlikely for the validator to not have enough time to execute the block verification. A parachain block is currently allowed 500ms but if the validator(s) assigned to your parachain is slow, this could lead to the block not being included.
Possible issue #3: Invalid parachain code in the relay
Another possibility is if the parachain code in the relay is not matching the code in your parachain. This can happen when the parachain and the relay are planning to upgrade the parachain code at a different relay block number.
To avoid this issue, avoid performing the upgrade within a scheduled extrinsic (like using system.setCode in a proposal or in the pallet scheduler).
If this is the case, you will need help of the relaychain maintainer to update the parachain code on the relay.
Comment: thanks! My machine configuration is definitely sufficient (4C16G), I think it is because the relay chain has not been upgraded, how does the administrator on the relay chain upgrade the specified parallel chain?
Comment: The relay chain gets the new parachain code when the parachain code notifies it (through `system.setCode` or `parachainSystem.enactAuthorizedUpgrade`). This is automatic and except when done incorrectly should not require any human interaction.
In the relay chain, you can verify your code with the `paras.currentCodeHash` which should match your new runtime hash


CookieManager and CookieSyncManager not syncing cookies to webview in ICS (works on all previous API levels)

Question: Background:
I'm acquireing cookies through my app and use them internally by making requests to http. Users can switch to webview any given time, in which case I sync/inject cookies to webView.
Code for synchronizing cookies to webview using CookieSyncManager:
<code>CookieSyncManager.createInstance(a);
CookieManager cm = CookieManager.getInstance();
cm.setCookie(domain, cookieName + "=" + cookieValue);
CookieSyncManager.getInstance().sync();
</code>
This works on all API levels except API 15+ (Android 4.0, Ice Cream Sandwich). The CookieManager API is not deprecated.
What is causing this problem and are there any workarounds?
Answer: I had the same problem recently which I found was my mistake. The problem was the way I set the domain (but it worked till API 15). Try to prefix the domain with the dot: ".company.com" instead of "company.com".
Comment: This worked, but I found that it caused the same problem in reverse - it'd work in ICS, and not pre-ICS. I had to do a quick if-else to use ".domain.com" if the app was running on Ice Cream Sandwich, and "domain.com" if not. Strange.
Comment: After tried lot of various ways, Finally Worked for me by just adding a dot before domain cookieManager.setCookie("."+domain, cookie);
Comment: What does the domain variable contain?
Answer: You can try the Apache DefaultHttpClient to do this work for you, I don't think it been changed in Ice Cream Sandwich.
I found this sample, but there is lots more in here
Comment: This could actually work... Overriding the `WebViewClient.shouldOverrideUrlLoading` to use the `Apache DedfaultHttpClient` to acquire webpage using cookies and inject the HTML into webview with `webView.loadData` (meaning, you handle all the logic and webview is used only for displaying/rendering HTML)
Comment: @Beuj found another one
Answer: I wasn't injecting cookie from the client, but i found ICS
cookie weren't saving.
One work around is
to use the local storage instead of cookies. You don't need a cookie sync manager.
this works on ics and v2+  android.
In my case I didn't have a domain , so the above didn't seem relevant
- I was using a local html file in the asset folder of the app.
this works on ics and v2 android
enjoy
java
<code>// java
WebSettings webSettings = myWebView.getSettings();
webSettings.setDomStorageEnabled(true);   // localStorage

// e.g., if your package is www.myapp.whatever;
webSettings.setDatabasePath("/data/data/www.myapp.whatever/databases/");
</code>
html
<code>// javascript

function createCookie(name,value,days,path) {
    localStorage.setItem(name,value);
}

function readCookie(name) {
    return localStorage.getItem(name);
}
</code>
Answer: Here is your answer : In ICs, can`t get cookie
Its the domain which is causing the issue.
for all version after 15+ you have to you have to use **.**domain.com , instead of domain.com.


Track HTTP and HTTPS traffic details separately on Google Analytics?

Question: How can I track HTTP and HTTPS traffic details separately from Google Analytics.
Comment: Welcome to Webmasters! When you create a property in GA, you enter either HTTP or HTTPS. Each are considered different websites by Google regardless of whether they are actually the same site or not. Do you remember how you created your properties? Cheers!!
Answer: As far as I know, once the data gets to GA you can't do anything based on protocol - although you can set http or https for your property, that does not cause any filtration to happen, and there are no dimensions include the http(s) part of the URL to use in segments or in filters to include or exclude traffic from different Views.
(This is unlike Google Search Console, where protocol does matter.)
If you use Google Tag Manager to send data to GA, you have more options. First, you could split the traffic and send it to two different properties, with a Custom Javascript variable for your tracking ID. This would contain a function like the following:
<code>function() {
  if ({{Page URL}}.indexOf('https://') === 0) {
    return {{SSL GA ID}};
  }
  return {{Non-SSL GA ID}};
}
</code>
To keep the data in one Property, you could use a Custom JS variable in GTM to set the value of a custom dimension based on the protocol, or to add an identifier to the page name or page path depending on protocol. [Custom dimensions must be set up on the GA end as well, under Admin > Property > Custom Definitions.]
With either a custom dimension or an alteration to a built-in dimension, you'll be able to separate out SSL and non-SSL traffic in a custom report or segment, or by creating Views that include only one of the two kinds of traffic.


Memorizing the quran

Question: Prophet Muhammad (pbuh) said that the best of the Muslims are those who memorize the quran. What I've been doing is listening to surahs over and over again until I can recite them with the reciter. That has worked for me so far, but now I'm having trouble with yaseen. I'm not going in order. Does anyone have any tips for how to memorize those long surahs?
Comment: first of all,k I am not sure that Allah said that the best are those who memorize the Quran, actually I think you mean what the Prophet {Peace be Upon Him] said that the best are the ones who learn the Quran and teach it, http://sunnah.com/bukhari/66/50  second, this question is a list question, not good for this site.
Comment: You can use [this](http://www.mounthira.com/) service for memorization. I use it from time to time and found it useful (only for memorization). Other than that, make du'a to Allah to help you retain what you have memorized. Other than that, I think this question should be closed
Comment: @evthim: you might find it easier to memorise if you learn arabic :)
Comment: understand them(not just rote learning), break into sections as comfortable, revise as much as possible. No shortcuts, biger the surahs, more difficult it is...
Answer: Listening again and again is not a way of memorizing, though it may help you memorize short surahs. Longer surahs have to be memorized  by reading again and again. Listening is a great way of revising.
I'd like to share how I memorize the long surahs.

First of all stop treating it a long surah. Divide the surah into pages or ruku's, you'll find it shorter.
Fix a time of the day for memorizing and follow it daily. The ideal time I would suggest is the time between asr and isha prayers. After fajr is also a great time.
For memorizing, use a hafizi mushaf.
Be in a constant effort to join the divided memorizations as soon as you complete the memorization of a new part.
For revising by listening, divide the surah's audio file in the same proportion as you did for memorizing. As an example, you can take a look here, at the parts I have divided Ruku' wise. You can use softwares like Blaze and Adobe Audition or a free one like audacity. But make sure you don't miss out an ayah. You can use this divided file for revising and listen when you are free or while travelling.
Audio is a great way of revising and correcting yourself but it is slow. I recommend you to use the mushaf for revising and use the audio only when you don't have access to the mushaf. As for correcting yourself, visit a Hafiz or the Imaam of your mosque at least once a week.
Meanwhile, As @Abdullah suggested, Constantly pray to Allah and seek guidance and his help to memorize and retain the memorized.

As you continue memorizing, you'll develop your own methods and patterns Insha Allah. Do add an answer here if later you realise that you've developed one.
ۚ  وَاللَّهُ عَلِيمٌ حَكِيمٌ (And Allah is the All-Knower, the Wise)
Jazaakallah...
Answer: The best online resources are those that can offer you with "ayats" and "surahs" that can help you in gaining a complete and vivid understanding about Quran in no more than a single click. You are supposed to make an effort, in order, to be able to locate a course that will prove to be the useful so as to ensure that you can become competent about Quran. If you are able to search for the right memorize Quran online course, you must not face the least difficulty in learning details about different types of Quran topics such as; poetry, Arabic parables, a Hadith and Quranic verses.I hope it will be help you.

Memorizing the quran


How can I seal around pipe baseboard heating to seal out smoke from downstairs?

Question: I live in an apartment on 2nd floor.  The landlord lives downstairs and 3 people down there constantly smoke. It's so bad in my second bedroom.  I bought expanding foam but afraid to spray around pipe where hole is because of heat. Is this a fire hazard or should I  use silicone instead? And should I go along the bottom as well where the floor meets the wall or will that affect the heat? Also be Dangerous??
Comment: "around pipe" - what kind of pipe? (hot water, cold water, gas, radiator)
Comment: It is gas heat...coils under baseboard
Comment: Would also like to do this on bathroom as well. There is a huge hole around pipe for heat and I believe cigarette smoke iscoming in from there as well.
Comment: They make fire blocking spray foam. BUT cigarette smoke is tenacious and insidious, even if you seal all the holes it may not be something  ( the smell ) you can eliminate completely.
Answer: There are a few different issues here, including one that I'll bet you didn't think of:
Smoke/Odors
This is your initial concern. Something like Great Stuff Foam will do well for this.
Heat Resistance
Here is where it gets...tricky. I have found various references - the one specific one I found for Great Stuff or similar foam (and it may vary both between brands and between products within a brand) was 240 F. That is high for a normal room. But is not so high if you are talking about a heating system. Around ordinary forced air ductwork that would be fine or around dryer ductwork (I found plenty of references to that). A big question though is What is your heating system?

It is gas heat...coils under baseboard

Gas heat is typically either forced air or a boiler heating water that is pumped through radiators. So "coils under baseboard" sounds like hot water. Which unless it is actually high pressure steam (not something typically found in apartments but used in some big buildings and industry), it is likely < 212 F and probably OK. But you might want to measure the temperature of these coils when the heat is on to get an idea of what you are really dealing with.
FIRESTOP
This is the biggie, which I doubt you have considered. If cigarette smoke can get from one apartment to another, a REAL FIRE could spread life-threatening smoke and flames just as easily! (OK, yes cigarette smoke will kill you too - but secondhand smoke takes a long time. An actual FIRE will kill in minutes.)
I don't know the exact rules, but there are some pretty strict rules in most areas about fireblock between apartments (so a fire in one apartment doesn't kill everyone else in the building before the fire department can get there), between residential areas and garages and probably other specific areas as well. This typically means that there are no openings between those areas where smoke and fire can easily get through and that all walls, doors and windows between those areas are "fire rated". That doesn't mean fire can never get through - the rules set minimum times for a fire of a particular temperature to be prevented from getting from one room to another, provided the doors, windows, etc. are closed at the time.
So if your landlord doesn't care about you smelling smoke, and doesn't care about wasting energy on heating & cooling (if there are gaps between floors I'll bet there are gaps to the outside as well), I'll bet the landlord would definitely care about being in violation of code requirements regarding firestops.
That being said, you don't need to confront your landlord or call the building department - neither tends to end well. But you may be able to get your landlord to pay for sealing the cracks, holes, etc. if they understand the importance of proper firestop.
Comment: +1 for firestop - you can buy a block of firestop putty that's easy to apply, just check the temperature ratings when you buy.
Comment: THANKYOU yes I read 240 degrees as well and I believe it is a bolier that heats the water.  I bought the yellow great stuff I think u mean and also bought tite foam but haven't used it because of heat issue.  Watched a video on you tube where a contractor used that but only along baseboard cracks where there wasn't heating coils. Believe me I think about FIRE all the time!!! I live here with my son and there were NO smokers when I moved in! He bought the house from the last landlord who was my friend and unfortunately smokes! I doubt theres fireblock.. and hes lazy about everything
Comment: Thanku so much for taking the time.  I just wish I knew if silicone caulk was better than the expanding foam
Comment: For a small amount more money, you can get a fireblocking form of the spray foam. You can also get fireblock in a caulk form.
Comment: Also, it is quite an older home that was then broken up into 3 apartments. Trying to find another affordable apartment but no luck. Live a healthy lifes and this is horribel.  I've bought 3 air purifiers too!!
Comment: Thanks so much everyone!! I will definitely look into the fireblock as well.
Answer: Depends on the gap size and location. The danger with that foam is that it tends to drip, sag, and just generally get everywhere you don't want it to, and it is difficult to clean up. Would suck to foam some things and have a glob fall into his apartment and destroy something expensive. So depending on risk of that I'd use clear 100% silicone.
For larger gaps stuff them with backer rod (called "caulk saver" at big box stores, located with weatherization supplies) and caulk over that, and tool (smear) to contact adjacent structural surfaces using the tip of caulk tube, a putty knife, or your finger. As far as fire/heat, people foam gaps around baseboard heat ALL the time, never an issue. Even in steam systems you shouldn't see much or anything more than 212 degrees. There is a fire resistant foam though if you want to use it. Most silicone compounds also resist flame, to a point.
Comment: That's great.. knowing the heat won't be an issue is awesome.


How do I avoid these deadlocks?

Question: I have a routine which is updating my business entity.  The update involves about 6 different tables.  All the commands are being executed within a transaction.
Recently, I needed to add some code into the routine which accesses a lookup table from the database.  The lookup code already existed in another business object so I used that business object.  For example:
Using tr As DbTransaction = myConnection.BeginTransaction()
    ExecuteCommand1(tr)
    ExecuteCommand2(tr)
    If myLookupTable.GetLookupTable().FindById(id).HasFlagSet Then
        ExecuteCommand3(tr)
    End If
End Using

However, the lookup table business object hangs/deadlocks.  I think this is because it doesn't have a reference to the transaction being used by the original routine.
After doing some research, I attempted to put the lookup table logic in its own transaction, setting the IsolationLevel to ReadUncommitted.  This gave me the results I desired.  However, after further research, I'm now second-guessing if I've implemented this correctly.
Assuming a reference to the active transaction is unavailable to my lookup table object, is what I've described considered best practice?  I feel like I might be missing something.
Comment: Does command1 or command2 do something with the lookuptable?
Comment: No, they don't.  They don't even read from it.  They work with tables which have a FK to the lookup table however.  None of that intuitively suggests a lock issue to me.
Answer: If you're doing a read in the middle of your transaction then you should do it under the transaction context, not using a different transaction and dirty reads. Luckily there is an easy solution: instead of using the ADO.Net transaction objects use the .Net TransactionScope object. The ADO.Net code is sensible to it and will enlist all your operations in this transaction, including your other business component reads. Just make sure your business object does not open a different connection, this will result in attempting to escalate the existing transaction into a distributed transaction and enlist the new connection into it.
The alternative is to pass down your SqlConnection/SqlTransaction pair on each call, but that propagates horribly ugly everywhere in your code.
Answer: If it were me I would rewrite the logic so I do not have to do an uncommitted read.
Answer: The golden rule to avoid deadlocks is to always take table locks in the same order in every transaction. So look at the code in the other transactions to see what order they take table locks; then make sure you use the same order in your transaction.
Answer: Apparently your look up is attempting to access a row(s) that is exclusively locked by transaction tr. If you use a readuncommitted transaction or alternatively use WITH(NOLOCK) in your lookup query, you will see all uncommitted changes by transactions that might be occurring and effecting your lookup logic. So I am not so sure how desirable this would be.
I think it is best to find a way to ensure that your lookup query participates in the current transaction if you need to do the lookup during that transaction. If all of these operations are to be executed in the same thread, one thing that you can do is to store the transaction object in thread local storage when you create one and have GetLookupTable method check the thread local storage for a transaction object and if there is a transaction set, you can get the connection from that transaction object. Otherwise, you create a new connection. This way your lookup will become part of that transaction and it should run its logic without getting blocked by the current transaction and in turn blocking the current transaction and thus leading to a deadlock.

How do I avoid these deadlocks?


Can I ask whether a specific game/program is right for me?

Question: I know you can ask for recommendations based on the criteria you give, but can I ask whether a game/program I've found will be right for me based on what I want from it?  For instance, "I found this program, I didn't like a program similar to it for these reasons, I like these things I've heard about the program."  Is that allowed on this site?
Answer: Great question.  It's definitely a gray area.
My interest is to help as many people as possible, so therefore I would like to see every question on-topic.  But because of the current layout of StackExchange, this is not really possible.  Personally, I often wonder if SE would be better with only tags instead of many separate sites.  But I digress...
Instead of asking if a software package is "right for me", you could definitely write "these are my requirements, and I tried package XYZ and I didn't like it because of these reasons" (and then list the reasons).
Although I don't want to say it, I think asking "is software XYZ is a good fit for my requirements" (and then listing the requirements) will be considered off-topic by our community.
That said, what is considered on-topic and off-topic is not written in stone.  Instead, it is defined by the desires of our community.  As an elected moderator, I'm very willing to go with whatever our community prefers.  Personally, I prefer your question to be considered sufficiently on-topic, but I think I'm likely in the minority.
Conclusion: You ask a great question. I think it's worth hearing what the rest of the community thinks.
P.S. Izzy has to buy us all a free drink when he posts that he thinks it's off-topic. :)
Comment: Thanks for the help!  What I may do is post my question and link this meta page if people want to discuss this.  I just hope users hold their downvotes until a consensus is reached.  =)


If the word "Brother" is ambiguous as far as The Bible is concerned, can we be named Brothers of Jesus Christ?

Question: According to Catholicism and some evangelical denomination in order to give justifications the perpetual virginity of Mary, they affirm that the word "Brother" in the Bible is ambiguous and include cousin and relatives. But if that is the case, can we really be named brothers of Jesus? or we should be just cousins or relatives of Christ?
Answer: "Brother" is not vague, but it does have multiple subsenses. These are usually distinguished quite clearly, and Protestants who reject the perpetual virginity of Mary would say that those who argue for it have to go to great lengths to get misinterpret the verses which indicate otherwise. But that's a whole nother topic, and we don't need to get into it to answer this question.
Adoption is a major Biblical theme, and the Bible clearly says many times that we are Jesus's brothers and sisters.

Mark 3:33-35: He replied to them, "Who are my mother and my brothers?" Looking at those sitting in a circle around him, he said, "Here are my mother and my brothers! Whoever does the will of God is my brother and sister and mother."
Romans 8:15-17: For you did not receive a spirit of slavery to fall back into fear. Instead, you received the Spirit of adoption, by whom we cry out, "Abba, Father!" The Spirit himself testifies together with our spirit that we are God's children, and if children, also heirs—heirs of God and coheirs with Christ—if indeed we suffer with him so that we may also be glorified with him.
Romans 8:29: For those he foreknew he also predestined to be conformed to the image of his Son, so that he would be the firstborn among many brothers and sisters.
Galatians 4:4-7: When the time came to completion, God sent his Son, born of a woman, born under the law, to redeem those under the law, so that we might receive adoption as sons. And because you are sons, God sent the Spirit of his Son into our hearts, crying, "Abba, Father!" So you are no longer a slave but a son, and if a son, then God has made you an heir.
Ephesians 1:5: He predestined us to be adopted as sons through Jesus Christ for himself, according to the good pleasure of his will,
Hebrews 2:11-12: For the one who sanctifies and those who are sanctified all have one Father. That is why Jesus is not ashamed to call them brothers and sisters, saying:
I will proclaim your name to my brothers and sisters;
I will sing hymns to you in the congregation.
Answer: It's not the place to argue for the position that Mary did not have any other children than Jesus here. However, it can be confidently and unequivocally said that at the least, it was the prevailing and apparently perennial view of Christians as far as the historical record allows us to judge the matter.
For example, when a man called Helvidius in the fourth century circulated this idea, that Mary had other children, it was unknown to one of the most learned Scripture scholars and theologians of the day, Jerome:

Who, pray tell, before you appeared, was acquainted with this blasphemy? Who thought the theory worth two-pence? Against Helvidius, 18

Christians always held that the Virgin Mary never had other children: it wasn't to 'prove' such that they cited the fact that among the Hebrews "brothers" could be used of either close kin or actual siblings (as well as even friends), they only did so to make clear to those unfamiliar with the usage of the word the nature of its use with respect to Jesus.
We can't 'decide' to, or become, Christ's actual siblings, cousins or kinsmen. We can, however, become His brothers and sisters spiritually (Hebrews 2:11; Revelation 12:17; John 19:27).
Comment: Would you mind elaborating at least beyond the downvote?
Comment: Did you intend to imply you knew of data to contradict that Christians always believed this or...? Jewish Greek makes use of Greek words to render Hebrew words when there is a more accurate Greek word *all the time.* Especially idiom, like "behold," (rare if ever seen in normal Greek) or "brother" (Hebrew had no other finer word for close male and female relations, except for in-laws and such) ;)
Comment: I haven't voted, but this answer is lacking sources for the first paragraph.
Comment: I don't want to make this a 'make a case for the pvom' answer so I've just gave a key example of how this was unknown to Christians, and scoffed at when it first appeared.
Comment: @4castle See all historical citations which support his first paragraph at [this wiki link](https://teachthe.net/index.php?title=Who_were_the_Brothers_of_Christ%3F#Appendix.2C_Historical_Belief_FOR_Perpetual_Virginity_of_Mary).
Answer: If the word "Brother" is ambiguous as far as the Bible is concerned, can we be named Brothers of Jesus Christ?
First of all, I would like to demonstrate what Catholicism has to say about the Brethren of the Lord:

The exact nature of the relationship between the Saviour and his "brethren"
The texts cited at the beginning of this article show beyond a doubt that there existed a real and near kinship between Jesus and His "brethren". But as "brethren" (or "brother") is applied to step-brothers as well as to brothers by blood, and in Scriptural, and Semitic use generally, is often loosely extended to all near, or even distant, relatives (Genesis 13:8, 14:14-16; Leviticus 10:4; 1 Chronicles 15:5-10, 23:21-22), the word furnishes no certain indication of the exact nature of the relationship. Some ancient heretics, like Helvidius and the Antidicomarianites, maintained that the "brethren" of Jesus were His uterine brothers the sons of Joseph and Mary. This opinion has been revived in modern times, and is now adopted by most of the Protestant exegetes. On the orthodox side two views have long been current. The majority of the Greek Fathers and Greek writers, influenced, it seems, by the legendary tales of apocryphal gospels, considered the "brethren" of the Lord as sons of St. Joseph by a first marriage. The Latins, on the contrary, with few exceptions (St. Ambrose, St. Hilary, and St. Gregory of Tours among the Fathers), hold that they were the Lord's cousins. That they were not the sons of Joseph and Mary is proved by the following reasons, leaving out of consideration the great antiquity of the belief in the perpetual virginity of Mary. It is highly significant that throughout the New Testament Mary appears as the Mother of Jesus and of Jesus alone. This is the more remarkable as she is repeatedly mentioned in connexion with her supposed sons, and, in some cases at least, it would have been quite natural to call them her sons (cf. Matthew 12:46; Mark 3:31; Luke 8:19; Acts 1:14). Again, Mary's annual pilgrimage to Jerusalem (Luke 2:41) is quite incredible, except on the supposition that she bore no other children besides Jesus. Is it likely that she could have made the journey regularly, at a time when the burden of child-bearing and the care of an increasing number of small children (she would be the mother of at least four other sons and of several daughters, cf Matthew 13:56) would be pressing heavily upon her? A further proof is the fact that at His death Jesus recommended His mother to St. John. Is not His solicitude for her in His dying hour a sign that she would be left with no one whose duty it would be to care for her? And why recommend her to an outsider if she had other sons? Since there was no estrangement between Him and His "brethren", or between them and Mary, no plausible argument is confirmed by the words with which he recommends her: ide ho uios sou, with the article before uios (son); had there been others sons, ide uios sou, without the article, would have been the proper expression.
The decisive proof, however, is that the father and mother of at least two of these "brethren" are known to us. James and Joseph, or Joses, are, as we have seen, the sons of Alpheus, or Clopas, and of Mary, the sister of Mary the Mother of Jesus, and all agree that if these are not brothers of the Saviour, the others are not. This last argument disposes also of the theory that the "brethren" of the Lord were the sons of St. Joseph by a former marriage. They are then neither the brothers nor the step-brothers of the Lord. James, Joseph, and Jude are undoubtedly His cousins. If Simon is the same as the Symeon of Hegesippus, he also is a cousin, since this writer expressly states that he was the son of Clopas the uncle of the Lord, and the latter's cousin. But whether they were cousins on their father's or mother's side, whether cousins by blood or merely by marriage, cannot be determined with certainty. Mary of Clopas is indeed called the "sister" of the Blessed Virgin (John 19:25), but it is uncertain whether "sister" here means a true sister or a sister-in-law. Hegesippus calls Clopas the brother of St. Joseph. This would favour the view that Mary of Clopas was only the sister-in-law of the Blessed Virgin, unless it be true, as stated in the manuscripts of the Peshitta version, that Joseph and Clopas married sisters. The relationship of the other "brethren" may have been more distant than that of the above named four.
The chief objection against the Catholic position is taken from Matt 1:25: "He [Joseph] knew her not till she brought forth her firstborn son"; and from Luke 2:7: "And she brought forth her firstborn son". Hence, it is argued, Mary must have born other children. "Firstborn" (prototokos), however, does not necessarily connote that other children were born afterwards. This is evident from Luke 2:23, and Ex 13:2-12 (cf. Greek text) to which Luke refers. "Opening the womb" is there given as the equivalent of "firstborn" (prototokos). An only child was thus no less "firstborn" than the first of many. Neither do the words "he knew her not till she brought forth" imply, as St. Jerome proves conclusively against Helvidius from parallel examples, that he knew her afterwards. The meaning of both expressions becomes clear, if they are considered in connexion with the virginal birth related by the two Evangelists.

Can we really be named brothers of Jesus? This would seem in a Catholic perspective that we would have to respond in the negative. However, we are all children (sons) of God by adoption.

Having predestinated us unto the adoption of children by Jesus Christ to himself, according to the good pleasure of his will. - Ephesians 1:5

Thus it has been the traditional practice of the Church to address the faithful as Brothers and Sisters in Christ and not in the ambiguous phrase Brothers of Christ since it seems to carry connotations that we are somehow related to Jesus through an actual bloodline. A fact this is impossible to substantiate and has The DaVinci Code written all over it.
Here is just one tiny example of a Catholic traditional use of the phrase in Christ by Pope
John Paul II:

Dear Brothers and Sisters in Christ,
Praised be Jesus Christ !
It gives me great pleasure to greet the Council of the International Catholic Union of the Press and other Catholic journalists with this traditional Christian salutation, because this salutation expresses an essential part of your vocation.


Raycast against a mesh without using a mesh collider?

Question: I have a complicated mesh that doesn't need to have anything to do with physics. However, I need to be able to detect said mesh with a raycast from a point. I have several hundred of these objects that regularly get moved around and rescaled, so a mesh collider is way too computationally expensive - especially since I don't need any form of collision detection other than this raycast. However, the mesh is human-shaped, and is thus irregular enough that I can't just use lots of primitives, nor can I just check if the mouse point is within a specified area (since the area is far too complex to manually specify). Turning the mesh collider off when it's not relevant works a little, but the act of turning the collider on and off is ALSO computationally expensive enough to cause noticeable frame drops. What component or settings can I use in order to raycast a mesh without all the slowdown of a mesh collider?
Comment: Regarding making your current collider solution more efficient: you may want to try adding a kinematic Rigidbody, and setting the mesh collider to be a trigger, on its own layer that collides with nothing. The kinematic body ensures Unity knows it will move, so it doesn't ask the physics engine to rebuild the static collision acceleration structures every time you turn it on/off. And by being on its own non-interacting layer, it should incur zero collision checks apart from the rays you fire. Making it a trigger should skip any inertia tensor recalculation too.
Answer: A similar question was asked before so I'll just re-post the answer 'Kay' provided.

Use compound colliders especially box and sphere s Rigidbody manual
Always attach rigidbodies to moving items
If you need more than one raycast consider using Physics.RaycastAll
If the physics engine is to blame for significant frame rate Drops, check whether you can use layers to optimise calculations
Use the profiler


What it feels like as a PhD student in math or computer science in the US

Question: I am currently an undergraduate in Canada, but I am interested in math/comp sci PhD in the US. I heard that an academically supporting environment(the environment of the school? of the department?) in PhD study is very important. Also, I heard in some schools, PhD students don't like helping each other, because they think they are competing, which is a sign of bad experience. In some other cases, the adviser might be unhelpful or even selfish. So how can we choose a university/department/adviser to ensure a good study experience? If you are a PhD student, do you like your department? I like any personal experience or examples.
Comment: It feels pretty much the same, just a bit more south. However, this is way too broad.
Comment: Sorry what you meant by south?
Comment: South of the US-Canada border.  Unless you're studying in Alaska.
Comment: @JeffE Or in Detroit, which is due north of Windsor, Ontario.
Comment: But there is no direct entry to PhD in Canada.
Answer: This is not really an answer but a (somewhat) relevant anecdote that's too long for a comment. About 20 years ago, I chaired my department's graduate admissions committee. The college had a requirement that new graduate students whose undergrad degree is from outside the U.S. must participate in an orientation before the start of their first semester of enrollment, to acquaint them with various aspects of life in the U.S. and, in particular, university life in the U.S. We could apply to an assistant dean to have specific students exempted from this requirement. We had admitted a student who did his undergrad work at the University of Waterloo (Ontario, not Belgium), and I requested that he be exempted form this orientation requirement.
I thought (and I still think) this was a no-brainer, but the assistant dean wanted evidence, meaning information from people who had taught at the University of Waterloo. So I had to write (with some embarrassment) to a few of this student's instructors, asking them for the necessary information about similarities and differences between Waterloo and Ann Arbor.
One of the responses ended with a sentence that, I think, summarized the situation very well: The only thing the student will have to get used to in the U.S. is the absence of Tim Horton's.
End of anecdote.
We now have Tim Horton's in the U.S. So I suggest you think about U.S. universities the same way you'd think about Canadian ones.
Comment: Hmmm, I have to question this anecdote if there was no mention of poutine. Doesn't compute. Or is Ontario exempt?
Comment: @Buffy - I'd say that poutine is getting more common these days in the US, particularly at brew pubs. So, Canadians don't even have to abstain from it for the duration...
Comment: @JonCuster, ah, but is it the real thing? To be or not to be (poutine). That is the question.
Comment: @Buffy - if the beer is good enough, does it really matter?
Comment: @JonCuster, Hmmm. I'd have to think about that, though I wasn't born in Canada. But I am descended from both Jean Guyon and Zacharie Cloutier of the Percheron Immigration. But beer resonates as the other half of my family is from western Germany.
Answer: I think this depends a lot on your advisor. Some will be very helpful and supportive and others not. I had both experiences.
The first part of a doctorate in the US is normally a lot of coursework, giving you access to several faculty members. You will also probably be assigned an advisor, but you don't need to stay with them for the dissertation phase. They are there mostly to watch over your progress and see that you get ready for comps. At this stage I had an advisor who was not yet tenured and spent all of his time making sure that he got over the line. He wasn't very helpful and I was lucky to eventually leave him behind. However, I stayed too long with him even knowing we weren't going anywhere.
Later in my studies (long story) I wound up in a better situation with a better advisor. It wasn't that he gave me more support, actually. It was just that our mathematical interests were more alined and he had a wealth of experience to give me the support and helped me with new ideas when I needed them.
But, had I switched out my first advisor (much) earlier for someone that I knew would be better for me, my journey would have been much shorter.
So, your experience can be good or bad. There are horror stories on this site. But the good stories don't get mentioned here. But, look around at the options and hook up early with an advisor who has a good reputation among students and is aligned with your research interests.
Some of the best advisors will run a formal or informal seminar series in which a few faculty and a few more students meet regularly to discuss ideas and/or papers. These tend to be more senior faculty, I think. People share ideas openly, though each works on their own stuff more or less independently.
And, I'm pretty sure that the advisor is more important than the school in almost all cases. The exceptions would be for those advanced students who can carry on research with minimal help from an advisor.


How to calculate number of days between two given dates

Question: If I have two dates (ex. '8/18/2008' and '9/26/2008'), what is the best way to get the number of days between these two dates?
Answer: If you have two date objects, you can just subtract them, which computes a timedelta object.
from datetime import date

d0 = date(2008, 8, 18)
d1 = date(2008, 9, 26)
delta = d1 - d0
print(delta.days)

The relevant section of the docs:
https://docs.python.org/library/datetime.html.
See this answer for another example.
Comment: Note that the result is not inclusive, i.e., 2019/05/01 to 2019/05/03 counts as 2 days.
Comment: Great answers here. Since a lot of the folks might be using pandas data frame, thought might be useful to check the link on how to convert from `np.datetime64` to `python datetime` https://stackoverflow.com/questions/52982056/how-to-convert-numpy-datetime64-ns-to-python-datetime
Comment: The nice thing is that this solution also returns correct delta for leap years.
Comment: That's why i love python - things like this, which make an technical complex problem feel solved in a natural way
Comment: Does this account for leap seconds?
Comment: in case you need to exclude weekends and holidays (workdays) try this https://github.com/cadu-leite/networkdays - its simple and add no third dependencies
Answer: Using the power of datetime:
from datetime import datetime
date_format = "%m/%d/%Y"

a = datetime.strptime('8/18/2008', date_format)
b = datetime.strptime('9/26/2008', date_format)

delta = b - a

print(delta.days)

# that's it how to calculate number of days between two given dates

Comment: @JeremyCantrell And yet, even eight years later, `date` still lacks its own equivalent to `strptime()`.
Comment: actually, the date class would be more appropriate in this case than datetime.
Comment: Why needs `strptime` the `format` arg? Should be clear with the first arg date which has a format.
Answer: Days until Christmas:
>>> import datetime
>>> today = datetime.date.today()
>>> someday = datetime.date(2008, 12, 25)
>>> diff = someday - today
>>> diff.days
86

More arithmetic here.
Comment: Updated answer: -4602
Comment: Correction:
 today = datetime.today()
Answer: everyone has answered excellently using the date,
let me try to answer it using pandas
dt = pd.to_datetime('2008/08/18', format='%Y/%m/%d')
dt1 = pd.to_datetime('2008/09/26', format='%Y/%m/%d')

(dt1-dt).days

This will give the answer.
In case one of the input is dataframe column. simply use dt.days in place of days
(dt1-dt).dt.days

Answer: You want the datetime module.
>>> from datetime import datetime
>>> datetime(2008,08,18) - datetime(2008,09,26)
datetime.timedelta(4)

Another example:
>>> import datetime
>>> today = datetime.date.today()
>>> print(today)
2008-09-01
>>> last_year = datetime.date(2007, 9, 1)
>>> print(today - last_year)
366 days, 0:00:00

As pointed out here
Comment: @VickiB `delta = today - last_year`
`print(delta.days)`
Comment: How do I get this without the 0:00:00 part?
Comment: Note the calculation order: from_earlier_time - to_later_time, then you get a positive timedelta! Not the other way. Kinda weird.
Answer: from datetime import datetime
start_date = datetime.strptime('8/18/2008', "%m/%d/%Y")
end_date = datetime.strptime('9/26/2008', "%m/%d/%Y")
print abs((end_date-start_date).days)

Comment: +1 for the use of `abs()`, which is useful when the compared dates are unknown beforehand and it is the difference you are interested in. If your second date in `datetime.strptime(date, date)` is later than the first date, the result will be negative. `abs()` makes all input absolute (ie. positive).
Comment: This adds nothing new compared to the answers given 4 years earlier. -1.
Answer: It also can be easily done with arrow:
import arrow

a = arrow.get('2017-05-09')
b = arrow.get('2017-05-11')

delta = (b-a)
print delta.days

For reference: http://arrow.readthedocs.io/en/latest/
Answer: without using Lib just pure code:
#Calculate the Days between Two Date

daysOfMonths = [ 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]

def isLeapYear(year):

    # Pseudo code for this algorithm is found at
    # http://en.wikipedia.org/wiki/Leap_year#Algorithm
    ## if (year is not divisible by 4) then (it is a common Year)
    #else if (year is not divisable by 100) then (ut us a leap year)
    #else if (year is not disible by 400) then (it is a common year)
    #else(it is aleap year)
    return (year % 4 == 0 and year % 100 != 0) or year % 400 == 0

def Count_Days(year1, month1, day1):
    if month1 ==2:
        if isLeapYear(year1):
            if day1 < daysOfMonths[month1-1]+1:
                return year1, month1, day1+1
            else:
                if month1 ==12:
                    return year1+1,1,1
                else:
                    return year1, month1 +1 , 1
        else:
            if day1 < daysOfMonths[month1-1]:
                return year1, month1, day1+1
            else:
                if month1 ==12:
                    return year1+1,1,1
                else:
                    return year1, month1 +1 , 1
    else:
        if day1 < daysOfMonths[month1-1]:
             return year1, month1, day1+1
        else:
            if month1 ==12:
                return year1+1,1,1
            else:
                    return year1, month1 +1 , 1

def daysBetweenDates(y1, m1, d1, y2, m2, d2,end_day):

    if y1 > y2:
        m1,m2 = m2,m1
        y1,y2 = y2,y1
        d1,d2 = d2,d1
    days=0
    while(not(m1==m2 and y1==y2 and d1==d2)):
        y1,m1,d1 = Count_Days(y1,m1,d1)
        days+=1
    if end_day:
        days+=1
    return days

# Test Case

def test():
    test_cases = [((2012,1,1,2012,2,28,False), 58),
                  ((2012,1,1,2012,3,1,False), 60),
                  ((2011,6,30,2012,6,30,False), 366),
                  ((2011,1,1,2012,8,8,False), 585 ),
                  ((1994,5,15,2019,8,31,False), 9239),
                  ((1999,3,24,2018,2,4,False), 6892),
                  ((1999,6,24,2018,8,4,False),6981),
                  ((1995,5,24,2018,12,15,False),8606),
                  ((1994,8,24,2019,12,15,True),9245),
                  ((2019,12,15,1994,8,24,True),9245),
                  ((2019,5,15,1994,10,24,True),8970),
                  ((1994,11,24,2019,8,15,True),9031)]

    for (args, answer) in test_cases:
        result = daysBetweenDates(*args)
        if result != answer:
            print "Test with data:", args, "failed"
        else:
            print "Test case passed!"

test()

Comment: There seems to be a problem with your code. If you try daysBetweenDates(*(2013,2,28,2013,1,1,False)), it will end up in an infinite loop because the condition y1 > y2 in the daysBetweenDates is not very well thought-out. Moreover, in the Count_Days, you use if month1 ==2 on the first line, and then if month1 ==12 on the 5th line. This is redundant or perhaps even a mistake. The first if will not allow the following if to be True by design.
Answer: For calculating dates and times, there are several options but I will write the simple way:
from datetime import timedelta, datetime, date
import dateutil.relativedelta

# current time
date_and_time = datetime.now()
date_only = date.today()
time_only = datetime.now().time()

# calculate date and time
result = date_and_time - timedelta(hours=26, minutes=25, seconds=10)

# calculate dates: years (-/+)
result = date_only - dateutil.relativedelta.relativedelta(years=10)

# months
result = date_only - dateutil.relativedelta.relativedelta(months=10)

# week
results = date_only - dateutil.relativedelta.relativedelta(weeks=1)

# days
result = date_only - dateutil.relativedelta.relativedelta(days=10)

# calculate time
result = date_and_time - timedelta(hours=26, minutes=25, seconds=10)
result.time()

Hope it helps
Answer: There is also a datetime.toordinal() method that was not mentioned yet:
import datetime
print(datetime.date(2008,9,26).toordinal() - datetime.date(2008,8,18).toordinal())  # 39

https://docs.python.org/3/library/datetime.html#datetime.date.toordinal

date.toordinal()
Return the proleptic Gregorian ordinal of the date, where January 1 of year 1 has ordinal 1. For any date object d,
  date.fromordinal(d.toordinal()) == d.

Seems well suited for calculating days difference, though not as readable as timedelta.days.
Comment: There are cases in which this approach wins. For example, the actual  difference between 2019-07-09 23:50 and 2019-07-10 00:10 is twenty minutes. `(d1 - d0).days` returns `0`, `d1.toordinal() - d0.toordinal()` returns `1`. Depends on what you need in your actual usecase.
Comment: this approach can actually compare datetime and date.
For example to check if 2020-04-17 == 2020-04017 00:00:00
Answer:
from datetime import date
def d(s):
  [month, day, year] = map(int, s.split('/'))
  return date(year, month, day)
def days(start, end):
  return (d(end) - d(start)).days
print days('8/18/2008', '9/26/2008')

This assumes, of course, that you've already verified that your dates are in the format r'\d+/\d+/\d+'.
Comment: The main difference is most of the other answers didn't even bother to account for the fact that the OP had his dates as strings. And those who did account for that largely used more complicated formatters than strictly necessary. So, the main difference is `map(int, s.split('/'))`. Not exactly groundbreaking, but then again this question is pretty stupid basic. My answer just shows another way to skin the cat.
Comment: This adds nothing new compared to the answers given 8 years earlier. -1.
Comment: Also mentioned validating that dates are in the correct format, and gave a first-approximation validation regex. Which others didn't.
Answer: Here are three ways to go with this problem :
from datetime import datetime

Now = datetime.now()
StartDate = datetime.strptime(str(Now.year) +'-01-01', '%Y-%m-%d')
NumberOfDays = (Now - StartDate)

print(NumberOfDays.days)                     # Starts at 0
print(datetime.now().timetuple().tm_yday)    # Starts at 1
print(Now.strftime('%j'))                    # Starts at 1

Answer: Without using datetime object in python.
# A date has day 'd', month 'm' and year 'y'
class Date:
    def __init__(self, d, m, y):
            self.d = d
            self.m = m
            self.y = y

# To store number of days in all months from
# January to Dec.
monthDays = [31, 28, 31, 30, 31, 30,
                                            31, 31, 30, 31, 30, 31 ]

# This function counts number of leap years
# before the given date
def countLeapYears(d):

    years = d.y

    # Check if the current year needs to be considered
    # for the count of leap years or not
    if (d.m <= 2) :
            years-= 1

    # An year is a leap year if it is a multiple of 4,
    # multiple of 400 and not a multiple of 100.
    return int(years / 4 - years / 100 + years / 400 )

# This function returns number of days between two
# given dates
def getDifference(dt1, dt2) :

    # COUNT TOTAL NUMBER OF DAYS BEFORE FIRST DATE 'dt1'

    # initialize count using years and day
    n1 = dt1.y * 365 + dt1.d

    # Add days for months in given date
    for i in range(0, dt1.m - 1) :
            n1 += monthDays[i]

    # Since every leap year is of 366 days,
    # Add a day for every leap year
    n1 += countLeapYears(dt1)

    # SIMILARLY, COUNT TOTAL NUMBER OF DAYS BEFORE 'dt2'

    n2 = dt2.y * 365 + dt2.d
    for i in range(0, dt2.m - 1) :
            n2 += monthDays[i]
    n2 += countLeapYears(dt2)

    # return difference between two counts
    return (n2 - n1)

# Driver program
dt1 = Date(31, 12, 2018 )
dt2 = Date(1, 1, 2019 )

print(getDifference(dt1, dt2), "days")

Comment: -1: Untested code. `dt = Date(01, 01, 2019 ) SyntaxError: leading zeros in decimal integer literals are not permitted; use an 0o prefix for octal integers.` Even if I fixed that error, IndexError was thrown.
Answer: If you want to code the calculation yourself, then here is a function that will return the ordinal for a given year, month and day:
def ordinal(year, month, day):
    return ((year-1)*365 + (year-1)//4 - (year-1)//100 + (year-1)//400
         + [ 0,31,59,90,120,151,181,212,243,273,304,334][month - 1]
         + day
         + int(((year%4==0 and year%100!=0) or year%400==0) and month > 2))

This function is compatible with the date.toordinal method in the datetime module.
You can get the number of days of difference between two dates as follows:
print(ordinal(2021, 5, 10) - ordinal(2001, 9, 11))

Answer: If you don't have a date handling library (or you suspect it has bugs in it), here's an abstract algorithm that should be easily translatable into most languages.
Perform the following calculation on each date, and then simply subtract the two results. All quotients and remainders are positive integers.
Step A. Start by identifying the parts of the date as Y (year), M (month) and D (day). These are variables that will change as we go along.
Step B. Subtract 3 from M

(so that January is -2 and December is 9).

Step C. If M is negative, add 12 to M and subtract 1 from the year Y.

(This changes the "start of the year" to 1 March, with months numbered 0 (March) through 11 (February). The reason to do this is so that the "day number within a year" doesn't change between leap years and ordinary years, and so that the "short" month is at the end of the year, so there's no following month needing special treatment.)

Step D.
Divide M by 5 to get a quotient Q₁ and remainder R₁. Add Q₁ × 153 to D. Use R₁ in the next step.

(There are 153 days in every 5 months starting from 1 March.)

Step E. Divide R₁ by 2 to get a quotient Q₂ and ignore the remainder. Add R₁ × 31 - Q₂ to D.

(Within each group of 5 months, there are 61 days in every 2 months, and within that the first of each pair of months is 31 days. It's safe to ignore the fact that Feb is shorter than 30 days because at this point you only care about the day number of 1-Feb, not of 1-Mar the following year.)

Steps D & E combined - alternative method
Before the first use, set L=[0,31,61,92,122,153,184,214,245,275,306,337]

(This is a tabulation of the cumulative number of days in the (adjusted) year before the first day of each month.)

Add L[M] to D.
Step F
Skip this step if you use Julian calendar dates rather than Gregorian calendar dates; the change-over varies between countries, but is taken as 3 Sep 1752 in most English-speaking countries, and 4 Oct 1582 in most of Europe.

You can also skip this step if you're certain that you'll never have to deal with dates outside the range 1-Mar-1900 to 28-Feb-2100, but then you must make the same choice for all dates that you process.

Divide Y by 100 to get a quotient Q₃ and remainder R₃. Divide Q₃ by 4 to get another quotient Q₄ and ignore the remainder. Add Q₄ + 36524 × Q₃ to D.
Assign R₃ to Y.
Step G.
Divide the Y by 4 to get a quotient Q₅ and ignore the remainder. Add Q₅ + 365 × Y to D.
Step H. (Optional)
You can add a constant of your choosing to D, to force a particular date to have a particular day-number.
Do the steps A~G for each date, getting D₁ and D₂.
Step I.
Subtract D₁ from D₂ to get the number of days by which D₂ is after D₁.
Lastly, a comment: exercise extreme caution dealing with dates prior to about 1760, as there was not agreement on which month was the start of the year; many places counted 1 March as the new year.
Comment: This just gets a plus for interest.
Answer: If you want to have a date object for every calendar day between a start and end point then this code may help.
It returns a date object for every day between start and end:
from math import ceil
from datetime import date, datetime, timedelta

def day_range(start: datetime, end: datetime) -> date:
    first_day = start.replace(hour=0, minute=0, second=0, microsecond=0)
    daycount = ceil((end - first_day) / timedelta(days=1))
    for n in range(daycount):
        yield (start + timedelta(days=n)).date()

start = datetime(2023, 1, 1, 23, 0)
end = datetime(2023, 1, 4, 0, 20)

for day in day_range(start, end):
    print(f"Day: {day}")

Comment: Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer).


Leaking Supply Hose

Question: So yesterday we discovered a leak under the sink, it was coming from the supply line into the valve, (suppose the seal broke after several years of use, there was no instigating incident to cause this), well we have tried 2 new hoses, and a new valve and we are getting the same leak! We cannot get the seal to work properly, we've tried tape, no good, it is coming right at the joint where the flex house meets the hardware as well as just around the nut. Anyone have any ideas or tricks they may help us figure this out???
Comment: Is this shutoff valve indeed a free hanging thing between two flex lines? If so this seems rather odd to me. All sink supplies that I have seen use a shut off valve that is joined to a fixed pipe that comes out of the wall behind the cabinet or up through the floor from below the cabinet. I would guess that 95% of the shutoff valves from the store are a type is designed to connect into a fixed line on one side and the flex line from the other side. There is a very good chance that the valve that you have is not designed for the types of seals used on flex lines from both sides.
Comment: Typically on the supply side, it should be not able to flex. @MichaelKaras is 100% correct. Also, how are you using teflon tape? It should not be more than 1 or 2 circuits around the male end. It is to provide a lower friction for the nut to more snuggly tighten down.
Comment: it actually may be that the valve is not necessary at all, the homeowner before us did the plumbing and the flex lines are a little short, the replacement I bought last night could be long enough to go directly from the wall to the sink, let me see if this works
Comment: These types of connections shouldn't use PTFE tape. They seal by using a rubber washer. Also, there needs to be a valve under the sink. Do you currently have two in the water line? Then it's OK to remove one, so you still have one in the end.
Comment: Thanks everyone for the responses! We cut out the straight free hanging valve, it was being used to connect the two flex lines. We used the longer line to connect directly from the wall to the sink (there is a shut off valve on the wall). This is what happens when you try to undo someone else's crappy plumbing hacks. :-)
Answer: It looks like someone used a straight 5/8 compression x 3/8 compression stop valve as an in-line valve. This picture shows what that valve looked like new:

Your valve has the wrong threads for that flex line (larger end). For a quick fix, you could use a 1/2" MIP x 3/8 compression adapter:

If you must have a valve there, you could use a small ball valve and a couple adapters to make the same connection. Be aware that you may have damaged the threads on the flex line due to cross-threading it. If it was me, I would use a single long flex line, rather than connecting two.

Leaking Supply Hose


cdosys mail from classic ASP

Question: I am supporting a customer running a proprietary Content Management System written in Classic ASP. Certain pages use the cdosys message routine to send email. This is used to report page errors back to me as well as email password reminders and forward customer inquiries to the client requesting site information. I utilize the IIS Virtual mail server to process the mail. If I take a text email and drop it in the inetpub/mailroot/pickup folder it grabs the mail and mails it out just fine. But mailing from the website via cdosys on asp pages (example objmail.Send) the mail never makes it to the pickup folder. Is this a possible permissions issue? The website is running in IIS 10 on Windows Server 2019.
Answer: I solved this by adding write permissions to the inetpub/mailroot folder and subfolders. I also added read permissions to the smtp subtrees in the metabase for IIS using Metabase explorer as a tool.

cdosys mail from classic ASP


How to calculate precipitation chance with basic weather data?

Question: I would like to know if there is any algorithm which allows us to calulate precipation chance with following data: temperature, humidity, illuminance (in lux) and pressure. I've searched it in google, but no results satisfied me.
Comment: Could you maybe add results you did find, which did not satisfy you, or at least summarize what those results did tell, such that people trying to answer your question have an idea how much detail you are expecting. Your current description also only seems to ask about whether such an algorithm exists not about the physics/models involved.
Answer: Simple climate models use the fact that the total amount of water is conserved, and assume that there are three processes that affect it: evaporation, precipitation, and moisture flux (i.e. how the moisture already in the atmosphere moves around).
We can write the moisture flux vector simply as the product of the velocity vector and specific humidity: $\mathbf{F_M}=q\mathbf{v}$, and vertically integrated gives us total column water transport:
$$
\mathbf{F}=\int_0^\infty \rho \mathbf{F_M}dz
$$
where $\rho\equiv\rho(z)$ is the density of the air at a given height, $z$.
So, the rate of change of precipitable water in the atmosphere can be written as the sum of the contributions from evaporation, precipitation, and column moisture flux convergence, hence:
$$
\frac{\partial}{\partial t}\int^\infty_0 \rho qdz = \text{E}-\text{P} -\nabla\cdot \mathbf{F}
$$
So an estimate for precipitation can be derived from surface evaporation rates (ignoring complicated transpiration terms from vegetation, this is essentially a function of sea surface temperature) and functions of specific humidity.
Insmaller scale models, things get significantly more complicated - depending on the scale, one must consider implicit convection terms and/or cloud microphysics as well.
Answer: While Kieran Hunt's answer is very good, a more blunt answer is that no, there is not such an algorithm.  The easiest way to see that there is not consider not physics but economics.
There are a large number of economically-important events which are crucially dependent on whether or not it rains -- as an example when wheat is harvested its moisture content makes a large difference to its price and this depends on whether it has rained in the immediately preceding period to the harvest among other factors.  Insurance companies and financial markets are therefore very interested in the chance of rain in a given period and good estimates of this are very valuable.  They would pay very well for such estimates.
Well, one of the things that weather-forecasting places try to do is produce such estimates.  And the figures on how well they do and how well they have done in the past are available and they have two important characteristics: they don't do very well, but they are getting significantly better over time.
They are getting better for three reasons: better and much more detailed observational data, principally from satellites; better numerical models of weather; enormously more computing power to run these models.
And this really answers the question: the kind of model (algorithm) which can make a useful prediction of the chance of precipitation relies both on an enormous amount of observational data (far more than that you specified) and a really enormous amount of computer time.  These are very expensive things: the Met Office in the UK recently spent £$10^8$ on a new computer for instance.
And finally we can put these together: if a simple algorithm was known which was any good at all then anyone using it could make a huge amount of money.  Therefore no such algorithm is known.
Well I've been careful above and said that no such algorithm is known rather than making the claim that no such algorithm exists.  However it is extremely unlikely that such an algorithm exists: the weather is a very complicated nonlinear system which has sensitive dependence on initial conditions: such systems are notoriously hard to predict in any useful way and there is no reason to think that the weather is any different.


MySite Branding Event Receiver not firing

Question: I followed this blog for creating mysite branding for sharpoint 2013.Everything works fine but  feature stapler doesnt work for new Personal sites. but if i manually activate the feature than it works fine. also through powershell if i specify correct feature id , branding gets applied. but i want this to happen automatically. please help.
Answer: I also faced the same issue. Please make sure that the feature id that you have mentioned in feature stapler must be exactly same as feature id by which you are deploying your event receiver.
Please check the below post "http://weblogs.asp.net/sreejukg/apply-custom-theme-to-sharepoint-2013-mysite-using-feature-stapling"
Point to be noticed in the above post: Be noted that you need to use the Guid of the "MySiteThemeFeature". To get the Guid for the feature, see its manifest. The below is the manifest for MySiteThemeFeature.
This might help you. :)
Comment: thanks. i solved that long back almost one and half year back!. Even after using correct guid for features, you still need to re-do the event receiver again if you have deployed event receiver before with incorrect GUID!
Answer: try attaching OWSTimer and debug. If you find weird behavior ( null exception on SPSite)  just restart the timer service. - by this time this issue must have resolved itself.
However, if there's any errors underlying in the logic it will come out on debugging.


Typical and minimum voxel sizes for various field strength MRI machines?

Question: Hoping somebody can give me some real world numbers on the typical capabilities of 3T and 7T MRI machines in terms of there minimum voxel size (specifically in relation to there use in fMRI studies if that makes a difference)? The Wikipedia article on MRI gives a rather non committal range of 1mm to 5mm on a side, but I have been reading the term High-Resolution fMRI in a few places without any qualification being placed on it.
Answer: This is a slightly older post, but the Wikipedia article is basically correct.  It is a non-committal range of 1mm - 5mm.  Typically high resolution fMRI will probably be <= 1mm on a side, but is typically going to be higher field scanners (>>= 3T) or using slightly different sequences than the standard fMRI sequence.
Best thing to do would be to do a quick survey of the literature (e.g., https://scholar.google.com/scholar?hl=en&as_sdt=0%2C9&q=high+resolution+fMRI&btnG=) and get an intuition from there.  I think what you will find is it will depend a lot of sequence, sequence parameters and main magnet field strength.


Is it impossible to attune to more than one copy of a magic weapon?

Question: So I'm aware that attunement cannot be applied to more than one copy of a magic item, I.E. two rings of protection. Does the same rule apply to magic weapons that require attunement as well?
Comment: If you had mentioned a specific weapon, then examples or explanations could be given in greater detail.
Comment: a magic weapon IS a magic item, keep that in mind!
Answer: You can only attune to one copy of a magic weapon at a time.
The relevant rule on attunement states:

Additionally, a creature can't attune to more than one copy of an item. For example, a creature can't attune to more than one ring of protection at a time.

Magic weapons are no different from other magic items in this regard; you can only be attuned to one copy of a particular magic weapon at once.
Answer: You can speak with your DM about said topic. If allowed, one could have another weapon type crafted with the same magical properties as the initial weapon of choice.  Mind you, you can't benefit or be penalized from multiple similar properties.  If a weapon creates an on going effect, one presumes it would restart the effect upon every hit or not at all.  If a magical property pushed the target away, then your additional attack would not have a viable target.

Modifying an Item
The easiest way to invent a new item is to tweak an existing one. If a paladin uses a flail as her main weapon, you could change a holy avenger so that it's a flail instead of a sword. You can turn a ring of the ram into a wand, or a cloak of protection into a circlet of protection, all without altering the item's properties. (DMG pg. 284)

Just remember your attunement limit of 3 items.
Comment: +1 because even though I would not allow it, this gives additionnal info that could be useful to soemone.


Is there a way to enable some kind of autoupdate in the appcenter updates?

Question: Is there a way to enable some kind of autoupdate in the appcenter updates?
I'm using Elementary OS Hera 5.1.6
Answer: AppCenter does not upgrade any packages without you asking it to.
When you boot, appcenter perform an "update" of the package cache in the background. This is the equivalent of sudo apt update. This doesn't modify any packages, it simply contacts the software repositories to see if any newer packages are available and you will get a notification if any updates are available. After this, you can choose whether to update or not.
Read more: Appcenter Auto update


Server running Windows Server 2012, Access the VM using remote desktop from an external network

Question: I have installed Windows Server 2012 in a dedicated server, Using a VM I installed Windows 7, Everything is setup for the VM to access the internet. But I am unable to login by remote desktop connection into this VM/Windows 7 from an external network. I want someone to give me some insight about this. I was able to login using RDP using local network. But I want to access the VM using remote desktop connection "mstsc" is there any particular way to route to the VM. My client asked me for this requirement, can a dedicated server be split into many virtual Machines and be given remote desktop access.If this has to be achieved should both the physical server and VM run Windows Server?
Answer: Start out by checking your firewall settings.  If you can RDP from the local network, but not an external one, you are likely being denied connectivity due to a NAT Traversal setting being enabled (this is default on RDP for server 2008+ I believe).
Open Windows Firewall, go to Advanced Settings, go to the Remote Desktop User Mode (TCP), and disable the rule that blocks Edge or NAT traversal.
Furthermore, if it's sitting behind a firewall or NAT router, then you'll have to do some port forwarding to make sure the traffic gets to the machine in question - this depends on how you have the Virtual Switch in Hyper-V enabled (If you're using Hyper-V, but from your question it seems you are...)
Comment: Hi IceMage, Actually I tried with Hyper-V but it gave some error while configuring for internet on VM, So started using VMware. After that internet problem got solved. Now I have a ques. Let me tell you the dedicated server is having a dedicated IP. So both the physical and VM use the same IP to connect to internet. Imagine the dedicated ip is X.X.X.X and the local ip given to VM is 192.168.X.X if I use mstsc and enter X.X.X.X and give the Username of the VM OS , it must connect in RDP. How to do this? No access to physical router so port forwarding has to have a work around.. please help
Comment: The VMware host will need to have a port forward on 3389 to that points your X.X.X.X:3389 > 192.168.x.x:3389

Go to the incomingtcp section here and checkit.
https://www.vmware.com/support/ws55/doc/ws_net_nat_advanced.html
Comment: I tried this using 9997 port forward, but after sometime the port is automatically getting closed. I dont know why. I have added firewall exception it is open for sometime and it is getting closed after sometime automatically. Is there any solution using VPN?
Comment: The Edge Traversal setting doesn't do what you think it does and isn't the cause of the problem. Have a read here - http://blog.boson.com/bid/95501/MS-Windows-Tips-and-Tricks-2-8-2-Windows-Firewall-Part-2
Comment: Can Anybody share a clear solution for this problem? Is it really possible to access a VM inside a Physical computer via RDP from an external network? does it involve VPN? or is there any straight forward approach by using an ports?
Comment: Did you port forward port 3389 to the VM in the router/firewall?


Is there a way to use EntityManager in play! framework 1.2.x 404 page?

Question: we are providing custom 404.html page (in app/views/errors) for play! 1.2.5
During serving 404 we would like to connect to DB, but when doing so we get:
play.exceptions.JPAException: The JPA context is not initialized.
JPA Entity Manager automatically start when one or more classes annotated
with the @javax.persistence.Entity annotation are found in the application.
at play.db.jpa.JPA.get(JPA.java:22)
at play.db.jpa.JPA.em(JPA.java:51)
at play.db.jpa.JPQL.em(JPQL.java:18)
at play.db.jpa.JPQL.find(JPQL.java:46)
...
at controllers.Security.check(Security.java:146)
at play.utils.Java.invokeStaticOrParent(Java.java:162)
at play.utils.Java.invokeChildOrStatic(Java.java:184)
at controllers.Secure$Security.invoke(Secure.java:203)
...
at play.server.PlayHandler.serve404(PlayHandler.java:681)

Should I go for a solution like https://stackoverflow.com/a/12242994/1444089 - so defining my own controller handler instead of just a template?
Maybe there is some configuration option for that, but couldn't find one.
And last but not least - why is this happening, is there a reason why 404 goes in some other request lifecycle than a typical play request?
Answer: You may use JPAPlugin methods startTx and closeTx inside a try/finally
JPAPlugin.startTx(false);
try {
    // your code
} finally {
    JPAPlugin.closeTx();
}


opening or unzipping Xcode 8.3.2.xip.file

Question: How can I "unzip" or extract files from Xcode.8.3.2.xip.file on 2009 MacBook?  Would you have to do it from the command line?
Comment: & what are you going to do with it on a Mac that can't run Sierra? I'm seeing an [XY Problem](http://xyproblem.info) here...
Comment: @Tetsujin, Alex didn't say which 2009 MacBook he has, however the Late 2009 MacBook supports macOS Sierra. Have a look at: [MacOS Sierra - Technical Specifications](https://support.apple.com/kb/sp742?locale=en_US)
Comment: For more about the `xip` format, see https://apple.stackexchange.com/questions/242948/what-is-the-format-of-a-xip-file
Answer: So you asked two questions, and I'll address the second one first, "Would you have to do it from the command line?", no, it does not have to be done from the command line.
As to your first question, "How can I "unzip" or extract files from Xcode.8.3.2.xip.file on 2009 MacBook?", you would have to have the Late 2009 MacBook, which supports macOS Sierra, and have macOS Sierra installed. Then assuming the Xcode.8.3.2.xip.file was in your Downloads folder, you simply double-click it.
This will cause Archive Utility to expand the file by first verifying the digital signature it contains, and expand it to the Xcode.app application bundle, at first located within the TMPDIR, e.g on my system it was /private/var/folders/7c/wmqb3p_14hq_6g1vtj20rv0h0000gn/T/Cleanup At Startup/.BAH.vW5Gr/Xcode.app and then it gets moved to the, e.g., ~/Downloads folder, where you'd then manually move it to /Applications.
Comment: Thanks got it unzipped but couldnt get simulator working right.


Why does water boil differently in a microwave than over a flame?

Question: Over a flame, small bubbles will start to form on the bottom of the pot, and as the average temperature rises, the bubbles will become larger until they start rise to the top. As it gets even hotter, the amount of boiling becomes more vigorous as well. It is a rather gradual process. In a microwave however, I noticed that the boiling happens all of a sudden. One moment there is no sign of boiling and the next, the water spontaneously boils. The bubbles that form are spontaneous and much larger than the ones formed from the heat of a flame. What is the explanation for this phenomenon?
Answer: Several things: first,  a stovetop heats the water only (primarily, anyway) by heating the bottom of the pot.  This causes a significant thermal gradient.  The water is hottest at the bottom and starts to boil there.
The microwave heats the water more or less uniformly from all sides of the container, with a penetration depth that you can look up -- i.e.  how far microwaves penetrate water before being fully absorbed.  This means a lot more water reaches the boiling point than just the bottom layer.  But that's part of the story.  The other is that not only do you need a bunch of energy to vaporize (without changing the temperature), but bubble formation is greatly enhanced either by lots of energy being added, as in the case of water at the bottom of the pot,  or by the presence of sharp edges such as scratches in the container walls.  Lacking such scratches, the microwaved water gets "superheated" (an actual chemistry term) and suddenly boils when a few molecules turn to vapor and 'encourage' their adjacent molecules to do so.
You may also have noticed that a non-boiling microwaved water will boil like crazy if you drop in some sugar, a tea bag, etc.  Those solids provide the surface nonuniformity for bubbles to form (but as you note, smaller ones).
Comment: This sentence from the [Wikipedia article on superheating](https://en.wikipedia.org/wiki/Superheating) is especially illuminating: "What makes superheating so explosive is that a larger bubble is easier to inflate than a small one; just as when blowing up a balloon, the hardest part is getting started. It turns out the **excess pressure due to surface tension is inversely proportional to the diameter of the bubble**." (Emphasis mine. References the book Atmosphere-Ocean Interaction by Eric Bradshaw Kraus.)


Must a RESTful service always be based on HTTP?

Question: Lots of websites (e.g. twitter, stackexchange) provide RESTful OPEN APIs based on the HTTP protocol. Can I design a RESTful service based on some other protocol (such as raw TCP)?
Answer: The short answer is that a RESTful service does generally imply HTTP, but it's not strictly necessary.  The wikipedia entry includes a section on implementations outside the web, though it's pretty brief and really only talks about  Common Management Information Protocol (CMIP).
Realistically, to most developers, RESTful services operate over HTTP.
You could surely take inspiration from RESTful protocols on the web and build your own similar protocol over raw TCP, but you may well finding yourself implementing it in the language of HTTP.  At that point you may want to ask yourself why you didn't just use HTTP in the first place.
Answer: If you look at Roy Fielding's PhD thesis, you'll see that REST is defined in chapter 5, while it's applied to HTTP in chapter 6.
"Representational state transfer" is indeed quite abstract. There's no reason you couldn't apply it to your own adhoc protocol. The aim is to make it stateless, to have safe read methods (that are cacheable), and if possible idempotent write methods.
Answer: If you adhere to the true tenants of the architecture where every operation is ignorant of historical operations you could probably drum up something a bit different. Currently the easy Put, get, post and delete operations lend well to http based service calls.


What are optimal settings for Recycling of Application Pools in IIS7 in shared environment?

Question: What are optimal settings for Recycling of Application Pools in IIS7 in a shared environment?
Answer: As a Hoster, you definitely want to recycle on Memory & Time, potentially Request limits and CPU.  You want to be pretty aggressive about these limits, but make sure you publish them to your clients.
Memory - 512 for an x86 box, maybe 768.  For x64, you can set this much higher depending on the number of hosts per server.  You just have to be careful and watch your app pool recycle events on memory issues.
Time - We typically recycle at 1 am in the morning, plus or minus (first site 1:01, second 1:11, third 1:21, just so you don't have all recycling at the same time)
Request limit - 35,000 was the default for IIS6, but this number is quite arbitrary, and very dependant on the site in question.  For small usage sites, the nightly recycle will hit long before you get 35k requests.
CPU - 95%/1 minute limit/KillW3WP, but use this carefully.  My understanding of this is that if the CPU hits 95%+ over the 1 minute limit for this worker process, the worker process gets killed and is unable to restart for the remainder of the limit when Action is set to KillW3WP.  You might want to try NoAction initially and just watch your event logs carefully.
Recycle Event Logs - You want to make sure you are logging app pool recycles for each event threshhold that you set - i.e. if you limit based off of requests limits, make sure that Request Limit logging is enabled.
One thing to remember is that you should set retail="true" in the <deployment> element in your machine.config:
<system.web>

    <deployment retail="true" />
</system.web>

Not setting this will allow a site to turn debugging on, which allows unlimited timeouts in requests - not exactly ideal for a hoster...
Comment: You should consider the 1:1 Site to AppPool rule.  With IIS 7's AppPool isolation enhancements, this prevents Application pools running under the same identity from accessing each other's memory/resources.
Comment: Thanks. If You have any other advices how to set up correctly IIS environment for hosting please edit Your post/add new answers.
Answer: Tip: When you recycle your app, all your session variables are destroyed... so caution on this!
IMHO, keep the defaults.
Comment: Your session variables will only get destroyed if you use InProc.  I would always maintain session variables out of process so that you can scale easily to a web garden/farm.
Comment: But this is only if you are InProc, no?
Answer: If you have a heavy traffic site, use long recycle schedule. If you have a low traffic site use shorter/default schedule to save memory.
I learned this from Al Zabir's blog: http://msmvps.com/blogs/omar/archive/2008/10/04/best-practices-for-creating-websites-in-iis-6-0.aspx
Daniel S. is right, your session variables get destroyed on recycle, so make sure you test this well or have good error protection/recovery when getting your session objects.
Answer: you need to cater the settings to your needs, take into account the amount of memory you have and the peak times of usage for your site/web application.
Also take into account the memory usage of your site/web application as if there are memory leaks you might be recycling more often then you think.
Weigh up any leaks against the cost of recycling, as stated above you will lose state variables.


Fullscreen for VLC media player

Question: I open vlc and the mini defaulty display shows the file I've opened. When I double click on the screen to make it fullscreen - it goes into fullscreen but the actual video is dead centered and tiny. I right click and it's already in fullscreen so I'm unsure of how to make the video fit the screen.. any advice on how to about fixing this would be GREATLY appreciated. Just downloaded a cracking movie and this is a shite situation to be in.. on a Monday!
Cheers
Comment: Try going (in your menus) to `Tools` > `Preferences` > `Video` > `Output` and select from the dropdown `X11 video output (XCB)`.  Then close down all instances of vlc and restart.
Comment: You are an absolute belter! Mate, thank you so much.
Answer: Go in you menus to Tools > Preferences > Video > Output and select from the drop-down X11 video output (XCB).  Close down vlc and restart it.

Fullscreen for VLC media player


In a skeletal muscle contraction, what happens after ACh binds to the nicotinic iontropic receptors on sarcolemma?

Question: Does the bound ACh becomes unbound and then gets hydrolysed by acetylcholinerase?
Answer:
Acetyl choline, which is released at the neuromuscular junction is continuously broken down by the enzyme acetylcholineesterase into acetate and choline. Choline is once again taken up by the neuron through choline carriers to regenerate acetylcholine. This process continues as long as an the neuron is stimulated.
Source:
Wikepedia
Comment: That's correct, acetylcholineesterase is a hydrolase (An enzyme which hydrolyzes choline esters (Such as Acetylcholine).


Grounding of an old house

Question: I am replacing the  wiring of an old house( partially burned),some of the 220v appliances such the stove and the clothes dryer have only 3 wires( black, red and white), I think (not sure) the house is grounded through the water copper pipes( the white wire-the neutral- is connected to the ground bar in the panel) . My first question is : do I need to run a dedicated ground wire for each appliance or I can leave the old wire connected as they are(  keeping the  neutral  connected to the ground)?My second question is: do I need to install a grounding rod to supplement the existing grounding which I assume is connected to the water pipes ? Thank you
Comment: The house is in Sacramento CA
Comment: You're best off talking to the local building department.  They may let you leave existing wiring as is, or they may require you to bring it up to current code. It completely depends on the local requirements, type of remodel, and amount of damage to the home.
Answer: If you are replacing the wiring (after a fire, I guess you mean by "partially burned"), I believe the normal standard is to meet the current codes at the time of replacement, not the code at the time of the building construction.
As such, you will need 4-wire service (hot, hot, neutral, ground) to 240V appliances that use the neutral. 240V appliances that don't use the neutral only need hot, hot, and ground.
You will also need to bring the grounding system up to current applicable code.
My sense from your question is that you might want to self-educate a bit more, or consult with an electrician in the planning stages, rather than have to re-do stuff later from improper planning now.
Answer: It sounds like only the appliances were damaged. If the wiring was not damaged code allows it to continue to be used replacing an outlet with the same type is allowed.
 Usually the grounding system only requires updating with a panel upgrade. However I have run into several houses that the water mains were replaced with plastic pipe and ground rods needed to be added.

Grounding of an old house


Slack Dark Theme

Question: Is there a way to use a dark theme in the Slack Desktop app?  Specifically where the background is dark (black, dark grey) and the text is light.  There are some built-in themes in Slack, but they are all light colored.
Answer: In order to make slack dark you can do the following for OSX (as of today 7/30/2018).
1) open the following configuration file in a text editor such as sublime:
/Applications/Slack.app/Contents/Resources/app.asar.unpacked/src/static/ssb-interop.js
2) Add the following code at the end:
/* Slack Dark Theme */
document.addEventListener('DOMContentLoaded', function() {
 $.ajax({
   url: 'https://gist.githubusercontent.com/Icebird/638220c4b3eb7f68c39431740fbd7eb7/raw/6565832413fb971a34d9cb1b23bf0f633504072c/slack-dark.css',
   success: function(css) {
     $("").appendTo('head').html(css);
   }
 });
});

3) Re-open slack.
When I did this, I saw that the message backgrounds were black but the sidebar was a purple color I didn't really like. To fix that aspect of it I went into the slack Preferences option when clicking on the little down caret on the top left of the app then going into Sidebar option and scrolling down to themes and clicking Ochin or Work Hard...
Comment: https://rawgit.com/ is about to go offline.  I copied down that css and uploaded it to a gist.  Use this URL instead: https://gist.githubusercontent.com/Icebird/638220c4b3eb7f68c39431740fbd7eb7/raw/6565832413fb971a34d9cb1b23bf0f633504072c/slack-dark.css
Comment: Updated the URL because rawgit is being deprecated. Thanks @kwill !
Comment: would be great if someone could create a .css which does not override the sidebar colors (like active item)
Comment: Well this solution no longer works, but Slack claims a dark theme is coming to Desktop soon.
Answer: To open ssb-interop.js on a Windows machine (change USERNAME to yours):
PS C:\Users\USERNAME\AppData\Local\slack\app-3.3.3\resources\app.asar.unpacked\src\static> notepad .\ssb-interop.js
Edit:
After update to version 4.0.0, the directory structure has changed. There is no more ssb-interop.jp file. It is now part of app.asar archive. These are the steps to enable the dark mode on version 4.0.0

Make sure you can read and modify asar archives (one way to do it is to install 7-Zip, and add asar support by installing a *.dll file that you can get from http://www.tc4shell.com/en/7zip/asar/ )
Close Slack completely, then go to the folder with app.asar file: C:\Users\USERNAME\AppData\Local\slack\app-4.0.0\resources
Open the app.asar archive with 7-Zip, and go to /dist/ folder.
Find and open the file ssb-interop.bundle.js
Add the usual code at the end, then save the file, and close it (click OK to let 7-Zip update the archive with the change)
Open Slack, enjoy it dark :)
Comment: It looks like you accidentally created a new account. You might want to use the contact us Link at the bottom of the page and request an account merger
Answer: I've actually created a sort of "plugins" infrastructure for slack based in my github repo https://github.com/glajchs/slack-customizations.
It has instructions for how to install (there's a script to do the patching described above in the instructions above), as well as some other modifications I've made that you can selectively turn on if you want, with descriptions (and a few screenshots).  My favorite extra plugin is the "random emoji" one :-)
The dark theme is based on the "laCour" user's dark theme from a while back, that I've been maintaining a version of locally, but there's no reason you can't just point at their theme instead.
An important note about the ssb-interop.js file patching described in the other answer (and that I've automated with the ./patch-slack.sh script in my repo).  Every time Slack updates to a new version, this file gets overwritten, so you have to re-patch it.
Final note, I don't have it working in Windows yet, but (patch script aside) that should just be a matter of changing some file separator characters.
Answer: As of version 4.17.0, this feature is integrated in the settings under Themes.

Slack Dark Theme