What is the use of the multiple random appended characters after ASPSESSIONID?

Question: I have noticed this on several cookies that I have collected over time from different sites. The cookie will be named: ASPSESSIONIDAQSDTADTG or something similar. I realize that ASP appends these randomly generated characters onto the end of the cookie base: ASPSESSIONID
but I have never come across the reason why. It's probably something simple I missed, but a search online did not give me the answer. I realize that these cookies try to differentiate themselves from each other, but why is this a requirement of ASP classic? Why is this different than ASP.NET's standard ASP.NET_SessionId?
Answer: This is old question but I will leave my 5 cents tip. I found a reference for this matter.
| ASPSESSIONID |            JHSDFEKK            | KJSHFWEJNDFSERFWERKJNLKE |
|--------------|--------------------------------|--------------------------|
| cookie name  | IIS process number transformed |     session instance     |

But I couldn't find official resource.
Answer: Sessions
HTTP is a stateless protocol. This means HTTP servers would respond to each client request without relating that request to previous or subsequent requests. RFC 2109 introduced state management mechanism to HTTP.
This RFC basically introduced two header directives: Cookie and Set-Cookie. Set-cookie directive sets the session cookie and sends to the client browser indicating beginning of a session. From now on each request from this browser would contain Cookie directive in the header which indicates that the request is part of the current session.
Session management in ASP session and concerns

When the first request comes from the client browser, it marks the beginning of a new session. This means that a session object is created and a session id is assigned to this session object on the server. This session id is now sent to the browser in an encrypted form as a session cookie. The browser will store this cookie in memory for entire duration until the browser is closed. Each subsequent request from the browser will send this cookie as part of the header. The server on receiving the cookie will know the corresponding session id and hence the sessions object.
The session ID is a read-only value that uniquely identifies the current clients to the Web server. In classic ASP, session IDs are assigned in a sequential manner i.e., the session ID 981249305 is followed by the session ID 981249306, and so on. The session cookie for session ID 981249305 would be stored on the client machine as the cookie
ASPSESSIONIDJHSDFEKK=KJSHFWEJNDFSERFWERKJNLKE

Classic ASP does not support any method to enforce the change of cookie value.
So, answering your question, this "randomly generated characters" it's a way to generate a cookie that never existed before.
Comment: Could you please elaborate? Why does ASP classic require cookies to be named uniquely. How does this contrast with ASP.NET's uniform ASP.NET_SessionId?
Comment: I fully understand how sessions work and the creation of session cookies. The characters that I'm talking about specifically are "JHSDFEKK" on the left hand side. Unless I wasn't following your answer correctly, I believe you described the actual value of the session cookie as opposed to the naming conventions of the cookie. Could you update your answer and focus on the naming convention rather than how sessions work? Thanks.
Comment: like I said:

"Answering your question, this "randomly generated characters" it's a way to generate a cookie that never existed before."


Solid State Relay in NC configuration

Question: Is it possible to build an SSR relay circuit for controlling 240VAC (using TRIAC and other components) with NC configuration?
The idea is to keep the AC circuit closed, even when there are failures in the driver side (like a power supply failure or some control side failure)
Answer: They're widely available commercially from more than a dozen suppliers around the globe, so the answer is "yes" it is possible.
Comment: Can you share the components used and a circuit diagram?
Comment: I don't have the internal circuit diagrams- manufacturers are not keen on sharing their proprietary designs. There are a variety of ways of going about it, but basically it boils down to using the AC power to trigger the triac and inhibiting that when an input is presented. One more-or-less obvious way would be to use a HV depletion-mode MOSFET and a bridge rectifier with a PV optoisolator driving the gate.

Solid State Relay in NC configuration


Edit the email before sending with InfoPath form

Question: I am using InfoPath in SharePoint which sent automatic mail up on submit. I was wondering is there any way that we see and edit the email before sending it.
Comment: Rinu, are you sending email via InfoPath code-behind, rules or SharePoint Workflow?
Comment: SharePoint workflow
Answer: Yes you can edit the email's content before sending. Create a column in your form library and put the email content inside it. In the SharePoint workflow, click inside the email body area and click Add or Change Lookup. Now select the Field from source the column that you created. Now before submitting the InfoPath form you can anytime edit/change the content inside this new column and the email body will carry the new text.
Even you can change the email recipients, Subject exactly the same way by creating custom column and referencing it through Field from source. For email recipients click on the book icon and choose Workflow Lookup for a User.
This is the only way I know you can edit the email before sending else email editing is only possible at design time in SharePoint Designer.

You can have an attachment control on your InfoPath form. Check this ARTICLE.
Create a prompt message using Rules in InfoPath and remind the user to attach the file before submitting the form.
Comment: Hi Zakir, Thanks for the Reply, I have done the above but what i had issue is when the user clicks submit the infopath form should allow open up the outlook with all the content of the form. and the user should be able to attach a file before sending it. I know that sharepoint workflow sends the email automatically upon submit with all the information entered from the infopath . But what i need is to prompt before sending the email so that we can attach a file to it. I use sharepoint list form where the attachment is stored in the sharepoint.
Comment: is there any chance that we can store the attachment localy in the infopath form. I created a sharepoint list and click customize using infopath form. but i can only find one attachment field which is stored in the sharepoint and no attachment control is available in control are available either.
Comment: pls see my amended answer above.


With and without autoincremented id performance

Question: I am using myqsl an sql server for quite long time. I am C# developer. I always used to create for each table first column Id as primary key and auto-incremented. Last time i saw my colleague (also C# developer) are not using it at all - no id at all. I found lot of issues when there is no id with pk and ai - hard to delete records etc... Our last conversation was also about performance. He said for performance is better to not use Id with auto increment pk for big data. I would like to get your feedback what's the fact?
Comment: Another one reason. One field must commonly carry out only one function. PK function is to identify the record unique during the whole period of table (not record!) life. When PK is natural one, it performs two different functions - store data and identify record. It's bad in most cases, moreover, while change the structure in future this functions can became conflicted.
Comment: Does your colleague use a natural key?
Comment: @Vérace Not sure but i dont think so.
Comment: To create links between data stored in tables You **must** have unique key in table on the 'one' side of link. In MySQL the difference between primary and unique key is small except the absence of PRI leads to small (6 byte per record for InnoDB, for example) overhead. While You use natural, not synthetic, pri/uni key for linking, which are of string type in most cases, You almost certainly decrease the
performance of Your queries.
Comment: @Akina Our tables contains milions of data. Specific tables contains either raw data and also upper level tables which are based on inner joins based on raw datas, however my colelague are not making AI PK along all tables he said that its not good regarding performance.
Comment: Millions of data is not even small. This is 2018 - tables in large databases can span hundreds of gigabytes. Generally anything that is smaller than the memory of a mid range server is not large. A mid range server now is around 256gb memory.
Comment: Your colleague SUBSTANTIATE this statement or only SAID it? Words without theoretical justifications, proofs and/or experimental measurements costs nothing. I can believe He's right in Your particular case but I'm sure He's **NOT** right generally.
Comment: @Akina The question could be simpler: Does Id column PK AI is not affecting performance and why.
Comment: Dedicated autoincremented unique/not-null field is not mandatory but it is very useful and convenient because it is generated internally and separated from data.
Comment: *Does Id column PK AI is not affecting performance and why.* Additional field always decrease performance itself. But in complex synthetical PK AI increase performance in most cases compared with natural (especially string-type) PK.
Answer: Let's categorize things into 3 buckets:
Case 1: No natural PK.  Then do have an AI.  Soner or later, you will find that having it makes maintenance easier.  Example: Deleting or modifying a specific row due to a data error.  That is, do not depend on the hidden PK that InnoDB will generate.
Case 2: There is a natural PK and you need an index by that column(s).  Bingo!  A PK is an index, so you can get the performance benefit of the index inherent in a PK.  Plus you avoid the space, clutter, etc, of the AI.
Case 3: Natural PK possible, but indexing it is not needed.  Now we are in a gray area.  Flip a coin.  Or, since a VARCHAR is slightly slower for indexing, pick the INT AI.
Case 4: (Yeah, I started with 3 buckets.)  If the table is PARTITIONed, a lot of additional considerations come into play.  I won't go into them in this Q&A.
Let me provide an example of Case 2 -- a many-to-many mapping table.
A lot of people build essentially
CREATE TABLE A_to_B_mapping
    id INT AUTO_INCREMENT,       -- not used
    id_a,  -- link to table A
    id_b,  -- link to table B
    PRIMARY KEY(id),
    INDEX(id_a),  -- for joining from `A` to `B`
    INDEX(id_b)   -- if going the other way
)

But this would be much better:
CREATE TABLE A_to_B_mapping
    -- no AUTO_INCREMENT,      -- saving space
    id_a,  -- link to table A
    id_b,  -- link to table B
    PRIMARY KEY(id_a, id_b), -- PK, covering, unique, and for joining from `A` to `B`
    INDEX(id_b, id_a)   -- if going the other way, now 'covering'
) ENGINE=InnoDB;        -- so PK is 'clustered'

A "Covering" index is an INDEX that has all the columns needed anywhere in the SELECT.  A non-covering index must reach into the data BTree (after reaching into the index BTree) to get the rest of the columns.  That is, "covering" is more efficient.
Note:  Even if the ids are VARCHAR, the benefit of 'covering' outweighs the string-vs-int argument.
More on many-to-many:  http://mysql.rjweb.org/doc.php/index_cookbook_mysql#many_to_many_mapping_table
Another Case 2 example:  wp_postmeta is inefficient .  That applies to other EAV schemas, as well.
I find that 2/3 of the time, a 'natural' PK can be made from a column (or combination of columns).
Comment: *Case 2: There is a natural PK and you need an index by that column(s). Bingo!* You forget one word. **NOW**. Imagine for a moment that in the future this provision will change for some reason which is now unpredictable... and uniqueness of this natural PK became a dust.
Answer: InnoDB engine autocreate the internal PK if it isn't declared explicitly. That PK is autoincremented integer anyway so there is no performance difference between table with or without explicit id field. Single-column index is faster then multicolumn ones and INT-based index is faster than other types.
The only difference is that you can refer to the explicit id field and can't refer to the hidden field created by engine.
Comment: so that means i cannot use Innodb's autogenerated one. Therefore creating col Id AI PK is good habbit? How could i explain it to my colleague who saying it's bad for performance.
Comment: You can refer to the chapter 188.8.131.52 of the mysql manual. Separate `id` field contains not only some tag to tell one record from another but also the order rows been inserted into the table. That additional information can become crucial in some cases. As far as that column/index exists anyway it is better to have the control over them.
Comment: Also we can't rely on incoming data to be unique/not-null to use column(s) for PK. Additional autoincremented field is more (not absolutely) reliable .
Comment: has really nice information but i still not see anything about performance my colleague is refering to.
Comment: InnoDB creates this 6-byte internal column only if there is no PRIMARY KEY defined and no UNIQUE constraint on NOT NULL columns. If there is one of the above, it doesn't add anything.


Is a period used after a stand alone phrase?

Question: If you have a stand-alone phrase, such as "Serving Washington and the United States since 1700" as your brand, should it have a period after it? I say no but our graphic designer insists on putting one. Am I just viewing things from older eyes?
Comment: "Should it have a period after it?"  It should probably explain how that is possible after it.
Answer: No, you don't need one. I agree with you that it looks better without one.
Consider UPS whose slogan is "synchronizing the world of commerce". They don't use a period:

The following image has quite a few corporate taglines:

Most don't have periods. The ones that do do so to be more assertive, which is not something your particular tagline has to convey. The only exception is Microsoft's which is two separate clauses.


Error accessing the Cache in the Application_Start method of Global.asax

Question: I am trying to access the Cache in the Application_Start method of Global.asax. I am trying to accdess Context.Cache. When I run the code from visual studio it works just fine but when I run it on the server from IIS I get: Session state is not available in this context. I want to seed some values in the cache when the application starts. How can I get at the cache from Application_Start?
Answer: Wow. I found the answer to this. Use the variable HttpRuntime.Cache instead of Context.Cache.
Answer: Yes, this changed in IIS7 with the switch to integrated mode. Application_Start executes earlier so the HttpContext is not available.
Visual Studio uses Cassini which differs from full IIS in several ways. Check out the newly released IIS Express which can also be used with Visual Studio. It's a self-contained version of IIS 7.5 so you won't hit problems in production that didn't exist when testing using Cassini.


Is it okay if I give an upvote to all the answers of my question?

Question: I asked a question on Stack Overflow and I found that all the answers are good, and I learned from all of them. Is it okay to give an upvote to every answer? Or is that bad for some reason?
Comment: In particular, try to avoid to upvote a post *just because they answered*. Your gut reaction may be to upvote everything and everyone, but as said, the votes on Stack Overflow are used to determine "helpfulness of an answer", and if every answer got upvoted by way of "it did not work but still +1 for effort", then votes have no value anymore.
Comment: If the answers are good, then yes, by all means, up-vote them all. You vote based on your perception of answer quality.
Comment: Please vote on the quality of each answer, separately. Do not try to add any other parameter to the vote: it should only represent the quality of the answer you're voting on. If they're all good, upvote all. If only some are good, only upvote those. If none are good, don't upvote. Simple! :)
Comment: because sometimes you answer a question, saving OP from spending hours trying to figure it out. Then instead of upvoting your answer and marking it as correct, either he says "thank you" or does not answer anymore lol @viper
Comment: @usr2564301 yes, it happens too often
Comment: @usr2564301 thanks sir I understand its true if I give upvotes without any reason then votes have no value
Comment: I wish all people that ask questions are like you
Comment: @PeterHaddad why ?
Comment: well I understand peter thanks
Answer: Generally, upvotes are yours to do with as you please, except:

If you target a user with upvotes, i.e. Upvote every post of theirs you come across regardless of merit, or go through their profile and upvote all of their posts there.
If you make a second account to upvote yourself.

Aside from those cases, there aren't strict, enforceable rules for what to upvote.
The guideline is to upvote good, clear, helpful posts. From the sounds of it, the answers on your question meet this criteria, so definitely feel free to upvote them!
Upvotes and downvotes are our main quality control metric. So if you find the quality of a post to be good and in line with our standards, go for it. Your vote is anonymous anyway.
A good way to remember this:
If you vote on the post based solely on quality and only when you organically/naturally come across them, without regard for who posted it, you'll be fine. If you vote on the person posting, you're running down a bad path.
Comment: @viper Simply vote on the answers you come across without considering who wrote them, only their quality.  If you do that, there's basically no chance at all that the votes will be deemed fraudulent.
Comment: so it is bad if I target a specific user to upvote
Comment: Yes. In fact, we have systems to catch this. Now if that user posted multiple answers to your post and all of them happen to be good, that's a different matter. But if you try to thank them by upvoting all of their posts, that'll just get reversed by the system, and could even get you a suspension.
Comment: thanks for the answer to every senior I understand now I just give the upvote if they are right
Comment: @Servy it's a pity that you can't browse a user's catalog and vote as your conscience dictates (without fear of reversal).
Comment: @canon I know what you mean, but it's *extremely* hard to be objective when you immerse yourself in a single user's posts.
Comment: If you mean marking answers by the same user with the checkmark on different questions, no issues there so long as it's not two accounts run by the same person. (People do try that...) In some smaller tags, that can actually happen a lot! If you mean upvoting... It's a matter of how natural the votes are. If they're correctly answering your questions and you upvote that answer _as it happens_ and don't specifically hunt it out... That's also acceptable.
Comment: @canon Well played! :)
Comment: one more thing sir suppose if a same user give answers to my questions and if they are correct and I mark them correct, so is there be a problem if I mark all the answer right to the same user
Comment: @PM2Ring Objectively, I find that assertion extremely subjective.
Comment: I follow several users and upvote most of what they ask or answer, but only if it is good – and it usually is. It would be a shame if that got flagged as I believe it is appropriate.
Comment: @Servy and kendr  upvote on comments with same two accounts continuously will also go to the circumstances of suspension???... Please confirm
Comment: @AnthonyWinzlet Honestly can't tell you on that one. I mean, comment upvotes are basically meaningless, so... Maybe not? I think that'd be a question to post to all of meta, rather than in the comments here. I don't know how the mods would handle that if they came across it.
Answer: When in doubt, refrain from voting. Definitely don't upvote just because someone made the effort to type something in the answer box.
If you're talking about this question, there's three answers:

https://stackoverflow.com/a/50002185/: this answer, which you accepted, tells you what to do, but not why (apart from "make a strong reference" which seems plausible at best) or why that would solve your problem. I wouldn't upvote.
https://stackoverflow.com/a/50002320/: "Try this: [code block]". Not a good answer, definitely don't upvote.
https://stackoverflow.com/a/50002286/: that's a comment asking for clarification ("Is X the case? Then do Y"). That's not an answer, but should be a comment. Definitely don't upvote.

As a side note, as you did under the answer you accepted, don't go ask new questions in comments under an answer.
Comment: @CodeCaster: I think you mean "I'll never *back* down on my ... stance".  The phrase "double down" means to take an even stronger position, as in doubling your bet on something in a gambling game.  In this case, doubling down on that position might be to advocate *downvoting*, rather than just not-upvoting.
Comment: You are a bit hard-ass about it.  Keep in mind that he's in the role of the OP and will actually pursue the suggestions.  Unlike a random by-passer.  If they turn out to be accurate/helpful then an upvote is not wrong.  Ideally with a comment that states that the answer was in fact correct so the poster can tweak it.
Comment: thanks for explaining Sir I remember these things in future, for newbies like me its hard to understand the things going on SO
Comment: Sure, you don't have to.  It is the OP's prerogative.  The vast majority of them often already aware that the question is too vague to empower 100% correct answers on the first try.  Such is life in the stacks.  Fwiw, I personally find answers that give no indication at all that the post is based on some amount of guessing a lot worse.
Comment: While perhaps not broadly answering the question, this answer does analyse the answers to the original SO question in a way in which I completely agree. I see no "hard-assing" here. Voting using your actual brain is crucial to the quality of the site.


javafx desktop app xml operations

Question: I have one javafx desktop app to be prepared which needs some xml operations like create xml, insert - retrieve data from xml, etc.
Which is the best way/api to achieve this?
Thanks
Answer: Without a doubt, the Java api you would use for that, as JavaFX solely focus on UI generation, and not on general operations.
EDIT
My best guess, were your files small, is to use JDOM, as it is a simple yet powerful Java XML Api.

javafx desktop app xml operations


How does wavelength affect scattering of light rays?

Question: I am asking how wavelengths affect scattering(not diffraction). We know lesser the wavelength, greater is the scattering. For example, violet ray(wavelength 0.4 micron) is scattered most and red ray(wavelength 0.7 micron) is scattered the least among the visible light rays. But, I am asking WHY does this happen?
Comment: You need to look up Rayleigh scattering.
Answer: Briefly:  radiation is generated by accelerating charges.  The acceleration of a charged system is equal to the second derivative of position w.r.t. time.  An oscillating charge produces an oscillating field:  a radiating wave.  For a sinusoidally varying  charge, the second derivative is proportional to the square of the frequency of the wave, so the intensity of the radiation is proportional to the frequency squared.
The process of exciting a charged system into a state of oscillation is the same process in reverse:  an oscillating field produces an oscillating charge.  The amplitude of the charge oscillation is proportional to the frequency squared.
For scattering, both mechanisms occur:  The field excites the charges into oscillation, and the oscillating charge radiates.  The effectiveness of the scattering is then proportional to the effectiveness of excitation multiplied by the effectiveness of the radiation, and is thus proportional to frequency to the fourth power.  Higher frequecies (bluer light) is scattered more effectively than lower frequency light.


Making a new post visible on a specific page

Question: I am creating a wordpress site which will have different sections , which will essentially be pages which can be accessed through a top level menu. Now when I make a post, I dont necessarily want all the posts to appear on the front page but instead while making the post want to choose which page it should be shown in. I cannot find a way to do this in wordpress 3.x. Any help is greatly appreciated.
Answer: I would solve this using the plugin Advanced Custom Fields.
1) create an ACF item with the following config

view larger
2) it will show a metabox when editing a Post, where you can select which Page the post should appear

3) in your page template, adapt this code to your needs
<?php
// START - THE LOOP
$the_ID = $post->ID;

$search_posts = get_posts(array(
    'numberposts' => -1,
    'post_type' => 'post',
    'meta_key' => 'show_this_post_on_page'
));
if($search_posts) {
    foreach($search_posts as $post_found) {
        $key_value = get_post_meta($post_found->ID, 'show_this_post_on_page', true);
        foreach($key_value as $key => $value) {
            if($value==$the_ID) echo 'The post '.$post_found->post_title.' should appear in this page';
        }
    }
}
// END - THE LOOP
?>

Answer: How many of those pages you have? There are lots of way you can do this.

Normally you can do it via making specific category for each pages.
If you don't want to make extra category for this reason you can make tags for it.
If you want to make some post that will show in homepage. You can use the post_thumbnail() feature and make query in homepage for posts which have post thumbnails only.
Or you can use custom post types is special cases.
Comment: Can you please point me to some of the plugins that would help me do this ?
Comment: Can't really help you with this if you not coding :) i am not really know this kinds of plugins really well.
Answer: If you are familiar with Wordpress code, then you can assign a category or tag to that post then use custom queries on the pages you want to show or hide the tag in and put something like
$query = new WP_Query('category__in=mytag');
//or
$query = new WP_Query('category__not_in=23');

You may want to read this in wordpress codex.
Answer: If the posts don't have any similarities, you could manually add them to each page you want using the Inline Posts Plugin.


How to specify a capacitor in Altium schematic as DNP

Question: I am working on a prototype of a project and it involves an antenna. This means that I will probably have to tune this first version a little bit once I get it assembled. To do this, I wanted to place into my circuit a "dummy" capacitor. I realize that I could make a pads in the CAD with the right dimensions, but this wouldn't show up in the schematic. Also, I have seen in schematics capacitors with DNP values. This is what I am essentially looking for. Is there an easy way to do this/best practice? I am a student trying to learn the right way to accomplish these tasks..
Comment: Look in the Altium documentation for the term "variants".
Comment: For a one-off, I wouldn't usually mess with variants, though. Just put "DNP" in the comment field.
Comment: Ahh much better googling that. I'll answer this later, thanks
Comment: Ok, would I have to do anything extra for the manufacturer or do they usually look for and see that stuff? Or does that actually show up in the BOM as DNP?
Answer: The correct way to do this is with variants, as others have pointed out. Do not use the 'Type' property. For every project I have a variant named "Only Populated Components" which makes it super easy to DNP components. Not populated components should NOT appear on the BOM, as this will indubitably lead to questions from the CM. They should also not appear on the PCBA assembly drawing.
A good sanity check to see what is populated and what is not is to view the PCBA in 3D; you can tell at a glance which components are missing.
Comment: Why is the "variant" method prefered over the `Type` method? I'm getting ready to use variants for true variants of single designs. Your method seems like it would complicate that. The `Type` method seems to work perfectly without any extra variant configuration. What am I missing?
Answer: The preferred method for this functionality seems to be the component's Type property. Specifically, I think you would use the Standard (No BOM) part type for the capacitor in question.  This means the part has electrical information and is synchronized between the schematic document and the PCB document, but it will be ignored by any BOM generation.
See Altium's documentation page on it.
Comment: is there a way to show this on the schematic? So people see that without looking at the BOM.
Comment: If you use Variants, rather than Type, you can select the variant in the Project tree, then compile, then you get a little tab on the bottom of the screen.  When you click on the tab, the menus change around a little, and the non-populated components get marked with a big red X, or whatever option it is you have set for how to show these things.  From that view you can also click on the X icon and click individual components that will be "not fitted", which is Altium's terminology for non-populated/non-stuffed, whatever.


boolean multiple meshes without fusing and keep faces

Question: i have a bunch of hexagons all in one object, but I want them to form to a point while staying separate like this
when I try to use a boolean to do this all the hexagons fuse together in odd patterns and almost none of them have faces, is there an easy way to do this?
Answer: This can be done, although it is a bit of a work around.

Select the hexagon object and add the Boolean Modifier to this object (as apposed to the object that cuts it in to a point), and as the modifier Object select the cutting object.

Add the hexagon object to a collection (this is optional but makes things slightly easier. Also in the future this is how you might be doing this step)

Select the hexagon object and go into Edit Mode. Press P to Separate > By Loose Parts. Now all the hexagons are separate objects, but they all have the Boolean Modifier.

Now you want to apply all the modifiers, but it would be cumbersome to do them individually. Luckily there is a trick. Select all the separate hexagon objects (possibly by right clicking the collection and choosing Select Objects) and then press Alt + C to covert them to different type of object and choose Mesh from Curve/Meta/Surf/Text. The hexagons are already a mesh but this operation will apply all the modifiers.

Finally select all the separate hexagon objects (make sure one is selected to be the active object) and press Ctrl + J to Join them into a single object again.

Because the boolean operation was done on each hex individually the chance of missing faces in significantly reduced (i think you'll find none, and I'll be surprised if you'll find any) and fusing together should be impossible.


em1: Watchdog timeout -- resetting - freebsd 8.3 / network down

Question: i have a major issue that i can't find nor heads nor tails of. I have googled this error, but i have not found any relevant solutions.
The problem:
I have about 8 servers, all running freebsd 8.3 p3 / p4. This fileserver is pushing around 300-400 mb/s.
This is the second time it happens. The network card just seems to die. I have 2 network cards in it, and i can reach the server via private network, and it all works okay, only that the public network is completely down. I have tried restarting the network interfaces: /etc/rc.d/netif restart && service routing restart | ifconfig em1 down && ifconfig em1 up, but with no success.
I can only bring the connectivity back if i reboot the server.
Below is the output from dmesg.boot that shows the network card drivers info.
<code>em0: <Intel(R) PRO/1000 Network Connection 7.3.2> port 0xf020-0xf03f mem 0xf7b00000-0xf7b1ffff,0xf7b25000-0xf7b25fff irq 20 at device 25.0 on pci0
em0: Using an MSI interrupt
em0: [FILTER]
em0: Ethernet address: 00:25:90:7a:8e:9f
ehci0: <EHCI (generic) USB 2.0 controller> mem 0xf7b24000-0xf7b243ff irq 16 at device 26.0 on pci0
em1: <Intel(R) PRO/1000 Network Connection 7.3.2> port 0xd000-0xd01f mem 0xf7900000-0xf791ffff,0xf7920000-0xf7923fff irq 16 at device 0.0 on pci3
em1: Using MSIX interrupts with 3 vectors
em1: [ITHREAD]
em1: [ITHREAD]
em1: [ITHREAD]
em1: Ethernet address: 00:25:90:7a:8e:9e

----------------------------

pciconf -lv
em1@pci0:3:0:0: class=0x020000 card=0x000015d9 chip=0x10d38086 rev=0x00 hdr=0x00
    vendor     = 'Intel Corporation'
    device     = 'Intel 82574L Gigabit Ethernet Controller (82574L)'
    class      = network
    subclass   = ethernet
em0@pci0:0:25:0:        class=0x020000 card=0x150215d9 chip=0x15028086 rev=0x05 hdr=0x00
    vendor     = 'Intel Corporation'
    class      = network
    subclass   = ethernet
</code>

I would really love some help to debug and fix this, because it usually happens while i am sleeping, at random days, and it's driving me crazy. I love my sleep.
Comment: i think this question should be migrated to serverfault.  Did you try 9.0?
Answer: This is a supermicro server, right?
cat /var/run/dmesg.boot | grep MSI
em0: Using an MSI interrupt
em1: Using MSIX interrupts with 3 vectors
Your answer is probably here: http://forums.freebsd.org/showthread.php?t=27736


Unity2D: Click to move Snake Game

Question: I'm trying to create a click to move snake game on mobile but I'm having problems with the whole click to move functions and adding a body part every time my snake eats an apple. I want to make the click to move smooth you know like an actual snake is slithering around and when the snake eats an apple, I want to add another body part to my snake (maximum of body parts should be 5). Can anyone point me into the right direction or give me an example of what to do, thank you!
Comment: What have you tried so far? The next step will depend on how the parts you've already built are working, so you should show the relevant bits of your code or scene hierarchy setup.
Comment: (Also, note that we get a *lot* of questions about making Snake clones, so [do a quick search through the existing questions](http://gamedev.stackexchange.com/search?q=snake) to see if the answer you're looking for might already be there)
Answer: The "smooth slithering" could use some more explanation, but assuming you want more gradual turns than the normal 90 degree snake game, you could instead deal with simply a turn left and a turn right event from the player input. This would apply a rotation to the velocity vector of the head, such as one degree per update. This is different from your typical snake game where input determines the absolute direction, not the change in direction.
This control setup may be the best for mobile where you can simply track tap/hold events on each half of the screen. If I press my left thumb to the left side of the screen, the snake will turn left. If I press the right side with my right thumb, the snake gradually turns right. If I lift both my thumbs, the snake goes straight.

Unity2D: Click to move Snake Game


Rear red light with seat bag

Question: My bike has this red reflective light right below the seat (I don't know its name), and I'm thinking of buying a seat bag such as this one. Won't the light be covered? Isn't this potentially dangerous? How does one fix it normally?
Comment: Is the red reflective light below the seat an actual light (as in, battery-powered) or simply a reflector?
Comment: It's only a reflector
Answer: The reflective brand name tab on the rear of that seat bag is a light holder. You will most likely need to remove the light from the seat post. Hopefully it has a clip styled mount, otherwise you can get a light that has a clip mount.
Comment: +1 - This is the answer. I have a different brand of seat bag, but it has the very same sort of tab that my rear light clips onto.
Comment: Of course, the OP doesn't actually have a light, just a reflector, which probably doesn't have any sort of clip. But getting a light to clip on is good!
Comment: The reflector on the bag is sometimes times more-effective at reflecting lights than the "free" reflector that's included with bikes.
Answer: If it's only reflective you have currently, then you might want to buy a separate battery operated active light, and place it below the bag on the stem.
I would assume the bag is designed to fill most space available, and hence would obstruct the existing light.
Answer: It's a little sad that the bag doesn't come with a proper reflector, but a clip-on unit can be added, as suggested.  The flashing red LED clip-on tail lights are quite inexpensive, will run continuously for a week or two on one set of batteries, and are well worth the investment, though make sure that there is at least some degree of passive reflector function in the clip-on and/or the cloth of the bag as well.

Rear red light with seat bag


Why would magnetic monopoles not violate the law of conservation of energy?

Question: The field lines around a magnetic dipole are continuous unending loops. If magnetic monopoles were to exist, we could limit the path of a monopole along one of these field lines where it will continue to accelerate and in theory and provide free energy.  Although there are few other cases where we can establish circular electric or magnetic fields (eg, induced electric field along changing magnetic field or straight current carrying wire) but in those cases the set-up already requires some work to be done on it to be functional. However in this case no work has to be done.
Since there are many physicists who believe that magnetic monopoles could exist in nature, what is wrong in this argument?
Comment: any energy given to the monopole at some point is extracted from the field at that point
Answer: Since the magnetic monopole acquires a significant amount of energy, you cannot just treat it like a (magnetic) test charge that moves passively on and on in the supposedly constant solenoidal magnetic field. Only the whole system encompassing the solenoidal magnetic field, the electric current that creates it, the moving monopole and finally the solenoidal electric field that will be generated by it, must obey energy conservation.
The situation is easier to understand, if you take an infinite straight line current as the generator of the original magnetic field. Then the magnetic flux density at a distance $r$ from the line current has constant magnitude and its field lines are strictly circular.
Now place a cylindrical shell of magnetic monopoles around the electric line current at radius $r$. Then these monopoles will start moving circularly around the line. By symmetry of Maxwell's equations with magnetic monopoles, these circularly moving monopoles are similar to an infinitely long "coil" in electrical engineering, and hence, will generate a homogeneous electric field inside of them, which is then, of course, directed in parallel to the electric line current that generated the original magnetic field. Hence, this additional electric field will decelerate the line current and weaken the magnetic field, which in turn leads to attenuated acceleration of the magnetic monopole shell.
After all, potential energy of the original magnetic field and kinetic energy of the initially moving charges will be converted into potential energy of a newly generated electric field and kinetic energy of the moving magnetic monopoles. Total energy will stay the same, however.
When you take this simple example to your non-ideal magnetic dipole field and a magnetic point charge instead of a shell, only the details get more complicated, while the principles stay the same.
Basically, this is all pretty similar to Lenz' rule in classical electrodynamics, only adding magnetic monopoles: the effect of induction (when applied to magnetic monopoles) counteracts its cause and so makes sure that energy is conserved.
Additional note: be aware of the fact that classical electrodynamics (i.e. without magnetic monopoles) also allows closed electric field lines. Although these only occur during radiation, they principally exist for a certain duration. If your argument were true, you could also apply it to closed electric field lines, and so energy conservation would be violated already for Maxwell's theory. But of course, energy is also conserved there, again because of the "test charge" acting back on the "external field".
Yet another note: Actually, energy conservation is a surprisingly non-trivial topic in classical electrodynamics. While in classical mechanics, you are always assuming a complete Lagrangian from whose explicit time-independence you can derive energy conservation, there is no such complete Lagrangian for classical electrodynamics with massive charges. This is known as the problem of radiation damping, and it is one of the things that motivated the development of quantum mechanics. In quantum electrodynamics radiation damping can be treated consistently. But until the discovery of quantum electrodynamics, physicists had to assume that energy was "just conserved" although they could not strictly prove it from theory (at least not in the presence of charged masses). On the other hand, if there are no charges/masses, energy conservation in classical electrodynamics is trivial, but then again, what use is a "dry" theory of vacuum fields that cannot act on something material?
Comment: That depends on what magnetic charge is counted positive. But independent of finger gymnastics, the back action will amount to a double cross product (just as for the usual inductive back action), mathematically, which is basically equal to negative Laplacian, and that negative sign constitutes antiparallelism.
Comment: Do magnetic monopoles follow right hand rule? Because in that case induced electric field would act along the direction of line current instead of opposite (antiparallel) to it.
Comment: Sorry, I mistyped it. Either, dynamically, read "double curl" instead of "double cross product", or, quasistatically, read "negative direction" instead of "negative Laplacian". This involves a little bit of tedious calculation to show, but it's true, trust me. :-)
Comment: As a quick reference on the double curl, see e.g. this question: https://math.stackexchange.com/questions/2584350/double-curl-and-vector-laplacian
Comment: Nice answer. However, I am not entirely reassured. If I take a bar magnet, and a magnetic monopole particle (that for simplicity we assume can "ghost" through the physical material of the bar magnet) then I can still make a closed loop along which the monopole either does work or has work done on it. In this case I have little idea what the back-action could act on, as their is no current. Maybe it further magnetises or demagnetises the magnet. But that seems contingent on various details of whether the magnet is already fully magnetised or not.
Comment: Interesting objection. The bar magnet's field is generated by spin and angular momentum of the electrons in the material. Since those can only be treated quantum mechanically, this is of course outside the classical consideration of my answer (and presumably the original question). I don't know off the top of my head, but maybe it somehow boils down to statistically destroying the alignement between the elementary magnetic moments in this case? But maybe it also requires resort to Dirac's monopole argument, which is about the relation between monopoles and quantum mechanics and implies...
Comment: ...charge quantization. Maybe you should ask this as a separate question: how an accelerated magnetic monopole might realize back action to the spins in a permanent ferromagnet (as an example). Maybe the consideration of only one spin is sufficient to outline the problem.


Java Reactor Pattern with java.io Package

Question: I see in several application source like Minecraft and JIrcs they both use java.io to implement Reactor Plugin (if I'm not wrong) and also in this article. So, what is the difference between java.io and java.nio when implementing Reactor Pattern? I mean, like performance advantage, process efficiency etc and where i can get good tutorial if you think java.io is the good solution to implement Reactor Pattern (since google give me tons of java.nio tuts not java.io as i want)
Comment: I'm not a fan of the Reactor pattern in any case but it certainly doesn't fit `java.io.`
Comment: @EJP Why is that so? Is it due to some limitations of Reactor?
Answer: It isn't really true that NIO is faster. Paul Tyma demolished that myth sometime back.
http://mailinator.blogspot.in/2008/02/kill-myth-please-nio-is-not-faster-than.html
http://paultyma.blogspot.in/2008/03/writing-java-multithreaded-servers.html
Hope that help.
Answer: I hope you can get a conclusion with the below information taken from the book
at page no.42

java.io.* classes use the decorator design pattern. The decorator
  design pattern attaches responsibilities to objects at runtime.
  Decorators are more flexible than inheritance because the
  inheritance attaches responsibility to classes at compile time. The java.io.* classes use the decorator pattern to construct different
  combinations of behaviour at runtime based on some basic classes.

and 43.

Java has no long been suited for developing programs that perform a
  lot of I/O operations. Furthermore, commonly needed tasks such as file
  locking, non-blocking and asynchronous I/O operations and ability to
  map file to memory were not available. Non-blocking I/O operations
  were achieved through work around such as multithreading or using JNI.
  The New I/O API (aka NIO) in J2SE 1/4 has changed this
  situation.
         A server's availability to handle several client requests effectively depends on how it uses I/O streams. When a server has to
  handle hundreds of clients simultaneously, it must be able to use I/O
  services concurrenty, one way to cater for this scenario in Java is to
  use threads but having almost one-to-one ratio of threads (100 clients
  will have 100 threads) is prone to anormous thread overhead and can
  result in performance and scalability problems due to consumtion of
  memory stacks (i.e. each thread has its stack, Refer Q34,
  Q42 in Java section) and CPU context switching(i.e. switching between threads as opposed to doing real computation.). To overcome
  this problem, a new set of non-blocking I/O classes have been
  introduced to the Java platform in java.nio package. The non-blocking
  I/O mechanism is built around Selectors and channels. Channels,
  Buffers and Selectors are the core of the NIO.

and read more.
Here are some reference links which provide Java IO vs Java NIO :
Java IO Faster Than NIO – Old is New Again!, Java IO vs Java NIO and IO vs. NIO – Interruptions, Timeouts and Buffers.
Comment: "Java has no long been suited ..." Does it really say that?
Comment: @EJP `Java's I/O operations is more complicated than C/C++ to support internationalization (i18n). Java internally stores characters (char type) in 16-bit UCS-2 character set. But the external data source/sink could store characters in other character set, in fixed length of 8-bit or 16-bit, or in variable length of 1 to 4 bytes. As a consequence, Java needs to differentiate between byte-based I/O for processing raw bytes or binary data, and character-based I/O for processing texts made up of characters.` [read more...](http://www3.ntu.edu.sg/home/ehchua/programming/java/j5b_io.html)
Answer: It is important to understand the differences between blocking and non-blocking I/O. The java.io package does NOT support non-blocking I/O so it won't scale for a large number of connections. Moreover, with blocking I/O you can only resort to the terrible one-client-to-one-thread model which is completely unsuitable for low-latency systems. I suggest you take a look on this article written by me about an asynchronous network I/O library that implements the reactor pattern, so you can understand how non-blocking plays a key role in high-performance systems.
Comment: Disclaimer: you wrote the article?
Comment: Yes, I did. I edited my answer to state that. I will do that from now on. Thanks.


How can I make a control transparently overlay a DirectShow video?

Question: I have a control, VideoControl, which displays video using DirectShow - it's set as the owner of an IVideoWindow.  I have another control, AreaControl, which is supposed to show a dashed rectangle over the video control.  AreaControl is set to be transparent using SetStyle(ControlStyles.SupportsTransparentBackColor, true).  If I place AreaControl over any other control, it works as expected, showing a dashed rectangle over the controls behind it.  But when I place the dashed rectangle control over the video control, the AreaControl is filled in with the VideoControl's BackColor.
What do I need to do to get the video to display through the AreaControl, with the dashed rectangle overlaid on it?  Is there a way to get the VideoControl to paint itself with the video, rather than just drawing its BackColor?
Answer: As far as I know, there is no way of doing, what you want to do directly. The problem is, the implementation of the transparent style of a control. A control with this style attribute basically just draws, what is behind it making it appear transparent. (In reality it isn't really transparent at all).
The only solution that comes to my mind is to use a window (Form) and put the control in that. A Form can be made transparent by setting its Opacity property to something less than 1.0. A value of 0.0 will be totally transparent (read: Invisible). The dashed border should be totally black. With a opacity of f.e. 0.4 it will appear gray.
Alternatively, you may have some luck with TransparencyKey Property of the Form. Setting this to white may have the desired effect, but I haven't tested this one.
In either case the Form should be completely borderless. You may have to add some code to reposition the form, when the video form moves.
Answer: In the end the answer to this turned out to be to use the AreaControl's Region property, since we didn't need partial transparency.


Is 3D printing of PCBs possible?

Question: I just saw this picture about PCB 3D printing on a website, can it work in real life?
It's would be so cool, if it could useful in the real life.

Comment: Has this been done? Yes. Does it have a yield above 50%? Yes. Above 90%? No. Is it accurate to 5mil? No. Will it compete with existing technology soon? Probably not. Will it eventually beat existing technology? Possibly, yes.
Comment: Which website did you see this?
Comment: 3D printing substrates may impose some constraints on soldering processes and temperature profiles...
Comment: There's a company that gave a talk where I work a week or so ago that can print semiconductors (10um working transistors from an inkjet printer!). So 3D printing a PCB doesn't sound farfetched after that!
Comment: @Andyaka Voltera.
Comment: Wondering if it might beat out DIY etching, but I have no ideas about solderability and whether it can hold up to a reflow profile.
Comment: @Andyaka element14 3D printing blog: [First Ever 3D Printer for PCB Prepares for Market](https://www.element14.com/community/groups/3d-printing/blog/2015/11/30/first-ever-3d-printer-for-pcb-prepares-for-market)
Comment: For applications where part quality, performance and production cost is not very important compared to shortening (calendar) time it might have some niche applications. Widespread use? Not likely in the forseeable future. Modern PCBs are very, very good and have quite inexpensive tooling.
Comment: looks kinda sloppy to me
Comment: mmm ,maybe the cost is a problem
Answer: It can work. I have recently seen an entire speaker built using a multimaterial 3D printer. In the future, it will certainly be possible to print 3D circuits and electromagnetic components (motors etc.) inside products without planning for any openings. A real breakthrough for applications which pay a lot of money for seals, for example. It may also replace the flex-rigid circuits which allow you to have PCBs with bends (to wrap a camera with PCBs for example).
However, nowadays parts made of multiple materials require either a 3D printer which automatically switches between materials (we are talking hundreds of thousands of dollars), or which stops and allows the material to be changed before proceeding with the rest of the part. Note that you cannot even use any material: although plastics and resins are dead-easy, and metals require different techniques (e.g. powder fusing using a laser) generally but can be done very reliably if you throw the money on the table, I am not aware of any proven method (other than very early prototypes) to print fiberglass or polyimide therefore your PCBs will have to be thicker than existing PCBs, will not handle temperature as well or will have a lower breakdown voltage (and therefore a higher creepage distance at high voltage) for example. On top of that, there is the plating to improve the mating of connectors and the soldering. You may not realise this, but existing laminates are very advanced, and use materials which are not ready for printing yet. It is not necessary in all industries and certainly not for domestic use, though.
Property of materials are one thing, and precision is another. The current process to build PCBs is EXTREMELY accurate. Even the cheap PCB houses out there can do tens of 12-18um layers, perfectly round vias of 0.1mm in diameter, tracks as thin as 0.1mm and spaced y 0.1mm, with shapes so accurate you will never see any difference with your CAD view zoomed 10 times and a microscope of the same magnification (I've never had any acid traps issues). It may sound like overkill, but it isn't. You may not need tens of layers, but 0.1mm spacing is very common in dense circuits including surface mounted components and you don't want your 45° mitres to short with adjacent lines.
Finally, I expect the build time to be higher. Photolithography, acid etching etc. form a relatively quick process and the assembly lines are laid out such that the throughput is very high: dip tens of PCBs in a bucket, move it over to another one, while another panel takes its place. Time is money when it comes to production. I would not buy a cutting edge 3D printer that builds 25 PCBs in 3 hours when I can build hundreds in the same time using widespread machinery and chemicals.
When that technology is ready, it will be very good news to many applications (though I suspect, not all of them). In the meantime, it is just not worth it.
Comment: 3D printing excels in small production runs. It's not how long it takes to make 25 more PCB's. It's the time from the design to the first prototype. Latency over throughput, basically. If PCB 3D printing takes off, presumably it will be with dedicated printer designs. The metal traces probably will be plotted, so a 45° angle is no big deal.Still, quite a bit of work to be done.
Comment: @TomášZato Thanks. For some reason, "certainly" carries a bit of doubt, so I used it instead.
Comment: @MisterMystère Looks much better than my proposal indeed. :)
Comment: @MisterMystère You do no need hundreds of thousands of dollars for a printer that can switch between materials. Multi-nozzle printers exist in the consumer 3d printing space for as low as ~$400.
Comment: I strongly advise everyone to use word *probably* whenever making *in the future* assertions.
Comment: @MSalters: Thanks, well said. 3D printing is great whenever the tooling to make the product doesn't exist yet. When it does, the cheapest option considering the production run, wins.
Comment: thanks ,you gave me a detail and useful answer .Let me understand more comprehensive .you are right ,there are a lot of problems about 3D printing of PCBs ,like The material, conductivity and layers and so on. I think the cost will be very expensive .but this is a great invention ,  I like to hear that it can work in real life In the near future
Answer: As I understand it there are two main problems with 3D printed PCBs, both related to the printable conductive material.

The material is expensive (generally silver based). This is tolerable for basic designs but high speed work requires ground and power planes which start eating up the material real fast.
The conductivity is far worse than copper. That means far greater losses in the PCB.
Comment: is there a possible that 3D printing technology is widely used in the life ,and it will reduce a lot of machines and Labor costs after solve the problems you raised

Is 3D printing of PCBs possible?


Why do I get a message saying, I am in danger of been blocked from asking questions, if I only asked 1 or 2 questions for the first time in months

Question: Why do I get a message saying, that I am in danger of being blocked from asking questions, when I have only asked 1 or two questions, for the first time in months. In Stackoverflow, I also only asked one question then I get a message saying, my question limit has been reached, and that my questions aren't received well in the community.
Answer: Because automation. We don't know the specifics of how it works, if we did people would game it, but it looks like your actions aren't considered ideal.
If I look at your profile there are a few yellow flags that an automated system might pick up on:

You have asked and then deleted 4 questions, 2 of which were closed ( deleting just hides them, the system still sees them, as do moderators )
of the 12 questions you asked, you have only accepted an answer for a single question
that specific question also has a close vote and a flag
you only have 13 reputation, most accounts that get auto-moderated by code are low rep users. After all why expend the effort to get reputation if you're going to spam advertisement? Gaining reputation gets you perks, it can ever get you low level moderator powers, or turn off the advertising, it's a trust signal.

These are just speculation though, the site doesn't share the exact criteria it uses. What I would do is go back to your existing questions and do the following:

check the answers you have and accept an answer if that makes sense
comment explaining why you can't accept answers on questions were you can't accept any, making sure to edit your question to clarify any misunderstandings or additional information/requirements that lead to it
edit existing questions so that they're formed better
answer your own question if you found the answer elsewhere or on your own
wait, time may help

Accepting Answers
When you ask a question, an additional button appears under the voting controls of any answer left. For reference, this is the button to accept an answer:

It will turn green when accepted, only one answer can be marked as accepted, indicating to the site that your question was answered and that this is the best factual answer for all users who might have this question

Note that other people might arrive and write better or newer answers in hopes of taking over as the best accepted answer. The person who answered then gets reputation points, and you get a small reputation point boost by accepting.
This button does not appear on questions, or on the answers left on other peoples questions, just the answers left on your own questions.
Not accepting answers can put people off who don't see any pay off in answering your questions, and is used as a signal to the site. It also deprives you of reputation points that can be used for perks and bounties. Questions from higher reputation users can also attract better answers.
That doesn't mean if you go on an accepting answers spree that this will instantly fix the question block though, that's going to take time either way, but it does make you a more attractive target for answering questions.
Comment: Thanks, I  don't know how to accept the answers, otherwise I would.
Comment: Sorry Tom, I only see icons for the show activity on this post, up and down arrows for research or not, and bookmark this question. and share, edit, delete, flag underneath that. Where can I find to accept the answers.
Comment: I added screenshots, it's the tick underneath the voting controls, it only appears on answers written trying to answer your questions


Why is there a lid on the Hubble Space Telescope?

Question: What is the lid on the Hubble Space Telescope for?
Comment: To keep out "[pranksats](https://i.stack.imgur.com/Kol1O.png)"? or the sun, either accidental direct exposure (ouch!), or scattered/stray light? (notice the direction of the sun in this image)
Comment: Somewhat related but different question: https://space.stackexchange.com/q/10029/12102
Comment: To keep the popcorn from flying out.
Answer: The aperture door is used to protect the telescope during launch and service operations, and to prevent the sun from shining down the telescope barrel.
Here, the HST is being released from shuttle Discovery.

The door opens soon after the HST has been released:

The door closes automatically if the HST is pointed to within 20 degrees of the Sun's direction.

The telescope does not generally observe targets within 50 degrees of the Sun, 15.5 degrees of any illuminated portion of the Earth, 7.6 degrees of the dark limb of the Earth, nor 9 degrees of the Moon. Following the first servicing mission, the telescope is again allowed to point directly away from the Sun.
There are exceptions to these rules for HST pointing in certain cases. For instance, the bright Earth is a useful flat-field calibration source. However, there are onboard safety features that cannot be overridden. The most important of these is that the aperture door shown in Fig. 1 will close automatically whenever HST is pointed within 20 degrees of the Sun, in order to prevent direct sunlight from reaching the optics and focal plane.

Direct sunlight would rapidly heat up the optics and focal plane, potentially destroying the instruments, so has to be avoided.
The door is also used as a sun shield, it seems:

HST is, in principle, free to roll about its optical axis. However, this freedom is limited by the need to keep sunlight shining on the solar arrays, and by a thermal design that assumes that the Sun always heats the same side of the telescope.
To discuss HST pointing, it is useful to define a coordinate system that is fixed to the telescope. This system consists of three orthogonal axes: V1, V2, and V3. V1 lies along the optical axis, V2 is parallel to the solar-array rotation axis, and V3 is perpendicular to the solar-array axis (see Fig. 1). Power and thermal constraints are satisfied when the telescope is oriented such that the Sun is in the half-plane defined by the +V1 axis and the positive V3 axis. The orientation that optimizes the solar-array positioning with respect to the Sun is called the "nominal orientation."

note: this diagram is for an older configuration of the HST. Since then, instruments have been replaced during service missions.
So there's a sun-facing side of the telescope. I'd be surprised if the aperture door hinge location did not take this into account.
Comment: The diagram above is fine for answering this question, but the instrument info is a bit out of date.  The axial instruments now are NICMOS, STIS, ACS, and COS.  The radial instrument is now WFC3.
Comment: Do you know approximately how often it opens and closes? Is closing it just an emergency option that has never been use (other than during servicing missions)?
Answer: Because, among other reasons, the Shuttle payload bay was FILTHY. It's so large, with such a complex design and parts count, that it's impossible to effectively clean at all, let alone before a critical payload such as Hubble. Certain critical missions, such as infrared instruments, were originally scheduled to be recurring Shuttle payloads, so the cryogen could be refilled for reflights. However, after one or two flight demonstrations, it was found that the Shuttle orbiter is so gross, Pigpen-like, that the telescope images would be noised up by all the dust floating loose. Hence, flight demonstrations of critical missions.
One telling case: at one point, an orbiter flew with a wrench unaccounted and loose in the payload bay blanketing. It was a few missions before the wrench showed up in an X-ray; a woman with small hands was found to finally fish it out. The "lid" is prudent HST management taking matters into their own hands.
The Shuttle program was, metaphorically and fiscally, gross. Those in denial are now served notice: it was also physically gross.


A complete image manupulation solution in classical ASP

Question: Does anyone have a past experience on implementing a complete image manipulation solution in classical ASP? I need a solution where a user can:

Upload an image
The uploded image is stored on the filesystem (inside or outside wwwroot)
The image is displayed in the browser but it is resized... on-demand

The on-demand resizing is my main problem. In PHP I could use phpThumb library that allows me to specify a filename and max width/height in a query string. The library resizes the images accordingly, in addition, it caches the copy of the image so that next time the same image with same width/height is requested it is served from the cache.
Can I implement such a solution in classical ASP, if possible with open-source components? ImageMagick?
Answer: It would appear that ImageMagick has a COM+ component that can be used for this purpose.
Another mature (though I don't think it's free) library that's commonly used for this is AspJpeg.
Answer: ASP.net has build-in functions to manipulate images, since most servers serving ASP classic have some version of ASP.net installed, you can rely on it to do the work.
ie:

Comment: Can you suggest an stand-alone open source ASP.Net script that does not require application/session and allows resizing+caching?
Comment: This question http://stackoverflow.com/questions/2808887/create-thumbnail-image-in-c has the answers. You can write the file to disk for caching.
Answer: This post is a little old, but we recently faced the same issues regarding resizing via Classic ASP.
We found a solution which used the VB.NET route, but it didn't do everything we wanted so we adapted it to include features to resize, crop, pad (with colour) and display the resulting jpg out to the screen and / or a file.
We've uploaded our efforts here in a zip file with the script and an example asp file with instructions: http://easierthan.blogspot.co.uk/2013/02/code-tip-3-classic-asp-image-resizer.html
With regards to uploading, we used http://www.freeaspupload.net which seemed to work very well.


Enable the controls in a InfoPath 2010 read-only view

Question: Hi
I would like to display a read-only infopath form the the end-users.I have created a read-only view,everything works perfectly apart from the file attachments.In a a read-only infopath form view , users could not download the file attachments.Is there a way I could ovverride this just for the file attachment?Otherwise ,I have to create a rule to manually make every controls read-only on the form.
Can anyone shine some light on this?
Answer: Ybbest, I was just researching the same thing.  You'll need custom code in order to open, instead of download, the file attachment
Code here:
http://blah.winsmarts.com/2008-8-InfoPath_2007_-_Extracting_those_pesky_Binary_attachments.aspx
Referenced Thread:
infopath File Attachment - Run/View instead of Download?
Answer: You can only display Infopath Picture of File Attachment field as Picture/File Attachment control or Calculated Value (field). Unfortunately Calculated value shows entire base64 contents of the attached file so it does not help much.
Two options IMHO:

Remove that field from the read-only view all together
On edit view add additional required String field where user filling form would enter filename and display it on read-only view

Please note: InfoPath views are nice but they are just views, this is not a security feature and skillful user can still retrieve your files from InfoPath.
Comment: Thanks for the quick reply however I do not get the second option?Let people type in the file name they attach to the form and display the form name in the read-only view?But I would like people to see the attchment content?
Comment: I am not sure I understand your problem then, if you would like people to be able to open attachments, what do you mean by "users could not download the file attachments". As soon someone opens attachment it has been downloaded to their computer.


Unsure about cause of browning avocado leaves

Question: My avocado leaves are all looking like this and dying (3 years old plant). I gave it some fertilizers a while ago, like 2-3 months. I am sure I am not watering too much, been doing rarely since the winter, once a week or even less. I hope you can help me save it!
Comment: Maybe few sunlight? It happened to my avocado plant in the past as well.
Answer: One possibility is salt burn, although that tends to brown more from the tip of the leaf like the one on the right, not all over like the leaf on the left.
Avocados are very sensitive to salt: even the amount of salt in tap water from the Colorado River can be too much, especially with frequent light watering where water can evaporate.
For larger outdoor plants, gypsum and a couple of deep waterings to leech salts out the bottom every year or 2 are the general fixes plants.  Also, outdoor avocados do much much better with deep mulch covering the soil, both reducing evaporation that leaves salt behind, and keeping the very shallow roots cool.
My guess is that your pot is too small for the size of your plant, so you're watering frequently and over a year or so salts have built up.  While avocados are sensitive to transplanting or repotting, I would try to repot that in something twice the diameter, keeping the current soil ball as intact as possible, and perhaps switch to watering with reverse osmosis water if you have that in your house.


How to save a NSImage as a new file

Question: How can I save a NSImage as a new file (png, jpg, ...) in a certain directory?
Comment: I added a bounty since someone called the first option an ugly hack and I can't seem to easily find a a seemingly correct and definite answer on google , more voting/answers please.
Answer: You could add a category to NSImage like this
@interface NSImage(saveAsJpegWithName)
- (void) saveAsJpegWithName:(NSString*) fileName;
@end

@implementation NSImage(saveAsJpegWithName)

- (void) saveAsJpegWithName:(NSString*) fileName
{
    // Cache the reduced image
    NSData *imageData = [self TIFFRepresentation];
    NSBitmapImageRep *imageRep = [NSBitmapImageRep imageRepWithData:imageData];
    NSDictionary *imageProps = [NSDictionary dictionaryWithObject:[NSNumber numberWithFloat:1.0] forKey:NSImageCompressionFactor];
    imageData = [imageRep representationUsingType:NSJPEGFileType properties:imageProps];
    [imageData writeToFile:fileName atomically:NO];
}

@end

The call to "TIFFRepresentation" is essential otherwise you may not get a valid image.
Comment: No, TIFF does Alpha and multi-page images just fine. What gave you the idea it didn't? It's what Apple recommends as a destination format for retina images (multi-representation TIFFs).
Comment: But TIFF is RGB and throws away any transparency info.
Comment: TIFF should support alpha and Transparency
https://en.wikipedia.org/wiki/Transparency_(graphic)
Comment: Will it support Gif ?
Comment: What is ImageProps ? what is this value passed ?
Comment: I'm getting `TIFFRepresentation` data much larger (5x times) than the original file. is it normal? do I still want to transfer it over the network?
Answer: Do something like this:
NSBitmapImageRep *imgRep = [[image representations] objectAtIndex: 0];
NSData *data = [imgRep representationUsingType: NSPNGFileType properties: nil];
[data writeToFile: @"/path/to/file.png" atomically: NO];

Comment: This is buggy hack. See below for regular answer.
Comment: You should get the bitmap image rep in a more reliable way than assuming that it is the first representation. You also cannot assume that there is one; if the image was loaded from a PDF, for example, then there will be an NSPDFImageRep, not an NSBitmapImageRep.
Comment: If one gets a `[* representationUsingType:properties:]: unrecognized selector sent to instance` the workaround is here: [NSCGImageSnapshotRep, how get bitmapData](http://stackoverflow.com/questions/4438802/nscgimagesnapshotrep-how-get-bitmapdata)
Answer: Not sure about the rest of you, but I prefer eating my full enchilada. What is described above will work and nothing is wrong with it, but I found a few things left out. Here I will highlight my observations:

First the best representation is provided which seems to be 72 DPI
even if the image resolution is greater than that. So you are losing
resolution
Second what about multi-page images such as those in animated GIFs or
PDFs. Go ahead, try an animated GIF, you will find the animation lost
Lastly any metadata such as EXIF, GPS, etc...data will be lost.

So if you want to convert that image, do you really want to lose out on all of this?
If you wish to eat your full meal, then lets read on...
Sometimes and I do mean sometimes there is nothing better than good ole old school development. Yeah that means we have to do a bit of work!
Let's get started:
I create a category in NSData. These are class methods because you want these things to be thread safe and there is nothing safer than putting your stuff on the stack. There are two types of methods, one for the output of non-multi-page images and one for the output of multi-page images.
List of single images: JPG, PNG, BMP, JPEG-2000
List of multiple images: PDF, GIF, TIFF
First create a mutable data space in memory.
NSMutableData * imageData    = [NSMutableData data];

Second get a CGImageSourceRef. Yeah sounding ugly already isn't it. It's not that bad, let's keep going... You really want the source image not a representation or NSImage chunk of data. However, we do have a small issue. The source might not be compatible, so make sure you check your UTI against those listed from CGImageSourceCopyTypeIdentifiers()
Some code:
CGImageSourceRef imageSource = nil;
if ( /* CHECK YOUR UTI HERE */ )
    return CGImageSourceCreateWithURL( (CFURLRef)aURL, nil );

NSImage * anImage = [[NSImage alloc] initWithContentsOfURL:aURL];

if ( anImage )
    return CGImageSourceCreateWithData( (CFDataRef)[anImage TIFFRepresentation], nil );

Wait a sec, why is NSImage there? Well there are some formats that don't have metadata and CGImageSource does not support, but these are valid images. An example is old style PICT images.
Now we have a CGImageSourceRef, make sure it's not nil and then let's now get a CGImageDestinationRef. Wow all these ref's to keep track of. So far we are at 2!
We will use this function: CGImageDestinationCreateWithData()

1st Param is your imageData (cast CFMutableDataRef)
2nd Param is your output UTI, remember the list above. (e.g.
kUTTypePNG)
3rd Param is the count of images to save. For single image files this
is 1 otherwise you can simply use the following:
CGImageSourceGetCount( imageSource );
4th Param is nil.

Check to see if you have this CGImageDestinationRef and now let's add our images from the source into it...this will also include any/all metadata and retain the resolution.
For multiple images we loop:
for ( NSUInteger i = 0; i < count; ++i )
                CGImageDestinationAddImageFromSource( imageDest, imageSource, i, nil );

For single image it's one line of code at index 0:
CGImageDestinationAddImageFromSource( imageDest, imageSource, 0, nil);

Ok, finalize it which writes it to disk or data container:
CGImageDestinationFinalize( imageDest );

So that Mutable Data from the beginning has all of our image data and metadata in it now.
Are we done yet? Almost, even with garbage collection you have to clean-up!
Remember two Ref's one for the source and one for the destination so do a CFRelease()
Now we are done and what you end up with is a converted image retaining all of its metadata, resolution, etc...
My NSData category methods look like this:
+ (NSData *) JPGDataFromURL:(NSURL *)aURL;
+ (NSData *) PNGDataFromURL:(NSURL *)aURL;
+ (NSData *) BMPDataFromURL:(NSURL *)aURL;
+ (NSData *) JPG2DataFromURL:(NSURL *)aURL;

+ (NSData *) PDFDataFromURL:(NSURL *)aURL;
+ (NSData *) GIFDataFromURL:(NSURL *)aURL;
+ (NSData *) TIFFDataFromURL:(NSURL *)aURL;

What about resizing or ICO / ICNS?
This is for another day, but in summary you first tackle resizing...

Create a context with new size: CGBitmapContextCreate()
Get the an image ref from index: CGImageSourceCreateImageAtIndex()
Get a copy of the metadata: CGImageSourceCopyPropertiesAtIndex()
Draw the image into the context: CGContextDrawImage()
Get the resized image from the context: CGBitmapContextCreateImage()
Now add the image and metadata to the Dest Ref: CGImageDestinationAddImage()

Rinse and repeat for multiple-images embedded in the source.
The only difference between an ICO and ICNS is that one is a single image while the other one is multiple-images in one file. Bet you can guess which is which?! ;-)
For these formats you have to resize down to a particular size otherwise ERROR will ensue.
The process though is exactly the same where you use the proper UTI, but the resizing is a bit more strict.
Ok hope this helps others out there and you are as full as I am now!
Opps, forgot to mention. When you get the NSData object do as you want with it such as writeToFile, writeToURL, or heck create another NSImage if you want.
Happy coding!
Comment: This is a good start, certainly better than the other answers (even though those are rated higher) but it's not complete. First the logic as presented here won't handle PDF files by itself (CGImageDestinationAddImageFromSource won't work since the image source will by nil). PDF and other non-copyable image sources need special treatment (to either get images via thumbnails or otherwise copy the data). Second, it won't copy any meta data by itself, you need to do it explicitly by retrieving the properties dictionary from the image source and adding it to the image destination.
Comment: Two questions please. 1) how can you be sure that [anImage TIFFRepresentation] always returns something? aren't there NSImage's that don't have TIFFRepresentation?. 2) Could you please provide a working-order code-snippet for at least one (say JPEPDataFromURL) of these functions in full? I tried to follow your instructions, and at least for me - it won't work (I'm trying to save incoming video data frame as JPEG to disk, and my input goes from AVSession's CMSampleBuffer through an NSImage - and I try to use your code to save this to a file.
Answer: save as PNG using swift3
import AppKit

extension NSImage {
    @discardableResult
    func saveAsPNG(url: URL) -> Bool {
        guard let tiffData = self.tiffRepresentation else {
            print("failed to get tiffRepresentation. url: \(url)")
            return false
        }
        let imageRep = NSBitmapImageRep(data: tiffData)
        guard let imageData = imageRep?.representation(using: .PNG, properties: [:]) else {
            print("failed to get PNG representation. url: \(url)")
            return false
        }
        do {
            try imageData.write(to: url)
            return true
        } catch {
            print("failed to write to disk. url: \(url)")
            return false
        }
    }
}

Comment: let tiffData      = image.tiffRepresentation!
        let imageRep = NSBitmapImageRep(data: tiffData)
        let data          = imageRep?.representation(using: .PNG, properties: [:])                   do {

            try data?.write(to: URL(fileURLWithPath: path3), options: NSData.WritingOptions() )

        } catch {

            print("\(error)")
        }
Answer: Swift 4.2 Solution
public extension NSImage {
    public func writePNG(toURL url: URL) {

        guard let data = tiffRepresentation,
              let rep = NSBitmapImageRep(data: data),
              let imgData = rep.representation(using: .png, properties: [.compressionFactor : NSNumber(floatLiteral: 1.0)]) else {

            Swift.print("\(self) Error Function '\(#function)' Line: \(#line) No tiff rep found for image writing to \(url)")
            return
        }

        do {
            try imgData.write(to: url)
        }catch let error {
            Swift.print("\(self) Error Function '\(#function)' Line: \(#line) \(error.localizedDescription)")
        }
    }
}

Comment: Can you explain why you use `self.self` instead of `self`? Is there any difference?
Comment: Turns out there is no difference.  Perhaps this was in an earlier version of swift, but I thought it used print the explicit class name but it looks like either just return `< >`
Answer: Swift Style:
if let imgRep = image?.representations[0] as? NSBitmapImageRep
{
      if let data = imgRep.representationUsingType(NSBitmapImageFileType.NSPNGFileType, properties: [:])
      {
           data.writeToFile("/path/to/file.png", atomically: false)
      }
}

Answer: To help with cross-platform code, I implemented a version ofUIImagePNGRepresentation() that runs on Mac (and uses NSImage).
#if os(macOS)

public func UIImagePNGRepresentation(_ image: NSImage) -> Data? {
    guard let cgImage = image.cgImage(forProposedRect: nil, context: nil, hints: nil)
        else { return nil }
    let imageRep = NSBitmapImageRep(cgImage: cgImage)
    imageRep.size = image.size // display size in points
    return imageRep.representation(using: .png, properties: [:])
}

#endif

Usage:
if let data = UIImagePNGRepresentation(myImage) {
    do { try data.write(to: url, options: [.atomic]) }
    catch let error { print("Error writing image (\(error))") }
}

Comment: This worked well for me, but I had to remove the imageRep.size = image.size code to keep the same image size as the original.
Answer: Just one more guaranteed to work approach using SWIFT:
I have an "Image Well" where to user can drop any image. And this "Image Well" has an image property (of type NSImage)  accessed via outlet:
@IBOutlet weak var imageWell: NSImageView!

And the code that saves this image (you can put it inside the button action) is:
if imageWell.image != nil {
   let bMImg = NSBitmapImageRep(data: (imageWell?.image?.TIFFRepresentation)!)
   let dataToSave = bMImg?.representationUsingType(NSBitmapImageFileType.NSJPEGFileType, properties: [NSImageCompressionFactor : 1])
   dataToSave?.writeToFile("/users/user/desktop/image.jpg", atomically: true)
}

In the 1st line of the given code we check if our Image Well has an image.
In the 2nd line we make a bitmap representation of that image.
In the 3rd line we convert our BitmapRepresentation to a JPG type with a compression factor set to "1" (no compression).
In the 4th line we save the JPG data with a given path. "atomically: true" means that the file is saved as one piece and that assures us that the operation will be successfull.
N.B.: You can use another NSBitmapImageFileType in the 3rd line, to save your image to another format. It has plenty:
NSBitmapImageFileType.NSBMPFileType
NSBitmapImageFileType.NSGIFFileType
NSBitmapImageFileType.NSPNGFileType

etc.
Answer: Objc solution with and without compression
NSImage* image;

// No compression
NSData* data = [image TIFFRepresentation];
// With compression
NSData* data = [image
                TIFFRepresentationUsingCompression:NSTIFFCompressionLZW
                factor:0.5f];

if (data != nil) {
    NSBitmapImageRep* bitmap = [[NSBitmapImageRep alloc] initWithData:data];
    if (bitmap != nil) {
        NSData* bitmapData = [bitmap
                              representationUsingType:NSBitmapImageFileTypePNG
                              properties:@{}];
        if (bitmapData != nil) {
            [bitmapData
             writeToFile:<file_path>
             atomically:true];
        }
    }
}

How to save a NSImage as a new file


How do I wrap part of object around cylinder?

Question: I want to wrap the top part of the banner (red) onto the horizontal cylinder of the pole and then use the wind physics for the rest of the banner. How I can wrap only the top part? I have divided the surface but shrinkwrap does not gives me the result I need. Thanks in advance.
Comment: Have you tried shrinkwrap using a vertex group applied to the top of the flag?
Comment: You'll need to subdivide the top part horizontally. A few loop cuts or knife cuts in edit mode should do the trick. A mesh can only bend as much as its geometry allows it to. You can also use the spin tool
Comment: Hello could you please make a drawing of how it is supposed to wrap onto the cylinder?
Comment: ![Banner help](https://imgur.com/pdDnsgW)
Comment: The easiest way if you make loop cuts on the rod, duplicate tha part where the flag is,  upscale them, delete the face near the flag and bridge them together.
Answer: you can use a simple deform modifier, if you have this topology (create some loop cuts):

and assign the selected vertices to a group:

and use the simple deform modifier like this:

result:
Comment: Thanks! I did manage to end to this solution by myself. I did not used the correct start for the loop initially.
Comment: @Morfeas333: If my answer helped you, pls click on the checkmark left of my answer. thx.


Do women bentch gomel less often?

Question: Often in my shul a man who traveled from Israel or Asia to the US will bentch gomel. I have never once seen a women bentch gomel for anything other than giving birth. I'm not sure if this is just my personal experience so I am asking if women in fact bentch gomel less often than men, and if so why?
Comment: Many women don't even come to Shul. Why is it surprising you don't hear them that often?
Comment: @mevaqesh, if a question directly about the frequency of observance of _halacha_ is not a question about Judaism then no question on this site is about Judaism.
Comment: possible dupe http://judaism.stackexchange.com/q/9531/759
Comment: @msh210 That is absolutely false. The vast majority of questions on the site are about Judaism itself; not statistics about Jews' practices. Whether or not the latter are on-topic, the former stand. || In this particular case I find your opinion puzzling. A question about the correct berakha on tea, would certainly be on-topic. A question about the meaning of the berakha on tea would be appropriate. A question about what percentage of Jews in China, make the correct berakha on tea, however, would be about Jews; not Judaism.
Comment: Seems like a question about Jews; not Judaism; unless you are asking for halakhic issues in particular, in which case it is probably a dupe.
Comment: In my experience, husbands bentch gomel for their wives. I have no source for such a practice, though.
Answer: The answer is Shulchan Aruch Orach Chayim siman 219, sayif 1, in the first paragraph of Magen Avraham and other commentaries.

בכ"ה תמה למה אין הנשים מברכות ברכה זו ואי משום דבעי י' הא דבדיעבד סגי בלא י' ולכן תברך בפני איש א' או בפני נשים עכ"ל ואפשר שמנהגן מפני שס"ל שברכות אלו רשות:
(loose translation making use of Baer Heytev and Mishna Berura) The Sefer Knesset Hagedola expressed his astonishment why women don't bless Hagomel. I f the problem is the need of minyan,  and by modesty it's not recommended for a woman to talk in front of a male audience, so she can bless alone.  The best is to bless before a female audience containing one man (one of the 10 need to be a man) . Magen Avraham said that the reason that they don't bless it is because this kind of blessing are not really a duty.

so I am asking if women in fact bentch gomel less often than men

--> Yes,  the Knesset Hagdola made the same observation.

and if so why?

-->  First Teruts: because of modesty they bless it without minyan; second  Teruts: they bless before an audience with a majority of women,  third teruts: the Ykar hadin is that blessing of this type are not a duty,  and they don't bless at all.

The mention of a minyan is from the Gemara itself Berachot 54b:

Abaye said: And he must utter his thanksgiving in the presence of ten, as it is written: Let them exalt Him in the assembly of the people.
Mar Zutra said: And two of them must be rabbis, as it says, And praise Him in the seat of the elders.
R`Ashi demurred to this: You might as well say [he remarked], that all should be rabbis! - Is it written, 'In the assembly of elders'?
It is written, 'In the assembly of the people'! - Let us say then, in the presence of ten ordinary people and two rabbis [in addition]? - This is a difficulty.

@Double AA noted tha even t if the answer is the above,  women don't know it generally, this is a Kashia for him.   Right but I think that poskim searched to understand the minhag that women don't say Hagomel.  The possibility to regard Hagomel as facultative or to  bless Hagomel without minyan apparently contradicts the Gemara,  we need to understand  more the statements of the poskim. I believe that I didn't invented nothing.
Comment: "The answer is" Aside from being pure speculation (and speculation that almost no women past or present consciously hold of) this answer contradicts the Talmud ארבעה **צריכין** להודות. This is pretty clearly not why the OP doesn't see women saying Gomel.
Comment: @DoubleAA who contradicts the  Talmud? The Magen Avraham,  the Knesset Hagdola,  a point I have misunderstood?

Do women bentch gomel less often?


Calculations of Retaining Wall

Question: If I have to find the maximum bending moment of this retaining wall, is the maximum bending moment located at the toe? If not, where is the location of the maximum bending? In order to find the maximum bending moment, I added the moment due to weight and that to the earth pressure (trapezium distributed load) at the toe, is it correct?
Comment: Are you a student, and is this a homework assignment? The distribution of the soil pressure is incorrect if there is no soil in front of the wall. Also, the base slab is too small to meet stability requirements and carry the load.
Comment: The horizontal loads will not change the moment about a point if the point moves left or right since the moment arm will be in the vertical direction.  However, the vertical load caused by the dead weight of the concrete (and soil if there was any over a heel slab) are affected by the left and right placement of your reference point.  At the toe your dead weight is clockwise and your soil is counter clock wise.  At the heel they are both clockwise.  Normally for design you have three critical location to check.  Toe/Stem, Toe/heel and Stem/footing interfaces.
Answer: I assume that this sketch is not up to scale otherwise this retaining wall would topple! One would need a longer and thicker toe possibly with a heal. Usually, we use the relation, $ \ \frac{RM}{OM}\geq 2$

RM = resisting moment
OM = overturning moment

Getting back to your question.
If you do not have soil in front of the stem to offer passive pressure which is your case, the retaining wall acts as a cantilever beam with support at the base.
So the maximum moment is at the middle of the wall thickness at the level of the top of the toe.
Comment: Not to scale or... The reinforcing is not shown, so you are missing the dowels from the footing into the bedrock that are resisting the uplift at the heel?

Calculations of Retaining Wall


How do I show the GRUB menu in GRUB 2

Question: How do I show the GRUB menu in GRUB 2 during boot up?
Answer: You can get to the Grub 2 menu by holding the Shift key down on startup and not letting it go until the menu appears.
Answer: If you want to enable the menu by default, check the line GRUB_HIDDEN_TIMEOUT in the file /etc/default/grub. This option does the following:
Wait this many seconds for a key to be pressed before displaying
the menu.  If no key is pressed during that time, display the menu
for the number of seconds specified in GRUB_TIMEOUT before booting
the default entry. We expect that most people who use
GRUB_HIDDEN_TIMEOUT will want to have GRUB_TIMEOUT set to `0' so
that the menu is not displayed at all unless a key is pressed.
Unset by default.

As you see it is unset by default, so check whether it has been set or not in your case.

How do I show the GRUB menu in GRUB 2


How to open sheets to a specific tab based on days of the week?

Question: I have a file with 7 tabs or sheets each of them represent a day of the week (Monday to Sunday). In each day (Tab) a have this formula in B2 to show the day of the week if it is today...
=IF(WEEKDAY(TODAY(),2) = 1, "Monday", IF(FALSE, "True", ))
=IF(WEEKDAY(TODAY(),2) = 2, "Tuesday", IF(FALSE, "True", ))
=IF(WEEKDAY(TODAY(),2) = 3, "Wednesday", IF(FALSE, "True", ))
=IF(WEEKDAY(TODAY(),2) = 4, "Thursday", IF(FALSE, "True", ))
=IF(WEEKDAY(TODAY(),2) = 5, "Friday", IF(FALSE, "True", ))
=IF(WEEKDAY(TODAY(),2) = 6, "Saturday", IF(FALSE, "True", ))
=IF(WEEKDAY(TODAY(),2) = 7, "Sunday", IF(FALSE, "True", ))

I would like the document every time is open to open in the correspondent "Day of the week" Tab,
Is this possible with a script?
Here is the link to the Sheet:
https://docs.google.com/spreadsheets/d/1GI2R_KI6ujxK7g_jBEpcCoLZt6Fyqngri5CP3kEJNz8/edit?usp=sharing
Answer: You have seven tabs named Sunday-Saturday inclusive. When the spreadsheet opens, you want the the tab for that day of the week to be automatically selected.
Your question probably has several solutions. Consider the following answer as just one solution to your question.
Note: onOpen is a simple trigger that will automatically execute when the spreadsheet is opened.
function onOpen() {

  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var today = new Date();

  //Returns a number 0-6. Sunday is 0, Monday is 1, etc.
  var dayOfWeek = today.getDay();
  // Logger.log("DEBUG: the day of the week is "+dayOfWeek);

  // create an array for the days of the week/tabs
  var thedays = ["SUNDAY","MONDAY","TUESDAY","WEDNESDAY","THURSDAY","FRIDAY","SATURDAY"]

  // get the sheet for today
  var sheet = ss.getSheetByName(thedays[dayOfWeek]);

  // select a cell and make it the active cell
  var cell = sheet.getRange('A1');
  sheet.setCurrentCell(cell);
}


Is Inverse Function Composition Commutative?

Question: Given $f: \mathbb{R}\to(-1,1)$ is there a theorem that states
$f\left(f^{-1}(x)\right) = f^{-1}\left(f(x)\right)$. In example, is $\tanh{\left(\tanh^{-1}{(x^2)}\right)} =\tanh^{-1}{\left(\tanh(x^2)\right)} = x^2$ even though on the left hand side $\tanh^{-1}\left(x^2\right)$ does not exist for $|x| \geq 1$. Once again how can I prove this equivalence, or is there a theorem that states it.
Comment: This is usually taken as part of the definition of an inverse function..
Comment: @CameronWilliams Great even with the bounds placed on $\tanh^{-1}$?
Comment: I guess, if $f:A\to B$, then $f(f^{-1}(x))$ will have the domain $B$ whereas $f^{-1}(f(x))$ will have domain $A$
Comment: @SwapnilTripathi So then do you suppose I can not prove commutativity in the case of $\tanh(x)$ and its inverse?
Comment: I think my claim is wrong and also waiting for someone to give some insight.
Answer: Actually, this is a definition. We say that function $f : X \rightarrow Y$ has an inverse iff there is a function $g : Y \rightarrow X$ such that
$$\forall x \in X.g(f(x))=x \quad \forall y \in Y.f(g(y)) = y$$

It turns out that if $g$ exist, it is unique. So we denote it $f^{-1}$.

To see this, assume we have functions $g,g' : Y \rightarrow X$ satisfying the following.
$$\forall x \in X.g(f(x))=x \quad \forall y \in Y.f(g(y)) = y$$
$$\forall x \in X.g'(f(x))=x \quad \forall y \in Y.f(g'(y)) = y$$
Now prove that $g=g'$.

Also, it turns that $f^{-1}$ exists iff $f$ is a bijection (i.e. one-one and onto).

Now in the example you give, $X = \mathbb{R}$ and $Y = (-1,1)$. So for $\mathrm{tanh} : \mathbb{R} \rightarrow (-1,1)$ to have an inverse, we require that there exists a function $\mathrm{tanh}^{-1} : (-1,1) \rightarrow \mathbb{R}$ such that:
$$\forall x \in \mathbb{R}.\mathrm{tanh}^{-1}(\mathrm{tanh}(x))=x \quad \forall y \in (-1,1).\mathrm{tanh}(\mathrm{tanh}^{-1}(y)) = y$$
Hence, it follows that:
$$\forall y \in (-1,1).\mathrm{tanh}^{-1}(\mathrm{tanh}(y)) = \mathrm{tanh}(\mathrm{tanh}^{-1}(y))$$
But this does not hold with $y \in (-1,1)$ replaced by $y \in \mathbb{R}.$
Answer: When $f$ is both injective and surjective, we have
$$f(f^{-1}(x))=x,x\in (-1,1)$$
and
$$f^{-1}(f(x))=x,x\in\mathbb{R}.$$
So even in this special case, the equality $f(f^{-1}(x))=f^{-1}(f(x))$ does not hold. For example, when $f$ is both injective and surjective, we have
$$f(f^{-1}(0))=0=f^{-1}(f(0)).$$
But $f(f^{-1}(2))$ doesn't defined and $f^{-1}(f(2))=2$.
When $f$ is both injective and surjective, and also its domain and range are same, the equality $f(f^{-1}(x))=f^{-1}(f(x))=x$ will be true.
Answer: The inverse function composition is commutative if and only if domain and codomain coincide.
If $f:X\rightarrow Y$ has an inverse $g$ then automatically $g:Y\rightarrow X$.
This with $f\circ g=id_Y$ and $g\circ f=id_X$ wich leads to:
$$f\circ g=g\circ f\iff id_X=id_Y\iff X=Y$$