Why is the truss member between two fixed supports zero?

Question:
If i first assume the member(far left) to not be zero and use method of joint at both points of constraint, with both constraints having unknown vertical reaction, it cannot be solved.
Load and lengths are known, horizontal reaction can be found.
Answer: In this situations, it's worth remembering Hooke's Law, which tells us that internal forces and deformations are related.
A beam can deform either because a load is directly applied to it or because one (or both) of its extremities is being deformed by a load on another beam somewhere.
If, however, a beam has no load applied directly to it and both of its ends are constrained (can't move in any direction), then it will never deform in any way shape or form. And if it doesn't deform, then we know by Hooke's Law that it won't suffer any internal forces.
That is the case for your truss: there are no loads applied to the member between both supports, and since it is between two supports, it will never deform and therefore never suffer any axial forces. And since this is a truss, any rotations suffered by the surrounding members won't be transmitted to the member either, so neither will there be any bending moment (or shear).

For the more visually inclined, imagine the deformed configuration of the structure: all the other members will be deformed as the load pulls the cantilever down. This member, however, won't be deformed at all. And therefore, neither will it suffer any internal forces.
Answer:  If both constrained points are pinned, the model is over-constrained and cannot be determined without more information.

If both the constrained points are fixed there can be no load on the member between because the fixed constraints take that load.
If the bottom constraint is only constrained by a bearing (like a wheel) then there will still be no load on that member. The only way I can see to put a load on it would be to remove the bottom horizontal member and make the top vertex a fixed point or place the load there. This would make a downward force along the diagonal that is fixed to the bottom constraint and put a downward force on the leftmost member. But this is only if that bottom constraint is a roller.
Basically, there is no load on that member because there are no forces acting on it, the same could be said for the other vertical member, unless the bottom horizontal is made of two sections and pinned, then that other vertical only serves to keep the bottom from bowing.


Print Title, Header and in Different divs

Question: I have created a view and called content types events from FILTER CRITERIA
, created template page--events.html.twig to override design.
Problem is here I have called {{ page.content }} which prints header, content and other footer parts eg: bread crumb so I want to call them in different div like header in other div
Answer: A simple solution to this would be to create a new view, with a block display, and add a contextual filter to get the current node ID from the url. Then select a field you would like and add it to the view, for example; "Header". Once you've done that then save.
Visit the "Blocks" admin page and add the block to the "Header" region of your page. Your theme should already have these. Restrict the block to display only for that content type, and then repeat this whole process for your footer field.
There are more dynamic solutions, I'm partial to Display Suite these days, something to think about if your looking to make more complex displays.
Comment: that solution may be don't like the admin user,I have events page eg drupal.local/events so I just need to call header content, content of page in separate divs.


Does a future contract's price show where investors think the underlying asset's price would be?

Question: When the price of an asset's future contract is at a certain level, does that mean investors as a whole expect the actual underlying asset to reach that price level in the future?
Answer: It depends. But generally for a storable commodity and as long as there is no shortage of storage capacity or temporary problems with the supply of the spot commodity, the answer is NO.
Gold is an example. You have $F > S$ but that is because of the financing and storage cost of buying gold and delivering it in the future, rather than because of an expected future appreciation. We say that the Future price is determined by "Cash and Carry Arbitrage". Stock Index Futures (and financial futures in general) also follow this simple relationship.
If you have a product that cannot be stored, such as a perishable food crop, the answer might be different and the Spot and Future prices can become decoupled and the mathematical relationship breaks down. Expectations of the future crop become important.
Also, there have been times in the Crude Oil market when the World did not have enough space to store all the unsold crude, so the arbitrage relation could not take place.
Finally there are sometime "spot shortages" for a commodity like Copper where factories need Spot copper for immediate use and buying futures does not solve their problem. In this case again the two markets can become decoupled with $S > F$.
But the most common case is F slightly higher than S as a result of interest rates and storage, insurance and other handling costs, with no role for price expectations.
(Nevertheless many people think F is typically determined by investor expectations, even some fairly sophisticated people. Probably the reason is historical. The futures markets were created in Osaka Japan and later Chicago IL to price a new crop of rice (or wheat) which will not even exist until year (or more) from now, here expectations are indeed key. But most futures markets nowadays are not of this kind. Most futures markets today deal in the deferred delivery of an existing, easily storable product.)
Comment: This is very interesting. Because whenever I hear analysts talking about futures markets they talk about them as if they're a gauge for future investor expectations. So there isn't any case where this is true?
Comment: In a far enough away (say 1 year) agricultural contract (soybeans, wheat, corn) it is true. The price is based on expectations of how much will be planted and what the yield will be.
Answer: For a purely financial product, with no pent-up investor sentiment for buying or selling (i.e. no supply/demand concerns), the futures market is purely a function of the discounted cash flow in 'carrying' the current spot price forward.  Now, if markets are efficient, today's product spot price is a function of the discounted expectation for future cash flows, and so, if markets are efficient, logically, the two markets should be in kilter.
Answer: The answer is that it depends on the asset. If you were thinking of commodities (e.g., oil), it is a common misconception to think that the future contracts reflect market expectations. For these, prices simply reflect what is called the cost of carry, or the cost of carrying the commodity to that certain future point
Comment: What are some assets where futures do reflect investor expectations?


Sigma 8-16 vs Canon 10-22

Question: The title says it all. I read mixed reviews about the Sigma lens and wanted to know your opinion about it. Some people say its sharpness is not that great as compared to Canon within the 10-16 range. However, the 2 extra millimiters are quite compelling.
It is hard to figure out which one I should go for.
Answer: I had this quandry a year or so ago and researched it to death, and also tried both the Canon and Sigma lenses to see how they compared.
In my experience the Canon 10-22 far exceeded my expectations.  It's a great lens - with near on L quality optics (just like the EF-S 17-55 f/2.8 is).
The Sigma did not have the same build quality nor did it have the same eye-popping contrast and IQ of the Canon.
In the end, I bought neither....  Both are APS-C only lenses, and I wanted to move to Full Frame at some point.  (Which I have now done).
Anyway - that's just a personal viewpoint.  My recommendation to you would be to get down to your local camera retailer and try them both out on your camera body and see what you think works best for you...
Comment: It's probably fair to say that the only thing keeping Canon from attaching the "L" label to a couple of its lenses is the EF-S mount. That said, the "L" stands for "Luxury" (and has since the F1n days at least) and has traditionally signified fast apertures for a given focal length (or focal length range, in the case of zooms) and ruggedness rather than raw optical performance (some "Ls" were horrible optically, but if you needed, say, a 50mm f/1.0, it was going to cost a mint regardless, so fragility wasn't an option).
Comment: Just to note though, as the Sigma is third party it still has the EF mount. not EF-S, so you can still attach it to a full frame camera, but you'll not get a full circle until you're zooming somewhere around 12-14mm
Comment: @Mike just for curiosity, which full frame did you end up buying?
Comment: @Bob 5D Mark III. Absolutely amazing camera, don't regret it for a second ;-)
Answer: I went for Sigma. 2mm might seem insignificant, but they really does make a difference on wide angle.
According to Lenstip test Sigma is sharper than Canon across the range, especially in corners if you stop down to ~f/8, but even wide open it's sharper than Canon. It also got significantly lower Chromatic Aberrations, vignetting (difference is huge here - Canon vignettes like crazy, so even if Sigma isn't flawless - it's completely different league) and works much better against the light (Canon gives you huge green bulb, Sigma few small sparkles).
So I would say: If Canon 10-22 is near the L quality than Sigma is above L quality.
Disadvantages of Sigma are quite obvious: You cannot use filters on it. There are some tricks with using Cokin, and supposingly some people made it, but I never did. The overall contrast is also slightly lower, but that's easy to fix in post-processing. AF also isn't the best one - My makes a bit of noise each time it stops the glass, as well as got a tendency to hunt focus if light isn't perfect. So if you need a wide angle for video than I'd recommend Canon.
I don't - I bought my camera for photos - so the choice is quite obvious: Sigma.
Digital Picture made quite a nice comparison of two lenses. Hover the picture to view Sigma, move mouse away to view Canon.
Comment: Have you got a link to the comparison on digital picture?
Answer: I just came back from Angor Wat with my Sigma 8-16 and I think if I've the chance I really want to try the Canon.
There is nothing wrong with the Sigma and 8mm is great, but I hated having to change out my 17-55, take the ultra-wide shot, then change back again. Now if you don't mind carrying two bodies, or sticking with an ultra-wide all day, or have plenty of time for changing lenses (i.e. no wife / companions to hurry you around) then by all means go for the Sigma. For myself the Sigma didn't end up getting all that much use and what I really need is a UWA that can shoot somewhat-normal as well.
A previous poster said the Canon build quality beats the Sigma but I'm not so sure if the 10-22 is built anything like my 17-55. The 8-16 is solid, tightly assembled, and just handles like it's a whole class above my wobbly 17-55. Of course this is an unqualified comment because I've never actually handled a 10-22.
I've no complaint about the Sigma's IQ and as to colours & contrast I actually think it beats or at least match all of my 6 other lenses (17-55, 17-85, 55-250, Sigma 30, Canon 50 1.8, Canon 85 1.8).
And finally on focus, I'm not even sure why there is an autofocus motor on this lens because let's face it, it's a 8mm UWA. Put it on f/8, hyperfocal distance and you don't need to worry about focus again.
Comment: Just checking whether you're talking about the 17-55 2.8 IS USM or the 18-55 kit lens?
Comment: I was referring to the 17-55 f/2.8 IS USM.

Sigma 8-16 vs Canon 10-22


How do I turn the "_shares" into ERC20 Tokens in this contract?

Question: I was tinkering a bit with the following Vault contract. The contract works like that: Deposit Token X and receive minted shares. Withdraw Token X for the amount of shares you are holding and the shares get burned.
I want the shares to be a ERC20 Token(with a name, symbol etc.) but I am having the issue that once the shares are generated I cannot send them anywhere. Can anyone help me what I have to add?
Here is the affirmentioned code:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;

contract Vault {
    IERC20 public immutable token;

    uint public totalSupply;
    string public symbol;
    string public name;
    uint8 public decimals;
    mapping(address => uint) public balanceOf;

    constructor(address _token) {
        token = IERC20(_token);
        name = "VaultWithdraw";
        symbol = "wdraw";
        decimals = 0;
    }

    function _mint(address _to, uint _shares) private {
        totalSupply += _shares;
        balanceOf[_to] += _shares;
    }

    function _burn(address _from, uint _shares) private {
        totalSupply -= _shares;
        balanceOf[_from] -= _shares;
    }

    function deposit(uint _amount) external {
        /*
        a = amount
        B = balance of token before deposit
        T = total supply
        s = shares to mint

        (T + s) / T = (a + B) / B

        s = aT / B
        */
        uint shares;
        if (totalSupply == 0) {
            shares = _amount;
        } else {
            shares = (_amount * totalSupply) / token.balanceOf(address(this));
        }

        _mint(msg.sender, shares);
        token.transferFrom(msg.sender, address(this), _amount);
    }

    function withdraw(uint _shares) external {
        /*
        a = amount
        B = balance of token before withdraw
        T = total supply
        s = shares to burn

        (T - s) / T = (B - a) / B

        a = sB / T
        */
        uint amount = (_shares * token.balanceOf(address(this))) / totalSupply;
        _burn(msg.sender, _shares);
        token.transfer(msg.sender, amount);
    }
}

IERC20:
interface IERC20 {
    function totalSupply() external view returns (uint);

    function balanceOf(address account) external view returns (uint);

    function transfer(address recipient, uint amount) external returns (bool);

    function allowance(address owner, address spender) external view returns (uint);

    function approve(address spender, uint amount) external returns (bool);

    function transferFrom(
        address sender,
        address recipient,
        uint amount
    ) external returns (bool);

    event Transfer(address indexed from, address indexed to, uint amount);
    event Approval(address indexed owner, address indexed spender, uint amount);
}

Comment: "...but I am having the issue that once the shares are generated I cannot send them anywhere..". Can you clarify this phrase and your logic? When you use this statement 'token.transferFrom(msg.sender, address(this), _amount);' I think that's you're sending shares amount to who interact with this function...
Answer: To allow the transfer of shares your contract and make your contract fully ERC-20 compliant, you must implement the remaining logic of an ERC20 token (i.e. transfer, transferFrom, etc.)
An even better solution would be create a vault contract that is ERC4626 compliant. That would allow other devs to easily integrate your vault token in their application (example 1, example 2).


TortoiseSVN post-commit.bat doesn't work

Question: I am using TortoiseSVN on Windows 7 x64.
I tried to put a post-commit.bat in the hooks folder of a repository, but it doesn't work at all. So I tried to put a pre-commit.bat (the content is exact the same as post-commit.bat) in hooks, and it worked fine.
This is very strange. The .bat file is very simple, I just tried with:
@echo off
setlocal
set REPOS=%1
set TXN=%2
xcopy C:\a C:\b\ /S /F
exit 0

Anyone makes post-commit work with TortoiseSVN?
Comment: TortoiseSVN is a Subversion client, not a server. Please elaborate your question.
Comment: I just found post-commit.exe works, but not post-commit.bat. I don't know why however.
Answer: The issue isn't a TortoiseSVN issue, but a server issue. Where is the repository stored? What server are you using? Are you using svnserve or httpd?
I take it that your commit happens anyway. There are several possibilities:

Your hook is being executed, but not doing anything. As long as it exits with a zero exit status, Subversion thinks everything is hunky. Try a Subversion program called pre-commit.bat that contains only the line exit 2. If you can still commit stuff, your hook isn't working at all.
Your hook isn't being executed. Subversion executes the program pre-commit in the hooks directory. There is an environment variable called PATHEXT on Windows that contains the suffixes that will be appended to a file in order to find the executable. Usually, it tries *.com, *.exe and then *.bat. If there is a pre-commit.exe or pre-commit.cmd in that hooks directory, your pre-commit.bat won't be executed. Check the value of PATHEXT for the user executing your Subversion server, and make sure it is set correctly.

One of the issues is that Subversion's hooks eat STDOUT and will only display STDERR only when the hook fails. This makes hooks pretty uncommunicative for the user, and if you're depending upon printing output while executing, you may get the felling that your hook isn't doing anything.
Print stuff to STDERR and not STDOUT. Have a way to force a hook to fail, so you can see STDERR if you need to.
I also don't recommend writing hooks in batch script on Windows. It simply isn't cut out to do this type of work. Use Python or Perl. Or, if you are really that PC oriented and don't want to install Python or Perl on your server, use PowerShell which is a very powerful, but underutilized programming language for Windows.


Light modifier compatibility with different brand speed ring?

Question: I have two Flashpoint monolights from Adorama and matching speed rings for these strobes. I want to rent a Paul Buff softbox and a Bowens strip box. Physically, are these light modifiers compatible with my lights, or can they be made to work with my lights? How? To what level of success?
Comment: What I mean by success is how well the rods of the soft boxes will fit into my speed rings without damaging the soft box. Some light spill or leak out the back is ok. That's what gaff tape is for.
Comment: This might be a good question for tech support at Adorama. They are a pretty sharp bunch.
Comment: It will be impossible to tell you what level of success these two modifiers will allow since you have not shared anything regarding what kind of image you wish to create with the modifiers in question.
Comment: As long as the modifiers you are renting do not have built-in speedrings, you should be able to insert the rods into your Flashpoint speedrings without incident, though it will be worth investigating the rod size on those boxes vs. the hole size on your speedring.
Answer: Your Adorama monolight is designed for modifiers using a Bowens S mount, so the Bowens stripbox should work just fine. The Bowens mount has 3 tabs on the modifier that you twist to lock into place on the light itself. It'a very solid fit and the modifier won't move once it's locked in place.
Paul C Buff uses a different mount (Balcar). This is a grooved ring on the modifier, and there are four spring-tensioned clips on the light that grip this groove and hold the modifier to the light. I've used this with Einsteins and the advantage is that you can angle the modifier any way you like vs. being fixed in one of 3 positions with Bowens.
To use the Buff softbox with your Bowens light, you will have to buy a new Bowens mounting ring ($10-$15), take the Balcar ring off the Buff softbox, and then fix the Bowens ring to the softbox. It's not that difficult -- Buff lights use thumb screws to hold the ring onto the softbox, so you don't even need a screwdriver -- but remember you are doing this with a rented softbox, so be careful not to mess it up. And don't forget to convert it back before you return the softbox.


Using the names of the teachers in Personal Statement?

Question: Is it ok to use the names of my ex or recent professors in the personal statement? Of course in positive context (how they influenced me etc.) I am not from the USA and in my country it is quite uncommon to write essays like that, so I do not know if it would be ok to use the names.
Comment: Could you give an example?
Comment: I can't imagine there's a problem with that.  You might want to contact that professor so they know they're being mentioned, in case they have an objection for some reason or so they're prepared in case they're contacted.
Comment: I am going to write about the people and circumstances that motivated me to pursue for studying in the USA. the ex professor of mine influenced me a lot in this case, so I would like to mention him, but I am not sure if it is ok to mention his name also.
Comment: Is this regarding your CV or résumé?
Answer: There is no reason of ethics or custom to prevent you from using the names of professors in your personal statement.  Remember, however, that the personal statement needs to be about you, not about your professors, and choose accordingly whether to talk about a particular professor.
Thus, for example:

If you are talking about a research experience that you had as an undergraduate, then the name of the professor that you worked with is quite germane, and likely to be one of your references in any case.
If you are talking about a class that inspired you, then the class and the professor are not particularly interesting for the statement: instead what is interesting is what that inspiration has caused you to do.


Issues regarding phpMyAdmin - character set

Question: I'm trying to migrate a Wordpress site from one server to another. Everything is going fine apart from the database migration.
I have my database 'A', and using phpMyAdmin I am attempting to export it so that I may use phpMA on the destination server to to import it.
The problem appears to be that when I'm importing the database, it doesn't recognize the character type utf8mb4 despite my efforts to change the character set/type in phpmyadmin to utf8 via queries and being told that it has changed by the console.
I also ensured that UTF8 was selected on both locations and that doesn't seem to help at all. I've tried to search for help but I've been unsuccessful.
Answer: MySQL did not have utf8mb4 until version 5.5.3; are both versions newer than that?
Is the exported file a text file?  If so, look in it for utf8 and see if it says utf8 or utf8mb4.
Did you use any "character set" argument on mysqldump when exporting?  What about on importing?  For mysql and phpmyadmin it needs to be utf8mb4.  For the rest of the world, UTF-8 or maybe UTF8.


How to show value of Count Function on my template. Django

Question: I would like to show the total number of employees registered in my database. Using the count function.
My views.py:
def home(request):
    return render(request, 'dashboard.html')

def return_total_employees(request):
    return_total = Employees.objects.aggregate(total=Count('EmployeeCard'))[
            'total'
        ]
    return render(request, 'dashboard.html', {'return_total ': return_total })

My template:

 {{ view.return_total_employees }}

Answer: The dict you're returning in the render function is called context. You can access the value of returned context in your template like this
{{return_total}}


How do i sync an iPhone 4 (that has never been synced) to a computer without losing all of my pictures and data?

Question: I got my iPhone in may, and have never synced it to a computer. I would like to now so that I can out music from my CDs on it. But when my friend synced her iPhone 4 to a computer it erased all of her pictures. What can I do so that doesnt happen?
Comment: Is there a good reason why you don't rely on iCloud backups since any action you take could expose a bug in iTunes and you'd lose all your pictures? The software isn't designed to erase anything until you get a notification that things will be erased, but sometimes the message isn't understood or software fails to work as designed so it's hard to know why data loss happened in the case of your friend.
Answer: Either iPhoto or Image Capture will let you pull all your photos off the phone to get the safely onto the computer. From there you can store them wherever you want.
DropBox also has a camera upload function now so you can upload straight to DropBox from the phone, or from the computer when you plug your phone in.
Just make sure you use iPhoto or Image Capture first when you plug in your phone.
If you plug the phone into your computer and set it up with iTunes it might prompt you to reset it to automatically sync with that computer. You can do that after you've removed the photos using iPhoto.
If you do sync with iPhoto it'll give you the option to remove the photos from your phone after syncing - that's your choice.
Finally, if you're worried about losing photos, you can configure iPhoto on your computer to use Photo Stream, and on your iPhone too in the iCloud settings. That'll copy the photos to the cloud, and then iPhoto automatically, so you don't need to plug in your phone to sync each time.
Most of this assumes you have a Mac computer, btw, you don't make clear whether you're syncing to a Mac or PC.
Answer: You should make sure that you sync it with iPhoto or whatever photo program you have first, and then sync the phone via itunes.
iTunes might automatically popup and start asking you stuff, but just ignore it and import the photos using some program.
Answer: Syncing with iTunes shouldn't make any changes to your Camera Roll.
Answer: You can use iCloud to sync your data to your PC.Before this, you must set up your iCloud in case it erase your data on your iPhone.


Show SQL script using graphviz

Question: I am looking for software can show SQL scripts (MySQL in my case) in visual way. Example every script is a circle in the diagram.  Similar to doxygen but for SQL scripts.
Answer: An interesting, simple and funky visualisation of your db, literally in a circle:
https://github.com/westonruter/schemagraph/blob/master/schemagraph.php
A single php file which produces svg output.
A more comprehensive metadata query tool: http://schemaspy.sourceforge.net/
this gives you entity relationship diagrams and much more.
There is a gui if that is your thing:
http://www.joachim-uhl.de/projekte/schemaspygui/
I found but did not use:
http://code.google.com/p/mysqlviz/
Answer: graphviz allows you to plot graph - if you have entities (Nodes) and connection between entities (Node). What this means is, if you could write a script which will split up sql to different units and relation , then you could create a .dot file use graphviz to create visual.
Answer: try http://schemaspy.sourceforge.net/ works well if you have foreigns keys, if not is useless.
Answer: it exist a plugin to symfony who make this.
http://www.symfony-project.org/plugins/sfDoctrineGraphvizPlugin

Show SQL script using graphviz


What is position of International Treaty in the Law of United States?

Question: If United States is signatory of an treaty signed with another state which is still valid, what is position of that treaty which regulates something (for example giving citizen of state which is signatory of treaty some rights in US) according to valid laws of United States?
Comment: Has the treaty been *ratified,* or only signed?
Comment: Treaty in question is ratified.
Answer: The constitution has the "Treaty Clause" (article II, section 2) which states that the president "shall have Power, by and with the Advice and Consent of the Senate, to make Treaties, provided two thirds of the Senators present concur". There is no legal concept of "signing" a treaty in the US, and only ratification counts. It is unclear what limits there are to enforcement of treaties in lieu of statutory enactment. Medellín v. Texas held that

While a treaty may constitute an international commitment, it is not
  binding domestic law unless Congress has enacted statutes implementing
  it or the treaty itself conveys an intention that it be
  "self-executing" and is ratified on that basis

This was a reversal of prior trends going back to Ware v. Hylton based on the Supremacy Clause, that

all Treaties … which shall be made … under the Authority of the United
  States, shall be the supreme Law of the Land; and the Judges in every
  State shall be bound thereby

But Medellín doesn't mean "never": you have to "parse a treaty's text to determine if it is self-executing", which is a different ball of wax.
Comment: "NOTE BY THE DEPARTMENT OF STATE
Pursuant to Public Law 89-497, approved July 8, 1966
(80 Stat. 271; 1 U.S.C. 113)--" What about this foreword in many agreements between US and other states based on treaties? Too long text to paste it here - no permission to do that.
Comment: For example if a question about a treaty (or law) arises in a case, the Little and Brown published edition is declared to be presumptively correct as a statement of whether there is such a treaty (or law), but it says nothing about the interpretation or application of said document.
Comment: "Serbia Commercial Relations Treaty"

Since the dissolution of Yugoslavia in the early 1990's, the following agreement is being applied with respect to: Bosnia and Herzegovina, Croatia, the Former Yugoslav Republic of Macedonia, Slovenia, Serbia, and Montenegro.

Treaty signed at Belgrade for the United States and Serbia October 14, 1881

Senate advice and consent to ratification July 5, 1882
Ratified by the President of the United States July 14, 1882 "   Here is the link for the text of treaty: http://tcc.export.gov/Trade_Agreements/All_Trade_Agreements/exp_005386.asp
Answer: What is internationally considered a "treaty" may be considered several different things in US legal terminology, depending on how it was enacted in the US:

A "treaty" (under the meaning of the Treaty Clause of the Constitution), ratified by two thirds of the senate. Such a ratified treaty has a similar position under US law as a regular federal Act of Congress. Like an Act of Congress, a "treaty" can be modified or repealed (for the purposes of US law) simply by passing a subsequent Act of Congress that modifies or repeals it, according to the Supreme Court ruling in the Head Money Cases. Also like an Act of Congress, a "treaty" is inferior to the US Constitution and any provision that conflicts with the Constitution is null and void (for the purposes of US law), according to the Supreme Court ruling in Reid v. Covert. In one sense, however, a treaty may be somewhat more powerful than Acts of Congress, because according to the Supreme Court ruling in Missouri v. Holland, a treaty can act in areas that Congress doesn't have the power to act, and which ordinarily belongs to the states, although there is question about the validity of this ruling today.
A "congressional-executive agreement", which is an executive agreement concluded by the President, and then the parts requiring legislative changes are passed through Congress as regular legislation. Since it is passed as regular legislation, it has exactly the same position as regular legislation.
A "sole executive agreement", which is an executive agreement concluded by the President, which does not involve any action by Congress. It has the same position in US law as an executive order or executive action by the President, and hence can only act in areas where the President already has the legal authority to act alone.


TriangleTube Smart 30 digital thermostat

Question: I have a TriangleTube Smart 30 indirect water heater which unfortunately only comes with an analog (red top blue dial) thermostat. I would really love to find a way to get a digital thermostat on it so I can set it to a certain temperature instead of "partially red". Anyone have the same experience or any ideas?
Answer: Depending on your boiler, you can at least see the DHW called temperature on your boiler display. I have the Smart 30 water heater coupled with a Triangle Tube Prestige Solo boiler, and on its display, under the various info items, I can see the DHW temperature. I'm guessing that will be the closest you can get with this specific setup.
Comment: Thank you, unfortunately my 14 year old Burnham boiler doesn't have that kind of feature either.


Fiscal versus Financial

Question: I've never quite got the hang of this one. Money is the object, but what's the difference between for example 'fiscal policy' and 'financial policy', or are they indeed merely synonyms?
Answer: The domains are different (though overlapping to some extent), as these two definitions show (bolding mine):

Fiscal Policy
In economics and political science, fiscal policy is the use of
  government revenue collection (mainly taxes) and expenditure
  (spending) to influence the economy.[1] According to Keynesian
  economics, when the government changes the levels of taxation and
  government spending, it influences aggregate demand and the level of
  economic activity. Fiscal policy can be used to stabilize the economy
  over the course of the business cycle.

[Wikipedia]

Financial Policy
Financial Policy definition : Criteria describing a corporation's
  choices regarding its debt/equity mix, currencies of denomination,
  maturity structure, method of financing investment projects, and
  hedging decisions with a goal of maximizing the value of the firm to
  some set of stockholders.

[ADVFN]
Answer: There is some overlap in meaning between the terms: financial, meaning (obviously) 'involving financial matters', is a subset of fiscal, which has the additional meaning of 'relating to government revenue and taxes'.
(Links to definitions at Oxforddictionaries.com)
Comment: That is not my experience. *Fiscal* can be and often is used more widely than in government. You are right that there is not a clear distinction between *fiscal* and *financial*. But in general terms *fiscal* and *fiscal policy* are used to describe the more liquid elements, decisions, and policies e.g. cash, bonds, banking matters etc; whilst *financial* also takes in the wider elements of an organisation's affairs: sales revenue, costs, inventories, business assets etc. But there are no hard and fast rules to this.
Answer: Financial policy is related to money and only money.  Lending/interest rates are the bellwether of financial policy - it is just pure math.  Fiscal policy is more about how (much) a Government wants to spend and earn - this is not pure math as financial policy and is quite discretionary.
Edit Fiscal policy is top-level directive/decision and includes financial policy.
Comment: Why don't you include references for your answers?
Comment: I believe you sir, but you will score more rep points if you add references for all of your answers. Take example from all the other answers you see, especially the answers of high rep users.
Comment: Since 'fiscal policy' is mentioned and 'contrasted' with, I took it as 'financial policy' of Government.  If you type fiscal policy in Google - it auto-completes to say 'Fiscal policy is the means by which a government adjusts its spending levels and tax rates to monitor and influence a nation's economy. It is the sister strategy to monetary policy through which a central bank influences a nation's money supply'.  As I said it is more of decision making (where to spend and earn) and financial policy is management of expenditure and revenue.

Fiscal versus Financial


Could the US extradite the Russian Hackers?

Question: Many people get extradited for breaking a country's laws by hacking against that country. This is how International Cyberattackers get brung to justice, But what if one Jurisdiction Government personnel commits a crime against one country but was working for a foreign government, does extradition apply to this? Is there forced extradition? Could the US extradite the Russian Hackers who started the cyber attack against the US private sector and US government agencies and departments?
Comment: @Lawyer. No, I was asking you to clarify your question because you do not explain what you are refering to. **IF** it is what I think, it seems that you think that the USA government has the ability to extradite people from Russia, which is false.
Comment: If we are talking about "Russian hackers in Russia", then the USA government does not "extradite them". It might **demand the extradition** to the Russian government, which would be the one to decide if it complies or not. Even if there was a mechanism for that (i.e. extradition treaty) and the Russian government was willing, the USA government would have to identify them and provide evidence of their activities.
Comment: Russia doesn't have an extradition treaty with the US, what would compel them to obey an extradition order? Didn't work when we asked for Snowden...
Comment: @SJuan76 If you're comment was an answer then...answer. Don't put answers in the chat.
Comment: Do you mean to ask 'would Russia extradite to the US?'
Answer:
Could the US extradite the Russian Hackers who started the cyber attack against the US private sector and US government agencies and
departments?

No.
The United States and Russia do not have an extradition treaty. See Russian Indictment and Extradition | American Constitution Society. And within Russia, extradition is constitutionally prohibited; see Chapter 2. Rights and Freedoms of Man And Citizen | The Constitution of the Russian Federation.

Is there forced extradition?

Maybe.
Either country could use covert action or even start a war to "force" extradition, or use a form of covert or overt rendition to bring the individuals to a country to face trial.
Comment: Russia **can't** extradite its own citizens - its constitutionally prohibited.
Comment: Interesting, I didn't know that.
Answer: The US could file an extradition request for the hackers involved. It would need to know who they were, and have significant evidence that they were responsible and that their actions were a crime under both US and Russian law.
But if the hackers were in fact sponsored or employed by the Russian Government, as has been claimed, I would expect extradition to be refused, probably on some pretext, perhaps that what was done was not illegal under Russian law for some reason.
Extradition is never automatic, the country where the wanted person is can choose to honor a demand or not. The risk is that if a demand is refused, demands the other way may also be refused, and other forms of international pressure may be used. The effectiveness of that will depend on the relationship and relative positions of the countries involved.


Wife's mother asking her to give khula

Question: Assalamualaikum
My question is regarding wife seeking khula and the reason here for it is that she lives in USA and I live in India and her parents are forcing her to ask khula from me by giving her the reason that I cannot come there they have asked lawyers about my visa and all of them said there is only 2% chance of getting visa (my in-laws haven't applied for visa they just asked lawyers) so my wife said she'll wait or come to me and I'm all ready to welcome her in my home so her mother states that she's going to tear her passport and don't let her go. Then my mother in law gave another reason to ask khula which was he doesn't give you money and bear your expenses and she asked my wife to ask me 3000$ every month tho my wife knows I'm not rich nor I've that much money to bear her expenses according to USA lifestyle but she knows and I'm good enough to bear her expenses and daily need or basic needs of life if she's with me. And the main reason they are forcing her to ask divorce is that my in laws hate me because we did love marriage after going thru many struggles and made this relationship halal by nikah and we both know the value of our marriage and we don't need it to break please guide us
Comment: These complex personal issues are best taken to an expert rather than online like this.
Answer: Walaikum Us Salaam Wa Rahmatullahi Wa Barakaatuhu!
First of all, sorry to say that, according to Islamic Shariah. The nikah was not fulfilled for a woman without her Wali (Father, Brother or any other close male relative), but in your case, there is confusion that the nikah should be fulfilled by the permission from your wife's male relative.
Otherwise, you should keep struggling to protect your marriage with lots of patience and do ask Khair from Allah Subhanahu Wa Ta'ala.
InShaAllah, you will not disappoint.
My suggestion is that you should not give Khula to your wife. You should convince her to bring her to your side.
May Allah helps you both regarding your marriage life. (Ameen)
Comment: First it is out of question whether nikah was fulfilled as OP actually starts from the position that they are legally married else why should there be a khul'a issue. Secondly khul'a is done via court.

Wife's mother asking her to give khula


How to show transaction isolation level (MySQL)

Question: I want to know what isolation level is set for current Mysql database. How can find it out? I tried searching it on the google but did not find it.
Answer: check session transaction level (mysql8+)
SELECT @@transaction_ISOLATION;

check global transaction level (mysql8+)
SELECT @@global.transaction_ISOLATION;

Comment: is ```@@global.transaction_ISOLATION ``` the current session variable?
Comment: Wait a second, it's the other way round, right? `@@global.` is the global one.
Answer: There are potentially six different transaction isolation level values in MySQL/MariaDB - and they could have different values. They are:

Value defined in the configuration file(s).
Value used in the command line option used to start mysqld.
The global transaction isolation level.
The session transaction isolation level.
The level that will be used by the very next transaction that is created.
The level being used by the current transaction.

The reason you want to know its value, will determine which one (or multiple ones) you need.
Also, be aware of when the level that was obtained can change - sometimes by things outside your control.
1. Configured level
Look for a transaction-isolation entry in the configuration files. This may be found under sections such as [mysqld] or [server].
Start with the default /etc/my.cnf, but you may have to look in other configuration files depending on the include statements used. Be aware that mysqld might be started with command line options telling it to ignore the configuration files or to use a different set of configuration files.
2. Command line option level
Examine how the mysqld process was started. The level used here will override any specified in the configuration files.
It may change if mysqld is somehow started differently in the future.
3. Global level
This can be retrieved by running SELECT @@global.tx_isolation;.
This is initially set when the database starts up, to the level provided by the command line option or from the configuration file.
It can be changed by running set GLOBAL transaction isolation level .... But be aware that any value set that way will be lost when the database restarts. It could change if some other program runs the set global command.
4. Session level
This can be retrieved by running SELECT @@tx_isolation;.
When a new session/connection is created, it is set to the current global level.
It can be changed by running set SESSION transaction isolation level ... in that session.
If you are using connection pools, be aware that its value could change on you (reverting back to the global level), since connections can be silently terminated and re-established if it is put back into the pool.
5. Next transaction level
There is no way to query this.
This level is set by running set transaction isolation level ... and that level will override the session level and global level for the very next transaction created in that session. The next transaction after that will revert back to using the session level (unless another set transaction isolation level command is issued again).
To know this value, you'll have to keep track of how you've used set transaction isolation level (if you've used it at all).
6. Current transaction level
There is no way to query this. (It is the subject of MySQL bug #53341.)
To know this value, you'll have to infer what it is from the session level (at the time the transaction was created) and if you had set the "next transaction level" immediately before you created the transaction.
References

Set transaction in MariaDB: https://mariadb.com/kb/en/library/set-transaction/
Transaction isolation levels in MySQL: https://dev.mysql.com/doc/refman/8.0/en/innodb-transaction-isolation-levels.html
Answer: I use the following snippet:
mysql> SELECT @@TX_ISOLATION;
+-----------------+
| @@TX_ISOLATION  |
+-----------------+
| REPEATABLE-READ |
+-----------------+
1 row in set, 1 warning (0.00 sec)

Answer: MySQL 8+
SELECT @@transaction_isolation;        -- session
SELECT @@global.transaction_isolation; -- global
According to MySQL 8 Deprecation notes:

The deprecated tx_isolation and tx_read_only system variables have
been removed. Use transaction_isolation and transaction_read_only
instead.
Answer: I did a bit of more searching on the google and found out that if have MySQL 5.1+ then you can find out the isolation level by firing below query
SELECT * FROM information_schema.session_variables
WHERE variable_name = 'tx_isolation';

Comment: Note that this answer is outdated. See the other answers for MySQL 8.
Answer: You could
SELECT DATABASE();      to verify you are using the database, then
SELECT @TX_ISOLATION;    for the DB TX isolation value
SELECT @@TX_ISOLATION;   for global TX isolation value

if your db verification is not what you think it should be,
USE [db-you-want-to-check];
SELECT DATABASE();    to verify current database, then
SELECT @TX_ISOLATION;   for current database TX isolation value
SELECT @@TX_ISOLATION;   for GLOBAL TX isolation value

Answer: Just one another query grammer:
MariaDB email@example.com:mysql> show variables like '%tx%'
+---------------+-----------------+
| Variable_name | Value           |
+---------------+-----------------+
| tx_isolation  | REPEATABLE-READ |
| tx_read_only  | OFF             |
+---------------+-----------------+
2 rows in set
Time: 0.006s

Answer: You can show session isolation level. *My answer explains how to set transaction isolation level:
SELECT @@SESSION.transaction_isolation;

Or:
SELECT @@transaction_isolation;

Or:
SHOW VARIABLES WHERE VARIABLE_NAME = 'transaction_isolation';

And, you can show global isolation level:
SELECT @@GLOBAL.transaction_isolation;

In addition, you can show persisted isolation level if it exists
SELECT * FROM performance_schema.persisted_variables WHERE VARIABLE_NAME = 'transaction_isolation';


How does LSTM fights vanishing gradient?

Question: Vanishing gtadient causes too small values which are come from non-linear functions like sigmoid, tanh. LSTM architecture was developed to fight these issues.
But how can it avoid a problem if there are 3 sigmoid, 2 tanh functions and, moreover, they are combinated via multiplication?
Comment: [How does LSTM prevent the vanishing gradient problem?](http://stats.stackexchange.com/q/185639/12359)
Answer: There are two factors that affect the magnitude of gradients - the weights and the activation functions (or more precisely, their derivatives) that the gradient passes through.
If either of these factors is smaller than 1, then the gradients may vanish in time; if larger than 1, then exploding might happen. For example, the tanh derivative is <1 for all inputs except 0; sigmoid is even worse and is always ≤0.25.
In the recurrency of the LSTM the activation function is the identity function with a derivative of 1.0. So, the backpropagated gradient neither vanishes or explodes when passing through, but remains constant.
The effective weight of the recurrency is equal to the forget gate activation. So, if the forget gate is on (activation close to 1.0), then the gradient does not vanish. Since the forget gate activation is never >1.0, the gradient can't explode either.
So that's why LSTM is so good at learning long range dependencies.


Cordova Android CORS crypt-file plugin

Question: I am currently developing an Android application with Cordova and am trying to use the following plugin, to encrypt the source files.
https://github.com/tkyaji/cordova-plugin-crypt-file
While iOS is working fine, on Android I get the following error.
No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost' is therefore not allowed access.
Without the plugin, everything is working fine. I do have the CSP set and am also using the whitelist plugin where I have added localhost in my config.xml. I have searched for quite a while now, but all seem to be solving the problem with whitelisting, which is not working for me.
I am currently using Cordova 5.4.1
Any help/idea would be appreciated.
Best regards
Answer: Runned into the same problem, solved this by allowing localhost request on the server for that specific action.
<code>header("Access-Control-Allow-Origin: http://localhost");
</code>
See also the github issue: https://github.com/tkyaji/cordova-plugin-crypt-file/issues/4

Cordova Android CORS crypt-file plugin


How do I create a MatPlotLib or similar graph that varies with time?

Question: What I am trying to do is to plot the data from an orbital simulation using Matplotlib; an example of what I am trying to achieve is attached below.

I have the data of planets as well as the spacecraft in X,Y,Z, time coordinates(or if necessary I can rerun to get it in other coordinate systems) with respect to the Sun.
How can I make a GIF like this?
I tried just using pyplot of x,y, but instead of the moving GIF I only get a flat image.(As expected, because PyPlot can only make static graphs). Any help/pointers to where I can look is greatly appreciated.
Comment: Have a look in the animation section of Matplotlib's examples.  There a few there that draw developing paths https://matplotlib.org/stable/gallery/animation/index.html
Answer: One can use matplotlib FuncAnimation facility to create animations based on data in matplotlib. The idea is to view the animation as a collection of frames and define the graph/contents of each frame based on the frame number (assuming that the frames are placed in ascending order). More details on matplotlib animations can be found on this page on the official site: Matplotlib Animations. Rest of the answer provides some guidance specifically for the question.

End Result
Here is a dummy animation that I created using matplotlib FuncAnimation. It is based around the idea of the question (though with dummy data).

Code
Here is the code to generate the above animation -
from matplotlib.animation import FuncAnimation
import matplotlib.pyplot as plt
import math

# dummy parameters, replace them with your own
sun_x, sun_y = 0, 0
voyager1_theta, voyager1_speed, voyager1_radius = 0, 0.003*math.pi, 40
planet1_theta, planet1_speed, planet1_radius = 0, 0.002*math.pi, 40
planet2_theta, planet2_speed, planet2_radius = 0, 0.001*math.pi, 90
fps = 10   # frames per second in animation
total_time = 5  # in seconds, total time of animation
time_ratio = 100 # in seconds, how many seconds in reality for every second on animation

# extra calculations
interval = 1/fps # in seconds
total_frames = total_time * fps

voyager_x_data = []
voyager_y_data = []

fig, ax = plt.subplots()

def update(frame):
    # this function accepts the frame-number as frame and creates the figure for it
    global ax

    # dummy calculations, replace them with your own calculations
    time = frame*interval*time_ratio  # in seconds
    voyager_x = (voyager1_radius+time/20) * math.cos(voyager1_speed*time + voyager1_theta)
    voyager_y = (voyager1_radius+time/20) * math.sin(voyager1_speed*time + voyager1_theta)
    voyager_x_data.append(voyager_x)
    voyager_y_data.append(voyager_y)

    planet1_x = planet1_radius * math.cos(planet1_speed*time + planet1_theta)
    planet1_y = planet1_radius * math.sin(planet1_speed*time + planet1_theta)
    planet2_x = planet2_radius * math.cos(planet2_speed*time + planet2_theta)
    planet2_y = planet2_radius * math.sin(planet2_speed*time + planet2_theta)

    # plotting
    ax.clear()  # clear the figure (to remove the contents of last frame)
    ax.set_ylim(-100,100)
    ax.set_xlim(-100,100)
    ax.set_aspect('equal')
    ax.set_title('Time = {:.3f} sec'.format(time))
    ax.scatter(sun_x, sun_y, color = 'yellow', marker = 'o') #, label='Sun')
    ax.scatter(planet1_x, planet1_y, color = 'blue', marker = 'o') #, label = 'Planet1')
    ax.scatter(planet2_x, planet2_y, color = 'green', marker = 'o') #, label = 'Planet2')
    ax.plot(voyager_x_data, voyager_y_data, color = 'red')
    ax.scatter(voyager_x, voyager_y, color = 'red', label = 'Voyager')
    ax.legend()

anim = FuncAnimation(fig, update, frames = range(total_frames), interval = interval*1000)  # multiplying by 1000 to convert sec into milli-sec
anim.save('result.gif', fps = fps)  # replace the name of file with your own path and name
#plt.show()  # uncomment this line and comment out the second-last line to see in realtime instead of saving

Explanation
The comments inside the code contain all the assistive information required while reading and working with the code. This section contains overall explanation.

Create the data. You can compute or load data from any database. In the code above, we are computing the data. Some data is also computed in the update function while creating the frames. Also, there are some extra convenience parameters in the code like fps, total_time, time_ratio.
Initialize the matplotlib figure and axis (fig, ax = plt.subplots()) and then define the update function which takes frame number as input and creates the figure for that frame number.
Create the animation using FuncAnimation. In the code we did this with FuncAnimation(fig, update, frames = range(total_frames), interval = interval*1000). We specify the frames to match the time we want and interval to match the FPS we want in the animation.
Finally, view/save the animation. To view, call plt.show(). To save, call anim.save() in which, specify the path to the output file along with the filename and the fps to match the FPS we want.

Note

The extension in the filename specified to anim.save() is used to decide the export format. Additional formats are supported with the help of ffmpeg. To get support for additional formats, install ffmpeg and specify writer='ffmpeg' in anim.save().
While viewing the animation in realtime i.e. using plt.show(), set frames=None in FuncAnimation() since we don't want to specify how long the animation runs. We want it to run as long as we are viewing it.


Does this Hampton Bay ceiling fan have a capacitor inside the motor housing?

Question: I have an older Hampton Bay "Andross" ceiling fan which only turns very slowly now (one of the kids fessed-up to using it as a catapult for their stuffed animals). I can't find this model for sale anywhere so wondering if I can replace the motor, or the start capacitor. I took the thing apart to find the start capacitor, which I thought might be inside the motor. I don't think it is. The two "shells" on the motor seem to be pressed on along with bearings. They don't want to come apart. Anyone know if this motor has the capacitor inside the gray wireless module?
Comment: Might find that there is no such thing as a "service manual" for this. Far too many items are made to be disposable, not repaired.
Comment: @crip659, I can't find too much blame for the kid. I bet it was a good time while it lasted. It would have been for me too at that age. Anyway, yeah, not sure which one caused it. I've tried looking for the MT-515 model and nothing comes up. I suppose I could take the module apart and see if there's a cap inside.
Comment: Possible the stuff animals and the fan being slow are two separate things that happen at the same time.  Might find on google the service/wiring manual for that make and model.
Comment: Imagine the kid only did what we wish we could do.  Don't think a regular stuff toy would do it, unless done for an excessive time(hours).
Comment: @isherwood `Anyone know if this motor has the capacitor inside the gray wireless module ? `
Answer: My best shot at an answer to the question whether the grey wireless module has a capacitor inside:
It does most likely not have a capacitor for the fan motor inside. I've had a few fans with an identical looking wireless module. Since all of my fan outlets are run with separate switched hots for light and fan, I preferred to use the wall switches instead of a remote. So I just wired the fan up directly without the wireless module, and everything worked normally. I am even using a fan speed control wall switch to control the speed.
But this leads to a troubleshooting step you could use: Since you said the fan only runs very slowly, you could try to wire it up without the wireless module. Maybe it has somehow become stuck on slow speed. If the fan runs at "full" speed when wired direct, you know you have a bad wireless module (or maybe even bad remote).
Comment: I hadn't thought of bypassing the wireless module. Good idea and worth a shot!
Answer: By the looks of it the the capacitor goes in the switch housing, or light kit (not pictured) which connects to the 6-way plug at the bottom of the photo.
if you pull on the black, white, and blue wires  you'll find that they pass through the motor axle without making any internal connections,
It's the orange, yellow, and red wires that go to the motor and they  have the capacitor connected.
Comment: Thanks for this! It was in the switch housing just as you said. Buried under a blob of wiring and I didn't even see it.


Ullage control on stage shutdown?

Question: Is ullage control a thing only engine startup? Would a rocket like the Saturn V or Falcon 9 leave an engine running for a second or two longer just for ullage control?
Comment: Run an engine longer than what?
Comment: Longer than the other engines: shut down all but one engine, say, then kill that last engine after a second or two. No clue if this makes sense. I ask because I think I've read something like this is done, maybe in the context of the space shuttle, but I never paid close attention to ullage, so all I have is a vague memory that may be pure BS. Just checking if something like this is done, I guess, so I can carry on without misconceptions :D
Comment: You could do it the Soviet way, and ignite the upper stage *before* shutting down the first stage. This completely removes the ullage need, but adds a bit of complexity in interstage design.
Answer: Yes, it is only done on engine startup.  Remember, ullage is done so that liquid propellant is fed to the engines, instead of gas bubbles.  When a tank is allowed to sit in microgravity for a significant amount of time, there is a risk of some of the gas bubbles in a partially-empty tank migrating to the tank's outlet at the bottom.  An ullage burn at the end of engine firing would do nothing to stop this process.  Instead, you do the ullage burn at the start of engine firing, to let the liquid in the tanks settle to the bottom.
Comment: @user39728: Best to use ullage in that case.  I have numbers handy for Saturn IB.  First stage engine cutoff at T+140.65, second stage engine start T+143.35.  That's *less than 3 seconds* between stages, and they *still* used ullage motors!
Comment: Thanks! Would 15s between MECO and stage-2 engine startup be too much? Or would stage the engine maybe be able to fire right away without ullage control?

Ullage control on stage shutdown?


is automated data movement via Excel considered ETL?

Question: I am wondering if informal methods of automatically extracting, transforming, and loaded data constitute "ETL." For example, I code Excel VBA to extract from databases onto a spreadsheet, transform the data into the desired format, and load by moving the Excel file to the correct folder. Would it be incorrect to showcase this as ETL for resume? Is there a term or lingo for this?
Answer: The process you describe is very extremely techinically ETL, though if I were reviewing qualifications with a candidate during an interview for a position that required what I usually think of as ETL experience and they described the process you mention as the "ETL" process they were familiar with, it's very likely that the interview would end politely and quickly.
It would be much better to describe this experience in terms of what it unambiguously is- VBA and advanced Excel skills are very valuable. You could call it "data preparation and processing using VBA and Excel," for example.
Calling these processes "ETL" experience is asking for trouble when an employer is looking for experience in one of the formal ETL tools or methodologies is unhappily suprised by the distinction.
Comment: I think you raise some good points, but I think I might be a bit more forgiving. I guess it would depend upon the level of experience and product specific proficiency you were looking for in a candidate. Are you wanting an experienced candidate with years of product specific experience or a graduate/intern that you intend to develop?
Comment: It *is* an ETL process but is not what most people are referring to when they ask for that sort of experience, so find a way of including ETL in the description but don't make it the whole matter. Perhaps list the skills/experience under an "advance Excel with VBA" heading and in the description of what you have used the skills for refer to a creating an "ETL-like semi-automated data consolidation process". That way you show you know what ETL is as a concept and that you have experience of it, but you aren't "accidentally" claiming experience of ETL specific tooling.
Answer: ETL is not a tool, but the process or group of processes intended for data integration from a source system to the destination system, generally a Data Warehouse.
So if you are doing an extraction, transformation and further loading of that transformed data, you are performing de facto ETL. Someone could argue that it is harder to maintain, and more prone to errors. And they'd be right. But a poor code does not convert it into something different than code. Same applies.
The tricky part is the final load process in the sense of being moving Excel files in a file system. We use at work a MapR DB based on MapR FS made out of independent files and yes, we do data integration and we finally "load" those files into their final destination, despite they are actually just files. In the end they are accessed by a Query Engine. So in the present day I would consider it an heterogeneous database and your system an ETL. Don't see why not.
https://en.wikipedia.org/wiki/Extract,_transform,_load
Answer: I believe what you are describing is technically ETL. However I don't think it is what people in the industry would typically consider as ETL. And Excel would not commonly be considered an ETL tool.
There is a difference between experience with ETL and experience with a specific ETL tool or product.
However I do think that if you explain yourself carefully that it would be beneficial to your CV. Eg: "Automated Extract, Transform & Loading of data between databases using VBA and Excel" is honest and unambiguous.
In my opinion it shows a degree of understanding, technical proficiency, problem solving and experience. And I think that has merit.


Copying VMDK's onto ESXi local disk

Question: I have just installed VMWARE ESXi5 on a physical server with 2 hard drives. OS on one, Virtual Machines will be on the other. I have the vmdk's I want to use on a usb disk.  How do I copy them from the USB disk on to the local disk???
Answer: Simplest, most supported and safest way is to plug the USB disk in to your own computer, and then use VMWare console to access the datastore browser and upload the files there.
See here for a step-by-step guide.
Comment: This is safer ignore my answer please.
Comment: VMWare may not see the NTFS formatted drive. I would just let the copy run, or risk having a makeshift solution fail and take even longer to fall back on the usual method.
Comment: Thanks Simon.. this is going to tame 340mins though :( (4 to copy)  The usb disk is an NTFS formatted SATA disk sitting in a HDD cradle hence connecting over usb. I could connect it to a sata cable internal, would it then be possible to copy the files across?
Comment: tried several other methods such as installing the ntfs-3g driver but all roads lead back to this answer... so shall let it run :(  Many thanks
Comment: .....and its finally complete. 4 hrs later :) Thanks again Simon
Answer: SSH onto the ESXi Server - and use the command line.
You can enable SSH access from vSphere.
e.g cp /usb/path/* /vmfs/volumes/datastore1/
Comment: It's an NTFS formatted disk and when I plug it into the ESXi server, /usb/ doesnt exist.
Answer: enable ssh/scp access and then use scp client [like winscp] to copy the files.
how to enable it: here.
Comment: Thanks pQd. SSH enabled but I now need a way to copy from an NTFS USB disk to the local datastore.
Comment: @Christian you can copy it to another machine and then scp over the network.

Copying VMDK's onto ESXi local disk


How do I export my .hs contract to .Plutus?

Question: How do I export my .hs contract to .Plutus? Please provide step by step guidance.
Answer: You can find a good example in Exercise4-solution of Alonzo-testnet program.
Source code is here: plutus-helloworld, if you have any doubt check the code to understand what it does.
Basically you need to:

Create an executable plutus-helloworld as defined in plutus-helloworld.cabal file
Compile the plutus file using: cabal run plutus-helloworld -- 1 helloworld2.plutus
Build the address: cardano-cli address build --payment-script-file helloworld2.plutus --testnet-magic 8 --out-file helloworld2.addr

Then you can follow the exercise solution.


how can we solve a circuit with two opposing voltage sources using thevenin theorem

Question: i have been asked to solve a circuit using thevenin theorem but when i try to solve it to find Vth by loop analysis, i realized that both voltages are in opposing directions and i can't understand that how can i write the loop equation for it.

  [1]: https://i.stack.imgur.com/OK0QK.jpg
This is where I'm stuck. I want to find Vth.
Comment: make one voltage negative with respect to the other?
Comment: Where is Vth in this circuit?
Comment: Welcome to EE.SE. Please edit your question to show your work so far. That probably requires you to draw your current loops and write the equations. You need to show where you are measuring \$V_{Th}\$ as it is not shown on your schematic.
Comment: This looks very much like a homework question, so we will expect you to show some effort and ask a specific question.
Comment: I suggest you use a minus sign in your equations and capital I's in your question.
Comment: I think you might get another answer or two to this, but it would be wise to rotate your first picture, and retake, crop and rotate the second.  As an alternative, you can click the button with a (pencil, diode, capacitor, resistor) on it and use the built in schematic editor to add a schematic to your question.
Comment: Use KVL - there is only one mesh once you've removed R3.
Answer: You must apply the Superposition Principle.
It is about passivating one of the power sources and solving the unknown with the other power source. Next, the other source is passivated and again the unknown is solved with the source that was passivated in the first place.
In the case of voltage sources, passivation implies that the source is removed from the circuit and instead, an impedance equal to the internal impedance of the source is placed. If the circuit model is ideal, this corresponds to removing the voltage source and instead placing a short circuit.
If it is a question of current sources, we proceed in the same way, removing the source of the circuit and placing in its place an impedance equal to the internal impedance value of the source. If the model is ideal, the current source is removed and an open circuit is defined instead.
Take a look of my response to this question: Ohm's Law of a circuit which have both Voltage Source and Current Source
Answer: Your solution is wrong on Thevenin equivalent.
 In first you have to cut circuit on R1 and R4 nodes then work on remaining part.
 Thevenin euivalent is composed by a voltage source and a series resistor that is the one when you short voltage source and open current source.
When applyed to, R2 result in parallel to R3. As I read RTh is 16.67 or 2*25/3 not 10 (50?) Ohm as seen on your hand writing.
Equivalent Thevenin Voltage source is the voltage at node of cut circuit so it is voltage across R3 (on cut part)
 By voltage divider VTh = VR3= B2xR3/(R2+R3) 7.5x25/75 so it is 2.5V.
 Reconnect Thevenin Equivalent to R1 R4 then evaluate current loop: is the remaining voltage loop divided by resistance of loop:
 (B1+BTh)/(RTh+R1+R4)
Answer: I seen Martin answer checked as best answer but I cannot see Thevenin applied to.
 As from these two schematics, one can solve by cutting circuit from left or right of R3.
 Upper are original circuit with a rotated C where to cut.
 On bottom are Thevenin equivalent of original
On left Generator V1 remain untouched with R1 R4, Gen V2 and R2 R3 whre changed using Thevenin
On Rignt V2 remain untouched with R2 R3, Thevenin apply to R1 R2 R3

All voltmeter display 2.5V positive upper.
 Applying superposition,
 V1 on  V2 Off voltage across R2_3 result in 4V
 V1 OFF V2 On  Voltage across R1_3_4 result in -1.5V
 So voltage across the two nodes again result to be V11+V22 = 4+(-1.5) again 2.5V

simulate this circuit – Schematic created using CircuitLab


Asymptotic behavior of the sequence $u_n=\int_0^1\frac{e^{-t}}{t+\frac{1}{n}}dt$

Question: I am interested in the asymptotic behavior of the following sequence at infinity
$$u_n=\int_0^1\frac{e^{-t}}{t+\frac{1}{n}}dt.$$
I proved that $$\frac{1}{e}\log(n+1)\leq u_n\leq \log(n+1).$$
But can we find an equivalent of this sequence: i.e a sequence $v_n$ such that $$\lim_{n\to\infty}\frac{u_n}{v_n}=1$$
?
Answer: Via a change of variables $u=t+\frac{1}{n}$, you can rewrite
$$
u_n = e^{\frac{1}{n}}\int_{1/n}^{1+1/n} \frac{e^{-u}}{u}du\,.\tag{1}
$$
The factor $e^{1/n}$ goes to $1$ as $n\to\infty$, so the equivalent will be determined by the integral. Further, as the integral $\int_1^{1+1/n}\frac{e^{-u}}{u}du$ is finite and bounded between $0$ and $\int_1^{2}\frac{e^{-u}}{u}du$, the equivalent will be determined by the rest of the integral, i.e.,
$$
u_n \operatorname*{\sim}_{n\to\infty} \int_{1/n}^{1} \frac{e^{-u}}{u}du\,.\tag{2}
$$
Now, it not hard to show (e.g., by rewriting $\frac{e^{-u}}{u} = \frac{1}{u} - \sum_{k=0}^\infty \frac{(-1)^k u^{k}}{(k+1)!}$ and showing the second term is integrable on $[0,1]$ by theorems for power series) that this last integral is equivalent, when $n\to\infty$, to $\int_{1/n}^{1} \frac{du}{u}$, so that
$$
u_n \operatorname*{\sim}_{n\to\infty} \int_{1/n}^{1} \frac{du}{u} = \ln n\,. \tag{3}
$$
Therefore, you can take $\boxed{v_n = \ln n}$.
Answer: Integrating by parts once,
$$ u_n = \left[ e^{-t} \log{(t+1/n)} \right]_0^1 + \int_0^1 e^{-t}\log{(t+1/n)} \, dt \\
= \log{n} + e^{-1}\log{(1+1/n)} + \int_0^1 e^{-t}\log{(t+1/n)} \, dt ,  $$
and the remaining integral is bounded between $\int_0^1 e^{-t}\log{t} \, dt $ and $\int_0^1 e^{-t} \log{(t+1)} \, dt $, which are both constant and so $o(\log{n})$. The middle term is also $O(1/n)$, whence we conclude that $u_n \sim \log{n}$.
Answer: $$u_n = \int_{0}^{n}\frac{e^{-t/n}}{t+1}\,dt = \log(n+1)-\int_{0}^{n}\frac{1-e^{-t/n}}{t+1}\,dt $$
and it is not difficult to prove (by exploiting the convexity of the exponential function) that the inequality
$$ 0\leq 1-e^{-t/n} \leq \frac{4}{3}\cdot\frac{t}{t+n} $$
holds for any $t\in[0,n]$. In particular
$$0\leq \int_{0}^{n}\frac{1-e^{-t/n}}{t+1}\,dt \leq \frac{4}{3}\int_{0}^{n}\frac{t\,dt}{(t+1)(t+n)}\leq\frac{4}{3}\int_{0}^{n}\frac{dt}{t+n}=\frac{4}{3}\log 2\leq 1 $$
and $u_n=\log(n+1)+O(1)$. By the dominated convergence theorem
$$ \lim_{n\to +\infty}\left(u_n-\log(n+1)\right)=-\int_{0}^{1}\frac{1-e^{-t}}{t}\,dt $$
hence
$$\boxed{u_n = \log(n+1)+\sum_{m\geq 1}\frac{(-1)^m}{m\cdot m!}+o(1).}$$
Answer: By the MVT for definite integrals, there is $\xi\in(0,1)$ such that
$$
u_n = e^{\xi}\int_{0}^{1} \frac{1}{t+\frac1n}dt=e^{\xi}\ln(n+1)
$$
which implies $u_n=O(\ln n)$.
Answer: Hint: The reason $u_n$ is large is because of what happens for $t$ close to $0$. So  fix $\delta\in(0,1)$ and note that $$u_n\ge e^{-\delta}\int_0^\delta\frac{dt}{t+\frac 1n}.$$


iTerm2 Cannot open more than 6 windows

Question: It seems there is some sort of arbitrary limit in place for the number of iTerm2 windows I can have open on my Mac at one time. I can open up to 6 instances normally, but the 7th instance always closes with the following message:

I can't seem to find any answers on why this might be or how I can increase the limit on terminal instances. My RAM usage is well below the limit with only 6 of these running. I like to have multiple spaces set up that I can swap between and this issue is hindering me once I have a couple of workspaces created for different tasks. Is there a way I can get around this? I can open 7+ instances of my browser so this seems to be iTerm2 specific.
Comment: Not an answer, but I just opened 12 iTerm windows with no issues. I've a Mac Studio M1 Max with 64GB ram. I know of no iTerm setting that limits the number of active windows. I hope you get it sorted.
Comment: A web search with that precise error message shows results for Terminal as well as iTerm2. Related to shell settings.  Like @SteveM I get to 12 windows without issue.
Answer: I had the same problem.
I couldn't open more than 6 windows of iTerm2.
I didn't fix the exact problem, but I found a workaround.
There is a difference between open a new instance:

from inside iTerm execute open -n -a iTerm

In this case you'll see more icons in the dock, one for each instance
and open a new window:

click w two fingers on the iTerm2 icon and select "New Window (Default Profile)"

In this case you'll see only one icon in the dock, but you can open more windows.

I was using the first one, with a shortcut, and I wasn't able to open more than 6 windows.
But then I changed the shortcut to execute this:
osascript /[you_path]/new_window_iTerm.scpt

# new_window_iTerm.scpt
tell application "System Events"
    set isRunning to (count of (every process whose name is "iTerm2")) > 0
end tell
if isRunning then
    tell application "iTerm"
      set newWindow to (create window with default profile)
    end tell
else
    tell application "iTerm"
      launch
    end tell
end if

Now I can open more than 6 windows.
I hope this helps you.

iTerm2 Cannot open more than 6 windows


Automatically detect an image collage

Question: I'm trying to automatically detect if an image is a collage vs a single photograph. I'm not too concerned with difficult cases of artistic collages. What I'm trying to solve is rectangular collages like below. I've tried edge detection (canny) + vertical and horizontal sobel filtering + line detection (Hough transform) to try to identify perpendicular lines but am getting too many false positives. I'm not very good at image processing so any input would be welcome. Thx!
Answer: Here is a basic answer with some rapid experiments to show you what is possible to do with Morpholocical operations. Note that it is just a proof of concept, not a viable solution and you should improve it to better fit your problem.
First filter your image to detect edges. I used Canny but you may use a more appropriate one.

Then filter the BW result to keep only vertical and horizontal (hypothetical) lines by eroding the result with line structural elements. Here is the result for the erosion with a horizontal line of 5px:

Lastly sum each eroded images on its corresponding dimension. Here is the result of the sum of the previous image on the 2nd dimension:

From here you have to chose a threshold in order to infer the presence (or absence) of a collage. In the previous graph the sharp peaks indicate the position of horizontal boudaries of frames. A threshold value of 100 may be appropriate as it indicated that more that $1/3$ of the horizontal line is populated with edge pixels.
Comment: Thanks a lot. This looks promising. What do you mean by "eroding the result"? Like a horizontal or vertical Sobel filter?
Comment: No, erosion is a morphological operation, check the link in first paragraph.

Automatically detect an image collage


The real numbers are a field extension of the rationals?

Question: In preparing for an upcoming course in field theory I am reading a Wikipedia article on field extensions.  It states that the complex numbers are a field extension of the reals.  I understand this since $\mathbb R(i) = \{ a + bi : a,b \in \mathbb R\}$.
Then the article states that the reals are a field extension of the rationals.  I do not understand how this could be.  What would you adjoin to $\mathbb Q$ to get all the reals?  The article doesn't seem to say anything more about this.  Is there a way to explain this to someone who has yet to take a course in field theory?
Comment: See [here](https://math.stackexchange.com/questions/112859/basis-for-mathbbr-over-mathbbq).
Comment: it is a non algebraic extension it just a question of definitions
Comment: If one was truly inclined to do this, one could first take the field of rational functions (with integer coefficients) in uncountably many variables. If you take the algebraic completion of that, I think you'd end up with a field isomorphic to $\mathbb R$. This makes the idea of "extension" clear, but it's a nasty construction (and I'm not 100% sure it works) (The variables represent transcendental numbers, and using the axiom of choice, you can find a set of transcendentals from which no real is algebraically independent)
Comment: An [extension](https://en.wikipedia.org/wiki/Field_extension) is not necessarily a [simple extension](https://en.wikipedia.org/wiki/Simple_extension), or a [finite extension](https://en.wikipedia.org/wiki/Finite_extension) for that sake (Wikipedia links).
Comment: You could adjoin all of $\Bbb{R}$...
Answer: Saying "the reals are an extension of the rationals" just means that the reals form a field, which contains the rationals as a subfield. This does not mean that the reals have the form $\mathbb{Q}(\alpha)$ for some $\alpha$; indeed, they do not. You have to adjoin uncountably many elements to the rationals to get the reals.
Comment: @CogitoErgoCogitoSum Infinite sums aren't part of the field structure. $\mathbb{R}$ is not the smallest field containing $\mathbb{Q}$ (since $1\in\mathbb{Q}$ it's redundant to write "$\mathbb{Q}(1)$"); that's just $\mathbb{Q}$ itself. Every real is of course expressible as an infinite string decimals, but that doesn't mean $\mathbb{Q}$ isn't a field.
Comment: I know its redundant to say $Q(1)$. Thats why I said "loose with notation". Is that really the only criticism you have? I didnt say Q wasnt a field. Where are you getting any of this? I was just trying to point out that every real is an (infinite) sum of rationals.  I didnt know it was forbidden to take infinite sums.  Arent the algebraics taken on whole an infinite extension upon the rationals?  The set of all algebraics necessarily includes real numbers that are the sums of infinitely many different roots, do they not? They have to be for closure.
Comment: I realize Im late to the party but I recently started learning this subject. I understand your argument but am thrown off by an observation.  Wouldnt you agree that all real numbers are an infinite sum of rationals?  $\pi = 3.1415\ldots = 3 + \frac{1}{10}+\frac{4}{100} +\frac{1}{1000}+\frac{5}{10000}+\cdots $.  Each of those addends are a product of 1 and an element out of $\mathbb{Q}$. So being very loose with notation, $\mathbb{R} = \mathbb{Q}(1)$.  I suppose the argument fails if not every real number is expressible in an infinite string of decimals?!
Comment: @CogitoErgoCogitoSum I don't understand what you're getting at here. For $\alpha$ a real, "$\mathbb{Q}(\alpha)$" is the smallest **field** containing $\alpha$. Since there's no requirement that fields be closed under infinite sums in any sense the fact that all reals are infinite sums of rationals isn't relevant. (If you mean something else by "$\mathbb{Q}(\alpha)$" you should explain *what* you mean.) "The set of all algebraics necessarily includes real numbers that are the sums of infinitely many different roots, do they not?" No they don't. You're mixing up two very different concepts here.
Comment: At this point I'm not really sure what you're claiming, or disputing in my answer. Can you state precisely what your point is? (Maybe you're asking about the relation between *algebraic* and *topological* closure? $\overline{\mathbb{Q}}$ is algebraically closed, but is not a topologically closed subfield of the topological field $\mathbb{C}$ (at least, with the usual topology).)
Answer: For $\mathbb{R}$ to be field extension of $\mathbb{Q}$, all we need is that $\mathbb{R}$ is a field containing $\mathbb{Q}$ as a subfield. That's definitely true.
The construction is a bit more delicate and analytic in nature: $\mathbb{R}$ is the completion of $\mathbb{Q}$ and is substantially larger. Since $\mathbb{R}$ is uncountable, it's not an extension of finite degree, meaning that you cannot write $\mathbb{R} = \mathbb{Q}(a_1, a_2, ..., a_n)$ for some finite sequence of symbols $a_i$ (nor even a countable sequence). You have to adjoin uncountably many symbols.

If you're interested in a way to construct reals from rationals, take a look at Dedekind cuts.
Comment: The reals are a fundamentally analytic or topological thing, there relevant stems from being complete, and this is decidedly non-algebraic. But there are two things you might recall: a construction of the reals that uses a bit of algebraic jargon and even results. Something like the set of all Cauchy sequence of rationals is a commutative ting and the  subset of sequences that have limit zero are a maximal ideal. The quotionent is a field and these are the real numbers. Or, it is was about the algebraic closure of $Q$.
Comment: @quid Ah, I think you're right - it was about $\mathbb{C}$ containing the algebraic closure while avoiding any complex analytic methods.
Comment: As an addendum that I'm not sure about, I seem to recall reading an almost completely algebraic construction of $\mathbb{R}$ from $\mathbb{Q}$ in terms of some sequence of field extensions - probably in Lang or Hungerford. If someone can confirm / correct this, I'd appreciate it.
Answer: You are confusing field extension with an algebraic field extension. In the former case, you only need a non trivial field homomorphism from the rationals to the reals, which will be injective.
Answer: The field extension is of a quite high degree. You need to adjoin infinitely many elements (more precisely continuum many). Nobody can give you an explicit list, at least not a non-redundant one.
A field $L$ being an extention of the field $K$ just means that $K \subset L$ and the operations on elements of  $K$ are the same when considered in $K$ and in $L$.
So it really just says the rational are a subset of the reals, and it does not matter whether I add and multiply two rationals thinking of them as rationals or as reals.
Answer: Several people here have already noted that, while $\mathbb{Q}$ is a subfield of $\mathbb{R}$, this fact isn't "caused" by the same explanation as $\mathbb{R}$ being a subfield of $\mathbb{C}$. Pithily, $\mathbb{C}$ is an algebraically complete algebraic extension of $\mathbb{R}$ while $\mathbb{R}$ is a metric-complete metric extension of $\mathbb{Q}$.
If $N$ is a norm on a ring $R$, we can define Cauchy sequences in $R$ with respect to $N$ as those $(x_n)$ with $\forall \delta \in \mathbb{R}^+ \exists N\in\mathbb{N} \forall m,\,n \in \mathbb{N} (m,\,n > N \to N(x_m-x_n)<\delta)$. We can also define null sequences in $R$ with respect to $N$, viz. $\forall \delta \in \mathbb{R}^+ \exists N\in\mathbb{N} \forall n \in \mathbb{N} (n > N \to N(x_n)<\delta)$. We call Cauchy sequences $(x_n),\,(y_n)$ equivalent if $(x_n-y_n)$ is a null sequence. We can think of equivalent Cauchy sequences as "having the same limit", even if that limit does not exist in $R$. We say $R$ is metric-complete if it contains its Cauchy sequences' limits; for the choice $N(x)=|x|$, $\mathbb{R}$ is metric-complete but $\mathbb{Q}$ does not. Indeed, just as we may identify $\mathbb{C}=\mathbb{R}[i]$ with $i^2=-1$, we can identify $\mathbb{R}$ with the set of equivalence classes on $\mathbb{Q}$ with $N(x)=|x|$. Each real number is one such equivalence class. For example, $\sqrt{2}$ is the set of Cauchy sequences $(x_n)$ in $\mathbb{Q}$ for which $x_n^2 \to 2$.
If you want something to which to compare the $\mathbb{Q}$-to-$\mathbb{R}$ extension, you can consider the $p$-adic numbers. These are obtained the same way, but with a different choice of $N$. The trivial norm $$N\left(x\right)=\left\{ \begin{array}{cc}
0 & x=0\\
1 & x\neq0
\end{array}\right.$$ obtains only eventually constant Cauchy sequences, which are equivalent iff their eventually constant values match, so $\mathbb{Q}$ is metric-complete with respect to this choice. It can be shown the only other norms on $\mathbb{Q}$ are the $p$-adic norms; for fixed $p\in\mathbb{P}$ define $$\text{ord}_p x=\inf {k\in\mathbb{Z}|p^k x\in\mathbb{Z}},\,N(x)=p^{-\text{ord}_p x}.$$Now we get different Cauchy sequences and different equivalence classes of them (as we have different null sequences), and the $p$-adic numbers $\mathbb{Q}_p$ differ from the reals (as well as the $q$-adic numbers for $q\in\mathbb{P}$ with $p\neq q$).
All metric completions of $\mathbb{Q}$ are also field extensions. They can all be algebraically extended by introducing an imaginary unit; there are also complex $p$*-adic numbers* $\mathbb{C}_p$.
Comment: The set of primes.
Comment: +1 for the pith in the first paragraph. One question: I'm assuming $\mathbb{P}$ refers to some "well known" set, but I haven't see that before. What does $\mathbb{P}$ denote?


Practical differences between SVG and Canvas within a ggvis & Shiny Context

Question: I have already read
What is the difference between SVG and HTML5 Canvas?
&&
https://en.wikipedia.org/wiki/Canvas_element#Canvas_versus_Scalable_Vector_Graphics_.28SVG.29
So i am aware of the basic differences, but i was wondering if anyone had encountered any practical difference between the two within the context of ggvis and shiny apart from SVG inability to deal with NA's in the data
Answer: The short answer:
SVG would be easier for you, since selection and moving it around is already built in. SVG objects are DOM objects, so they have "click" handlers, etc.
DIVs are okay but clunky and have awful performance loading at large numbers.
Canvas has the best performance hands-down, but you have to implement all concepts of managed state (object selection, etc) yourself, or use a library.
The long answer:
HTML5 Canvas is simply a drawing surface for a bit-map. You set up to draw (Say with a color and line thickness), draw that thing, and then the Canvas has no knowledge of that thing: It doesn't know where it is or what it is that you've just drawn, it's just pixels. If you want to draw rectangles and have them move around or be selectable then you have to code all of that from scratch, including the code to remember that you drew them.
SVG on the other hand must maintain references to each object that it renders. Every SVG/VML element you create is a real element in the DOM. By default this allows you to keep much better track of the elements you create and makes dealing with things like mouse events easier by default, but it slows down significantly when there are a large number of objects
Those SVG DOM references mean that some of the footwork of dealing with the things you draw is done for you. And SVG is faster when rendering really large objects, but slower when rendering many objects.
A game would probably be faster in Canvas. A huge map program would probably be faster in SVG. If you do want to use Canvas, I have some tutorials on getting movable objects up and running here.
Canvas would be better for faster things and heavy bitmap manipulation (like animation), but will take more code if you want lots of interactivity.
I've run a bunch of numbers on HTML DIV-made drawing versus Canvas-made drawing. I could make a huge post about the benefits of each, but I will give some of the relevant results of my tests to consider for your specific application:
I made Canvas and HTML DIV test pages, both had movable "nodes." Canvas nodes were objects I created and kept track of in Javascript. HTML nodes were movable Divs.
I added 100,000 nodes to each of my two tests. They performed quite differently:
The HTML test tab took forever to load (timed at slightly under 5 minutes, chrome asked to kill the page the first time). Chrome's task manager says that tab is taking up 168MB. It takes up 12-13% CPU time when I am looking at it, 0% when I am not looking.
The Canvas tab loaded in one second and takes up 30MB. It also takes up 13% of CPU time all of the time, regardless of whether or not one is looking at it. (2013 edit: They've mostly fixed that)
Dragging on the HTML page is smoother, which is expected by the design, since the current setup is to redraw EVERYTHING every 30 milliseconds in the Canvas test. There are plenty of optimizations to be had for Canvas for this. (canvas invalidation being the easiest, also clipping regions, selective redrawing, etc.. just depends on how much you feel like implementing)
There is no doubt you could get Canvas to be faster at object manipulation as the divs in that simple test, and of course far faster in the load time. Drawing/loading is faster in Canvas and has far more room for optimizations, too (ie, excluding things that are off-screen is very easy).
Conclusion:
SVG is probably better for applications and apps with few items (less than 1000? Depends really)
Canvas is better for thousands of objects and careful manipulation, but a lot more code (or a library) is needed to get it off the ground.
HTML Divs are clunky and do not scale, making a circle is only possible with rounded corners, making complex shapes is possible but involves hundreds of tiny tiny pixel-wide divs. Madness ensues.
I have past content from the following link.
Please see this link for more details
HTML5 Canvas vs. SVG vs. div
Comment: Haven't done a full diff, but this seems almost entirely copy+pasted from the answer referenced at the end (which doesn't really excuse the massive plagiarism). https://stackoverflow.com/a/5883032/18484


What is the expression for playing out several theoretical scenarios?

Question: Is there an expression to describe the act of thinking about all the possible scenarios that might happen? For example, an army general might envision possible attacks from the enemy in order to come up with a response plan. The Pentagon might run simulations to identify security weak-points to our infrastructure. In business, one might think about various possible actions and play them out in their mind or conduct a thorough analysis. The end-goal for this type of thinking process is typically to predict what might happen and decide what the next best action is. Is there a term for this, like war-gaming?
Comment: Newspeak and already getting old:  blue-sky thinking.
Comment: There is the unattractive *game theorizing*. Hopefully, someone can do better.
Answer: From MW:

contingency plan
a plan that is made for dealing with an emergency, or with something that might possibly happen and cause problems in the future:
a contingency plan for sth/doing sth Companies wishing to apply for a hazardous waste transporter license must submit a contingency plan for responding to any type of incident.
...
contingency planning
The report says there was a lack of contingency planning for a crisis in London's markets.
Answer: A common expression, probably enough of a 'set phrase' to include as an 'answer' is

plan[ning] for every eventuality.

I haven't found it in a list of set phrases, but ludwig.guru's site lists some examples of it being used.


Can I withdraw proceeds from covered call selling?

Question: Suppose I have the funds to buy exactly 100 shares of SPY in a regular, taxable (i.e. not 401K or IRA) account.   I then sell at or in the money covered calls one year out, say Jan 2019 calls.   This will result in a deposit in my account.   My question is:  can I withdraw the proceeds from the sale immediately (or after a few days)?  Or do I have to wait until the shares or assigned (or the call expires)?
Answer: It will depend on your broker's policies, but yes you should be able to withdraw the cash just as if you had sold stock.  From a collateral standpoint there's nothing that the cash will be needed for later (unlike, say, selling a covered call where you need to hold the underlying stock to ensure that the call can be exercised).
Comment: selling a covered call basically puts your SPY shares in escrow for the contract period. At the end of the period, if they are in-the-money, they are taken from you; otherwise out-of-the-money you get to keep the shares. either way, you keep the credit for selling the contracts.
Comment: It is subject to the broker's margin rules which vary depending on whether it is a cash account, margin account or portfolio margin account.  The stock covering the call is sufficient collateral in each case - more than sufficient in the last two, so could be withdrawn as well, but could make your portfolio subject to margin call risk.
Answer: The premium received from selling the covered call is yours to do with as you wish.  You can leave it there, withdraw it or use it to buy something else.
For example, you could buy 100 shares for $27,600.  Then seconds later, you sell the  Dec '19 275 call for  $29 and the $29 is now in your account.
OTOH, you could place a Buy/Write for $247.  Upon execution, the cost is the same but there's no premium sitting there in cash.
Either way, it costs $247 per share.
The only situation where you could not withdraw the $29 would be if other positions created a margin problem and withdrawing the $29 would put you in violation of the minimum margin maintenance level.


Rmagick composite image without source

Question: I have a Gallery model and a Post model.  Each Post has an image, and I would like to create a composite image for each Gallery based on the posts in that gallery.  I have a method for galleries that returns urls to the top 4 images in the gallery:
gallery.images_for_preview # => returns array of 4 image urls (200x200 images)

I'm using Carrierwave + RMagick to generate a composite image. I'm trying to follow along here: http://railscasts.com/episodes/374-image-manipulation but it seems my use case is slightly different. I have:
class GalleryImageUploader < CarrierWave::Uploader::Base
  ...
  def store_dir
    "galleries/#{model.obfuscated_id}"
  end

  version("full") { process :full_image }

  def full_image
    images = model.images_for_preview
    puts images
    manipulate! format: "png" do
      image0 = Magick::Image.read(images[0]).first
      image1 = Magick::Image.read(images[1]).first
      image2 = Magick::Image.read(images[2]).first
      image3 = Magick::Image.read(images[3]).first
      underlay = Magick::Image.new(406, 406) { self.background_color = "#333333" }
      underlay.composite!(image0, 2, 2, Magick::OverCompositeOp).composite!(image1, 204, 2, Magick::OverCompositeOp).composite!(image2, 2, 204, Magick::OverCompositeOp).composite!(image3, 204, 204, Magick::OverCompositeOp)
    end
  end

The full_image operation doesn't require a source file, but the only way I can seem to get it to generate the composite image is to do something like:
gallery.remote_image_url = "path/to/image"

which generates the image I need at /galleries/:id/full_image.png but also processes and generates an image at /galleries/:id/image.png
Is it possible to skip the "source" image and just generate a composite, then upload that as the ImageUploader's primary image?
Answer: Yes, just process the data on the go, no need for the version itself:
Replace this line:
  version("full") { process :full_image }

With this one
  process :full_image

Rmagick composite image without source


Why would a bind mount unmount unexpectedly?

Question: I have configured some bind mounts on all users's home directories to access a shared directory (or parts of it) that is somewhere else in the file system, so I have entries like these on my fstab file:
<code>/application/data/repository    /home/sergio/repository    none    bind
/application/data/repository    /home/mario/repository    none   bind
/application/data/repository/reports /home/carlos/reports    none    bind
</code>
Yesterday before I left the office all the binds where working as normal, however when I came to work today one of my users reported me that he couldn't access the shared folder. When I went into the server I discovered that all bind mounts were unmounted.
I went searching through the logs to see if there were any sign of someone else unmounting the bind mounts but nothing, the server did not reboot, no signs of intrusion attempts. No signs of errors in any of the log files.
I'm puzzled because I don't understand how can all the bind mounts get unmounted just like that. Just to be sure I changed all users's passwords and reviewed the firewall rules to make sure only authorized location have ssh access to the server.
Do you know of any reason for this? Any reason for the system to unmount the bind mounts?
I searched through the net but can find anyone reporting this kind of incident.
Answer: You should check the cron files for whatever is inside /etc/cron* and if any "sudoed" users got a cron inside /var/spool/cron/crontabs/ that could umount something.
autofs can also do stupide stuff with mount binds, but I've never seen it happen.