Java IDEs won't open on my pi. How do I get them to open?

Question: Of the preinstalled programming tools on raspbian all of them work except for the java IDEs(bluej and greenfoot). I've scoured the internet but have found nothing. really need to code in java  for a project on it.
 It says its loading for like a minute but stops loading and never actually opens it. No errors are shown and its a on a 2014 model A+ v 1.1 running raspbian. Any idea how I can fix this problem thanks.
Comment: Welcome. You are more likely to get help if you go into detail about exactly what happens, including the verbatim text of any error message.
Answer: I'm not really sure current Java versions are supported on this older Pi-board. Just to make sure, open a terminal, and type "java -version" to make sure Java can run. You should get something like:
<code>$ java -version
openjdk version "11.0.3" 2019-04-16
OpenJDK Runtime Environment (build 11.0.3+7-post-Raspbian-5)
OpenJDK Server VM (build 11.0.3+7-post-Raspbian-5, mixed mode)
</code>
If this is OK, you can install Visual Studio Code. VSC is a great tool for Java but is only available as 64bit version on the official site. But you can instal an earlier version of VSC which is 32-bit and compiled for the Pi. You can install in three easy steps:
<code>$ cd /home/pi/
$ wget https://github.com/stevedesmond-ca/vscode-arm/releases/download/1.28.2/vscode-1.28.2.deb
$ sudo apt install ./vscode-1.28.2.deb
</code>
To work with Java in VSC, you need some extra extensions. Click on the "Extensions" button in the left bar. With the search box on top you can find extension in the Marketplace. "Language Support for Java" by RedHat is the most important one you should install.
Answer: Run your IDE from command line, then you'll likely see the error messages besides just "Loading". Most likely it's a RAM issue, I have seen Java IDEs taking more than 1 GB of RAM when they load.
You can try enabling the swap file and increasing the swap size to a couple of GB, but if you run out of RAM on IDE loading, it is unlikely that you'll be able to work comfortably with it using swap.


Apparently it's important to use Int32 instead of int when messing with DLLImport stuff?

Question: In C#, when messing with that system DLLImport/(unmanaged?) code stuff, I read somewhere it's important to use Int32 exact type instead of int. Is this true? And can someone please elaborate on why it's important to do this?
Comment: Do you happen to remember where you read it? It would be interesting if you could post the link.
Comment: Related: [62503](http://stackoverflow.com/questions/62503/c-int-or-int32-should-i-care)
Answer: I think it is more likely that you read about using IntPtr instead of int. As others have said, int and Int32 are equivalent.
It is not really a problem to interchange int and IntPtr on a 32-bit system as they are the same size (4 bytes). The problem comes when on a 64-bit system - if you use int instead of IntPtr, it now has the wrong size (4 bytes instead of 8 bytes) and can cause errors.
Comment: Using IntPtr incorrectly can be a problem for the same reason.

If the type you are marshaling is an integer, you should use Int32 (or its alias.) If the type you are marshaling is a pointer, you should use IntPtr. Using IntPtr to marshal an integer is going to create problems since, on 64-bit Windows, an integer is still 32 bits (4 bytes). Similarly, using integer to marshal a pointer will create problems.

Always use the correct managed type for the native type being marshaled and vice versa.
Answer: I don't believe that this is true. int is an alias for Int32. They mean the exact same thing and will be compiled to the same IL.
A list of aliases can be found here.


Make a Declination Arrow for Data Driven Pages?

Question: I am making a map book over a large area and want to add a correct declination arrow for every page.  I have not found a way in ArcGIS to make a declination arrow (in 10.3).  I could make my own using two north arrows but I don't want to have to change it for everymap along the book. Is there a way to do this?
Comment: Can you include a description and/or picture of a declination arrow, please?
Comment: @PolyGeo a declination arrow is just a line/arrow showing the angle of magnetic north, often in conjunction with a line showing true north. Since declination changes over time as well as distance, it can be a pain to show. Donitza, I don't have a specific solution for you, but there are a lot of promising results to investigate from a Google search on "data driven pages declination". In particular http://blogs.esri.com/esri/arcgis/2010/03/19/adding-a-declination-diagram-in-arcmap/ and https://geonet.esri.com/thread/63407
Comment: There is one important, fundamental design decision to consider though. If your north arrow is part of the page layout, then that element must be some sort of dynamic element that can read a property of the dataframe/index elements. Somehow the declination value has to be present as an attribute of the ddp index. If the north arrow is actually part of the data though, you could do points, symbolize them with a marker/graphic, and give each point the declination attribute, rotating the symbol by that attribute. In that case the north arrow is independent of ddp.
Answer: I was able to use the Create Declination Diagram tool with the Production Mapping Extension. http://www.arcgis.com/home/item.html?id=dd664ce915214390b8cb8babb09a84bd. However, Chris W in the comments above was correct to state that it is now a part of the ddp index and is uniform with each page.  I'm not entirely sure what he is explaining in the comment of how to make the element dynamic and independent of the ddp, but that is the next step to consider.


How to decide whether to use a JavaScript or PHP object when using both languages?

Question: For example, you are  building a dictionary app where the entries are objects, and all the values are stored in a server-side database. The entries are visible client-side, so they should eventually be JavaScript objects. However, since the data is server-side, there are two ways to construct the object:

Construct the entries objects via PHP, then pass the result to a .js script, which makes JavaScript objects from it.
Construct the entries via JavaScript, calling AJAX methods on the object to request the specific information about the entry (e.g. definition, synonyms, antonyms, etc.) from the server.

The first way ends up constructing each entry twice, once via PHP and once via JavaScript. The second way ends up calling several AJAX methods for every construction, and opening and closing the database connection each time.
Is one preferable to the other, or is there a better way to do this?
Answer: I use a rule of thumb, the less AJAX (on a page opener) the better.
If you can push all information on the page load to the user, do it. Then use AJAX on subsequent calls. Otherwise the user-experience will suffer from AJAX (rather than benefit) as the page will take longer to load.
Answer: Another option would be, if you're not tied to PHP, to have a JS-based back-end like Node.js. This way you can transmit everything in one format. In some cases you can even store the JS object directly on the database. An example of this kind back-end would be Node.js + Mondo DB, if document database is suitable to your needs.
If you're tied to PHP/JS, i'd go for minimizing AJAX calls. Making asynchronous transfer (duplicating objects) should achieve improved user experience, and the choices made should aim for this. Too many HTTP-requests usually end up making the site slow to react, which is one of the things we usually try to get rid of by using AJAX.
One way that's sometimes useful is also to render JS object by PHP, that could be used if the data is going to be needed but that should not be directly (or at all) shown to the user.
Answer: Totally depends on the project. There are just too many variables to say 'you should do it this way'.
Instead, test it. Do it one way, push it to a high number of requests, and profile it. Then switch and try the other way. Keep it easy to switch the output from the PHP by following the MVC pattern.
The only general rule is 'minimise the number of HTTP requests', as HTTP is by far the biggest bottleneck when a page is loading.


How do self-adjusting hydraulic disc brakes work?

Question: I have Avid Elixir brakes on my mountain bike.  They are the only part of the bike that's a total black box to me.  I understand the principle behind disc brakes, and I understand the principle behind hydraulics.  I could draw a diagram of how this all goes together.  That said, I've been told that they automatically adjust for wear on the pads, so as the pads wear down, the braking action is the same.  Part 1 of the question: Is this true?  Part 2: How the heck does it work?
Comment: @user19317 ask it at new question, as it worth it.
Comment: All i've learned from reading these answers is that (a) people don't understand how brakes adjust for pad wear and (b) people don't understand that they don't understand how brakes adjust for pad wear!
Comment: i have avid elixer 5 on my orange squash,just bought it and the front brake when applied acts like its grabbing the disc every sec on off on off, bit like car brakes...is this normal for these brakes
Comment: Check this pdf out: https://sram-cdn-pull-zone-gsdesign.netdna-ssl.com/cdn/farfuture/9Ch1hjG3rE_toopsLAPJCqq41oj6pAhcywHmlpH8z2M/mtime:1379110588/sites/default/files/techdocs/gen.0000000004234_rev_a_hydraulic_disc_brakes_overview.pdf . Explains parts of it.
Comment: The accepted answer primarily cites a check valve as the primary mechanism. In reality, the specially designed caliper piston seals and their seats are what actually compensate for wear, while the lever "check valve effect" (there is no dedicated valve assembly, just the main piston and ports) is related to the "open" style hydraulic system used in most bicycle hydraulic brakes. Reader beware.
Answer: I think the answer he was looking for was how they adjust as the pads get worn.  There is a check valve in the master cylinder, that will allow enough fluid from the reservoir when the lever is pulled.  If more fluid is needed because of pad degradation, it passes it into the active system.  Therefore with more fluid in the system, the piston is pushed out slightly more and the pad is the same distance from the rotor.
That is why your res. needs to be topped off occasionally.
Comment: At least in automotive systems, what happens is that there is a small hole that connects the reservoir with the cylinder, so fluid goes freely from the reservoir into the cylinder: there is no pressure in the lines. When pressed the piston closes this hole, sealing the system and creating pressure. As pads wear, the piston travels a little deeper into the cylinder, pushing the pads further, but when it returns, it opens the before mentioned hole, letting fluid from the reservoir fill the newly created space in the lines. This happens a little at a time, you you wont notice it.
Comment: Hmmm, I don't know about the check valve part.  On the systems I'm familiar with, to put new pads in you simply compress the pistons by either pressing or screwing them in and fit the new pads.  A check valve would prevent that from working.
Comment: At least in automotive systems, what happens is that the main cylinder pushes a little bit of the fluid in the reservoir into the hoses. As pads wear out, a little more fluid is put into the hose when the main cylinder's piston retracts by letting fluid from the reservoir. There is no need for a check valve. That's why when changing pads you only need to push the pistons back into the calipers. You'll see reservoir level rising while doing so...
Comment: That may be how it works for automobiles. There is no check valve in any bicycle brake system I've seen, and I've completely disassembled most major brands.
Comment: To add to the comments above, anyone who's bled hydraulic brakes knows that when injecting fluid into the caliper, you can feel it in the brake lever, which wouldn't happen if a check valve was present
Comment: @mattnz That is how open hydraulic systems work, but it's a "reactive" process; the actual "active" compensation for pad wear occurs at the caliper end with the fancy seals.
Comment: Wow, that is *exactly* what I wanted to know, thank you!
Comment: Checkvalve by another name is still a check valve, some call it a port, I'll call it a bobbywhatsit. When the lever is in its rest position, the bobbywhatsit is open and fluid is free to move between  the res. and master cylinder in both directions. Has to be both directions as fluid expands with heat.  As soon as the lever is pressed, the bobbywhatsit is closed and fluid is trapped, forcing the caliper pistons out.  Every time the lever is released, the fluid is free to flow thought the bobbywhatsit letting the pads retract to their natural rest state.
Answer: Answer to part one:
Yes, within reason, it's true.
Answer to part two:
It works in a very simple fashion. Each time the lever is pulled, enough fluid to move the pistons, and therefore the brake pads, is pushed out of the caliper far enough to contact the brake rotor.
As they move out of the piston, they push past the caliper seal. The flex in the caliper seal acts as a retraction spring, to pull the piston back into the caliper by just enough to clear the rotor.
Since the seal that acts as a retraction spring is always in the same place relative to the piston, the pad wear is automatically compensated for because the pad is always pressed out of the caliper until it contacts the rotor.
It is a bit confusing to describe, but it is how it works.
Comment: I'd love to see a diagram added to this answer, particularly as the accepted answer seems to be incorrect...
Answer: Many high end hydraulic systems on bikes are very much the same design as the car & motorcycle variety. However there are cheaper cable/hydraulic type brakes for cycles avalable.
What happens in the fully hydraulic system is that the fluid within the system is put under pressure by you pulling on the lever, but the fluid and the system itself will not 'give' under this pressure as it is a pressure resistant system, apart from one part, the caliper.
Ok so.. Attached to this lever your pulling is what's called the master cylinder, this compresses the brake fluid in the system at the lever end, and forces it (in a small quantities) down the brake hose to the caliper.
As the master cylinder, brake hose and caliper are already full of fluid the fluid only has a couple of options.. It can try to expand into any gaps, or it can escape through any holes. However this is a safe braking system so we have no leaks and our fluid is trapped in our sealed environment :)
Ok.. The only place the fluid can actually move to, then expand in, is the calipers small chambers, these are located behind the caliper pistons and if the system has been bled properly should already be filled with fluid.
Each piston is fitted with fluid resistant rubber seals, each piston also floats inside the caliper, on these seals. The seals are very important as they not only help to stop dust/dirt entering the caliper and allow the caliper to float freely, but they also seal the fluid inside the caliper whilst withstanding the high braking pressures within the brake system.
In front of each piston is what you can see when you look down at the disk. You'll see the disk itself, the pads, and if you remove the pads you'll see the front end of the pistons. Now as you know behind each piston is the brake fluid, this is the brake fluid your are trying to make expand by pulling on the lever. Still with me? :)
The only thing this fluid that your pressurising (by pulling the lever) can do, is try and expand into the small chambers behind the caliper pistons which in turn pushes on the back of the pistons forcing them outwards, and against the rear of the pads. The pads then react in the same way and are forced outwards trying to squash the disc!
There is usualy no need for adjustment because as the pads wear down, the fluid just fills the remaining gap in the chambers behind the pistons. Although some brake systems do have an adjustment knob/screw on the master cylinder for adjustment purposes
Hope that helps.
Comment: @Benson: I think that he didn't mean that. If that was the case, it wouldn't be called automatism or auto-adjustment. I think this explanation is just wrong, as it doesn't describe the adjustment process, just how hydraulics work. Therefore -1 for this answer.
Comment: Thanks for the in-depth explanation.  I already understood most of that.  It sounds like, from what you're saying, the levers just move a bit further, but it's little enough that I don't notice.  Is that accurate?
Answer: None of the answers here was satisfactory to me, but one had a link having image that explained it all: https://web.archive.org/web/20210507014839/https://cdn.sram.com/sites/default/files/techdocs/gen.0000000004234_rev_a_hydraulic_disc_brakes_overview.pdf
The idea is that the brake levers have a master cylinder. The master cylinder has a reservoir of brake fluid and a piston going towards a brake line. When the piston is fully retracted, it is outside the brake line so the fluid in the reservoir is connected to the fluid in the brake line.
When you start to push the brake lever, the piston goes inside the brake line, disconnecting the reservoir from the brake line, and starts to push the brake fluid in the brake line.
At the other side of the brake line is the brake caliper. It has peculiar seals. The seals are made from rubber and are rectangular. However, the metal container of the seal has one slanted side. Even at the danger of doing a minor copyright infringement, I took a screenshot of that SRAM document:

When the fluid (yellow) is pushing the piston (intermediate grey), the piston seal (dark grey) bends until it is bent in such a manner that the piston seal right side is touching the slanted right side of the seal container.
This bending of the piston seal causes the piston to move the brake pad on that side towards the rotor. If the brake pad doesn't have any wear to adjust, now it is touching the rotor and all is good.
However, if the brake pad is not yet touching the rotor, then the massive pressure in the brake fluid causes the piston to slide on the seals. Friction at this interface is large, so this happens after (not before) the seal has flexed. The piston slides on the seals until the brake pad touches the rotor.
Then, let's assume the piston has slided on the seal (self-adjustment has happened). When you release the brake lever, it creates a vacuum pressure in the brake fluid. This vacuum pressure causes the piston seal to bend back to its original rectangular shape so that the piston moves back from the discs. But because self-adjustment has happened, this is not enough to remove vacuum pressure from the brake lines. The piston would need to slide back on the seals. However, that would require so much force that the vacuum pressure is incapable of doing that. So this creates a vacuum in the brake lines, there's lots of brake fluid and a small pocket of vacuum, nothing, not air, not anything.
When the brake lever is fully retracted, in the master cylinder the brake line is reconnected to the brake fluid reservoir. This causes new brake fluid to fill that vacuum that was created in the brake lines.
You are back to square one, except self-adjustment has moved the pistons and pads automatically towards the rotor, and new brake fluid has gone from the reservoir to the lines.
Because the brake pad retraction amount is determined by the slanted container of the brake piston seals, you can't adjust it. Not unless you disassemble the brake caliper, find a Dremel and start grinding the slant to a different angle.
The metal spring spreading the pads isn't the component that causes retraction. It's there only to maintain full contact between the pads and the pistons as the pistons and pads retract. It doesn't cause the retraction itself.
Comment: Excellent explanation, and finally the correct mechanism!
Comment: Thank you! This should be the accepted answer. All the other ones are blathering about how hydraulic disc brakes work in general while totally missing to answer the core question.
Answer: I've been researching this question in order to be able to adjust my self-adjusting brakes ;) So I'll report my findings here. I can't vouch for the accuracy since I am no bike technician.
The pistons are floating freely and are surrounded by seals. If there was nothing holding a piston back it would be possible to pump the brakes until it popped out of the caliper.
Engaging the lever pushes the piston further out and releasing it again lets the seal retract, which will in turn retract the piston somewhat (enough to release the brake).
If you want to adjust this type of brake, all you have to do is to push the piston further out, i.e slide it out so that the seal sits further back on the piston body.
Under normal operation the piston only moves with the seal and does not move relative the seal. When the pads are worn enough, however, the pistons will slide futher out relative the seal, simply because they aren't held back.
As you already noticed, the system needs more fluid if the pistons slide out. This is solved by means of a reservoir. When the system is in rest and the main cylinder is retracted, the lines are in direct contact with the reservoir through holes called timing ports. This connection will neutralize any pressure differences and thereby fill the lines. When the lever is actuated, the main cylinder passes the timing ports. After this point the system acts like a closed one.
My problem was that the system didn't want to auto-adjust. The gap between the pad and the rotor on one side was a bit too large. What you can do in this situation is to over-actuate the pistons a bit (which will force them to slide relative the seals), and push them back to where you want them. This way they will sit better relative the seals, giving you the right range of motion.
This procedure is called "advancing the pad position" in old Avid instruction manuals. The new ones don't have it since they are supposed to auto-adjust (but don't always do). Google it and you will find detailed instructions. But basically what you do is remove the caliper from its mount, push the pads until they almost meet (leave about 1mm), push them back to fit the rotor, and re-mount (which will also re-center the caliper). Made a big difference on my brakes.
Comment: There's a nice illustration of how a piston moves in its seal in [this video from Park Tool](https://youtu.be/vQXFFgRButo?t=75). It doesn't explain what's happening at the master cylinder, though!
Answer: Self-adjusting for pad wear happens only for open system hydraulic break type, not for closed. The self-adjustment is not an outcome of any hydraulic system, it's an outcome of specifically the reservoir in a hydraulic system.
An open system contains a reservoir partially filled with air and partially with oil. This reservoir is disconnected (sealed off) from the rest of the system when brakes are applied, thus hydraulic force transfer can take place. The reservoir is re-connected to the system when the brake lever is released (near its idle/resting position).
Open systems are still sealed. The total amount of oil in the system remains constant, but the volume (and thus pressure) of that air varies as pads wear out.
When pads are new and the slave cylinder at the caliper are in their most retracted position, the volume of that air in the reservoir is smallest. That is, by manually pushing the cylinders inwards, you are compressing the air in the reservoir. When pads are worn and the slave cylinders are in their most extended position, the volume of that air in the reservoir is largest (thus lowest pressure).
The reason it is possible to push the cylinders inwards manually, without them popping back out, is the friction in the cylinder seal. To move the cylinder outwards/inwards that significant friction must be overcome. And, to compress the air by a tiny amount (displacement of the cylinders is small, a few millimeters) requires a force that is smaller than the friction; thus the friction holds the cylinder in its retracted or extended position, even though technically there is a small force from that reservoir air that is constantly acting on those cylinders.
This does mean that on that first application of breaks, after a new incremental pad thickness has worn out, when the breaks are engaged, the high force not only moves the slave pistons normally, but also pushes them further outwards (overcoming friction). After this happened, the master piston would not return all the way to its starting position -- it would stop short by exactly the distance that can be calculated from distance the slave cylinder pushed outwards and the ratio of the respective diameter of the pipes, keeping the volume constant.
To make the lever retract all the way to its starting position there are only two ways: either the slave cylinder is pulled back in (in principle, in a closed system, that would be possible by forcing the lever away from the handlebar -- this motion which would in principle attempt to create a vacuum, but of course the Earth's atmosphere will instead push the cylinder back in rather than allowing a vacuum) OR new liquid is added into the so-far closed system.
The latter is accomplished by ensuring that the reservoir gets re-connected to the system when the lever is in that not-all-the-way retracted position. The force from the backward motion of the lever sucks oil out of the reservoir instead of pulling the slave cylinder back in. Sucking oil out of the reservoir is only possible because there is air in that reservoir and the volume (i.e. pressure) of that air is allowed to decrease.
This is not at all simple. The only detailed (though not detailed enough) explanation I could find, tther than the brief answers here is in this document by SRAM:
https://web.archive.org/web/20210507014839/https://cdn.sram.com/sites/default/files/techdocs/gen.0000000004234_rev_a_hydraulic_disc_brakes_overview.pdf
Answer: Epic Bleed Solution did an amazing post explaining the details of hydraulic disc brakes, covering concepts and mechanic principles, different fluids, pads, rotors, etc. It's a very good introduction to hydraulic disc brakes that you can find here: http://www.epicbleedsolutions.com/blog/how-hydraulic-brakes-work/
Comment: Summarize the link!!!
Comment: This is an extremely long post regarding various advanced concepts of hydraulic disc brakes. It is hard to summarize and is not suppose to be a direct answer but rather an "open if you want to know more" link. Maybe it should be written as a comment, I'll give you that. Friends? :)


Disconnecting From SUP

Question: My project supports two type of Connection viz SUP & Web Service. If user selects Web Service, connection to SUP should be disconnected. I use [SUPMessageClient stop] to disconnect. This functions stops the SUP, but when I try to connect to SUP again using [SUPMessageClient start] or [SUPMessageClient restart]  none of the methods of call back handler gets called. Is this right way to disconnect from SUP? If not then what is right way?
Thanks in advance.
Answer: Are u changing the network???
If Yes then you must know that changing the network in between the running application is not possible.
If NO then you can create a MBO of web service and can use in your project

Disconnecting From SUP


Moving from ISC DHCPd to Windows Server 2008 R2 DHCP

Question: I currently have a Linux server running ISC DHCPd and I'd like to eliminate this server and move to a Windows DHCP server. I'm wondering if there is an easy way to accomplish this or if someone could recommend some best practices?
Answer: The DNS servers in Windows Server 2003 and 2008 (R2) are capable of being configured textually using the netsh command. I'm not aware of any projects to parse the ISC DHCPd configuration file and output the equivalent netsh commands but it ought to be reasonably easy. (I see where some as written a REXX script to convert the other direction, but that's probably of limited utility to you.)
Some background on netsh should be able to get you started.
Comment: +1, I helped our Unix guy with going the other direction: MS DHCP to ISC DHCP. I needed to use `netsh` to export our config into a parseable form, and he ran that through a script he wrote to generate an ISC version. Worked pretty good.


Risk management plan vs risk register

Question: Should you be able to lay the two side by side and they will talk to each other item for item?
Answer: No-  I'm not sure that I understand your question.
The risk management plan is a plan - how you will manage risk. It should contain nothing that is ephemeral.  Generally it contains sections that describe how you will identify risk, how you will analyze risk, calibration standards (what does a likelihood of 4 mean?  What is an impact of 2?).  The plan should outline who is involved in managing risks, what roles, what responsibilities.  How will risk reporting be done? etc.
The risk registry is a list of risks (usually with some analysis).  Everything it contains is ephemeral.  Often the registry is a spreadsheet with columns for risk, Likelihood, Impact, mitigation, and owner.
I'm not sure what you mean by talk to each other item for item... the sections of the risk management plan are similar to the sections for all other planning documents. The items in the risk registry are risks.
Answer: The risk management plan describes the who, what, where, when, how, and why as it relates to managing threats against your project.  It should point to the risk register as one of several tools that would be used to manage risks. The plan would indicate who owns it, who can update it, where it is maintained, how often it might get updated, and how it feeds into whatever reports you plan on publishing.
Your register should be in a constant state of flux while your plan is relatively stable, only updating it as necessary.
Answer: Risk management is identifying and evaluating the organization's risk and selecting and implementing measures to treat risk or loss exposures while risk register is a document or tool used to record numbers of risk exposures, regulate compliance and state the relevant information relating to risk such as nature of risk,mitigation and measure and who's responsible for it

Risk management plan vs risk register


should intentionally misspelled words be in quotations?

Question: When we use intentionally misspelled words for effect, should the misspelled word be in quotations?
Comment: Could you give a sample sentence with a misspelled word? I think context is necessary to see exactly what you mean. Thanks.
Comment: I hope the discussion expands to the use of apologetic quotes in general, which I dislike, but am often guilty of.
Answer: Misspelled words can be acknowledged as misspelled or inappropriately written by inserting  [sic] directly after the words of concern.
Sic is a shortened form of sic erat scriptum, Latin for "thus was it written." The idea is that the words are a direct transcription from the original text.
Sic is often used for effect. For instance the writer may be making a subtle jab at the original author for his clumsy or incorrect writing. Or the writer may wish to draw attention to the fact that she intentionally wrote the words awkwardly or incorrectly.
Not all uses of sic are for effect.  Some are mere acknowledgements of error in the original.
Comment: That's not quite the same as deliberately misspelling a word for effect, though.
Comment: I tried to address this after reading your observation, which I agree with.


Should write in my resignation letter a 2 week leave notice for job I just started?

Question: I received an overall better job offer one week after I started to work for another company. I feel like there is no point in mentioning the 2 week leave notice as I don't have anyone to train in any task only I know how to do, and there is nothing to finish.
How I should proceed?
I'm aware that most likely I will burn some bridges, but I'm willing to take that risk.
Comment: And don't tell them where you're going, or they might try to contact your new employer. In fact, don't update your linkedIn for a while.
Comment: Have you *started* the first job or just *accepted* the first job?
Comment: Please add a country tag. There is no way to write a globally valid answer to that.
Comment: Just have a chat to your manager. Probably not even a letter is required.
Comment: Did you sign a contract? If yes, what does it say?
Answer: Talk to your manager before writing a formal letter. There's a pretty good chance they'll agree to an immediate exit since they won't want to waste two weeks' salary for you to twiddle your thumbs, especially since you've only been there a week.
If you have started some work/task, be prepared to be asked to stay a short time to complete it.
I once had a developer ask to leave after only a month into her probation. We agreed she would stay to the end of the week to complete her latest piece of work and tidy up some documentation. While I was a little annoyed, there wasn't any hard feelings as I knew the other job was actually a better fit for her.
However, you should also be prepared for your current employer to be upset - filling a job is time consuming. They may go so far as to put you on a do-not-hire list, or even be petty enough to force two weeks out of you (highly unlikely though).
Depending on your location, you might even get away with simply walking off the job - but that will certainly burn bridges.
Answer: If you work an office job, it is likely that for legal purposes, the company will ask for a resignation letter no matter what.  They can deliver your last paycheck on time and do any de-briefing that needs to take place.
If you don't work an office job, chat with your manager.  There is likely to be some level of distress, so anticipate that, keep a cool head, and don't do anything that will wreck your chances of making a clean exit.
Answer: You'll burn a lot of bridges, and, "word gets around fast."
You accepted their offer – then decided that the grass is greener on the other side of the fence.  I wouldn't do that, if I were you.
Comment: This is a sunk-cost fallacy. There is nothing wrong with departing while only a week into a new job, in the same way that there is nothing wrong with a company dismissing you a week into a new job (exception being contractual obligations). If the new position is a better fit, it makes more sense to jump ship rather than stick it out with the 'worse' choice. The issue comes only if the transition isn't handled properly, or the prospective employee does this frequently.


Pullback of Cartier divisors

Question: Let $f:X \to Y$ be a morphism of schemes (not necessarily reduced). Assume $X$ is smooth and $f$ is locally a homeomorphism. Let $D$ be a Cartier divisor on $Y$. We know that the pullback $f^*(D)$ is again a Cartier divisor. If $f^*(D)$ is effective then is it true that $D$ is effective?
Answer: The answer is no in general, but maybe you could put more conditions on $X$ and $Y$ so that it is true. Take $Y$ to be any variety, let $D_1,D_2\subseteq Y$ be subvarieties of codimension 1, and let $D=D_1-D_2$. If we take $X=Y\backslash D_2$, then the pullback of $D$ to $X$ is just $D_1$, which is effective.
Edit If $f$ is surjective, then it's true. If $D=F_1-F_2$, with $F_1$ and $F_2$ effective divisors that have no common components, then $f^*D=f^*F_1-f^*F_2$. Since this is effective, we have that $f^*F_2$ appears in $f^*F_1$. Locally at a point $x\in X$, $f^*F_1$ is of the form $g\circ f=0$, where $g$ is a regular function at $f(x)$ defining $F_1$. Moreover, we have that if $F_2$ is given locally by $h=0$ at $f(x)$, then $h\circ f\mid g\circ f$ in the local ring $\mathcal{O}_{X,x}$. If $U$ is an affine neighborhood of $x$ and $V$ is its image, then we can assume that $U$ and $V$ are homeomorphic, and so $h\mid g$. But then $F_2$ appears in $F_1$, a contradiction. Therefore $F_2$ must be equal to $0$.
Comment: @Auffarth: Please note $f$ is locally a homeomorphism. In your example I do not see how $f$ can be a homeomorphism.
Comment: In this example $f$ is locally the identity! Actually $f$ is the identity and so is a homeomorphism with its image, which is an open subset of $Y$!
Comment: @Auffarth: I did not mean homeomorphism with its image.
Comment: By locally a homeomorphism, I mean for every point of $Y$ there exists an open neighbourhood containing that point such that it is homeomorphic to its preimage. I guess this is not the conventional definition. Sorry for the confusion.
Comment: Ok, so you're looking for a covering space. And you want this using the Zariski topology, right?
Comment: @Auffarth: Yes.
Comment: Actually it won't quite be a covering space since the preimage of an open set won't be (in general) the disjoint union of open sets that are homeomorphic to the original, but we're looking at a surjective morphism that is a local homeomorphism.

Pullback of Cartier divisors


Using cpp-netlib 0.8 as a HTTP Proxy - Helpless

Question: I am trying to use cpp-netlib in a project of mine. I simply need to create a HTTP proxy into which I can plug in some functionality later. For now, I just need to listen to requests, send request to a new site, and forward the answer of the new request to the first request.
This is the code I have so far:
std::string ip = source(request);
http::client client;
std::ostringstream url;
url << "www.example.com/image.jpg";
http::client::request clientRequest(url.str());
http::client::response clientResponse = client.get(clientRequest);
response = server::response::stock_reply(server::response::ok);
response.headers = clientResponse.headers(); //This is not possible - not correct type or something
response.content = clientResponse.body();

Results in error C2679: binary '=' : no operator found which takes a right-hand operand of type 'std::multimap<_Kty,_Ty>' (or there is no acceptable conversion)

A request to the test image I am using yields 19.4kb data in the response. If I do the same request through the above code (without header copying) I get an answer with about 4kb data, which the browser tries to show as text (default header). It does seem like an image though, even in text.
Anyone out there that is familiar with cpp-netlib-0.8? is response.content = clientResponse.body(); the correct way? How can I add the correct headers?
It's altogether too much template weirdness in cpp-netlib for me to understand it right now!
Thanks...
Answer: Instead of using:
response.content = clientResponse.body();

the correct way is:
std::string body_content = body(clientResponse);

also, you are using response as variable, while your variable is actually clientResponse
For more examples read cpp-netlib v0.8 documentation


How to configure the Screen Locker

Question: I'm using KDE 4 and it locks the screen without warning and then it requires password to unlock, I need a warning before locking as the Gnome before locking the screen it set the screen brightness geting darker and darker, you know the screen is ready to be locked.
Answer: At System Settings -> Display and Monitor -> Screen Locker you can choose when to lock and when to lock with password. Also, there you can set a screensaver, so it can be as a warning that your session will soon be locked with password.
If this is not enough, you always can install gnome-screensaver, but it may install some gtk-gnome dependencies, so be aware.

How to configure the Screen Locker


When we build a kernel and busy box, we need toolchain only for busybox not for kernel?

Question: Am I correct that while making a small linux system for an embedded device, we need kernel build based on the configuration set with the default toolchain. Whereas rootfs requires a toolchain ? Since the architecture is set in kernel there is no need of toolchains. Whereas the busy box makes a binary. Thus, it needs a toolchain. Please correct me as i have a doubt here.
Answer: Toolchain plays very important role in embedded system development.
In compiling and building also you required cross tool chain that is specific to your Architecture.Tools chain will not be default.You have to set it during configuration or while passing make command you have specify your tool chain prefix.
make CROSS_COMPILE=arm-none-linux-gnueabi-
The same tool chain should be used in compiling and building your Busybox. If you compile busybox with
statically.Then no need to worry about shared library. But if you compiled busy box with dynamically then your toolchain plays important role in rootfs. here you need to copy libraries of toolchain to rootfs /lib folder .
what are the library need to be copied can be known just type following command.
strings _install/bin/busybox | grep ^lib
shows list library that should be kept in /lib of your rootfs.
This command says, "Get all the strings from the file, and only show the lines that begin with lib."
The program ldd can't be used, because the program has been cross-compiled and won't run on the
development host.
These files should be fetched from the sysroot directory of the toolchain. Most modern toolchains
have been configured with a sysroot, which is a directory that contains the files from the toolchain
likely to appear on a root file system of a system targeted by the toolchain. To check if your toolchain has
sysroot support, try the following:
$ arm-linux-gcc -print-sysroot
/arm-unknown-linux-gnueabi/bin/arm-linux-gcc
If this is a valid path, this is where the files should be copied from. If no path is displayed, use find
to locate a sysroot directory in , or use find to look for libc.so:
$ find . -name libc.so
After you've located libc and libm, create the (your rootfs)/lib directory and copy them there. The files
are likely symlinks to other files, so be sure to gather them all. The next file to get is the dynamic loader,
normally called ld-linux-, which also resides in the lib directory along with libc.so.*.
Copy that to the /lib directory. Your system now has all the shared libraries and the loader, so
BusyBox can run.
So finally if you want to compile any apps or program you should have to compile with this tool chain which you compiled busybox.
Comment: Thank You! Can you please elaborate on sysroot. What is sysroot?
Answer: --sysroot=dir
This option specifies the root directory where headers and libraries are located. when you give
(gcc) -print-sysroot
This will shows respective gcc(if its standalone tool chain) to look header and libraries to that particular directory .
While building stand alone cross-tool-chains at the time building and compiling gcc  ,--sysroot=dir is given to finding respective include and library file.
you can see here configuration
cd $CLFS_SRC
tar -jxvf gcc-4.7.0.tar.bz2 && mkdir -v gcc-build && cd gcc-build
AR=ar  LDFLAGS="-Wl,-rpath,${CLFS_CROSS_TOOLS}/lib" \
../gcc-4.7.0/configure --prefix=${CLFS_CROSS_TOOLS} \
--build=${CLFS_HOST} --target=${CLFS_TARGET} --host=${CLFS_HOST} \
--with-sysroot=${CLFS_CROSS_TOOLS}
Generally this folder contain all your shared libraries.
Answer: @Shreyas, you have an wrong interpretation. Toolchain is nothing but an cross compiler which cross compiles source, so that it can run on the processor architecture it is compiled for. Even kernel & bootloader is a c code and you want it to be ported on embedded board, need to cross-compile, you need toolchain to cross compile kernel & u-boot source. So toolchain is needed, it may be either u-boot bootloader, kernel, rfs (Busybox) and application.


Quasiclassical propagator

Question: Sometimes they are referred as Keldysh quasiclassical propagator or Eilenberger propagator.  How the quasiclassical propagator is derived? How they are implement with a simple case of a Green's function?
\begin{equation}
G^{K}=
\begin{bmatrix}
(g^K+\vec{g}^K \cdot \vec{\sigma}) & (f^K+\vec{f}^K \cdot \vec{\sigma})i\sigma_y \\
i\sigma_y(\underline{f}^K+\vec{\underline{f}}^K \cdot \vec{\sigma}) & (\underline{g}^K-\sigma_y\vec{\underline{g}}^K \cdot \vec{\sigma}\sigma_y)
\end{bmatrix}
\end{equation}
Answer: They come from a quasi-classical expansion of the Dyson's equation (in the context of superconductivity, the Dyson's equations for the normal $G$ and anomalous $F$ Green's function are usually called the Gor'kov equations). They originate from

Larkin, A. I., & Ovchinnikov, Y. N. (1969). Quasiclassical method in the theory of superconductivity. Sov. Phys. JETP, 28, 1200–1205.
Eilenberger, G. (1968). Transformation of Gorkov's equation for type II superconductors into transport-like equations. Zeitschrift Für Physik, 214(2), 195–213.
Usadel, K. D. (1970). Generalized Diffusion Equation for Superconducting Alloys. Physical Review Letters, 25(8), 507–509.

and they are many reviews of them, including

Serene, J. ., & Rainer, D. (1983). The quasiclassical approach to superfluid 3He. Physics Reports, 101(4), 221–311.
Langenberg, D. N., & Larkin, A. I. (1986). Nonequilibrium superconductivity. Amsterdam: North-Holland.
Wilhelm, F. K., Belzig, W., Bruder, C., Schön, G., & Zaikin, A. D. (1999). Quasiclassical Green's function approach to mesoscopic superconductivity. Superlattices and Microstructures, 25(5–6), 1251–1288. Mesoscale and Nanoscale Physics; Superconductivity.
Kopnin, N. B. (2001). Theory of nonequilibrium superconductivity. Oxford: Oxford University Press.
Gor'kov, L. P. (2008). Theory of superconducting alloys. In K. H. Bennemann & J. B. Ketterson (Eds.), Superconductivity (in two volumes), vol. 1: Conventional and unconventional superconductors. Berlin, Heidelberg: Springer Berlin Heidelberg.

and many other.

Quasiclassical propagator


(Mac) How do I STOP Netbeans from automatically SELECTING a suggested keyword, BUT keep the POPUP open for me to select MANUALLY?

Question: How can I stop Netbeans from automatically completing my code, but keeping the popup open so that I can select from its list?
Thanks for the read. :D
Answer: I just changed the Completion Selectors.
That seems to do the trick.


Is there an event in compact framework that fires on suspend and resume?

Question: Or do I have to pinvoke native code?
I don't want the power status...well I do, but I don't want to poll it all the time and would rather have an event fire.
Answer: No there is not.  Generally an application is completely unaware of the power state. When the device suspends, code simply stops executing.  When you resume, it starts again at the exact spot it left off.
You can hook into the power management system to get notifications, though be aware that you don't have time to actually react, so it's likely that your code can't actually handle the "going to sleep" event until after it wakes again.
Both These state transitions are exposed in managed functions in the Smart Device Framework's OpenNETCF.WindowsCE.PowerManager class.
Comment: Damn I looked there, I didn't find anything.  Actually I want the resume event.  Specifically for com ports.
Answer: If you absolutly need to know when a device is suspending the best alternative available is to run your program in unattended mode.  Instead of suspending your device will change to the unattended power state.  That is your warning that the device wants to suspend.  Do what ever work you needed to do before the device suspends then release your unattended request (note, if other programs are requesting unattended mode to then the device may not ever suspend!).
For more information on unattended mode see http://www.codeproject.com/KB/mobile/WiMoPower1.aspx
For an example of getting power change notifications see http://www.codeproject.com/KB/mobile/WiMoQueue.aspx


Following the big guys in real time

Question: In the book Rule #1 by Phil Town, he explains that in general a large investor can take between 3 and 6 weeks to buy or sell a complete position. For example, Warren Buffett took several months (between March 4, 2022 and August 8, 2022) (https://www.dataroma.com/m/stock.php?sym=OXY) to buy his entire position in OXY. When we know this information, if we notice him in the month of May, we can buy stocks at the same time as him and just profit from the rise. My question is: How can we track the IN and OUT of these big players in REAL TIME? Phil Town explains that it's easy to get access to this information, but I have no idea how.
Comment: Completely away from the question, but if you want to profit from what Warren Buffet does, just buy Berkshire Hathaway shares.
Comment: If you can profit from doing that, so can everyone else - which means all the profit is already taken.
Comment: @glglgl Not sure that would track new transactions very well - BH has gotten so huge that it pretty much just tracks the S&P 500 (and actually _underperforms_ a bit recently.
Answer: Impossible, for the simple reason that investment entities (even though he's a person, we can think of WB as an entity) generally don't face exchanges directly but rather through a broker.
So in a super simple example. WB decides to buy $100M in OXY. He doesn't go out to the NYSE directly but rather sends that order to a broker, or probably a number of brokers. WB has an account at those brokers, but so do many other entities. The broker goes out, executes their orders at the exchange and comes back to WB with $100M in OXY that will then be held in his name at custodian bank.
Even if you could somehow track the broker's trades at the exchange in real time (you can't, account information is obfuscated) you would never be able differentiate WB's orders through the broker from any of their other client's.
Answer: Large shareholders of public companies (more than 5%) are required to file documents with the SEC when trading the company's stock (I'm not sure if it is done before or after trading).  See here for some details.
These documents filed with the SEC are publicly available.  As an example, Elon Musk was in the news earlier this year because he was late in filing one of these reports with the SEC.
Comment: If someone buys 5% or more of a company's shares, they have 10 days to report it to the SEC.
Comment: Yes, I know that already, but it would be nice to track them down in real time. Some website that can tell me ''Hey, Warren Buffett just bought 30,000 shares of AAPL'' for instance but for the best 45 investors.
Comment: @BobBaerker But where can someone who does not work at the SEC see what trades were reported to the SEC? I think that's what OP actually wants to know.
Comment: There are web sites that track insider trades.  Google for info.

Following the big guys in real time


What are .a and .so files?

Question: I'm currently trying to port a C application to AIX and am getting confused. What are .a and .so files and how are they used when building/running an application?
Comment: one is library `a`rchive and other is `s`hared `o`bject
Comment: Possible duplicate of *[What's the difference between .so, .la and .a library files?](https://stackoverflow.com/questions/12237282/whats-the-difference-between-so-la-and-a-library-files)*.
Answer: Archive libraries (.a) are statically linked i.e when you compile your program with -c option in gcc. So, if there's any change in library, you need to compile and build your code again.
The advantage of .so (shared object) over .a library is that they are linked during the runtime i.e. after creation of your .o file -o option in gcc. So, if there's any change in .so file, you don't need to recompile your main program.
But make sure that your main program is linked to the new .so file with ln command.
This will help you to build the .so files.
http://www.yolinux.com/TUTORIALS/LibraryArchives-StaticAndDynamic.html
Comment: does any of these relates to `pic` (position independent code)?
Answer: .a are static libraries. If you use code stored inside them, it's taken from them and embedded into your own binary. In Visual Studio, these would be .lib files.
.so are dynamic libraries. If you use code stored inside them, it's not taken and embedded into your own binary. Instead it's just referenced, so the binary will depend on them and the code from the so file is added/loaded at runtime. In Visual Studio/Windows these would be .dll files (with small .lib files containing linking information).
Comment: A small `.lib` file for `.dll` is called an import library.
Comment: hi is there any option to decompile .so file in c/c++ code.?
Comment: @Ancee: look at this question: https://stackoverflow.com/questions/205059/is-there-a-c-decompiler
Comment: ". Instead it's just referenced", how does this work - doesn't the code in the dynamic library have to be loaded into the hosting process?
Comment: @JoelBlun Yes, but only at runtime, not at compile time.
Answer: .a files are usually libraries which get statically linked (or more accurately archives), and

.so are dynamically linked libraries.
To do a port you will need the source code that was compiled to make them, or equivalent files on your AIX machine.
Comment: @Dunc - There are a couple of ways. Do you have a makefile? Usually the command that assembles the whole program (and hence calls the linker) will specify the places to look for library files with -L/dir/dir1/.../ and may also name libraries explicitly with -lname. You will find that the actual name is libname.a or libname.so. The linker can then figure out what to do if this is a reasonably normal program. But you still have the problem of making or finding the .so file. Have you got source code to build it, or an AIX library?
Comment: How do I build my application to use .so files?
Comment: There are many excellent references for building both types of libraries and linking to them on the web. Google is your friend.
Answer: They are used in the linking stage. .a files are statically linked, and .so files are sort-of linked, so that the library is needed whenever you run the exe.
You can find where they are stored by looking at any of the lib directories... /usr/lib and /lib have most of them, and there is also the LIBRARY_PATH environment variable.
Answer: Wikipedia is a decent source for this info.
To learn about static library files like .a read Static libarary
To learn about shared library files like .so read Library_(computing)#Shared_libraries On this page, there is also useful info in the File naming section.

What are .a and .so files?


Cognito Forms: 'Save & Resume' problem with IE

Question: Is anyone having problems accessing (resuming) a saved form in Internet Explorer?  I sometimes can resume but sometimes IE only shows the form title and does not populate the questions or previously saved user input.  It seems to work fine in other browsers.
Comment: What version of IE?
Answer: I am a developer for Cognito Forms.
We have had reports of an issue using Save and Resume in Internet Explorer. We have found a bug related to this and released an update to correct the issue last night. You should now see the Save and Resume function work correctly in Internet Explorer.


If heroin overdose is so mortal, would it be a reasonable way to do euthanasia?

Question: If heroin overdose is so mortal, would it be a reasonable way to do euthanasia?
Would it be a good death? Or it can be in some way painful?
It's better for euthanasia than phenobarbital?
Comment: What have you read about heroin overdose?
Comment: The intention of most people who take heroin is not to die but to feel well, I guess. Euthanasia is much more commonly suggested by people who observe other people suffering than by sufferers themselves. There are probably documented causes and reviews that support my claim.
Answer: According to a 1999 paper

Recent research, mainly from the Netherlands, has shown that high doses of barbiturates are usually effective for physician-assisted suicide [...] Opioids are less reliable drugs for physician-assisted death because of the unpredictable duration of the dying process even after high doses.

There's also a story in the Atlantic about the search for substitutes in the US due to the astonishing price (in the US) of the barbiturates typically used. The story notes...

They discussed the synthetic opioid fentanyl, but were deterred by the drug's newness and dangerous reputation. So the group decided to use a combination of medications, and eventually settled on high doses of three: morphine, diazepam—also known by its early brand name, Valium—and propranolol, a beta-blocker that slows the heart. They called the mixture DMP. [...]
The first two deaths went smoothly. But the third patient, an 81-year-old with prostate cancer, took 18 hours to die [with DMP]. In Oregon, where aid in dying has been legal for 20 years, the median time from taking the medication until death is 25 minutes.
Patients themselves typically become unconscious in five or 10 minutes, so they are not affected by protracted times [...]. But longer waiting periods can be nerve-racking for families and other caregivers, especially in the exceptional cases where these have persisted for a day or more.

Interesting enough perhaps, barbiturates were also the drug of choice for physicians who killed themselves in one study in England and Wales... but not among anaesthetists.


Total # of miners?

Question: Is there any way to find out the total no.of mining nodes in the Bitcoin network? In case of mining pools, the devices present in each pool.
Answer: I don't know if mining pools keep stats like that, and I doubt they would be public if they did.  However, you can make a reasonable estimate of the physical hardware miners in the network by plugging a few numbers into an equation.
To get the lower bounds of our estimate, take the current network hashrate and divide it by the hashrate of the "best" ASIC miner on the market rated by hashrate.  This calculation represents the fewest possible number of miners on the network that would be required to produce the current hashrate, given the best technology available.
To get the upper bound of the estimate, you'd need to figure out what is the "average worst" available ASIC and it's hashrate.  That is to say, you need to figure out the ASIC that, on average, has the minimum required hashrate for miners to be profitable.  Since electricity and cooling costs vary from location to location, there is no single answer for this, and an average must be taken.  Once you have this average hashrate, divide the current network hashrate by it.  Now you have an estimate for the most number of hardware miners that are likely on the network producing the current hashrate.
Answer: I have another technique...I would like to have your opinions. But it only answers the Number of Mining Nodes, which is not the number of Miners.
I round numbers on their theoretical basis just for demonstration.
First, you take the Reward estimate earned by the Fastest Hashing rate Machine. Currently it appears to be the Antminer S19 Pro at 110Th/seconds. For this I use a calculator from https://www.buybitcoinworldwide.com/mining/hardware/
With this Hash Rate rate it calculates I get 0,2911 Bitcoin in rewards per year with the device running 24/7/365. This means that at 6.25 Bitcoin rewards per block, I contributed to solving 0.0465 of 1 block in 1 year. If all the Network used only these machines, then I divide the 55,000 Block per year by 0.0465 = 1,182,795 Mining Nodes. This is the Lower Bound, the minimum number of Mining Nodes on the system.
Now, my other assumption is that Network Difficulty is equivalent to the weighted Hash rate of the sum of all Mining Nodes. If the current, March 18 2021, Network Difficulty is 21.6 Th/seconds, then the same calculator calculates that if my device ran at this speed I would earn 0.0572 Bitcoin in 1 year. Using the same calculation, 55,000/(1/(6.25/.0572)) = 6,009,615 Mining Nodes. This would be the estimated number of total Mining Nodes on the Network.
Blockchain.com explains that it gets the Network Difficulty information from Full Nodes which have the number of Hash used to solve a block in a set time (around 600 seconds) once it has been authenticated. So in fact this is described as the Weighted average Hash rate of the Miners, which is used to either increase the difficulty if times falls measurably under 600 seconds per block, or loosen difficulty if time rises measurably over 600 seconds. But in the long term, the difficulty has risen at a rate of 400% per year. The calculator mentioned above does make an adjustment in calculating rewards, by using a discounting of performance of 0,45% per day.
Comment: It would help if you gave definitions for the terms you introduce such as "mining nodes". I take it that the term is supposed to refer to pieces of mining hardware. That's a bit of an odd choice, because "nodes" usually refers to participants in the Bitcoin network, but ASICs usually interface with some source of work assignments, not the Bitcoin network.
Comment: Murch, good precision, I was afraid I would take too much space. Obviously, there appears to be much misunderstanding and confusing vocabulary concerning Nodes...the clearest answer I found on a Swiss Blog:  https://www.seba.swiss/research/Classification-and-importance-of-nodes-in-a-blockchain-network . The easiest is the Full Nodes (usually the ones followed by Websites such a BitNodes. Full Nodes authenticate and are administrative, maintain quality of network. They don't get compensated. Mining Node are devices Mining. And the last category has many names: Light Nodes..(mostly Wallets),

Total # of miners?


Gaining weight without body building

Question: can you guys please suggest me a dieting plan or something to gain weight or to add some muscle around my body and face.
I'm a 21 year old guy , very slim for my age and want to gain weight really fast without body building.
Thanks in advance
Comment: First of all, welcome to Sports beta on StackExchange. Your question fits probably better at our sister site http://fitness.stackexchange.com/ I have flagged this question so a moderator can look at it and decide whether or not to move the question there. Regarding your questions, I understand that you might not be happy with your look or fitness but you should also consider that gaining weight "really fast" is not a good idea and often not possible to get "beefed up" without a proper workout regime. Did you try to talk to a personal trainer at your local gym?
Comment: Yes all they tell is to work out to a limit where i cannot workout any more, what they want is to exhaust my self everyday and i don't want that ...i eat like a monster but no results where as my friends eat in small amounts and they are more healthier than me ... i just want to gain 5 - 10 kg of weight that's it ... @posdef
Comment: @Harry One, I wish I had your metabolism. Two, if you want to add muscle, then your personal trainer is right. You have to go beyond your comfort level to make progress...anything less than that is essentially wasted motion. Nutrition is so important. See Rory's answer below...
Comment: so what you are saying is that i exhaust my self daily upto the level where my arms and shoulders start to shiver ? @edmastermind29
Comment: @Harry Daily, no. During a workout, yes. If you push yourself to the limit during a given workout, your body needs rest. It had always been told to me, "at the end of a workout, you want to feel destroyed." When I was lifting, I only lifted once a week with [high-intensity training](http://en.wikipedia.org/wiki/High_intensity_training). My gains were big however...I went from leg pressing 135 to 295 lbs in nine weeks.
Answer: Gaining weight is easy - eat more calories than you expend. If you find it very difficult to gain weight, it probably means you have a high metabolism and are burning more calories than you consume.
Gaining muscle is work - there are no easy ways round this I'm afraid. If you want muscle you need to persuade your body to make it, and that means using the muscle you do have hard enough that your body is forced to make more.
For rapid muscle gain, it's even harder work - you really need to push hard, exhausting yourself is very likely, and you need to eat the right foods.
And remember that your face may not be one of the places you will put on weight first - the waist is likely to be first for fat, and major muscle groups can bulk faster than small muscles.
Carbs and protein are essential to protect yourself from damage and provide muscle mass, and keeping well hydrated is also key.
Answer: Rory Alsop's answer hits nail right on the head. I will try and expand on the concept to provide more details.
The energy metabolism is a very intricate biological network (see my answer to a relevant question for more details), with many components that can vary due to intrinsic (e.g. genetic variation) or external factors (environmental exposure or diet). There is essentially very little you can "ensure" without doing extensive studies on how your body normally works .
To put it in simplest terms, we have the following statements:

weight = water + body mass (i.e. bone + tissue + ...)
many factors of contributing to the weight is regulated tightly, for instance you will get rid of excess water.
the body's biomechanical build up can be approximated by considering only bones and muscle tissue
muscle is essentially a type of spring which can hold tension force by contracting (but not extension, in other words muscles pull, not push).
given that you are not malnourished or have an underlying condition, your bone density will be exactly what you need it to be. In other words, bones get tougher over time, by undergoing tension.

To sum it up, your body will have the biomechanical setup that will keep itself stable. If you have high/fast-metabolism and do not train much you will most likely not have a large body frame and a muscular structure.
There are no shortcuts, and more often than not you cannot fool your own body. If you want to build up muscle you need to give your body a reason to do so (exercise), and the building blocks accomplish that (nutrition).

In response to OPs comment below:
Finding an optimum diet is a bit tricky but start trying. It's a good idea to get a quantitative feel for how many calories worth food you eat each day. You don't have to weigh everything you eat and look up in tables but at least get an estimate number. Then try to increase that number successively.
Also if you want to get a bit stronger/muscular you will need to increase your physical activity. You don't want to lift weights? Fine, no problem, you can work against your own body weight, try doing sit-ups, push-ups and pull-ups for a start. Working out more will make your body burn more calories, but you'll likely get more hungry as well. Try to make sure that you end up on the positive side with the calories, eventually you'll bulk up.
Comment: can you also please suggest a diet to match my BMI
Comment: @Harry I really can't, for two reasons: 1) I am not a nutritionist, 2) even if I was, it would be wrong and unethical to diagnose someone without actually examining him/her. I'll update my answer to give some *suggestions*

Gaining weight without body building


Making `#!/usr/bin/env python` work on Windows

Question: I use Bash on Windows, provided by MSYS.
I tried to run a Python file with a shebang of #!/usr/bin/env python, but I get this error message:
/usr/bin/env: python: No such file or directory

What can I do to make this work?
I know I can launch the Python file by suffixing it with python, but I want it to work without the suffix too.
Answer: Use the proper path where Python is installed instead, for example:
#!c:/Python/python.exe

If you have Unix-like path support on your system (I'm not familiar with MSYS), you can always enter the path to your python executable, i.e. the output of which python.
Comment: Or you could use `env`, as the asker is doing.
Comment: I can't change the shebang, it's part of a project which involves other programmers that work on Linux and Mac.
Comment: @RamRachum What's the output of `which env` and `which python` and `type python`?
Comment: Hard-coding the path to the interpreter doesn't seem like a very portable solution. I'd like this answer better if it considered whether there are more portable options (there may not be), and what the tradeoffs are.
Answer: You might be interested in a Python Launcher For Windows
Answer: I turned out to be a mismatch between Virtualenv's activate.sh file and MSYSGIT. It was never intended to work on Windows.
Answer: The root of the problem is that spaces in shebangs are interpreted as supplying additional arguments to an executable, so C:\Program Files\Python\python.exe gets seen as C:\Program given Files\Python\python.exe as an argument.
The best solution for this, because Windows LOVES spaces in the $HOME directory and Program Files and other places even though it can really break things in cmd.exe and Powershell and other tools, is:
Install Python to C:\Python and add the C:\Python folder where python.exe lives and the Scripts directory that lives inside it to your PATH environment variable at the system or user level.
If you need Python 2.7.x and 3.x to co-exist, install them into C:\Python27 and C:\Python36 and C:\Python37 and rename the python.exe to python2.exe, python36.exe, python37.exe, etc and add each of those folders and their Scripts folders into the PATH. You may want to determine which of the Python 3 versions you want to be the "default" and also make a copy in that folder as python3.exe to handle any scripts that use !#/usr/bin/env python3.
If your user home directory has a space in it, you may also experience issues if you use the pip install --user somepackage syntax. The --user defaults to your home directory, and the space will trip up things in this case as well. The workaround is described here but boils down to exporting PYTHONUSERBASE to your environment.
export PYTHONUSERBASE=/myappenv
pip install --user SomePackage

or in Windows (Powershell):
$env:PYTHONUSERBASE='C:\PythonPkgs'
pip install --user SomePackage

Answer: Latest versions of Windows 10 supports installing Linux subsystems. If you run from there paths should be correct.
It should be a working solution if you are okay with running it that way.
Answer: Although it doesn't answer the question...
For people that installed python2 then python3 and just now want their python3 programs to run... right-click => open with => Choose another app    now navigate to your python3 python.exe
Answer: What happens when you run (from the shell):
$ /usr/bin/env python

..?
If it starts an interactive python session, then python can be found.  (You can also simply run: type python).   If it prints "no such file or directory", then python isn't being found in your PATH. See if the following can be tweaked to fix the problem (spaces in the path/to/python will probably cause issues):
$ export PATH=$PATH:/path/to/python
$ /usr/bin/env python


Springer Humanities Bibtex

Question: it looks like there is no Springer bibtex style for their humanities bibliography (e.g. they want full first names!)  Has anyone seen or written one?
Comment: Welcome to TeX.SX! Could you provide an example for such a bibliography? Perhaps there is a similar style that could be edited to it or even used out-of-the-box
Comment: Put `\bibliographystyle{chicago}` before your `\bibliography` command. Do you use `biblatex`? You should read http://www.ctan.org/pkg/biblatex-chicago then.
Comment: I was using bibtex but am switching over to try biblatex.  Why don't you post this as an answer instead of a comment, what if just inserting that fixes it?  You're clearer / more specific than the only answer so far.
Comment: Argh, biblatex is not tolerant of the fact I use my bibtex file for all kinds of notes, many not properly formatted.  But just using chicago.bst seems well out of date.
Answer: Springer writes in its Key_Style_Points_HumanitiesRef.pdf (0.4 MB):

This style is based on the reference list style as suggested by the
  Chicago Manual of Style (15th edn.). In order to facilitate automated
  processing, the citation of Internet publications has been modified
  and follows the standard structure of journal and book citations.

If you do not need any internet publications in your reference, you will be safe to use the Chicago style. If you use online references and they appear different to the ones shown in the above PDF, you should show an MWE with that special case here and someone will try to fix that.
PS: As Springer is quite practised in LaTeX, it might also help to write an email and to ask for a template (some book of your taste without content for example).

Springer Humanities Bibtex


Is this galvanic isolation?

Question: I'm doing a project which consists of 2 big parts: a control part (a microcontroller with I/O pins expanded, USART-to-USB, a RTC, an EEPROM, a LCD) working @ 5V and an actuators part (optocouplers for interfacing with the microcontroller's I/O pins, MOSFETs driving DC motors working @ 24V and TRIACs driving AC motors @ 230V~). Both parts of the project are supplied by a DC 24V power supply. So, am I achieving galvanic isolation between the control part and the actuators part using optocouplers, even though they have the same power supply, consequently the same GND signal?. Should I bother to separate the control part's GND from the actuators part's GND?
Comment: How do you control the triacs?
Comment: I control the TRIACs through MOC3051 optoisolated triac drivers
Answer: You'll have galvanic separation between the mains and AC motors on one side, and the 24V/5V on the other side, because of the mains transformer. You also may have separation between 24V DC and 5V DC, but most regulators don't provide that. You'll need an isolated DC/DC converter, where the transformer takes care of the isolation.
If you have that you have 3 mutually isolated parts:

Mains and the AC motors
24V supply and DC motors
control part

If you don't the 24V motors aren't separated from the control part, despite the optocouplers.
Comment: Yes, they do protect; whatever voltages the optocoupler's transistor sees, they won't be seen on the LED's side. You may keep the optocouplers for that reason. It's just like you say that they share a common ground, so they're not isolated.
Comment: So if I only have a voltage regulator (L7805) on the control part, I guess there's no sense in using the optocouplers to drive the MOSFETs which drive the DC motors, isn't it? Don't they offer any degree of protection, even if the GND is the same?
Comment: Can you recommend any DC/DC converter (24V to 5V), suitable for isolation, that can provide 2A and can be PCB mounted?
Comment: @m.Alin - [this one](http://cds.linear.com/docs/Datasheet/3575f.pdf) can work off 24V and can supply up to 2.5A.

Is this galvanic isolation?


Selenium tests doesn't work when run in Jmeter with Java Sampler and multiple threads

Question: I'm running Selenium tests for Web site using Jmeter and Java Sampler.
I've exported test class which extends AbstractJavaSamplerClient using "Eclipse ->Export to jar" and copy it to the Jmeter/lib/ext. I'm using classes from another java project in my test. I packed this project to .jar and copy it to Jmeter/lib.
When I run my test in Jmeter in 1 thread it works just fine but if I run 2 or more threads Selenium web driver fails to find elements but I see that they are visible. I'm new to it but looks like Selenium cannot work in multiple threads.
What am I doing wrong? Please help.
Answer: As per How to Use JUnit With JMeter guide certain restrictions apply to JMeter's JUnit Samplers, to wit

Only the "Elapsed Time" is recorded for the JUnit Request Sampler. You won't be able to see Latency or Bytes metrics as JMeter knows nothing about your JUnit test. Therefore, JMeter is only capable of measuring your test method execution time
There is currently (as per JMeter 2.11) no way to run the JUnit suite or fixture. Only individual test cases can be executed and only one test case per the JUnit Request Sampler instance
There are certain limitations to the JUnit test design. Due to JMeter's multithreaded nature, the test developer needs to use a thread-safe approach (i.e. avoid static fields and methods wherever possible and keep in mind that the resource might be busy with another thread).
Limited JUnit Request Sampler configuration capabilities assume that all pre- and post-test logic should go in setUp and tearDown methods. If you need to feed external data to a sampler use property files or system properties

You're most likely to be suffering from point 3.
Moreover, as per WebDriver Tutorial

Note: It is NOT the intention of this project to replace the HTTP Samplers included in JMeter. Rather it is meant to compliment them by measuring the end user load time.

In addition, from the same source:

From experience, the number of browser (threads) that the reader creates should be limited by the following formula:

C = B + 1

where C = Number of Cores of the host running the test
  and N = Number of Browser (threads).
  eg, if the current reader's host has 4 cores, the formula would yield:

4 = 3 + 1

meaning that the script should have a MAXIMUM of 3 threads.

So I would suggest to use JMeter to produce the main load and either WebDriver Sampler or your existing code via JUnit Sampler in 1 thread in a separate thread group to measure real life user experience.
Comment: Thank you very much!  Point 3 was the real issue of my project. Just tried to avoid static references in my project and it works with multiple threads now. Thanks for your suggestions also. They are very useful.
Answer: I was with this problem for some time, its nothing, please declare all your variables without "static" key word, its worked for me.
Thanks
Answer: As Dmitri T point in his answer the multitread running of JUnit-Selenium tests through Jmerter brokes when some static fields are used in.
In our project we faced with the same sympthoms as question states, like test can not find element, or one thread close webdriver when others are using it.
So we implement following approach which makes our test tread-safety and allows runnig in multithread way through JMeter.
First, let's mention that static objects in Junit-Selenium tests usually appear with @BeforeClass methods which must be declared static and work with static fields. Also your probably could use @ClassRule annotation which also must be put on the static field. However @ClassRule annotation is not processed by JMeter Junit Sampler, so I will not talk about it further.
With @BeforeClass initialization in our case we have TestBase class where we initialize webdriver and some other resources to use over all tests. I just simplify our real classes for more clear demonstration:
 public abstract class P01_SL_TestBase {
    public static WebDriverResource driver = new FirefoxDriverResource();
    public static PageProvider<ARMLoginPage> loginPageProvider;
    public static ARMLoginPage loginPage;
    public static ARMApplicationStartPage ARMPage;

    @BeforeClass
     public static void loadApplication () {
        initResourcesForJmeterRunner();
        loadARM (armUser);
     }

     public static void initResourcesForJmeterRunner() throws Throwable {
         webDriverResource.before();
     }

     public static void loadARM(BPMUser armUser) {

        loginPageProvider =
            new PageProvider<ARMLoginPage>(ARMLoginPage.class,
                                           BASE_URL_ADF_ARM_LOGIN_PAGE,
                                           driver.getDriver()); //Here
                                           //we get thread-local value of
                                           //Firefox driver for our current thread
                                           //from the threadwide storage
        loginPage = loginPageProvider.goHome();

    }
}

As you can see in TestBase we have common case with static field driver and some others. Also there is @BeforeClass method which do two things. First, webdriver is instantinated. Second, the application to be tested is initialized. So everything in TestBase class is indifferent to the running tests in one thread or in multitread.
The implemantation of multithread running we put into WebDriverResource class:
public abstract class WebDriverResource extends ExternalResource {

    //  private final RemoteWebDriver driver; //this is implementation for
                                              //one thread running,
                                              //it is not thread-safety

    /**
     * {@code threadLocalDriverStorage} field stores thread-local instances
     * of {@code RemoteWebDriver}.
     * Note that now {@code threadLocalDriverStorage} is not static. We made
     * this for backward compatibility of some
     * existent tests using non-static createDriver() method.
     * TODO refactor createDriver() declaration and implementation to static
     * variant.
     */
    private ThreadLocal<RemoteWebDriver> threadLocalDriverStorage =
                 new ThreadLocal<RemoteWebDriver>() {
        @Override
        protected RemoteWebDriver initialValue() {
            return createDriver(locale.toLanguageTag());
        }
    };

    public WebDriverResource() {
    }

    protected abstract RemoteWebDriver createDriver(String language);

    @Override
    public void before() throws Throwable {
        //here we call threadLocalDriverStorage.get() first time,
        //and so the get() will perform initialValue()
        //and save to storage thread-local value for the current thread
        threadLocalDriverStorage.get()
                         .manage()
                         .window()
                         .maximize();
    }

    @Override
    protected void after() {
        logger.fine("quit browser...");
        //driver.quit();
        threadLocalDriverStorage.get().close();
    }

    /**
     * @return thread-local value of {@code RemoteWebDriver}
     */
    public RemoteWebDriver getDriver() {
        return threadLocalDriverStorage.get();
    }
}

Here we use TreadLocal class to implement threadLocalDriverStorage field. We override initialValue() method to return instance of RemoteWebDriver object.
Then in before() method when we call TreadLocal.get() for the first time it leads calling initialValue() method and instantinating the RemoteWebDriver object for current thread.
Also there is getDriver() which return tread-local value of RemoteWebDriver. This method should be used all over the test classes to get driver object.
As well we store webdriver fields in our page object model classes. So, we also add protected static ThreadLocal<RemoteWebDriver> threadLocalDriverStorage field into our base page class. But here we do not override initialValue() method. Instead, we use TreadLocal.set() method to save value for current thread.
public abstract class Page {

    //  private final RemoteWebDriver driver; //this is implementation for
                                              //one thread running,
                                              //is not thread-safety

    /**
     * {@threadLocalDriverStorage} field stores thread-local instances of
     * {@RemoteWebDriver}.
     *
     * Note that {@threadLocalDriverStorage} must be static. Without that
     * static classes extended Page will
     * work with unpredictable instance of {@threadLocalDriverStorage} and
     * as result would not set and get {@RemoteWebDriver} instance properly
     *
     * Note that {@ThreadLocal.initialValue()} method is not overrided.
     * Therefore thread-local value must be stored by
     * {@ThreadLocal.set()} method.
     * We do that in class consractor.
     */
    protected static ThreadLocal<RemoteWebDriver> threadLocalDriverStorage =
                           new ThreadLocal<RemoteWebDriver>();

    public Page(WebDriver driver) {
        super();
        threadLocalDriverStorage.set((RemoteWebDriver)driver);
    }
}


Cloudmade API Turn by Turn - can custom voiced be used?

Question: Anyone with experience using the Cloudmade api for iphone apps? I'm being asked if it's feasible to incorporate custom voices for the turn by turn navigation it offers.
Any advice appreciated!
Answer: Basically, you can get the turn-by-turn routing as an XML (see documentation) and feed the instructions to the Text-to-Speech engine (I'm afraid there's nothing out-of-the-box for iPhone, so I'd suggest you give a try to Flite or a similar).
I'm not sure Cloudmade SDK does anything different than that, also incorporating some TTS engine in their SDK. For sure, this is exactly what I did for an Android application myself for turn-by-turn routing.


Why does my Nikon FE occasionally fire at ¹⁄₉₀th regardless of setting?

Question: My Nikon FE has this annoying fault where the shutter occasionally fires at ¹⁄₉₀th of a second regardless of setting. I don't have enough money for a new FE (I'm 14) and I was wondering what could be causing this.
Answer: 1/90th of a second is the limit of the cameras shutter speed with out electronic assistance. On your shutter dial you should see it listed as "M90", the "M" standing for mechanical.
My first course of action would be ensure that you're using a fresh battery, then check the battery connections is free from corrosion. If the problem persists, it might mean there is a more serious fault with the camera's electronics.
Comment: Sadly I already tried a new battery and checked the contacts, It is only intermittent after all, I suppose I can cope until I can get it fixed/replaced


How to update php 5.4 to 7.0 via CLI in Windows

Question: I use this command:
export PATH=/usr/local/php7/bin:$PATH

But still showing:

PHP 5.4.45 (cli) (built: Apr 17 2017 15:59:08)
  Copyright (c) 1997-2014 The PHP Group
  Zend Engine v2.4.0, Copyright (c) 1998-2014 Zend Technologies
      with the ionCube PHP Loader (enabled) + Intrusion Protection from ioncube24.com (unconfigured) v10.2.4, Copyright (c) 2002-2018, by ionCube Ltd.
      with Zend Guard Loader v3.3, Copyright (c) 1998-2013, by Zend Technologies

I need to fix that, help me.
Answer: Are you doing this through a profile file?

you can create a .profile file if it does not exist: touch ~/.profile
edit the .profile file: nano ~/.profile
add this code inside the file to choose the desired php version: export PATH=/opt/php7.0/bin:$PATH
load the .profile file: source ~/.profile
check the version again: php -v
Comment: You might need to do a `hash -r` for the change to take effect. Also try running with an absolute path to verify that it's in the location you added to the search path.


Is there a way to equalize the thickness of my grease pencil drawing over an entire scene? or per entire frame?

Question: I drew and animated a whole scene using the grease pencil, but when moving from 2D animation tab to the 2D full canvas tab, it suddenly shows the difference in line thickness. Is there a way to equalize the thickness over the entire scene? or per entire frame? I tried to downscale using the object data tab and decreasing the ''stroke thickness'' and the "thickness scale", but that scales all the other lines with it as well leaving me with the same difference in thickness. I can scale using alt S, but I have a ton of frames. If I need to select only the thick lines in every frame and then alt S to the exact thickness the rest it's incovenient.
Answer: Solution: Thickness Modifier
Check my fast scribbled helper showing the might of the modifier.

Don't laugh, well you can, but only if this helped you, then i can laugh with you.
Joke aside, the modifier affects all layers under the same Stroke Object. It's slightly more work if you have multiple Stroke Objects. Then all need a modifier, but you can select all Stroke Objects and once you have "Normalize" active and the Thickness Factor set, just right click on each and use "Copy to selected" for each, that way all Stroke Objects or rather their Layers will be normalized and the same thickness.


How do I reverse criss cross pattern without having to redraw the whole path?

Question: I'm building a vector logo with one long continuous path and I realized there is an area where the vector path is crossed leaving a very tiny gap in the design. The only way I know how to fix this is to redraw the entire area and flip vertices by vertices.
Comment: No clue how anyone could guess and what you are referring to without actually seeing an image or something.
Answer: You can add new path anchor points. You may need 6 new points - 2 for separating the halves and 4 as guards who limit the surgery area.
Then, by the direct selection tool delete a couple of anchors. That kills also the pieces of the path around them. You do not lose very much if the guard points are not far away.
Now you have separated halves that can be edited in all ways separately. Do the edits, then draw what's missing between the parts. Start by the Pen and in the beginning and the end drag the handles into the right direction.
If you got an unwanted corner, double click on it by the "Covert Anchor Point" -tool.
Practice at first. Draw a 8 and edit it to a zero or other non-crossing loop.
Answer: Is this a white stroke at a joint?
You might repair it by changing the stroke cap and/or corner to round:

If the path has been expanded, are there nodes at these points?:

If so just delete the middle 1 or 2 and repair sides with the pen tool,
or draw a shape like this and combine it with your path with Pathfinder>Unite:
Comment: THIS WORKED!!! Thank you so so much!! I will never forget this trick!


View a method's implementation (method body) using Java Reflection

Question: I can view the methods of a class using java reflection.
    Method[] methods = Person.class.getMethods();
    for(Method method : methods){
        System.out.println("method = " + method);
    }

the person class ,
class Person{
String name;
int age;

Person(String name,int age){
    this.name = name;
    this.age = age;
}
public int count(){
    int count = 10*20;
    return count;
}
}

Using reflection the count method will view like,
method = public int Person.count() but not the implementation (method body).
is there anyway to view the full implementation details of a method using this kind of approach or with any other ?
Answer: It's not possible to do this using standard Java tools. The source method implementation is not accessible in runtime. You can however load this class file as a resource and pass it to some Java decompiler, which will try its best to produce the original source code of the class. Or course it's not guaranteed that the result will be 100% exact and it will be even worse if your class is compiled without debugging information.
Answer: There is a sourceforge project. It takes class file as input, decompiles it, provides the source file and is platform independent:
Java Decompiler


How is "Orthogonal distance" computed?

Question: I was reading the vignette of the R package chemometrics (link). In the second paragraph (right below the first equation) of Page 12, the author writes:

the OD (Orthogonal Distance) is calculated in the original space as the orthogonal distance of an object to the PCA subspace or, in other
  words, the distance between the object and its orthogonal projection
  on the PCA subspace.

Can someone elaborate upon how exactly the orthogonal distance is calculated (some R code as an illustrative example would be greatly appreciated, if possible!)
Comment: Did you try calculating the orthogonal projection?
Answer: Given a $n$ by $p$ matrix $\pmb X$ the SVD decomposition of $\pmb X$ is:
$$\text{svd}((\pmb X-\bar{x})/\sqrt{n-1})=\pmb{UDV}'$$
(I will denote $\pmb V_k$ the matrix formed of the first $k$ columns of $\pmb V$ and $\pmb D_k$ the diagonal matrix formed of the first $k$ rows and columns of $\pmb D$)
The SVD decomposition divides the total variance of $\pmb X$ unto two
mutually orthogonal components:

The variance of the projection of $(\pmb X-\bar{x})$ on the space spanned by the first $k$ singular vectors of $(\pmb X-\bar{x})$:

$$\sqrt{(\pmb X-\bar{x})'\pmb{V_kD_k^{-1}V_k'}(\pmb X-\bar{x})}$$

The variance of the projection of $(\pmb X-\bar{x})$ on the space orthogonal to the first $k$ singular vectors of $(\pmb X-\bar{x})$:

$$\sqrt{(\pmb X-\bar{x})'(\pmb{I_k}-\pmb{V_kV_k'})(\pmb X-\bar{x})}$$
(where $\pmb I_k$ is the rank $k$ identity matrix) which is also equivalent to:
$$||\pmb X-\bar{x}-(\pmb X-\bar{x})\pmb{V_k^{}V_k'}||$$.
In R
n<-100
p<-20
k<-5
x<-matrix(rnorm(n*p),nc=p) #your data matrix

#the orthogonal distances:

data_centered<-sweep(x,2,colMeans(x),FUN="-")
loadings<-svd(data_centered/sqrt(nrow(data_centered)-1),nu=0)$v[,1:k]
orthDist<-data_centered-data_centered%*%loadings%*%t(loadings)
orthDist<-sqrt(rowSums(orthDist*orthDist))

you will find a more complete code to compute OD (and SD, the statistical distances on the space spanned by the loading matrix)
 in the rrcov package:
library(rrcov)
rrcov:::.distances

the function is not documented, but the slot res@od therein are the orthogonal
distances.

How is "Orthogonal distance" computed?


bone spine004 cannot connect chain bone position is disjoint. incorrect armature for type chain_rigs

Question: Using rigify when generating the rig I get this error message Does someone know how I can fix this I don´t want to start it all over :_C
Comment: I had the same error with 2.83 version. I tried it again in 2.81 and it works perfectly
Answer: This worked for me...
I went to Bone Properties for Spine004.
'Inherit Rotation' was checked,  I unchecked it.
...no more Error
Answer: Select the spine004 bone in edit mode, hit Alt + P  and select Disconnect Bone.
Answer: The same things occurred to me. I used Blender 2.90. What worked for me: delete the problematic bone. Select Spine 3 and 5 (the spheres at the end of missing spine 4) and click F. Rename the bone to Spine 4. Save, go back to object mode, and try rigifying again. It should work now. Cheers.
Answer: You'll have to use the original 2.80 Blender build to avoid this error. It doesn't work in 2.83 nor 2.82, and not even in the final 2.81 version (although some interim 2.81 builds appear to be ok).
Answer: Had same issue. Here's what I did to fix it & successfully generate a rig:

Go into edit mode.
Select the lower joint spine004 (around neck area).
While this above is selected, hold the Shift key & select the top joint of Spine003.
While both joints are now selected (highlighted), click the F key to create a new bone that will connect your selection OR right-click to open up a menu & select "Fill Between Joints".
Answer: I deleted the problematic bone, then selected the bones on both sides of the empty space, then pressed F.


Simulate incomes only from median

Question: I am looking to generate data for income by using lognormal distribution but unfortunately, I have only median of incomes. Do you have any idea how can I generate data for incomes or I should have also mean and std?
Answer: The Log Normal Distribution requires two parameters, $\mu$ and $\sigma^2$, be specified.
We note that:
The median is defined as $\text{exp}(\mu)$
Given that you have an estimate for the median - you can determine $\mu$ by taking the log of the median. However, you will then need to specify a value $\sigma^2$ in order to generate a random sample $X_1, \dots, X_n$ where $X_i \sim Lognormal(\mu, \sigma^2)$.
You could then use R or Python to generate some sample data. Here is an example of how to generate a sample using R.
<code># Specify mu and sigma
mu = 1
sd = 0.25

# Generate Sample
sample = rlnorm(10000, meanlog = mu, sdlog = sd)

# Calculate the estimated mean and median and compare against the five point summary.
mean = exp(mu + ((sd)^2)/2 )
median = exp(mu)

print(mean)
print(median)
summary(sample)
</code>

Simulate incomes only from median


voltage regulation for car computer

Question: I am looking to install a home PC computer for the car.  I am concerned about voltage regulation.  The car voltage can range from 10 - 14V, so would the standard PC power supply have voltage regulation built into it for powering the PC components or would I have to find a voltage regulation circuit board to take the PC power supply out put and feed it to the PC?  Or have the voltage regulation circuit board placed before the PC power supply?  Ultimately I want a touch screen display, wireless internet, solid state hard drive, keyboard and mouse, sound ran through the stereo.  I've been looking at raspberry pi setups or iPad mounting kits, but think I want to do this since the car's wireless internet would link up with the home network and download my iTunes podcasts and latest movies and tv shows.
Comment: You can buy a replacement power supply for your PC that has a 12V input intended to be directly connected to an automotive electrical system. No engineering required.
Comment: Auto 12 volt is noisy as hell. And can spike during ignition way past 25 volts.  You need a supply that can deal with both.
Comment: A standard home PC power supply will not work when connected directly to a 12 volt source.  You could use a 12 VDC->120VAC inverter to power it, however (watch power ratings!)
Comment: Whatever you do, the voltage of 12V is "nominal" for a vehicle -- it's generally slightly higher in normal operation, and load dumps can cause transient voltages of nearly 100V. A hefty snubber / protection diode at the input is a very good idea.
Answer: I don't know well how one can connect a pc hardware in the car 12V supply but,
instead of connecting it wich has multiple voltage input and a high power consumption, you can use the new rapsberry pi (pi 3) witch has integrated wireless, high processing capacity, lots of gadgets available and is powered only by a 5V rail;
For the power regulator, you can use a cheap DC-DC step-down buck converter like this:
http://pt.aliexpress.com/store/product/DC-DC-Buck-Converter-5-25V-to-3-24V-Step-down-charger-Module-Adjustable-Constant-Current/715925_854284130.html
This devices usually have closed loop system that assure that the calibrated voltage on the output do not change, no matter the input (while its level is greater than the output). They have great power efficiency and robustness. If you want to use a common router instead of the built in wireless, you may use one of this DC-DC to power it. By my experience, it works fine;
However, RPI do not have sata connections and therefore use it with a SSD its an ugly work.
An alternative is the orangepi (http://www.orangepi.org/).
Keyboard, mouse and audio signal have low consumptions, however look carefully to your SSD, display and SOC consumption before buying the DC-DC converter;

voltage regulation for car computer