Would there be any motivations for them to create new things?

Question: There is a species of aliens, called the erubians, who have tech beyond our wildest dreams. They have fuel cells that can give almost infinite energy, replicators that can make pure energy into any materials they want, and teleportation. All of these use technology that we can not currently comprehend. They also have ships that can travel faster than the speed of light. My question is, with all this tech, would there be any good reason for the erubiams to invent anything knew?
Comment: We have tech beyond the wildest dreams of our ancestors. What motivates us to create new things?
Comment: I don't know   What
Comment: I tend to follow IM Bank's ideas is his Culture novels, where the new inventions come from super AI's and the people just live comfortable easy lives, by and large.  I presume the AI's do it because they're designed to and they can be competitive with each other sometimes - knowledge as currency or ego, perhaps.  So perhaps not "why do my aliens do X ?" but "why do my aliens' computers do X for them ?". :-)
Comment: Why wouldn't there be?
Comment: You should read "Enough is Enough", a short text by Aaron Diaz. [You can find it here](http://dresdencodak.com/2007/09/04/an-exotic-matter/), right below the comics.
Comment: There is always something to look forward to, even though you are more advanced. There could still be problems. If you can make whatever materials you want, wouldn't it cause an inflation? Would there still be a gap between poor and rich?
Comment: I'd also look at Stargate SG1.  The Nox and the Tollan have two completely different answers to your question, and yet they exist in the same fictional universe.  It makes for a good contrast.
Answer: Here's where you get a knowledge gap problem - when you don't know enough about a topic it's hard to see how much you don't know.
For example, why exactly do we twist copper cables together? Why is it important for an antenna to have the precise dimensions it does? Why do we build long distance fibre optic cables from two different kinds of cable and switch periodically? How can we modulate a transmission to limit the interference on a receiver from an open-air optical signal arriving multiple times due to reflection effects?
That last one might get you a PhD if you can prove your answer works. As you learn more about a topic you learn to ask questions you wouldn't have even realised existed with a lower level of knowledge.
So too for the Erubians. To us their replicators are pure magic, the stuff of gods. To them, well, they'd sure as heck love to find a design for a stray quark regulator that doesn't have a resonance in the 300THz band that wastes so many extra materials...
Comment: If I am not mistaken, or rather if I remember my computer science classes, some wire is twisted to cancel out magnetic interference, ie. noise.  Antenna size is based on the inverse of the frequency of the wave or something like that.
Comment: Yep, that's the one. You cancel out the electrical field from the current going one way with the current going the other. The other two are to do with getting the right resonant frequency and coping with red/blue shifting respectively. The finer details of 'why', of course, comes with a whole exciting world of its own.
Answer: It's very gratifying to do/make/achieve something that nobody else has done/made/achieved before and your aliens will seek this gratification, even if their technology is so advanced that they can't increase the limits of what it can do they'll still be coming up with new things to do with it.
Comment: It is also a viable commercial strategy!
Answer: Well, there are always new questions and new desires.
If you have a starving man and he finds food, soon he will desire for shelter, for better tools, for horses, etc etc
Alternatively, you will always have art and the desire to express one true's vision.
Comment: No I don't mean making knewart. I mean new technologies like cars and computers
Comment: There's the first suggestion then, they may be trying to discover how to solve the entropy problem so they won't have to deal with the heat death of the universe
Answer: There will always be something out of a curious race's reach and there will always be a problem that can be simplified or solved. Technology is simply a means to simplify things:

Teleportation simplifies long distance travel.
Perpetual Energy solves the energy crisis
Perhaps they also invented easy replication to solve hunger issues.

The simple idea is that there will always be something that needs to be solved that advancing technology can achieve. Perhaps the Erubians find something that needs solving or requires simplification?


My computer raises the ambient room temperature by about 4°F. I don't like it (in the summer)

Question: I'm running Windows XP Pro SP3 on an Intel Core2 Duo CPU E7400 with 3.5 GB of RAM and an Intel G45/G43 chipset. The motherboard runs at 35°C and the CPU at 32°C -- which I don't think is too hot.
First of all, is this too hot?
I'd like ways of stopping it from transferring the heat to the room. On a summer night the room temperature goes from 74°F to 78°F.
Turn of one of the fans and let things run hotter?
Will a liquid cooling kit help?
Thanks.
Comment: I get the impression you weren't paying attention when they were teaching thermodynamics in school
Comment: Manos: I got the impression that few people did pay attention on that class. My country just outlawed 100W light-bulbs even though people heat houses >0.5 of the year.
Comment: @Manos - what about the light bulbs that need to be >100W. There are plenty examples.
Comment: Ups, sorry. Last comment was directed to @tkadlubo. @tkadlubo - btw, what country ?
Comment: This happened in Romania, where I live :). Where are you from, tkadlubo?
Comment: Poland, part of european union. Lighbtulbs are off-topic and politically sensitive in our politcorrect times..
Comment: OT But:  @ldigas - I bet the most optimum place for a heater is not on the ceiling.
Comment: @StuartAxon - :-)))
Answer: Turning off the fans, liquid cooling, etc does not reduce the total heat caused by powering the components in your computer.
If you vent the heat from the electronics into the room, you are going to raise the temperature of your room, regardless of the method used to remove the heat.
The only solution is to either turn off the computer or vent the heat out of that room.
Comment: One way to vent the heat from the room is to run a ventilation tube from your computer to a window or even up an unused chimney. (You know, the bendy tubing stuff that looks kinda like a slinky. I'm sure you could get it from a hardware store.)
Comment: I think he's hoping that turning off the fans will keep the heat in the box rather than spreading it throughout.  :-S  strange question, but interesting to think about
Comment: If the heat don't leave the computer, it will overheat and break.
Comment: Not the only solution, replacing components with more energy efficient ones will also work.
Comment: When CPU gets hot it might downclock itself automagically and take longer to process data. Good cooling can improve per-second throughput and I think it might improve per-watt throughput.

I know, that's just overcomplicating the issue that is basically ,,I have 0.5kW electric heating gizmo in my room, what to do with the heat?''.
Comment: Or.... transfer the energy in the heat to some other form of energy.  That said, there isn't going to be enough to exchange it to electricity (and if there was, I don't think he'd want to be there...).  :-)
Comment: @humble coffee: Dryer vent piping?
Answer: You need to take the heat out of the room...
... I use the mains water pipes as my heat-sink!
I have a slightly unusual set-up.  My study was originally the kitchen which was relocated to an extension.  As a result, the mains-water inlet still comes into the room.  I have a water cooling system on an old machine that I want on all of the time and it's using an old Intel CPU that I should probably replace, but it works - it just generates a lot of heat.
My water-cooling pipes come out of the case and connect to a refrigeration pipe that I have wrapped tightly around the water-mains.  I now have a huge heat-sink of underground water to dissipate my heat into! ;-)
Keeps the system almost silent (pump makes a very low amount noise, much less than a fan) and stops the room from getting warm!
Comment: That, sir, Is awesome.
Answer: The amount of heat generated by your computer can only be altered by either using more efficient components (ones that generate less heat) or by removing components.
Heat is a byproduct of inefficiency, if you swap your CPU for one that consumes less power (look at wattage ratings) and remove extra items that consumer power (and in turn generate heat) then you'll find the temperature savings.
PC Cooling systems are intended to dissapate heat, not lower the total heat output.  Disabling them will help keep heat in your system but could cause problems (fans are there for a reason; hot chips are unhappy chips). So unless you want to bring home a block of dry ice every day to offset the generated heat then there's not a lot you can do.
Now, with all that said, try buying a cheap infrared thermometer and use it to determine where the heat is originating.  Components without fans will give you the best readings (the ones with fans will blow the heat away); take a look at your monitor, printer (laser especially), power bricks, and power-supply and find the worst culprits.  You might be able to put the bad-guys on a seperate power-strip and kill power to all of them when you're not around.
Comment: Some potential high-efficiency PSU's: http://www.silentpcreview.com/forums/viewtopic.php?p=427734#427734
Answer: I guess you could underclock the components (GPU CPU) also replacing the power supply with a more efficient one is a good thing to look at.  Some of the older cheaper ones are only about 50% efficient whereas more modern (and expensive) PSUs can be over 90% efficient i.e. 90% plus of the energy is delivered to the components and only 10% wasted as heat as opposed to a 50 50 split.
Comment: Yup, or undervolt.
Answer: It doesn't matter how you cool the PC. Regardless of the cooler you use, the computer is putting out the same amount of heat. If your temps are lower it means that your fans and cooler are taking more heat out of the case and putting it in your room.
The best way to fix this is to adjust the ventilation of the room. If there's a window, put a fan in it. If there's not, at least open the door. Think of the room like the inside of the computer case. If you don't have any cooling, the heat is just going to stay in there and the temperature will rise.
Comment: Downgrading the cooling will not keep the room cooler. Once the heat builds up, it doesn't just *stay* inside the case. It *has to* dissipate into the room. All of it.
Comment: My mistake. I assumed that because the temps were higher in the case, less of it came out into the room. I'll remove that part...
Answer: I think a good approach is to power down components not in use. Everything that uses power, produces heat.

Do you have multiple hard disks running? Do they spin down when idle?
Do you have multiple monitors? Might help if you switch one or more off, if not needed.
Is your computer the only thin producing heat? What about light bulbs? I'm not saying you should sit in the dark, which is bad for the eyes, but you probably don't need artificial daylight either.

This may not have a huge effect but still, you can try.
Answer: As the other posters said, you have to remove the heat from the entire room. Here's a guy who built a water-cooled concrete slab heat pump to cool his PC.
Answer: You need to think outside the box!! (like my cat ;-)
You don't mention your budget too? If budget is less of an issue do what I've done at home KVM over IP and put the PC OUTSIDE the room!! Who cares what temperature the PC box gets too, or what speeds your fans are. http://www.blackbox.com.au/PRODUCT.cfm?PARTNUMBER=DTX5000 is what I bought and it is fantastic, in combination with 2x USB extension cable, with a USB hub on the end of it (for external DVD-ROM, USB keys and HDDs). I understand you can get KVM over IPs MUCH cheaper on eBay and the like too.
The my room and the spare room next door to me shares a built in wardrobe, i ran the CAT6e cable through a small hole and plugged the PC in in the wardrobe.
Answer: Don't alter your system's cooling unless it's to increase it.  Computers are designed with certain cooling requirements and expected airflow patterns.  Reduce that cooling, and you could end up with fried computer.
Comment: But then his heat problems would be solved.
Answer: Open a few windows and doors, simple as that. Make sure air can flow through your room.
I had the same problem, so during the summer I keep my window open almost permanently. However I found my room still getting stuffy, so now I keep the door open, and the bathroom door/window open too (which is next to my room) and it can actually get a little chilly in the evening!
Keeping curtains open if possible helps, too. Only problem is with the lights on at night you often get bugs in the house :-o
Answer: The temperatures you give are normal.
To cool the room, add fans to the room. It would be really good if you can get some sort of air flow through the room so that air comes in one direction and goes out another.
Comment: Adding fans to the system wouldn't help. It would just put more hot air into the room. Putting them in the room would help a lot.
Comment: Correct. I'll edit my answer to reflect that.
Answer: You might install some software to adjust the activity level of your computer according to your own activity on it, thus saving on electricity and heat. One example is SpeedFan, that can control the speed of your fan. Another is your computer's power management options. See also http://www.greenlivingtips.com/articles/238/1/Green-your-computer-use.html.
Answer: Powersave, turn off the things inside the computer that you don't use.
Please note that practically all energy you put into a computer turns into heat.
So if you buy a mobile energy meter and messure how much power it use you get an estimate on how much heat it emits to the room.

If you don't "use" the energy, you don't have to cool it away.
Comment: "practically all energy you put into a computer turns into heat"

Documentation for this claim?
Comment: Well it is a question that energy never disappears, it can only change shape/state. And most energy becomes heat at the end, what ever you do. And since the overall energy efficiency of a computer is rather bad, the majority of the energy is wasted (aka transformed into heat).
Answer: You can add a larger fan, but the noise level can increase somewhat.

http://thereifixedit.failblog.org/2009/08/11/epic-kludge-photo-and-i-thought-my-fan-was-loud/
Comment: LS! but doesn't help OP's problem.


How to make our own environments for reinforcement learning?

Question: How can we make our own environments for reinforcement learning? I have a heavy doubt that a game engine is used.. And if a game engine is used, which game engine is used that can be downloaded for free?
Answer: Classical reinforcement learning (e.g. vanilla Q-learning) is not normally applied to games. There are some environments to play (and do research) on classical RL benchmarks (e.g. balancing pole), like OpenAI Gym. It can be extended to your own benchmark environments.
Games, nevertheless, are a standard testbed for deep reinforcement learning algorithms. Probably the most popular approach is to use Atari games. I believe they were popularized among the RL practitioners after the landmark article Playing Atari with Deep Reinforcement Learning by DeepMind. You can find multiple implementations of RL environments on top of the Atari emulator in github (e.g. this and this).
Another popular deep RL game-based testing environment is Starcraft. DeepMind open-sourced their Starcraft RL environment.


Safari Web inspector keeps disconnecting

Question: I've Safari 8.0.6 with iOS 8.3 on my iPad, while debugging through Web Inspector on my Mac (10.10.3), the connection keeps on disconnecting (I don't see the device name under Develop menu upon disconnection) but can resume if I quit safari followed by a relaunch then I'm able to refresh and inspect remotely again.
Comment: Happens to everyone constantly. It's a Safari bug.
Comment: It appears this issue has been resolved with the release of Safari 9.0.  I was experiencing the issue repeatedly yesterday but after installing Safari 9.0 today I haven't seen Safari disconnect while debugging my cordova app
Comment: I am experiencing this with Safari 10.0...
Comment: This seems to be a very common problem. Some people have suggested changing the cable, I have not had any luck with that though. When this happens to me I just unplug and replug the cable in the iPad, it is a bit quicker and slightly less annoying than restarting Safari.
Comment: @enifeder thanks for the comment, and yes changing cable didn't help me either, I was wondering earlier if there's some javascript error that breaks the connection
Comment: I have the same problem with both Safari 10.1.2 and Safari Technology Preview 11.1. Both running on a macOS Sierra 10.12.6
Comment: This is indeed a problem that happens very frequently; ensure that both MacOS and iOS on your device are up-to-date is a good thing to do first. Most of the time, updating to the latest makes debugging work again.
Answer: There are a few things to try:
1. Test on the Xcode Simulator:

Open the iPhone simulator in Xcode and debug there with Safari Web Inspector.

Sidenote: Maybe you need to download the Safari Technology Preview
2. Reset your location and privacy settings on your device.

Settings > General > Reset > Reset Location & Privacy

3. Debugging on a real device
With this configuration it seems to work right now.
iPhone X, iOS Version 12.1.3
macOS Mojave Version 10.14.2 (18C54)
Safari Version 12.0.2 (14606.3.4)
Edit 2019.08.13

Settings -> Safari -> Advanced -> Check that Webinformation is toggled on.

It was suddenly toggled off and I couldn't connect via the Web Inspector. After toggling it on, it worked.
For other devices / versions, please read further down (Maybe you can decrease your build size).

EDIT: 2018.09.20
@Chet found out, the Web Inspector keeps disconnecting for too large JS files and map files
https://stackoverflow.com/a/52338231/4641479
Issue on Github:
https://github.com/google/ios-webkit-debug-proxy/issues/275
https://github.com/google/ios-webkit-debug-proxy/issues/274
I could confirm this on a real device with a production build (1.8 MB + 2.4 MB files), the Safari Web Inspector stays always connected.

Since for the development build it is not:

Before my web inspector very rarely worked and often just stopped working - but was still open. After the safari update the web inspector opens and closes immediately. If you encounter such problems..
This will work:
Step 1. Get the latest Safari Browser
Safari: 11.1 (12605.1.33.1.2)
https://developer.apple.com/safari/download
macOS Sierra and OS X El Capitan (I assume macOS high Sierra is also supported)
Maybe you need to download the Safari Technology Preview

Step 2. Reset your location and privacy settings
On your device go to:

Settings > General > Reset > Reset Location & Privacy

Source: https://forums.developer.apple.com/thread/87181

Step 3. Connect your device
Open Safari on OS X
If you had connected your iPhone device with an usb cable, disconnect it first.
Now plug it in.
On OS X Safari go to:

Develop > Device name > Apply for development

Now on your phone there is a permission question. Choose trust and now you can choose the open tab on your devices safari and debug.

Happy debug!
Now the web inspector stays connected.
Comment: I thank you so much really!! *Step 2.* worked for me like charm <3
Comment: Worked for the first time but after that same problem again.
Comment: https://stackoverflow.com/a/51224913/694609 Emptying Cache fixed this problem for me!
Comment: "Settings > General > Reset > Reset Location & Privacy" on device worked for me!
Comment: There is no "Developers" menu item for OSX Safari
Comment: @AlxVallejo Go to Preferences -> Click on the Advanced Tab -> Down there `Show Develop Menu in Menu Bar` (If you meant my misspelling, you could've just corrected it, translation mistake - my safari browser is not english)
Here are pictures: http://osxdaily.com/2011/11/03/enable-the-develop-menu-in-safari/
Comment: resetting location and privacy settings
Comment: Step 2 fixed it for 5 minutes :')
Don't developpe IOS app !
Comment: Step 2 used to work for me, but not anymore :(, is there any update on that issue ?
Comment: Step 2 worked. IOS15.2 (iPhone SE2)
Answer: Do you have a lot of backgrounded apps running on your iPhone?  Kill them and try again.
We showed this issue to Apple developers at WWDC, and they suspected it was due to memory constraints on the iPhone.  Sure enough, killing most of our backgrounded apps resolved the issue for us.
Comment: Amazing, I didn't really hope for this option, but it helped
Comment: So both the Reset Privacy of the accepted answer, and this one seem to work for me. However, it's nice to do this rather than reset privacy settings to have to constantly be nagged then by every.single.app to allow something.
Comment: Thanks! This worked for me in August 2021. I thought I was going to need to download the developer version of Safari.
Comment: I only get one app open, the one to debugged.
Comment: whaou this works !!
Comment: This & the "Reset Location & Privacy" also worked for me! (iPhone 11, iOS 15.1)
Answer: Working Solution (as of 24th Mar 2020)
Well, after so many trials and opening thousands of blog posts to figure out a solution, I managed to get it working without a single case of failure.
For me, this has been always a problem with my Ionic+Cordova application.
My subconscious mind started to think about this problem when I saw that this issue (of Safari getting disconnected) is not there when I run a plain simple Cordova or Ionic application. And then suddenly, I tried another thing and it worked.
Basically, the Safari web inspector disconnects when the size of any files are too large (not sure about the limit). Maybe, some image, some script, and CSS. In my case, it used to because of the JavaScript & their source map files.
So, when I started to run my iOS application without source maps, the problem is gone. For that, all I had to do is to pass --source-map=false to my ionic cordova commands like:
ionic cordova run ios --source-map=false
ionic cordova run ios -lc --source-map=false

I wrote a small article about this to elaborate this in detail https://medium.com/wizpanda/a-small-tip-to-speed-up-development-with-angular-or-ionic-d5764f639c0c
Original Answer
Most of the answers listed here worked for me for a while but after a few hours they also stopped working and my Safari web console again keeps disconnecting as it opens.
Other few options that worked for me:
Option 1 - Empty Cache From Safari
Safari on MacOS -> Develop -> Empty Cache
Option 2 - Clear Trusted Computers
On iOS Device -> Settings -> Developer -> Clear Trusted Computers then reconnect the USB cable and then try to debug again
Option 3 - Make the debugger fool (as of 14th Jan 2019)
This solution is working for a long time now. Since this is an issue related to connection between iOS & Mac so I opened my Console app and just kept my iPhone selected. (This is somehow kept my iOS device connected to my Mac)
Then opening the Developer's console on Safari worked fine for me without disconnecting.
Option 4 - Run via Xcode
This is also a kind of workaround and a hack to see it functional. You can basically prepare your iOS app by ionic cordova prepare ios and then run the app using Xcode and deploy it to your iPhone.
At least, I'm able to see the console logs and sometimes, it even works with Safari web inspector.
Option 5 - Run on iPhone simulators
I think this is the most working solution. This option is suitable when your system is not running too many applications as firing a simulator suckup a good amount of system resources.
Basically, instead of running your app on a real device, run your app in an iPhone simulator via Xcode and debug it normally in your Safari web inspector and this problem will not occur.
This is probably because the files being transferred to Safari inspector is from the system itself.
Comment: Emptying the cache fixed it for me too.
Comment: The third option seems the most reliably for me so far.
Comment: 3rd one is guaranteed. Console is available on your macOS, use spotlight.
Comment: Second option immediately worked for both of my devices (5s and Xs).
Comment: Option 3 seems to be a life saver to me - the idea to get connected even having bigger sourcemaps is to first connect to any small app on the device and only then switch to another app/tab on same device.
Thanks!
Comment: Tried all of them and none worked :/ I regret developing for IE6
Answer: Sounds strange but it may be happening due to the battery being full triggering a disconnect: https://forums.developer.apple.com/thread/92290

The disconnection seems to occur when the battery of the Iphone is full. (So for the moment we turn the flash and the camera on to kill the battery while inspecting ...)
Comment: This is likely why you came to this SO post. The answer above helped me.
Comment: I thought this was the culprit for me, but it wasn't. So beware this might not be the problem.
Answer: This is only necessary for physical devices. Physical devices can be forcefully disconnected by Safari if the device's battery is full. ("Full battery? Well then, let's just disconnect you as you don't need to charge anymore -- and there goes your debugging session too...")
You will want to select Connect via Network in Develop > [device], and then attach your debugger to the page you want to debug. If you do not have the Develop menu in Safari, go to Safari > Preferences > Advanced and select Show Develop menu in menu bar.

If this doesn't work, you may try upgrading your OS/Safari through the App Store first.
If things are still breaking, disconnect your iOS device. Go into your iOS device into Settings > Safari > Web Inspector and turn it off and then back on. Force quit out of Safari. Re-plug in your iOS device and start up Safari again and re-attach your iOS device through Safari > Develop menu.
Comment: via Network worked for me. On Safari v11.1.2 iOS 11.4.1. It was crashing immediately without the network option. Thanks!
Answer: Closing XCode first helped for me.
Answer: This plagued me for a long time with very inconsistent behaviour, here are a few things I have found that help, I also wrote a blog post on this here.

Update both mac safari and ios - I have found after having the latest of both versions it started working for me, there could be debugging incompatibilities between Safari's.
Check that web inspector in ios is enabled - It has been known that this setting can be switched off after an upgrade, check in settings > safari > advanced > web inspector.
Check the port you are connected to - I have had mine plugged into a cheap hub / via apple keyboard/monitor hub and found that going directly into the mac works much better.
Are you using a good quality cable? - I have found that better quality / official cables that aren't worn out have better reliability when in debug.
Other notable observations - other people have commented that making sure cookies are enabled in safari, enabling private mode and trying whilst Xcode is open have affected the reliability of this, although I haven't seen this myself it may help others to try.
Answer: I can't say I have a solution, but a step in the right direction.
I tried using ios-webkit-debug-proxy so I can use the Chrome Dev Tools instead of Safari Dev Tools.
Note, in order to get it to work, I can to upgrade my iOS to the latest 11.4.1 and MacOS 10.13.65, then reinstall the latest versions:
brew update
brew install ios-webkit-debug-proxy
brew reinstall --HEAD libimobiledevice
brew reinstall -s ios-webkit-debug-proxy

ios_webkit_debug_proxy

After running ios_webkit_debug_proxy, I was able to try to connect through chrome://inspect and it disconnected immediately again:
Listing devices on :9221
Connected :9222 to Chet's Phone (6a028994cf281be807bf80c5557c3f2eb3fbb8b0)
Invalid packet header 0x1ffffff91ffffffa0ffffff9d == .... == 26321053
Disconnected :9222 from Chet's Phone (6a028994cf281be807bf80c5557c3f2eb3fbb8b0)

However, we have a clue! Invalid packet header. Sounds like a lower level bug somewhere. Not sure where to submit this but to though...
Comment: I was able to create a reproduction for [ios-webkit-debug-proxy](https://github.com/google/ios-webkit-debug-proxy/issues/274) and it seems relevant to this issue because the reproduction was consistent with the Safari Web Inspector issue. It appears to be an issue with the javascript source size when unminified with sourcemaps.
Comment: Yeah, me too. I have 39MB unminified js file I'm dealing with
Comment: Sit down to track this error down with the Console App and had also some new insights, I will update my post above
Comment: You're right! Thank you! With a production build with the AOT compiler of angular, with a size of 1.8 MB for a main.js and a 2.4 MB vendor.js with no sourcemap files, it works all the time, with Xcode connected and without. I would still like to debug my development build, though.
Comment: I can confirm that removing the sourcemaps fixed this for me.
Answer: The magic solution worked for me:

Reboot your MAC
Reboot your iPhone
Comment: rebooting iphone only thing that works at least for a while
Answer: 09-07-2020
Still this issue on Latest MacOs (Catalina 10.15.5) on Safari (13.1.1)
Solution on Ionic/Capacitor:
ionic cap run ios -l --external --source-map=false

Answer: The most recent Safari Technology preview appears to have solved it for me.
https://developer.apple.com/safari/technology-preview/
Comment: Didn't change anything :(
Comment: Now the inspector opens.. and in a second (sometimes more or less) it now closes, instead of being open and just nothing happens like before. Still it is closing right now and can not figure out why. Safari Desktop Version 11.1 (12605.1.33.1.2) => Sierra
Comment: I'm having the same problem. Safari Technology Preview didn't helped
Comment: Starting from `Safari Technology Release 42 (Safari 11.1, WebKit 12605.1.10)` seems that the problem is resolved
Comment: Still have this problem with Safari Technology Release Release 70 (Safari 12.1, WebKit 14607.1.13) so I don't think this answer is valid!
Comment: Release 72 still having the issue
Comment: 3 years later, Safari TP still has this issue
Answer: MacOS Mojave / Catalina Solution
For me the issue started right after I upgraded to the new macOS Mojave, this might have been mentioned somewhere above but for me I just needed to download the new "Safari Technology Preview" app that is built for Mojave.
Safari Download Page
https://developer.apple.com/safari/download/
Direct Download for Mojave
https://secure-appldnld.apple.com/STP/041-71285-20190604-6d0dcb17-07e5-40a0-b418-dba732cefe64/SafariTechnologyPreview.dmg
Answer: For me using a different adapter and cable solved the problem.
Every time you connect, it should ask for "Trust this device" like prompt on smartphone, if not then it's the cable/adapter issue.
Answer: When using a content-blocker (e.g. 1Blocker) on your iOS device, make sure it is disabled for the domain you want to debug.
Disabling 1Blocker stopped the Web Inspector (Mac) from closing immediately after opening it, and allowed me to get back to work.
Answer: I know there's a lot of answers already, but I wanted to post because none of them worked for me just now. But, my phone's battery was in "low mode" ... but since I'm plugging it up for development, I didn't think that was a big deal. But, going into settings on my phone and turning off low battery mode fixed my problem. Now safari doesn't disconnect.
Just wanted to post that in case someone runs into this with a low battery.
Answer: Working solution for ionic app:
ionic cordova build ios --source-map=false

Answer: I've been seeing this issue when using live preview in Capacitor while building an Ionic Angular project on macOS Monterey previewing on iPhone Xs. Here are a few ways I can get over this bug and continue development...

Make sure you're using Safari Technology Preview and not the regular version of Safari.
Close and Re-Open Safari Technology Preview if it continues. You could also try inspecting using regular version of Safari after installing Safari Technology Preview. It may work for debugging almost as well.
On your device, open the app switcher and close all background applications before starting development on your app.
Toggle 'Connect via Network' in Safari on your computer by using: Develop > Device Name > Connect via Network in the Safari menu.
Disconnect and reconnect the lightning cable of your device. Make sure it has a steady firm connection to the computer. Off-brand cables can cause intermittent development issues.
Quit your app, go to the app switcher and force close your application by swiping it away. Then re-open it using the app icon in the launcher. Try inspecting it again.
Try rebooting your computer and rendering your app again. After a lot of up-time there may be some built-up log data that needs to be dumped.
Answer: Just disable sourcemaps from being read in Safari.

Open the web inspector
click the cog to open settings
Go to the sources tab
Uncheck "Enable source maps"

This worked for me
Answer: Capacitor, Ionic, Cordova
rm -rf platforms/ios/**/*.map


Trespass and the police

Question: Can a US cop ask a land owner if a person is trespassing if no complaint has been made? i.e. can they ask a shop owner if a person is trespassing in their car park or outside the shop?
Answer: Yes, of course. Anyone can walk up to a shop owner and ask them pretty much whatever questions they want; police have just as much of a right to do that as anyone else. The shop owner doesn't have to answer, but police are free to ask.
Comment: Police have the same rights as any other citizen, unless specifically forbidden in the few restrictions and obligations borne from their public servant status. They also have several other abilities necessary to perform their duties.

Trespass and the police


How to make a Raspberry Pi?

Question: I'm currently a robotics hobbyist and am full fledged in Arduino and I have used the Raspberry Pi to make some robots and PCs. Currently, I am thinking of making my own Raspberry Pi, from scratch, on a breadboard or a PCB or something. I surfed the web quite a bit and I did not get the answer I was hoping for. By making a Pi, I mean like instead of buying an Arduino, I can make one myself by buying the Atmega328, Crystal oscillators, etc. I am asking for this because my school requires me to do a project in which I make a computer or a gaming console or something like that and I would hate to look at the disappointed face of the tester all because I just bought a Pi , an connected some devices to it. Thanks in advance!
Comment: This question does not appear to be related to robotics.
Comment: Both of these platforms are open-source hardware. You can find the board schematics and try to reproduce them on a breadboard. One might say "you just bought the components and connected some wires", so I'd say if your school project is not too big and depending on its scope, perhaps it's ok to just buy the board itself.
Comment: I voted to close this question because, as @BendingUnit22 said, "Questions on Electronics, Arduino or Raspberry Pi which are not specific to robotics are off-topic, so please try Electrical Engineering, Arduino or Raspberry Pi. Even questions which are on-topic here may still receive quicker and better answers on their own sites."
Comment: Take a look at [Standalone Arduino](https://www.arduino.cc/en/Main/Standalone), it is not quite the Pi (in fact it is just an Arduino on a breadboard) but dead easy to make. :-)
Answer: You would need to take the available SPICE and ECAD drawings, and then turn them into PCB schematics using something like KiCAD or Eagle. Then you can send the PCB file to a PCB printing service, and they'll send you what you order. You'll then have to find all the components and solder them yourself - you'll need to be very good at surface mount techniques. Honestly, unless you really need a custom RasPi, and already know how to design it, it's not worth your time to build your own IMO. Just buy one.
In terms of a school project, adding components to a RasPi is still not a simple task. These things aren't plug and play, you'll need to write the software for it, and name sure that your circuits are wired up correctly. I'm sure that your teacher will still be impressed with a 'store-bought' board used in whatever project you decide.
For future reference, this is the robotics stack exchange. I'm betting that your question is going to be closed because it is mostly unrelated to robotics. However, the electrical engineering stack exchange will probably be more than happy to help you, if you're set on building your own RasPi.

How to make a Raspberry Pi?


Unexpected error on server associating the workflow

Question: I cannot proceed with publishing the workflow whenever I add more steps. But if I create a new workflow and copy the steps there, it works. Does the 2010 workflow have limited number of If statements that it allows?
Answer: Each workflow is associated with a XOML file, please check for the difference of XOML settings in New and associated workflow, you can check XOML file with the help of SharePoint Designer. You will certainly get some idea. As per my knowledge there is no such limitation, there might be some  custom Workflow activity which is not available after association.
Comment: Just connect to SPDesigner, on the left bottom, you will see view all files, there under workflow folder, you will see all the workflows, select your workflow and download the XOML file for both the environments, use tool like WINDiff to check if there is any difference in both. Custom WF activity is deployed in Central admin, check for respective features.
Comment: how will i check this? @farshid


Outlook (on Exchange) rules - how can I use the OR operator?

Question: In my organization I'm a member of many distribution lists, I have a rule for each DL/ML such that each message is delivered to a subfolder for that DL, however it's important that any messages sent to a distribution list, but containing my name in the To:, Cc:, or in the message body are delivered to my Inbox and not my distribution list subfolders.
I have a rule set up in my Exchange (Office 365) account that looks like this:

Apply this rule after the message arrives
Where my name is in the To box

and where my name is in the Cc box
and where my name is in the To or Cc box
and with "Dai" in the body

move it to the Inbox folder

and stop processing more rules

At first-glance, this rule seems fine - except that it applies the AND operator, so logically only messages with my name simultaneously in To, Cc, and the body will be moved to my inbox. Surprisingly this does happen - but it means that a lot of messages fall through the cracks.
Rather than creating one rule for each, is there a way to change it so these predicates are applied with the OR operator instead of AND?
I'm using Office 365 Exchange so I can't use VBA rules (which, in my understanding, run on the client).
Answer: I cannot think of a way. Outlook rules are pretty limited, it's too bad they don't have an advanced RegEx method to create rules.
I think you'll have to fall back on your three rules idea.
Or open a suggestion to MS.


Was Light actually a friend to L?

Question: I know L said Light was his first friend but did he mean it? Yes we know L is a liar and knew Light was Kira the whole time but what if, during the time Light lost his memories, L thought of Light as a genuine friend. It's all very confusing to me still so can someone answer?
Comment: Related from the opposite PoV: [Did Light actually like L (in a friendship way)?](https://anime.stackexchange.com/q/21482/2516)
Answer: Apparently, no.
So here's the thing, the author of Death Note, Tsugumi Ohba put little notes and other trivia in Death Note 13: How to Read. And some even asked if L was genuine about him being friends with Kira. To which he answered "No" as L was lying to catch Kira.
From page 64 of the English translation:

L Has No Friends?
Nope. And when he says that Light is his first friend that's a big lie. He never considers him a friend. He probably secretly thinks really negative things about him.
Answer: I would say Yes.
L considered him as a friend because they had a lot of coherence as compared to the other characters even if he had a strong suspicion on Light being KIRA.
Also, to the "What if part" : he was never 100 % sure, but had a strong suspicion on Light.
Answer: L did have emotions but Light not.
L really considered Light as a friend, but at the same time was sure that Light was Kira. We can see that when L was dying (ep. 25), L was regretting that he is sure that Light is Kira, but has no way to prove it. So he still showed gratitude to Kira, and wiped his feet.

Was Light actually a friend to L?


flask sqlalchemy - dynamically generate data model based on columns in the database

Question: Is there a way to generate db model dynamically based on the columns in the database table for Flask SQLAlchemy?
I have an application to display data in from a database table, but the column name would change at times and break my app. I would like to have a way to generate the data model dynamically based on the actual column names in the database.
I currently explicitly declare all the columns as below.
class MyDbModel(db.Model):

    __tablename__ = 'my_table'

    id = db.Column('id', db.NVARCHAR(length=300), primary_key=True)
    name= db.Column('name', db.NVARCHAR(length=300),
                          nullable=True)

I'm not very familiar with sqlalchamy, I have tried the following but is getting an error as below, and I'm not sure if this is the right way to do it.
could not assemble any primary key columns for mapped table
from sqlalchemy import Table, Column
from sqlalchemy.orm import mapper

    db = SQLAlchemy()

    class MyDbModel(db.Model):
        __tablename__ = 'my_table'

        def __init__(self):
            #helper function to get column headers of a db table
            table_cols = get_headers_or_columns(
                'my_table'
            )
            t = Table(
                'my_table', db.metadata,
                Column('id', db.NVARCHAR(length=300), primary_key=True),
                *(Column(table_col, db.NVARCHAR(length=300)) for table_col in table_cols)
            )

            mapper(self, t)

Any help is appreciated!
Answer: I figured this out, in case anyone needed. It's really simple, use a helper function to get the column headers of your table, then just use setattr to set the attributes of the class.
from app import db

class MyDbModel(db.Model):
        pass

def map_model_attrs(model, table):
    """
    :param model: your db Model Class
    :param table your db table name
    """

    table_cols = get_headers_or_columns(table)

    for col in table_cols:
        setattr(
            model, col, db.Column(col, db.NVARCHAR(length=300),
                                  nullable=True)
        )

map_mode_attrs(MyDbModel, 'my_table')


Regex detect filename in Outlook Attachment

Question: Trying to go two routes with this. The goal is to let someone attach a file and then on _ItemSend event to run a Regexp to detect certain strings in the filename and then to a Cancel=True or Cancel=False. I have the following code, but the basic problem I'm having is converting the mailItem.Attachments to a String to actually run it through the Regexp. I get alot of errors saying it can't be converted to a String...any ideas?
<code>  Public Sub Application_ItemSend(ByVal Item As Object, _
    ByRef Cancel As Boolean) Handles Application.ItemSend
    Dim mailItem As Outlook.MailItem = TryCast(Item, Outlook.MailItem)
    If mailItem IsNot Nothing Then
        Dim attachments = mailItem.Attachments
        For Each attachment As Outlook.Attachment In attachments
            AttachmentQuery(attachment, mailItem, Cancel)
        Next attachment
    End If

    Dim instance As String
    Dim AttachmentMatchResults As MatchCollection
    Dim attachments1 = mailItem.Attachments
    instance = attachments1.ToString
    Dim returnValue As String
    returnValue = instance.ToString
    Dim RegexObj2 As New Regex("^.*(names|playlist|roster).*$", RegexOptions.Multiline)
    AttachmentMatchResults = RegexObj2.Matches(returnValue)
    If RegexObj2.IsMatch(returnValue) Then
        MsgBox("A key file has been found", MsgBoxStyle.OkCancel)
        Cancel = True
    Else
        Cancel = False
    End If
</code>
Answer: If you are talking about the string representation/name of individual Attachment objects (rather than the Attachments collection object) then you can use (for the i-th attachment):
<code>mail_item.Attachments(i).FileName
</code>


Is #10 wire correct for my mini-split system on a disconnect?

Question: I have a disconnect box that is on a 50 amp breaker connected to a disconnect box using 6 AWG. In order to connect my mini split system to the disconnect do I use 10 AWG wire based on the information on the label?
Comment: Does your disconnect use fuses or breakers inside it, or is it an unfused disconnect?
Comment: Yes, does your disconnect have fuses in it?
Answer: You can use any wire you want, 10 AWG or larger... so if you have some #6 lying around, don't make a run to the store lol.
As far as circuit breaker, 30A is fine.  What the label is telling you is that if you get nuisance trips, it's OK to bump to 35A or 40A.   Or even 45A, but that is not a commonly made breaker size, so that basically means 40A lol.   It might be available in fuses.
Answer: Yes, use #10 AWG. The minimum circuit capacity per the manufacturer must be followed. You will also have to replace the 50 Amp breaker with a 30 Amp breaker and pigtail the # 6 AWG to a piece of #10 AWG since the #6 won't fit (probably won't) into a 30 AMP breaker.
Comment: Yes,  the manufacturers give an upper and lower limit to what will protect the unit. A 40 AMP breaker would be ok too but then you'd need #8 AWG.
Comment: @JACK Actually in this specific case, you would be allowed to run the 40 amp breaker on #10 AWG. It's allowed because that is what the label calls for. You follow minimum circuit amp (MCA) for wire size, and maximum overcurrent protection (MOP) for breaker size. See https://diy.stackexchange.com/a/106924/65622 for code reference.
Comment: I presume the "Max.Fuse 45A" means a maximum 45amp breaker (or fuse), but since those don't seem to be common a 30 or 40am would be appropriate instead of the 50, right?
Comment: @PhilippNagel  Old dog still learning stuff. Thanks.
Comment: Don't understand the DV.


Limp and Hobble

Question: I have a problem with the word "limp" and "hobble". I do not know which word is appropriately used when it comes to context because I do not know how the words differ from each other. Can we use them interchangeably? Do they have the same meaning? How do we differentiate the word "limp" from "hobble"?
Comment: Have you checked the dictionary? While related, they have different meanings. Share your research - what part don't you understand?
Comment: I have. Here is what I found; limp: to walk slowly and with difficulty because of having an injured or painful leg or foot, while hobble: to walk in an awkward way, usually because the feet or legs are injured. Is hobble worse than limp? I am a non native speaker, so I find it a little bit confusing. Is it the injury that matters, or is there something else? I tried to google the images of limp and hoble, but it does not help.
Comment: [Limped around](https://www.google.com/search?num=30&client=firefox-a&rls=org.mozilla%3Aen-US%3Aofficial&channel=rcs&q=%22limped+around%22+bad+leg&oq=%22limped+around%22+bad+leg&gs_l=serp.12...24816.36904.0.392126.96.36.199.0.0.0.219.2630.3j17j1.21.0....0...1c.1.41.serp..20.1.113.r7iaajMPpq8)
Comment: Awful quality, but the video shows what a limp most commonly looks like https://www.youtube.com/watch?v=8EzEGSn6HzM.
Comment: Note also the meaning of the nouns _a limp_ and _a hobble_. One is a characteristic walk (_He walks with/has a limp_) and the other is a device (_The authorities attached an electronic hobble to him_). _Hobble_ has a causative sense 'to attach a hobble'; _limp_ has no comparable causative. Limps are accidental for the most part, but hobbling can be from some outside agency, it appears. Not that limping can't, too, but that doesn't seem to be a relevant feature of _limp_. So, partial overlap, partial uniqueness, par for the course.
Comment: Thanks for the youtube link! That helps a lot! :) But I tried to find the hobbled one without much succeed, and do you think that we can conclude that a hobbled somebody needs an equipment to help with the walking?
Answer: Limp means that you are favoring one leg.  A person that limps puts most of their weight on one leg and kind of drags the other along.
A hobble is someone who is walking weird, struggling to walk (both legs bad), and often someone who is just really slow (often because of injury/handicap).
Edit:  Mari-Lou has a point in the usage of hobble when a person hurts one ankle.  This is common especially in sports.  The use of hobble would be right because the person is not dragging the bad leg along, and they generally just look slower and like they may be injured in some way.  Lots of athletes hobble around the field/court, if they are actually hurt bad enough that they need to limp then their playing is a bit more heroic.
Comment: When in doubt, look at the etymology (something I've learned while contributing here). **Hobble** comes from the word *Hoblen*, a Middle-English word associated for 'idiot' (or someone who is slow). **Limp** comes from the Middle-English word *lympen*, which means 'to fall short'. So, this answer seems to fit, even though saying that is probably politically incorrect (implying that *hobble* originated from a metal state might not sit well with some people). Of course, I haven't searched for evidence (which I can do if people want) and was just speculating as to the evolution of the usage.
Comment: You can [*hobble*](https://www.google.com/search?num=30&client=firefox-a&hs=lGo&rls=org.mozilla%3Aen-US%3Aofficial&channel=rcs&q=%22hobbled+around%22+ankle&oq=%22hobbled+around%22+ankle&gs_l=serp.12...18088.20154.0.22051.9.9.0.0.0.0.135.925.3j6.9.0....0...1c.1.41.serp..9.0.0.KtpS8wD51MQ) on one leg too, e.g. when you've strained or twisted your ankle.
Comment: @Mari-LouA - you have somewhat of a point there.  I read the first ten or so posts and they all pointed to someone who had already recovered from a bad ankle/leg or that had an injury/non-injury where they continued to play through it.  When I twist an ankle playing basketball I wouldn't say I am limping.  Because if I am dragging one leg around I would be useless on the floor.  However I could be hobbling... but I am not sure if you would know which ankle was hurt.  I would be slower and maybe running more gingerly but not overly favoring one leg over another.
Comment: Added just for you @Mari-LouA.
Answer: The definitions you have quoted don't explain the difference.
A limp (see also) is an uneven movement, caused by a problem with a hip, leg or foot.
A hobble in this context is to walk with a handicap or injury.
They do overlap, but the limp is uneven.
There are other meanings for hobble shown in the link also. Notice that this answer uses three different sources. If one source isn't clear to you, look at others :-)
Answer: I think the difference is also one of degree.  A limp is an uneven gait in which the compensation is largely limited to the legs, but the head and torso move approximately normally.

limp, v.intr : To walk lamely, to halt. Also with about, along, away. Occas. with cognate object. 1837   W. Irving Adventures Capt. Bonneville III. 259   His trail was followed for a long distance, which he must have limped alone. 1867   Dickens Let. 24 Jan. (1999) XI. 302   He limps about and does his work.

A hobble is more severe.  The legs alone are unable to fully compensate and the entire body moves up and down to take the weight off of the injured leg.

hobble, v.intr: To walk with an unsteady rising and falling gait, as one whose limbs give way under him; to walk lamely and with difficulty 1666   London Gaz. 3 Sept.,   Many cripples were seen hobbling about not knowing which way to go.
  1728   J. Morgan Compl. Hist. Algiers I. iv. 99   In stony ways the poor creatures [camels] hobble very much.
  1781   F. Burney Lett. 15 May,   I now hobble about the garden with a stick.
  1871   L. Stephen Playground of Europe (1894) xiii,   The..old gentleman..now hobbles about on rheumatic joints.

In the examples of a limp, the limper is but little impaired, going on for long distances and doing work without further characterization of the movement.  Hobbles, however, are the movements of cripples, camels, rheumatics and those requiring sticks to aid their movements. This is born out by the other senses of both words.  Hobbles have more exaggerated movements. Limps are mild impairments.

Limp and Hobble


Please explain the walking mechanism

Question: When a person walks, he exerts a force on the road, lets say $F$, and the road exerts a force on the legs (friction), lets say $f$. Newton's third law says that $F = f$, so why is $f - F = ma$? Where does that extra $ma$ come from if friction applied is only $F$?
Answer: You are writing that the force on the road minus the force on the leg is equal to mass times acceleration. This is common mistake and is not how Newton's law works. You can se this if you ask yourself what mass and whose acceleartion would you consider in the right hand side of the equation. The leg's or the road?
The corrct way to use Newton's second law is to focus on one object at a time. If you  consider the leg, then only the forces on the leg should be considered and then you have the net force on the leg is m*a where both m and a reffer to the leg. If you refer to the road, then only the forces acting on the road should be considered.
So, to get back to your situation, If F and f were the only forces (in reality there are more forces acting on each object, leg and road) the correct way to write N's second law is f=ma where m is the mass of the "leg" and a is acceleration of the "leg".
So there is no mistery about where the acceleration comes from.
Answer: There's some misunderstanding of the law of reaction here. While it's true that $F=f$, those two forces are applied on different entities. A person walking is only affected by the force the road applies to him ($f$ in this case), and not by the force he is impressing to the road.
Thus we have two equations of motion, one for the person, the other for the road:

For the person we have $f=m_{person} \cdot a_{person}$ and hence the person is able to move
For the road we have $f=m_{road} \cdot a_{road}$; now you can not really move the road since it's attached to the soil, so you should be moving the whole tectonic plate, which has an enormous mass, and thus the result acceleration is (basically) $0$.
Answer: Generally, the equation of motion for a body is
$$m\vec a = \sum_i \vec F_i$$
When you apply that to walking, nothing special happens. For example, you could write (among many other possible, more or less simplified models of the process)
$$m\vec a = \vec F_{muscle}+\vec F_{friction}+\vec F_{gravity}+\vec F_{floor,support}$$
where all the forces on the right hand side may also carry implicit minus signs. Moreover, each force might depend in a specific way on state variables. For example the muscle force depends on the joint angles and what your brain considers appropriate leg-eye coordination. Or the floor support force depends discontinuously on the distance of your foot to the floor ("on-off-force" or more officially, contact force). Same for static friction: the force is restricted to a maximum value, the transgression of which causes a relative velocity (i.e. connected to state variables) between your foot and ground, until only sliding friction remains.
So the $m\vec a$ is not "extra", it is just the core of Newtonian mechanics.
Answer: While others have explained the misconception you have about Newton's 2nd and third laws, they still haven't given a hint about the mechanism of walking which is in your title.
In order to walk, you must begin to fall forward. That means you begin to rotate around some point which is your (hopefully) stationary foot. As your center of mass moves in front of that foot, because of the internal actions of your muscles and bones, gravity exerts a torque and you begin to rotate. You move your non-stationary foot in front of your center of mass and plant it firmly. You change the net force on the ground from your previously stationary foot so that the net ground force exerts a torque about your new stationary foot-ground contact point to keep your body rotating in a forward motion. This gets repeated and you walk.  It's a repetitive falling/stopping/falling motion. Some people learn to do this well, while others plod along clumsily, but the motion is caused by alternating gravitational and ground-based forces producing torques about your stationary feet.
If your feet slip, bad things can happen!
Answer: As our muscles allow our center of mass to move forward past the points of contact between our foot and the ground the friction keeps our foot from sliding out from under us as the muscles push it further behind. Then we move the other foot further in front of us to repeat the process as our momentum and muscles carry our center of mass onward. Were we standing on ice with a much lower coefficient of friction our foot might overcome static friction and slide out from under us when our muscles attempted to shift our center of mass forwards. Hope this helps.

Please explain the walking mechanism


What kind of system is required for dynamic equilibrium to be set up?

Question: Most websites and books mention a closed system, but technically isn't an isolated system required? If energy can be transferred, then the position of of the equilibrium will continuously change and no equilibrium will be set up, right?
Comment: Who cares about closedness? An equilibrium is possible in any system.
Comment: Do you know what *dynamic* means? You're talking about static not dynamic situation.
Comment: @Mithoron he used [the term](https://en.wikipedia.org/wiki/Dynamic_equilibrium) correctly.
Answer: If energy can be transferred, it does not mean it is transferred.
If there is e.g. zero net thermal energy transfer, a system is in thermal equilibrium with the neighborhood, even if it is not isolated.
As Ivan says, an equilibrium is possible even in an open system, if net transfer of particular matter kinds is zero.
The thermodynamic equilibrium consists of thermal, radiative, chemical and mechanical equilibrium.
Note that thermodynamic equilibrium happens at following conditions:

For a completely isolated system, the entropy $S$ is maximum at thermodynamic equilibrium.
For a system with controlled constant temperature and volume, the Helmholtz free energy $A$ is minimum at thermodynamic equilibrium.
For a system with controlled constant temperature and pressure, the Gibbs free energy $G$ is minimum at thermodynamic equilibrium.

$$\begin{align}
G&=H-TS \\
\Delta G&=\Delta H-T\Delta S \\
\end{align}$$
Total entropy of the not isolated system and it's surrounding increases in time.
Entropy of the system alone may decrease with time, if the Gibbs energy of system decreases, as this latter decrease also means
$$\Delta S_{\rm surrounding} +  \Delta S_{\rm system}  \gt 0$$
Comment: Gibbs free energy **change** = ..  G=H-TS DeltaG=DeltaH-T.DeltaS
Comment: What I found after discussing this with my friend is that Gibbs free energy = Enthalpy change - (Temperature * Entropy change) has to equal to 0 for equilibrium to be established. In a closed system this is possible, provided your temperature is kept constant (as entropy increases with time). Is that what your answer is saying as well or is it different?
Comment: See the update.
Answer:
If energy can be transferred, then the position of of the equilibrium will continuously change and no equilibrium will be set up, right?

When a system is at equilibrium, its state does not change. So there can't be a net transfer of energy into the system or out of the system, that would change its state. There also can't be a net transfer of matter into the system or out of the system, that would also change its state.
An open system allows energy and matter exchange with the surrounding. However, once the system and the surrounding together have reached equilibrium, the net transfer of matter will be zero (and the net transfer of radiation), and there will be no heat transferred between system and surrounding, and not work done by the system on the surrounding or the other way around.
So it is not that you have to prevent energy transfer, but that the processes at equilibrium will not show a net transfer of energy even though it is possible and probably happened as the processes approached equilibrium.

What kind of system is required for dynamic equilibrium to be set up?

There are no requirements, any kind of system is fine, including the universe (we're not at equilibrium yet, though).
Answer: I don't know German, but my perception is that German readily forms new words by making compound words out of what would phrases in English. So in English adjectives get thrown around. You have to learn the lingo.
A closed system is one in which matter isn't being exchanged with the outside environment, but energy can be.
An isolated system is one in which neither matter or energy is being exchanged with the outside environment.
An open system allows both the exchange of matter and energy.
Answer: A closed system is required for the dynamic equilibrium to set up.


Strange SSL error using docker and spring cloud

Question: I have a strange problem using feign client in a spring cloud environment.
I use the feign client to connect to an external HTTPS url for a REST call.
The problem is,that every night, server stops docker service to make a backup of volumes. After this,in the morning, i get
<code>feign.RetryableException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target executing POST
</code>

I thought that is about the certificate, so the first step was to import certificate with keytool into docker container java cacerts file (openjdk-8). (worked after restart of container but still got error in the morning)
I was still losing the certificate during night so i created a persistent volume for the store(same result).
I realized on a dev server that even without importing the certificate into container, i don't get the error anymore after restart of the docker container(just a docker restart {container} and nothing more).

So, each morning after restarting the container, everything runs smoothly.If i don't restart, i get the error.
I would like to understand what is happening there so i am open to ideas.
Thanks!
Answer: I had the same error, caused by root certificate version (unipass in my case). Check if you have the same root certificate as the client. Bring them to the same version (if they differ), and the error will disappear.


Can append only NTFS files become corrupted if power goes out?

Question: NTFS journals metadata so the file system itself doesn't corrupt if the machine goes down.  I read this is not the case for file data itself.  But what if the data is only appended at the end of the file?  I think databases do this, so presumably it's safe, but I couldn't find documentation.  I want to resume downloads safely after power on.
Comment: It may not be a problem, but the downloading program needs to check actual downloaded bits on your disk upon resuming. If it stores this information (*How many bits have been downloaded?*) in database or something, the actual state may be different.
Answer: It Depends.TM From TechNet, emphasis mine:

NTFS uses transaction logging and recovery to guarantee that the volume structure is not corrupted.

In theory, NTFS guarantees that either all of a volume structure update will be on disk or none of it will. Therefore, one of these two things will be the case after the power comes back up:

The file is its old size and your new data is absent
The file has its new size and your new data is... oh wait

The point of NTFS's journaling is to ensure that the bookkeeping and metadata aren't demolished if a change to them was in progress when the power was lost. This is accomplished with the change journal. (I have heard anecdotes of bad sectors appearing after power failures, but I can't find any official sources to confirm that such things happen.)
The user data, however, isn't always written when you think it is, especially in the presence of write caching. Even so, in that case, your volume is fine and nothing bad will have happened to the existing data, since it didn't get updated.
That said, if your download application isn't designed to deal with situations like this, it's entirely possible that the file will have been expanded but the new portion filled with zeroes. If the application updates multiple places, any OS write caching invalidates assumptions you might make about when user data gets written. (FILE_FLAG_WRITE_THROUGH might help, but even that can be ignored if advanced performance is enabled.)


Restricting selection to a specific folder for use as an image file

Question: The requirement is to have an image field that is not the standard one but rather a pulldown list of images from a specific folder.  I can get this to work on the backend by using a droplist field or droplink field and pointing the Source item of the field to the folder in question, however, trying to then retrieve the actual image in code has proved problematic.  I can't seem to cast the item to a mediaitem (it yields null), so I'm wondering if this scenario is typically handled in a different way or are there solutions I've just not been able to find?
Comment: Can you please share the code? Also if i understood properly, you want users to select images only from a specific container?
Answer: You can use either a droplink, droplist or even a droptree. However, you need to know how Sitecore stores the value of the selected image.
Droplink
For droplink, if you check the raw values, you will see that the data is a Sitecore ID.
DropTree
For droptree, if you check the raw values, you will see that the data is a Sitecore ID.
DropList
For droplist, if you check the raw values, you will see that the data is the name of the item selected.
So, I have tested on how you can retrieve the selected images and cast it as MediaItem.
I have use the Home item and updated the Sample Item template with the following 3 fields

Image Droplist
Image DropLink
Image Droptree

If you use the DropLink or DropTree, it is very simple as you just need to get the item by ID and cast it as a MediaItem. For Droplist, since the name of the item will be obtained, you will need to add the full path. Below is the code snippet on how to retrieve and cast the item as MediaItem for the 3 fields.
var database = Factory.GetDatabase("master");

var homeItem = database.GetItem(new ID("{110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9}"));

// If not all fields are being shown, uncomment below code
// homeItem.Fields.ReadAll();

var imageDroplist = homeItem.Fields["Image Droplist"].Value;

var imageDropLink = homeItem.Fields["Image DropLink"].Value;

var imageDropTree = homeItem.Fields["Image Droptree"].Value;

var imageDropListItem = (MediaItem)database.GetItem($"/sitecore/media library/Default Website/{imageDroplist}");

var imageDropLinkItem = (MediaItem)database.GetItem(new ID(imageDropLink));

var imageDropTreeItem = (MediaItem)database.GetItem(new ID(imageDropTree));

On a side note, I would tend to use the DropTree as field type because it will allow me to see the thumbnail of the image.
Comment: Thanks, however when trying to use the droptree code you provide above I get an error when casting specific to the new ID() - "System.Web.UI.Control.ID is a property but is used like a type.
Comment: AdditionallyI see you have "Image Droptree" etc. as field types in your screenshot but I'm not seeing these as options - do I need to create custom field types?
Comment: @LeviWallach those are not custom fields. It is found under the dropdown of when selecting the field type under section List Types and so on. new ID() is from the namespace Sitecore.Data and not from System.
Comment: @Hihaam Namooya, sorry, I was looking at your field labels!  I made the change to the ID, modified it based on my existing code and it now works properly, thank you!


Why does this layout look so weird with the pictures on the right?

Question: I'm trying to decide between these two layouts. For some reason, putting the pictures on the right makes it feel really funky but I can't explain why. Someone suggested that's it's because we read from left to right. Can someone offer a better explanation ?
Comment: I don't know for definite (hence this being a comment not an answer) but I would hypothesize that the issue is because the alignments with the content inside that column aren't consistent in the second example. In the top image both the text and the images are aligned left, whereas on the second image the text is aligned left but the image is aligned right. Perhaps if you aligned the text right in the second image it would work better.
Comment: I only noticed the difference after reading the replies. Visually, I prefer the second because the text on the left provides a divider between the main image section and the related articles images.
Answer: We read from left to right. It's so ingrained you can't really help starting at the top left to process a piece of text. However, we like looking at pictures more. Select boxes in a form do the same thing (perhaps not because we like em more, but rather they're more complex than other form elements): we're drawn to look at them.
Your second example really drags my eye to the right edge of the screen. The very light contrast of the text next to the images only reinforces that. Our eyes really like to move to the right to continue looking at something. However, in your second example there is nothing there. So, in stead, our eyes have to skip over the text next to image to start processing that. Moving from left to right, we again end up at a thumbnail and the edge of the screen. So, again, we have to force our self to skip back to process more of the screen in a zig-zag manner.
Your first example works better because our eyes are almost naturally drawn to each thumbnail, keeping our eyes from leaving the screen.
Basically it's one of the laws of composition. You can make eyes leave the area by putting something really interesting on the right, but a good image keeps eyes bouncing around inside it. A similar thing happens for instance when you put a person on the right edge of a photograph and have him looking to the right: it's so natural to try to look at what that person is looking at we almost immediately stop looking at the photograph.
Answer: A couple reasons it might be feeling 'funky':

All native/default(?) iOS apps use the left side for the menu/navigation hierarchy and the right side is left for content, which is opposite of what you're doing here.
Like you mentioned, we read enlgish from left-to-right and here you see image and then content, and then when you move down, content again. Sort-of de-emphasizes the image part here. Adding a bit more to this point: Since there is white space in the background of the image and the text panel is a light grey background; whenever you read one line and go down to find the beginning of the second line, your eyes are distracted to the left since it is not a clear differentiation.
I might be pedantic, but, you might want to align the direction of the images. Some bikes are pointing right and some, left. Which can be a little disorienting.
Comment: point 1: the main purpose of the "control" is to offer additional information - it's based on the facebook app's friends/chat thingy, and it disappears in portrait mode; there is another "classic" drawer control on the left for navigation
point 2: is finding the next line an issue in the first image as well?
Comment: Facebook does 2 panels (on the iphone atleast) left slide-in panel is navigation and right slide-in panel is chat. Finding the next line is easier in the first image since you have thumbnails to break flow.
Answer: I'd like to propose an alternative answer :
The design looks strange with the information on the right due to mismatched proportions and unbalanced negative space.
The overall design is not framed in a way that contains the information in a pleasing layout. Try using thirds or the golden ratio to get the proportions right (they're essential the same heuristic).
The white (empty) space in the bottom right is out of balance. Look at the other places you have white space, and (top right, below the picture, and top left around the bike). The white space is neither symmetrical nor asymmetrical. Make the white space look intentional.
As a side note, there's a great resource on the paradox of white space here. It is an opinion piece, that is well supported by the current understanding of the effects of visual acuity on cognitive processing. In short, it requires more energy to observe complex images, so we are physiologically drawn to observing simple images. But in terms of cognition, we are drawn to complex images - as simple images are not stimulating. Striking the balance (and using white - a full spectrum light) satisfies many of the anatomical triggers for complexity, without engaging the physiological functions for complexity.
Answer: Its funny you posted this because it involves something I noticed today.  For the pages I view these days, the right hand side is riddled with useless and ridiculous ads.  I've become accustomed to completely ignoring the right side of a page
Don't know if this has anything to do with the "feel" or not, but it was the first thing that came to my mind.


Splitting of data across blkxxxxx.dat files

Question: I am trying to parse out the bitcoin data using Big Data and wanted to know more about the blk files themselves. I was wondering how does bitcoin split the transactions across the files. I know there is a 128 MiB limit on the files. Does that mean it is possible for transaction data to be split across a blk ? For instance the merkle root of the transaction is in one file and the output index is in another ? Or is block data retained in a single file ?
Answer: Blocks are never split across files: the whole block, from magic to length, to header, to transaction data, is always stored in a single file, continuously.
However you may need to take into account:

Blocks in the blk*.dat files are stored in the order they are received from the network.l, which may not be the blocks' logical order.
It is possible that a block is in file N, and its descendant block is in file N-1.
The files contain all blocks ever received, including ones that are not part of the main chain but were reorged out.
There can be "gaps" of zeroes or garbage data between blocks in the blk*.dat files.
Comment: Bitcoin Core has a linearize script: https://github.com/bitcoin/bitcoin/tree/master/contrib/linearize. This can be used to construct a single file with all blocks in the active chain (no reorged forks), in order, without gaps.
Comment: Thanks for your answer! Just one follow up, is there anyway we can pre-sort the blk files in anyway ? Because I'd like to process them into a CSV on individual nodes on a distributed environment and then find out the input address by looking backwards if that makes sense
Answer: As a kind of addendum to the first bullet-point in Pieter's answer, I had written a program to parse blkxxxxx.dat files and, in my case at least, the blocks are very obviously not in logical order. Just as Pieter asserted.
Notice the day number in the timestamps in the first ten blocks:
C> blockchain -file blk02100.dat -blocks -longstats
Block      1, 2020-06-03 03:48, target 171297F6,   2273 transactions
Block      2, 2020-06-03 04:29, target 171297F6,   2768 transactions
Block      3, 2020-06-04 02:00, target 171297F6,   2177 transactions
Block      4, 2020-06-05 12:37, target 17147F35,   2243 transactions
Block      5, 2020-06-01 07:15, target 171297F6,   3150 transactions
Block      6, 2020-06-02 21:48, target 171297F6,   2911 transactions
Block      7, 2020-06-02 21:49, target 171297F6,   2722 transactions
Block      8, 2020-06-05 16:23, target 17147F35,    182 transactions
Block      9, 2020-06-03 05:34, target 171297F6,   2002 transactions
Block     10, 2020-06-03 04:36, target 171297F6,   1958 transactions
...
Block    111, 2020-06-06 03:39, target 17147F35,    259 transactions

Statistics for blk02100.dat (2020-06-01 to 2020-06-06)

   111 blocks
222519 transactions (2004.7 per block)
109173 Segwit tx    (49.1%)
622026 inputs       (mean 2.8, max 1030 per transaction)
614553 outputs      (mean 2.8, max 3799 per transaction)

Processed file in 322.5756ms

I guess this scattered order is because my node was receiving blocks from multiple peers and concurrently receiving them from fairly disjoint ranges.
I can confirm that every blkxxxxx.dat file I tried, started and ended at a block boundary. There were no partial blocks.

Footnote: My program isn't extensively tested so maybe take the above with a pinch of salt. I believe the timestamps to be parsed correctly.
Comment: Yes ! I have found the same to be true and the python parser i am currently using [parser](https://github.com/alecalve/python-bitcoin-blockchain-parser) also has the option to obtain blocks in an ordered/ unordered form.


Control the sound of an NFC reader

Question: I am using pynfc to read in NFC tags. I have an ACR 122U USB NFC reader/writes unit. This unit is capable to make a sound when it reads in a tag, however i was unable to find anything in the pynfc docs about controlling it. Is there a way with either pynfc, or some other python, or linux OS to invoke the sound of an NFC reader?
Comment: The [API documentation](https://www.acs.com.hk/download-manual/419/API-ACR122U-2.04.pdf) for that device lists a couple of commands to control the "buzzer" (sections 6.2 and 6.7 of said docs). Have you tried sending those commands?
Comment: @JonahBishop Thanks, it seems like a good start, but i dont know how can i control the reader this way.
Answer: Here is an example to buzz the buzzer:
Add the following code to pynfc/__init__.py at line 75.(above def poll at same indent)
def buzz(self):
    ba = (c_ubyte * 9)(*[0xFF,0x00,0x40,0x00,0x4C,0x10,0x00,0x01,0x01])
    result = nfc.nfc_initiator_transceive_bytes.argtypes[3]._type_()
    nfc.nfc_initiator_transceive_bytes(self.pdevice, ctypes.byref(ba), len(ba), ctypre.byref(result),2,1000)

Call nfc.buzz() from your script.
I do not have a device to test the code.  Also note that you cannot poll and buzz at the same time.
Answer: For nfcpy i found out that if the on-connect function returns True the buzzer and the light will go off if the reader is capable.
#!/usr/bin/python
import nfc
import time
import datetime

def on_connect(tag):
    print('Last read: {}'.format(datetime.datetime.now()))
    return True

while True:
    with nfc.ContactlessFrontend('usb') as clf:
        clf.connect(rdwr={'on-connect': on_connect, 'beep-on-connect': True})
    time.sleep(1)

Control the sound of an NFC reader


What steps would I need to take to get involved in working as a photographer for endangered or rare animal species?

Question: My dream job would be to stake out and find endangered or rare species in the wild and capture them with photos.  Does anyone have any specific steps to making that happen?
Answer: There are very few people out there with that job; it's an extremely tough discipline to break into. That said, here's what I'd work on to start down that path:
1) you need to be a good photographer. More than that, a good nature photographer, with a portfolio that stands out. So, go out and shoot. Shoot at zoos, shoot in refuges, shoot wherever you can get out work with animals in their environments (heck, shoot ducks at the local park to learn how to shoot things that are moving and not cooperating and may not want you to be near them). Shoot a lot, build an online portfolio of your best.
2) Study nature and the animals in it. You'll need a background to understand the species you're shooting and the world they live in. Very often the big difference between photographers with average shots in the field and the great ones is that the great photographers have done all the study and know what to expect and how to plan their way to improving the odds for that shot. The better background you have in this, the better you'll understand the subjects.
3) Volunteer. Find local nature organizations you like and start volunteering. The local humane society. The local wildlife rescue groups. Look around for organizations you can be helpful to. You amy well start out cleaning cages or feeding recovering animals, not being their photographer -- but get involved in the organization, and when you go, carry your camera. You won't get the photography jobs to start because lots of people want to be the group photographer -- but find ways to contribute and get involved, and you'll find opportunities to take photos along the way. Give those photos back to the group, and over time, they'll start asking you to do that. This kind of work can open doors that won't open any other way.
4) Make sure you're comfortable roughing it outdoors. Camp. Hike. Learn to backpack and hike out there. One thing people tend to forget is that if you're going out after rare and wild species, there are rarely hotels nearby, so you need to know how to handle yourself in rough terrain in bad conditions, and how to hike yourself in and out of the locations where those species are. And don't forget, the photographer who took that shot you drool over in National Geographic was probably out in the field tracking it for a month, not a weekend. It's not an easy life, just a rewarding one.
Those to me are the cornerstones of a foundation of a career that can lead in the direction you want to go. Not easy, not overnight, and maybe not ever. But if that's what you want to do, it'll be the kind of things to do to get you going down that path.
Answer: Like many "dream jobs", the one you describe requires a combination of multiple skill sets. You would need to master each of those skill sets before combining them in a way that makes what you have to offer unique enough to motivate someone to pay you to do it.
Here are just a few of the areas in which you would need to become exceptional:

Basic Photography  Learn how to properly expose, compose, and develop/edit photos that are appealing and evoke a response in the viewer. This includes learning the general principles of photography, learning how to select the proper equipment for a specific task, and how to bring about what you visualize to a realization in the form of an image.

Advanced Action Photography Building on what you have already learned, specialize in the photography of unpredictable, moving subjects. Shooting many human sports events provides an opportunity to learn and improve a lot of the same skills needed when photographing wildlife. You must learn how to anticipate and be ready for an action before it happens so that you and your camera are ready to capture that decisive moment when it occurs. This would include becoming so thoroughly familiar with your equipment that using it to execute a photo is an extension of your thought process about the shot you want without needing to consciously consider the sequence of actions performed by you in order to capture it.

Basic Outdoorsmanship Become adept at outdoor activities such as hiking, camping, fishing, hunting, etc. to the point that you are comfortable in the world away from human development and habitation. This would include a basic understanding of how to function for short periods without the support of modern "city comforts".

Advanced Outdoorsmanship Building on the basic skill set, learn how to survive and work in the wild for extended periods of time, either alone or in a small group of individuals. This would also include the skills necessary to hunt game. Even if you do not wish to actually take game animals you will need to learn how to track and stalk them. By far the greatest resources available for learning this skill set are experienced expert hunters.

Science  Become well versed in the worlds of biology/zoology, geography, and cartography. Learn how to distinguish various similar species from each other. Learn the habits and characteristics of the species you wish to document. Learn what natural habitats they prefer and need to survive. And learn how to find such habitats and place yourself in them.

Resume/Portfolio Building/Marketing  Learn how to recognize the best of your work and how to get it in front of as many of the right eyes as possible. You can be the greatest wildlife photographer in the world but if no one sees your work it won't matter. The bulk of your portfolio would need to be of wildlife that demonstrates you can get the shot of even the most difficult quarry both in terms of finding the rarest of animals and getting good photographic results when you find them. In the current landscape of the business of photography, this probably means doing some unpaid volunteer work in exchange for gaining access to resources and areas that might not otherwise be available to you.


determine if point lies in a plane bounded by 4 lines

Question: In a 3D cartesian domain I have four points $A=(x_1,y_1,z_1)$, $B=(x_2,y_2,z_2)$, $C=(x_3,y_3,z_3)$, $D=(x_4,y_4,z_4)$, and they form a plane $ABCD$. I want to find out, if an arbitrary point $P(x,y,z)$ lies within the plane $ABCD$.
Comment: There are many ways to do this. Do you only want to do this for one point or will you be testing many points against a fixed quadrilateral?
Comment: What will be the equation of a plane when four points are given?can you find it?If a given point lies in the plane then what will happen if you plug its co-ordinates in the equation of the plane?.....It should satisfy the equation of the plane.....
Answer: Let's say you have a convex, non-self-intersecting quadrilateral defined by its vertices $\vec{q}_i = ( x_i , y_i , z_i )$, $i = 1, 2, 3, 4$.
The first three vertices $\vec{q}_1$, $\vec{q}_2$, and $\vec{q}_3$ are on a plane with normal $\vec{q}$,
$$\vec{n} = \left( \vec{q}_2 - \vec{q}_1 \right) \times \left( \vec{q}_3 - \vec{q}_1 \right) \tag{1}\label{NA1}$$
at signed distance $d$ from origin (in units of $\lVert\vec{n}\rVert$),
$$d = \vec{n} \cdot \vec{q}_1 = \vec{n} \cdot \vec{q}_2 = \vec{n} \cdot \vec{q}_3 \tag{2}\label{NA2}$$
If the fourth vertex $\vec{q}_4$ is coplanar with the first three points, then $\vec{n} \cdot \vec{q}_4 = d$ too. For this question to make sense, let's assume so.
If we have an arbitrary point $\vec{p} = (x , y , z)$, it lies in the plane if and only if
$$\vec{n} \cdot \vec{p} = d \tag{3}\label{NA3}$$
This is the test you need to do for each arbitrary point $\vec{p}$. If it fails, the answer is "No, point $\vec{p}$ is not on the plane", and no further testing is done.
Let's say $\vec{p}$ does lie on the plane, but we want to find out whether it is inside the quadrilateral. There are many ways to do this.
We'll obviously want to do that in 2D. To do so, we could project the points to the plane, but here's the trick: we can just drop one of the three coordinates, the one with the largest magnitude in $\vec{n}$. (This way, we actually project to $yz$, $xz$, or $xy$ plane, whichever is most perpendicular to $\vec{n}$.)
(Mathematically, we can do that by multiplying the vectors by matrices $\left[\begin{matrix} 0 & 1 & 0 \\ 0 & 0 & 1 \end{matrix}\right]$,  $\left[\begin{matrix} 1 & 0 & 0 \\ 0 & 0 & 1 \end{matrix}\right]$, or $\left[\begin{matrix} 1 & 0 & 0 \\ 0 & 1 & 0 \end{matrix}\right]$, depending on which component of $\vec{n}$ is the largest in magnitude. In practice, we just drop the $x$, $y$, or $z$ coordinates, respectively, from all 3D vectors to transform them to 2D.)
Let's say the projected 2D coordinates are $\overline{q}_1 = ( u_1 , v_1 )$, $\overline{q}_2 = ( u_2 , v_2 )$, $\overline{q}_3 = ( u_3 , v_3 )$, $\overline{q}_4 = ( u_4 , v_4 )$, and $\overline{p} = ( u_0 , v_0 )$. If $\overline{p}$ is within the quadrilateral, it is on the same side of all four edges.
In 2D, if we have a line through $\overline{q}_1$ and $\overline{q}_2$, we can use the 2D analog of vector cross product ($(x_A , y_A)\times(x_B , y_B) = x_A y_B - y_A x_B$) to find the side $\overline{p}$ is on, based on the sign of
$$(\overline{q}_2 - \overline{q}_1)\times(\overline{p} - \overline{q}_1) \tag{4}\label{NA4}$$
Note that if $\overline{p}$ is on the line, the above is zero.
Essentially, we only need to calculate
$$\left\lbrace \; \begin{aligned}
s_1 &= (\overline{q}_2 - \overline{q}_1)\times(\overline{p} - \overline{q}_1)
     = (v_1 - v_2) u_0 + (u_2 - u_1) v_0 + v_2 u_1 - u_2 v_1 \\
s_2 &= (\overline{q}_3 - \overline{q}_2)\times(\overline{p} - \overline{q}_2)
     = (v_2 - v_3) u_0 + (u_3 - u_2) v_0 + v_3 u_2 - u_3 v_2 \\
s_3 &= (\overline{q}_4 - \overline{q}_3)\times(\overline{p} - \overline{q}_3)
     = (v_3 - v_4) u_0 + (u_4 - u_3) v_0 + v_4 u_3 - u_4 v_3 \\
s_4 &= (\overline{q}_1 - \overline{q}_4)\times(\overline{p} - \overline{q}_4)
     = (v_4 - v_1) u_0 + (u_1 - u_4) v_0 + v_1 u_4 - u_1 v_4 \\
\end{aligned}\right. \tag{5}\label{NA5}$$
Then, if ($s_1 \le 0$, $s_2 \le 0$, $s_3 \le 0$, and $s_4 \le 0$) or ($s_1 \ge 0$, $s_2 \ge 0$, $s_3 \ge 0$, and $s_4 \ge 0$), point $\vec{p}$ is inside the quadrilateral on the plane; otherwise it is outside it.
In a computer program, you can precalculate and store the 12 quadrilateral constants ($(v_1 - v_2)$, $(v_2 - v_3)$, $(v_3 - v_4)$, $(v_4 - v_1)$, $(u_2 - u_1)$, $(u_3 - u_2)$, $(u_4 - u_3)$, $(u_1 - u_4)$, $(v_2 u_1 - u_2 v_1)$, $(v_3 u_2 - u_3 v_2)$, $(v_4 u_3 - u_4 v_3)$, and $(v_1 u_4 - u_1 v_4)$), so that you need at most 11 multiplications and 10 additions for each test with that quadrilateral (not including the 8 multiplications and 12 subtractions in the one-time precalculation). In practice, the conditional jumps (if clauses) needed tend to take more time than the calculation. In some languages like C you can rewrite the sets of four tests as counts (of how many values are less than zero, and how many greater than zero), so that only three conditional jumps get generated.
If the quadrilateral is not convex, you can use any point in polygon test for the projected point $\overline{p}$ in projected polygon $\overline{q}_i$ test.


How does False Discovery Rate relate to linear models and regression?

Question: My understanding of the FDR is that it is synonymous with the Type 1 error or rejecting the null when the null is true. However, I am not certain how this relates to linear models. I read that false discoveries occur in high dimensional logistic regression models. What exactly is the false discovery? Is it a positive estimated $\beta$ coefficient when it should be zero for the MLE of the coefficient's?
Answer: A false discovery is a type 1 error - Basically when your coefficient is statistically significant, even though there is no relationship between the two things in question. False discovery rate is a way of adjusting your p-values in a multiple-testing scenario. The FDR described by Benjamini, Hochberg and Yekutieli (2001) basically controls the proportion of your discoveries (rejected null-hypothesis) that are false, that is, (type 1 errors) / (type 1 errors + correctly rejected hypothesis)
To understand this better, you have to first understand the problem with multiple testing: When you try to (statistically) find something for long enough, you will find it with certainty. That's just the nature of randomness, eventually you will find a null-hypothesis that can be rejected at any chosen confidence level.
The same applies to linear regression, when you have 1'000'000 variables in your model, on a 5% confidence level, you would expect 50'000 variables to have a statistically significant coefficient, even if all are false. Multiple testing adjustments, such as the (conservative) Bonferroni correction, or the FDR, can be used to deal with this problem (in various ways).
So basically, what false discovery rate does, is it allows you to control the fraction of "discoveries" (non-zero coefficients) that are wrong. When you make many discoveries, you will make more errors, using FDR, when you make less discoveries, you will make less errors.
Comment: A question I have is how FDR is even computed. Don't we need to know what the false discoveries are before calculating the FDR? In that case why not just not include them? Or is FDR a more theoretical notion? In other words, it seems that if we already know which are false discoveries, why both including them?


WebSphere - Jython command to view an Application's memory usage

Question: Using IBM WebSphere Application Server version 184.108.40.206, is there a way to view the memory usage of a running application on the server? Something with Jython or Jacl? I can view the memory usage of a Application Server, but not the individual applications themselves.
Answer: All applications share the JVM heap. There is no clear delineation of which application is using which.
You could force a heap dump and use some of the IBM diagnostic tooling to look at the output and try to manually determine which objects belong to which application, but even that will be confused by shared objects.


Image sharpness metric

Question: Is there some robust metric of image sharpness or bluriness? I have various set of images with
different parameters of saturation and captured from different optical systems, and i heed to show user something like "quality" of focusing. For getting most focused image i use metric getted with Sobel-Tenengrad operator(summ of high-contrast pixels), but the problem is that for different objects are quite different range of metric(depends on unknown parameters of image intensity, optical system ) - needed some metric where possible to say that image has bad focus whithout comparing with reference image, like this is "bad" or "good" focused image.
Comment: @Zeta - Since when is computer graphics off-topic for SO? The [help page](http://stackoverflow.com/help/on-topic) specifically says that questions about software algorithms are on-topic. I don't believe OP is asking for a theoretical answer, but rather for an algorithm to compute a metric.
Comment: This question appears to be off-topic because it is about a mathematical/numerical analysis/computer graphics topic. Don't get me wrong, it's interesting, but the underlying problem is actually really hard and still being researched.
Comment: possible duplicate of [Calculating image acutance](http://stackoverflow.com/questions/6123443/calculating-image-acutance)
Answer: You can calculate the accutance of the image by calculating the mean of the Gradient Filter.
Reference this StackOverflow answer to a similar question.
Comment: I have to implement this same way before asking, and this is looks like algorithm "mean of Gaussian filteter":
* Calculate gradient Sobel x,y derivative
* Get the magnitude image
* Get the average(mean) value of magnitude.

Result seems to be acceptable, but it vary his value range from image to image.
Answer: Autofocus is an interesting problem on its own, and so evaluating sharpness across arbitrary images is another level of complexity.
On sharpness evaluation, I suggest this paper from Cornell.  Their conclusion was that the variance metric provided the best evaluation of a given image.  And it doesn't hurt that it's really easy to calculate!
For creating a consistent metric across different images, you'll need a way to normalize.  The metric might be in units of variance per pixel. You could take advantage of the fact that lack of focus provides an upper bound on variance, and so look for clustering at a maximal rate of local variance.
Answer: You need a no-reference sharpness metric, such as:

Cumulative probability of blur detection (CPBD) https://ivulab.asu.edu/software/quality/cpbd
S3 http://vision.eng.shizuoka.ac.jp/pubs/pdfs/S3_preprint.pdf
Just noticeable blur (JNB) https://ivulab.asu.edu/software/quality/jnbm
LPC-SI https://ece.uwaterloo.ca/~z70wang/publications/TIP_LPCSharpness.pdf
Answer: Here's a short paper describing a method for detecting blurredness using a Haar Wavelet Transform
The other answers to this PAQ may also be helpful.

Image sharpness metric