Is this lock secure if the screws are on the outside of the door?

Question: Our landlord recently replaced the handle and deadbolt on our front door, and I realised last night the screws affixing it are visible from the outside:

You can see the tip of the screw on the inside of the door here:

I've flagged it to the agency managing our flat, but there's no way this is secure, right?
Comment: Define "secure". I do not think removing the outside cover/handle will defeat the lock. Ordinary residence locks do not prevent entry by those willing to demolish the lock/door.
Comment: Which picture is the inside? You'd think 'white', as 'white' has the edge of the latch plate visible, but 'red' appears to have the latch bolt backwards, preventing the door from closing, not opening. *and* btw, unless that is an anti-snap euro lock, they take about 10 seconds to break into. Quicker than undoing the screws. See https://www.locksmiths.co.uk/faq/lock-snapping/
Comment: Anyway - the whole lot needs re-doing properly. That wouldn't keep a burglar out for 30 seconds. The lock sticks out, making it even easier to break, the exterior handle is actually an interior one. It's a complete mess & wouldn't pass any building inspection, anywhere.
Comment: White is the inside, @Tetsujin. And thanks, hadn't heard of lock snapping before!
Comment: aendra - is it a trick of the light, or is that latch mounted backwards? btw, anti-snap aren't much more expensive than regular, $£€ 35 vs $£€ 15 or so. Not prohibitive. In the UK they carry a 'kite mark' to prove they're up to standard.
Comment: @Tetsujin It might be...? The door swings inward to the flat, which might be why it's like that
Answer: If (as seems likely) the screws are just holding the trim plate, it might not be especially insecure. Typically the inner handle can be removed and the outer handle is fixed to the shaft, so if the inner handle is in place the plate is held in place by the outer handle, even if the screws are removed.
The missing screw on the inside is sloppy work.
Comment: This is really reassuring, thank you. I  noticed it last night and none of our neighbours have exposed screws on their front doors, with some even having bars on their doors to that hallway (indeed, our door is fitted for one but I think those have been disallowed after Grenfell), so I was naturally a bit concerned.
Answer: There seem to be 3 different types of screws on the outside (red side) of the door:

Round headed Phillips/slotted on the top right
Flat headed Pozidriv on the top left
Flat headed tan Phillips (deck screws?) on the bottom

I'd say this was installed with a special installation kit called "whatever is handy", and not the hardware that it's supposed to have.
You also appear to be missing a screw on the inside.
I highly doubt this will be particularly secure to any but the most honest of your neighbors.
Comment: Screw driver or crow bar, does it really matter?  This isn't a high security steel door.  People worry about this kind of thing then have ground level windows.
Comment: @FreshCodemonger Like, most of my neighbours have or have had bars on their doors leading from this hallway. Just because the door is poorly maintained doesn't mean there isn't a possible security issue — indeed, this flat is poorly maintained in general.
Comment: It won't hurt for the lock to appear more secure.  The larger issue is perception, if you are worried about break and enter then a potential thief might look at this door and decide out of all the flats on that level, the one is the least likely to have additional security and choose it as a target.  If the area is prone to break and enter then I'd have an additional security mechanism in place.  Maybe put up a sticker that says video surveillance in place inside unit with cloud storage.  If worried about security while home then installing an interior bar type is a good idea.
Comment: To the truly pessimistic, @FreshCodemonger, locks only serve to keep honest people honest and slow down the dishonest.
Comment: There are thieves that just go for the easiest targets.  I've had my car "broken" into a few times but all times I or my better half left the doors unlocked.  There are sometimes teams of people that apparently drive down streets with one person hanging out window trying car door handles while the other person drives to find easy targets.
Answer: Bad news:
It is a low security lock. The cover is an "low security, door inside appartment"-model.
The cylinder (green marking) is protruding, therefor easy to remove. I won't go into details, but the means and guides to achieve this are openly available. I (legally) broke several of these locks and it took me just some minutes.
Better models protect the cylinder and don't have visible screws on the outside. Like this:.
Possible good news:
The lower lock(?), marked in blue, seems to be more secure. It seems the upper lock is only to keep the door shut, and the lower lock provides the security.
Answer: That looks like a mortice lock, the actual locking mechanism is embedded in the door and the euro cylinder lock is what provides the keyed protection.
Removing the handle is possible with just a small set screw, hopefully on the inside, but removing that should not affect the security of the locking mechanism.
To remove that euro cylinder lock you will need the key (to align the tab that actuates the deadbolt) and the side of the door (only possible when the door is open) to unscrew a bolt that goes from just under the deadbolt through the bottom of the euro cylinder.
To remove the mortice lock you should also need access to the side of the door to unscrew it from the door itself after which it can be removed from the mortice it resides in. This is only possible when the door is open.


Elder Scroll Online System Error

Question: I cannot start the game.
eso.exe - System Error.
"The program can't start because D3DCOMPILER_43.dll is missing from your computer. Try reinstalling the program to fix this problem."
On Windows 7 64 bit. I tried to (re)install DirectX (dxwebsetup.exe from http://download.microsoft.com/download/1/7/1/1718CCC4-6315-4D8E-9543-8E28A4E18C4C/dxwebsetup.exe), still the error message remains.
Any Idea?
Answer: Okay, the DirectX setup did not finished. I re-run it, and Elder Scrolls Online Started.

Elder Scroll Online System Error


Attaching a deck ledger to the concrete pad of a detached garage

Question: I am building a deck between my house and the garage. I will support the deck on one side with a ledger on the house and plan to support the other side with a ledger on the garage (with requisite beams in between).
My question is whether or not it is recommended to attach a ledger to the concrete pad that the detached garage is built on. The pad appears to be approx 5" thick (at least on the edges) and either a 2" x 8" or 2" x 6" ledger would hang below the bottom edge of the concrete pad (assuming I would like at least 2 inches above the ledger for decking and gap).
Does anyone have any recommendations for this? Thanks.
Comment: Trying to envision this but am missing something, there is no stemwall, turned down slab, thickened edge, or any other type of additional support for the slab?  Is the entire edge of the slab exposed?  Will the deck be buried in the ground?
Comment: I'm not well versed with how concrete slabs are poured for detached garages. There may very well be additional support. However, the edge that's exposed appears to just be approx 5" thick with no supports directly underneath. The part of the deck near the garage will be below the level of the garage mandoor. I'm moving earth around and will backfill with gravel. The other level of the deck will be approx 16" above grade.
Answer: Attaching ledger boards to a steel reinforced reasonably thick (12" or more) concrete pad is standard practice in deck construction. Use 4 1/2" concrete anchors 18" apart in a zig zag pattern - per engineered drawings for my high end deck projects
Comment: Hello, and welcome to Home Improvement. Thanks for the answer; keep 'em coming. And, you should probably [take our tour](//diy.stackexchange.com/tour) so you'll know the details of contributing here.
Comment: Hey Jake, thanks for the response! I've since built the deck and decided against attaching to the garage concrete pad at the time soon after I asked this question. I just built up to it, leaving about 1/8" gap from the pad with my decking. The overall deck is actually 2 parts, an upper and lower deck. The upper is attached to the house, and the lower deck is just floating on supports. It's held up well so far! Thanks for this, though, I'll keep it in mind in case there's another deck in my future.
Answer: You want to attach the ledger to the edge of a concrete pad?  Sounds like a terrible idea to me.
It's possible that an engineer could have designed a way to carry the load through the pad and into the ground, but that would have to have been done before pouring the pad. Attaching the ledger to an existing pad, will almost certainly crack, split, or otherwise damage the pad. Which will lead to the ledger losing any structural integrity that it had.
A better idea would to support the deck with posts, so that side of the deck "floats" up near the pad.  You'll want to avoid direct contact between the deck and the pad, so you'll leave a small gap between them.
Comment: thanks for the prompt answer. Looks like I'll be adding an additional beam close to the garage, then.
Comment: Agree with @Tester101.  Self support the deck as if the garage was not there.  The bigger problem is tying the deck to the garage as it will want to move over time (a long time if done properly).  Maybe you can drill the concrete in the middle and pin the ledger to the slab into the holes with long small diameter anchors (redhead or equivalent, NOT a blue tapcon) with a stack of galvanized washers between the ledger and the slab to keep a gap between the ledger and the slab.  If you stay in the middle of the slab, you should be OK.
Comment: @Damon The deck will have downward forces on it, which means any fastener that goes into the concrete will have upward forces at the tip in the concrete (think seesaw). Concrete is not meant to handle these types of forces, and will be damaged over time.  I'm no engineer, but I can't think of a safe way to attach to an existing pad.
Comment: Just curious, how would the forces differ for a ledger installed on a concrete foundation for a house? In that case, assume that the house has a basement. From my research, attaching a ledger to a concrete house foundation is commonly done.
Comment: @fideli The forces are not different, but a foundation is much different than a concrete pad.


How to refer to Global name space in JS

Question: What is the variable for JS global namespace does it have a reference and can I change it?
(disclaimer yes I know that is terrible practice if I can)
Comment: I have no idea what you're talking about.  However, in the browser, the global space is `window`. `window` and anything defined under it are directly available from any other scope in your code.
Answer: In the browser, it's accessible via window.
alert(window.document === document);    // true

I just tried to change it using assignment in Google Chrome, but surprisingly it had no effect.
Answer: The global namespace/object for Javascript in a browser is window. As far as I know, you can change it, but don't.
EDIT: I was mistaken. Thankfully, you can't change it (e.g. window = {}; has no effect, at least not in Chrome).
Answer: In JavaScript that isn't running in ECMAScript 3.1 strict mode, you can refer to the global object using the keyword this, but only when not executing code inside a function that has an object context.
// In global scope:
alert(this.Math === Math);  //-> true

function test() {
    alert(this.Math === Math);
}

test();     //-> true

var someObj = {};
test.call(someObj); //-> false, `this` is `someObj`

In browsers, as other answers have mentioned, the window object is also the global object.
alert(this === window); //-> true
alert(this.alert === window.alert); //-> true

Answer: The global namespace has these names:
window // most often seen
top // in some cases
self
parent // in some cases
this // in some cases

How to refer to Global name space in JS


google remarketing - Google Remarketing on custom tags list

Question: I have few web pages, which correspond to certain keywords which the user will enter on the search band of my website.
I want to put google remarketing code on some specific pages based on these keywords. I have list of 1350 combinations. How should I proceed with adding google remarketing code on these web pages?
Comment: Solved this problem. Actually this eluded and i didn't keep track of it. This was solved way before. Thanks anyway.
Answer: You should add a Global Site-wide Google Remarketing tag to your whole site:
Instructions here
http://support.google.com/adwords/bin/answer.py?hl=en&answer=2476688
"Adding your remarketing tag to your entire website"
and then
Create a remarketing list per keyword by having the keyword show in the URL.
instructions: http://support.google.com/adwords/bin/answer.py?hl=en&answer=2454064
Since you have many keywords I suggest checking which ones have the most traffic and start working with the top 10 and see if it brings the results you are looking for.
I do not know of a way to do create 1350 lists in bulk.


How to use setText() to edit text in custom layout dialog

Question: I have a TextView in a custom layout for dialog.
Its text has to be changed when the dialog is about to appear.
      <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/final_score"
        />

java code I used to set text and show dialog is
AlertDialog.Builder builder = new AlertDialog.Builder(this);
    LayoutInflater inflater = this.getLayoutInflater();
    builder.setView(inflater.inflate(R.layout.its_over, null));
    AlertDialog dialog = builder.create();
    dialog.show();
    TextView t = (TextView)findViewById(R.id.final_score);
    t.setText(""+score);

i have also tried this code.
 AlertDialog.Builder builder = new AlertDialog.Builder(this);
    LayoutInflater inflater = this.getLayoutInflater();
    builder.setView(inflater.inflate(R.layout.its_over, null));
    AlertDialog dialog = builder.create();
    TextView t = (TextView)dialog.findViewById(R.id.final_score);
    t.setText(""+score);
    dialog.show();

but the app would crash when these method is called.
but if we remove
TextView t = (TextView)dialog.findViewById(R.id.final_score);
    t.setText(""+score);

it does not crash.
Comment: What does your crash say? What does Logcat output? Knowing why it crashes is important. Then we can help further. It looks to me, it may be a null reference, is `TextView t = (TextView)dialog.findViewById(R.id.final_score);
` returning null or not?
Answer: Try to access the TextView by it's parent referance
View view = inflater.inflate(R.layout.its_over, null);
builder.setView(view);
TextView t = (TextView) view.findViewById(R.id.final_score);


Upgraded to AppCompat v22.1.0 and now getting "removing attribute" error

Question: I've just upgraded my app to use AppCompat v22.1.0 and I'm getting the following exception from the AppCompat layout XML file:
removing attribute http://schemas.android.com/apk/res/android:layout_marginEnd
    from <ImageView>
removing attribute http://schemas.android.com/apk/res/android:textAlignment
    from <android.support.v7.internal.widget.DialogTitle>
removing attribute http://schemas.android.com/apk/res/android:layoutDirection
    from <LinearLayout>

I upgraded to version v1.8 of the JDK and does not work either.
Comment: Can you post the problematic XML part of the layout please?
Comment: updated with screenshoot, the error is in the AppCompat.
Comment: Follow this issue: https://code.google.com/p/android/issues/detail?id=164673
Comment: I can not wait, this will have to be corrected immediately, I have to compile and I can not.
Answer: See discussion on https://code.google.com/p/android/issues/detail?id=164673
You have a couple of options:

Set Preferences > Android > Build > Build output to Normal or Silent. Verbose is causing the problem.
Force SDK Build Tools 21.1.2 for AppCompat project only in project.properties, see https://github.com/dandar3/android-support-v7-appcompat/blob/master/project.properties

You can have as many SDK Build Tools installed, you can specify a version per project or otherwise it will pick up the latest.
Answer: Solved by now uninstalling the "SDK v22.0.1 Build Tools" and install a previous version.
Comment: you should be using latest `Android API 22` for compiling and latest `build tools v 22.0.1` for building the app. Another important thing is that whole `Android World` is migrating to `Android studio`, so you also should stop using eclipse and start using `Android Studio`


sql error on creating a trigger

Question: I typed this code into mysql and it gave an error:

CREATE TRIGGER delete_vote_topic BEFORE DELETE ON vote_topic
  FOR EACH ROW BEGIN
    DELETE FROM vote_option WHERE vote_topic_id = OLD.id;
    DELETE FROM vote_option_votes WHERE vote_topic_id = OLD.id;
  END;

the error was:

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 3

Anybody knows what I'm doing wrong?
Answer: Try using a delimiter
delimiter |

CREATE TRIGGER delete_vote_topic BEFORE DELETE ON vote_topic
FOR EACH ROW
BEGIN
     DELETE FROM vote_option
     WHERE vote_topic_id = OLD.id;
     DELETE FROM vote_option_votes
     WHERE vote_topic_id = OLD.id;
END;

|

sql error on creating a trigger


Why won't my oven heat up?

Question: I've replaced two faulty parts in my oven after a small explosion stopped it heating up, but I still have a problem.

I replaced the fan element at the back.
I replaced the thermal cut-out attached to the upper element.

Both were obviously dead. The element had a huge hole in it and the cut-out had no conductivity.
Here's the current situation:

The oven still won't heat up.
The grill does work (always did).
The temperature light comes ON, and never goes off.
The cooling fan runs constantly, even when the oven is OFF.
All heating elements show conductivity (26Ω-55Ω)

Worth mentioning that the thermostat seems to work, because the temperature light does turn off when using the grill to reach temperature.
Why does the cooling fan stay on and the elements stay cold?
What other parts can I check for faults?
Additional notes:

I'm confident new parts are wired correctly and securely
Mains input gives 233Ω between live/neutral when off. 111Ω when oven switched on.
New new cut-out is marked 16A, whereas the old part was 10A. Supplier assures me it's compatible with my oven.

Update:
I may have bought the wrong fan element by matching it to the product number on the part itself. I've opened a separate question about this.

Update 2:
The selector switch is fried. Copper melted between two connectors. Will fix or replace and post back if still not heating.
Comment: I have done repairs on an oven that had a failure , the short in the element took out some of the controlls on a small pc board behind the clock, mine was a convection but don't remember the model# had to order a new board , found a u tube video describing the failure and opened mine up and the board had smoked also. You may be able to find the info with brand and model, if memory serves the controll boards ranged from 60 to 120 depending on the model.
Comment: After spending £50 on spare parts I'm not keen to buy a new board to then find out something else is fried. Is there any way to test the board is faulty? It has no burn marks.
Comment: @AndrewMorton IKEA/Electrolux 94406450601 See link in update
Comment: @Tim Which one of these [Which IKEA oven are you?](http://www.ikea.com/gb/en/products/kitchen-products/appliances/ovens/) is it?
Comment: It's not a current line. The serial above is one of several that apply to old Ikea Framtid line FOV-601-562-20.

Update: I think i've identified a fault in the switch. Investigating later today.
Answer: I appreciate everyone's help with this, but I'm posting an answer myself a I'm the only person who can in this case.
The final cause of the oven not heating was a broken selector switch. See image.

With a new fan element, thermolimiter AND switch - the oven is heating up fully on all settings. Spare parts cost about £90.
I think I may have a further issue with the ventilator, but I'll post a new question about that if need be.
Comment: Sounds like a controll on an older model to me
Comment: I don't follow. The control switch is direct from Electrolux and exact match for the oven model
Comment: @Tim I think that Ed might have meant as opposed to one of those new-fangled ovens with digital bits inside and triacs switching the current.
Comment: Ah, I see. The model does have a digital panel, but the analogue switch handles all the current switching for the various combinations of elements.
Answer: As I said in the comment you need to look for the cause. I am not saying throw parts at it, but a place to look.is the controlls as I have had similar failures in the past. Google Electrolux oven won't heat, I did and repair clinic.com. causes 8 &9 are relay boards and the controll board. You already troubleshoot the fuse ( cause 6) in many cases the damage is obvious because the problem was big enough to blow the fuse. If you want to fix the oven looking at these components are the next step. Checking the relays with a meter to verify that the contacts are good would be one way , live power testing probably should be left for pros as we have the correct safety equipment, many of the relays are mechanical if you hear them click they are getting the signal but the contacts in that position may be burned open/ not conducting.
Comment: Thanks, I'll do my best to test the relays. So you don't think the problem is my buying the wrong fan element?
Comment: Don't think the fan would cause it not to heat or my oven they were not interlocked you could use the fan for convection, but have it off for fancy dishes.

Why won't my oven heat up?


Environmental protection for computer equipment in unheated garage

Question: I live in Minnesota, and I have an unheated, detached garage. I would like to place an "offsite" data backup device (possibly a NAS) in the garage, which I should be easily able to connect to the wireless network in the house (in case of fire, burgling, etc).
My biggest concern is the cold in the winter; I understand most computer equipment has a published operating range down to about 40 degrees Fahrenheit, and I expect it to be, at times, up to 60-70 degrees colder than that during the winter. I'm slightly concerned with the heat in the summer, though days where the temperature in such a garage would be too hot for a computer would be few.  I'm also somewhat concerned about the physical security of the equipment.
I'm interested in building or buying some sort of a modest-sized, climate-controlled enclosure in which I could put a computer and/or NAS, that would ideally provide:

a safe operating temperature for the equipment, but in an energy efficient way (keep the temperature just warm enough and/or just cool enough to not put undo stress on the enclosed gear)
ventilation for the equipment; I'm not completely certain, but I don't think a sealed / airtight enclosure would be good for a computer-like thing
some degree of physical security for the enclosed equipment (in case of garage break-in)
not interfere with the wireless network unduly (it does need to attach to the network to serve its function)

I've googled a bit, but I haven't found anything along these lines either for sale or as a hobbiest project. Maybe it's out there and I haven't stumbled upon the right search terms.
Can anyone offer advice / suggestions on some sort of enclosure that fits the bill?
Thanks!
Comment: In MN, the summer humidity is likely an issue as well. Have you considered off-siting it either via a service ala Carbonite, or via co-location?
Comment: True off-siting is always an option, but I'm wanting to keep backed up / sync'd hundreds of gigabytes to a few terabytes of data (a media library + whatever), and further offsite than my LAN is going to be way more expensive in terms of bandwidth and co-lo costs.
Answer: First off, as long as the temps stay in range, I don't think you'll have a problem with an 'air-tight' container. The only reason computer equipment needs airflow is because it's dumping heat into that air. As long as you have a little bit of air, and can keep it at an acceptable temp, low airflow won't be a problem. You can't go zero airflow because the equipment in question isn't built to heatsink to it's case.
Off had the first thing that occurs to me is a 'garage fridge'(something like this: http://www.amazon.com/dp/B001B2P2G8/?tag=googhydr-20&hvadid=3788940351&ref=pd_sl_6z7wf02xh3_b)
The thing includes a heater system to keep it's refrigerated section from freezing in cold temps.
That's really more than you need though, because it's going to try to keep stuff cold when you really only need it to keep stuff room temp. It's going for a much narrower temp range than you'll care about.
If I were going to try this, I'd get an old fridge (doesn't have to work), and build my own controls (some kind of micro-controller) - I'd cut some kind of vents with controllable louvers and fans into the top and side.  And some kind of heating system (really small space header? dunno). I'd add in a temp sensor, and turn the heater on when things get too cold, and the fans on (with louvers open) when things get too hot. If the temp gets out of range, cut power to the device in question.
If you want it to deal with hot days as well, then get a fridge that WORKS, and put the chillers it into the mix as well - if things get hot enough that the fans aren't doing it, cut them, close the louvers and hit the chillers.
Answer: I'm looking at doing the same thing...putting a file server in my detached garage.  If the computer is always running, there should be no problems at all.  Cold, dry air is actually the optimal environment for computers.  In my case, one potential problem is during the spring warm-up.  If I leave the door open too long, the warm (wet) springtime air gets into the shop and condenses on the colder concrete, tools, etc.  That could be a show-stopper, but I'm guessing that the warmer components in a running computer will prevent condensation.  If you're not comfortable with this, I would take the other poster's advice about using an old fridge, with a few modifications.
I would get a used dorm-style fridge (working) and build a PC inside of it.  Mount the motherboard, power supply and drives to the inside walls, away from the cold (and sometimes frosty) 'freezer' area.  Drill a hole in the side of the thing and run spare power, USB, and monitor cords to the outside and then caulk around them.  Then I would set the fridge's thermostat to the warmest setting and fire it up.  This would keep it air-tight (dry) and temperature controlled (~50°F) all year-round.  The only down side would be the cost of running the fridge and the metal shell might not be good for the wireless signal.  A WiFi USB dongle outside of the fridge would solve this.
I would think this would be much easier than the fan, louvers, heater, and micro-controller mentioned above.
UPDATE:  After a quick Google check, it turns out that doing this will cause the fridge's compressor to run much more than it was designed to, resulting in a short life.  Too Bad.
Answer: There are any number of companies selling HVAC Cabinets, such as this one - many of these are secured to high level and can be bolted to the floor.
Some even have full fire suppressant kits fitted, if you require that level of protection.
I'm not sure what your price expectations are, but I think if your data is valuable, this will be the way to do it, rather than create something which may fail.
Comment: Good to know about, and "HVAC" just entered my google search term vocabulary on this topic. But I've discussed adding an insulated "closet" (conventional, 2x4s / insulation / sheetrock, etc) and my quote on that was considerably less than the linked-to HVAC server racks.  I'm thinking about deploying a single pro-sumer NAS device or the like out there, probably not a rack's worth of server equipment.  Thanks for the suggestion though.


Villagers don't go inside the house

Question: As I am playing on peaceful mode, I have made my own house as a village. villagers consider this as a house. They enter and exit the house frequently. However at night time they tend to go inside house, but not through door, they try to go through walls and just stay at edge of wall. I think the block they are standing is considered inside by them. What should I do so that they will actually go inside the house?
minecraft PC: 1.10.2(vanilla)
Comment: You could push him in.
Comment: Break the door and make it face the other way.  It's possible you placed it incorrectly and the Villager AI thought outside was the house.
Answer: The issue here seems to be that the block directly above where the villager is blocking the sky. Therefore, the villager AI assumes it is inside, when it is not. Adjust the position of the blocks at the top so they don't cover the area where the villagers keep going.
Comment: I will do that. by the end of the week. I have tight schedule

Villagers don't go inside the house


LO 188.8.131.52 runs really slow..what to do?

Question: This is my system
Distributor ID: Ubuntu
Description:    Ubuntu 23.10
Release:    23.10
Codename:   mantic
LibreOffice LibreOffice 188.8.131.52
I upgraded to 188.8.131.52 recently (from the Ubuntu Software store...this is the latest!) and it is really really slow. Is this because it is a SNAP version? Is there anyway to improve the speed....without going back an reinstalling an earlier version which was running quite well with my set of Calc files.
Answer: There is a confirmed bug filed against the LibreOffice snap because of its speed issues:
https://bugs.launchpad.net/ubuntu/+source/libreoffice/+bug/2027904
The same speed issues don't appear to show up with the .deb package version of LibreOffice, which is currently at version 7.6.4 and can be installed using sudo apt install libreoffice (or by searching for deb packages in the App Center).
Comment: Thank you for your help!

LO 7.6.3.2 runs really slow..what to do?


What is the best way to show the user they have watched a video?

Question: I'm created a Rewards site. Users can watch videos to earn points. The problem, users want to skip the entire video to earn their points. Therefore, the mechanism for earning points is based on time viewing the video. Therefore, they could be half way through the video, then have the video timer equal 100%.
Things I've thought of:

Show the % of the video watched in the corner of the video
Have a circle and hve it show green once the video is completed
Once the timer is over, stop the video and show something similar to this:

If the timer finished during the video, the button will say: "Continue Watching." Or, if the timer finished after the video, the button will say: "Re-watch Video."
In both cases, the user can move on and earn more points because they met the needs for the time requirement.
What is the most efficient and best way to display this kind of information?
Comment: So the most users don't want to watch the videos, and the only motivation is to earn the points?
Answer: Important:
Do not stop the video unless it has completed its playing duration. Even if user completes the necessary view time to claim points. This abrupt stop is annoying if I am watching a video of say, 10 minutes, and after the 7th minute. it stop showing me claimed points. I still have 3 minutes of video left.
I would suggest to have a visual indication (for e.g. Button saying "Claim Points) when necessary view time to claim points is completed. But do not stop the Video. Let the video play. Let user explicitly stop the video.
If user clicks on visual indication then you can stop the video and navigate user to the screen you have showcased in the question above.
Also if it is not that important, I would not display progress bar; because I want user to watch the full video(like you have the option for points for completion). When user has completed the said time duration to claim point(s), visual indicator/Toast message can pop up on the video player to grab attention of the viewer.
Comment: I'm going to do this. Interesting take...


Is there a Pythonic way of handling this sort of range mapping

Question: Can this be made more Pythonic please?
if joyx > 50:
   joyx = 100
elif joyx < -50:
   joyx = -100
else:
   joyx = 0

Answer: You can write it using math.copysign and abs functions:
In [30]: from math import copysign

In [31]: joyx = copysign(100, joyx) if abs(joyx) > 50 else 0

Example:
In [32]: joyx = lambda x: copysign(100, x) if abs(x) > 50 else 0

In [33]: joyx(51), joyx(-51), joyx(50), joyx(-50), joyx(0)
Out[33]: (100.0, -100.0, 0, 0, 0)

Comment: Nice :)  I already have math loaded (its a 2000 line prog!)  Didn't know about copysign - that'll be very useful :)
Comment: I think this is a more elegant way of doing it but the original is clear enough.
Answer: In my opinion, what you have is perfectly Pythonic.
Because you are using less-than and greater-than comparisons, we can't really improve this by using a dictionary or any other trick I can think of.
I guess you could factor this out into a function and just call the function:
def clean_up_joystick(x, y, xbound, ybound, on_value):
    if x > xbound:
        x = on_value
    elif x < -xbound:
        x = -on_value
    else:
        x = 0
    if y > ybound:
        y = on_value
    elif y < -ybound:
        y = -on_value
    else:
        y = 0
    return (x, y)

For an actual program, I suggest you should make a class that manages the joystick, and init the class with the bounds values you want to use with any particular joystick.
Maybe something like this:
class Joystick(object):
    def __init__(self,
            x_low=-50, x_high=50,
            y_low=-50, y_high=50,
            on_value=100):
        self.x_low = x_low
        self.x_high = x_high
        self.y_low = y_low
        self.y_high = y_high
        self.on_value = on_value

    def read(self):
        # do something here that reads the joystick value
        # joystick value saved in x, y variables
        x, y = 0,0  # dummy init for example

        if x > self.x_high:
            x = self.on_value
        elif x < -self.x_low:
            x = -self.on_value
        else:
            x = 0
        if y > self.x_high:
            y = self.on_value
        elif y < self.x_low:
            y = -self.on_value
        else:
            y = 0
        return (x, y)

j = Joystick()
x, y = j.read()

Then in your actual program, you just use j.read() to read the joystick and clean up the input data.  If you need to change how it works, you have one place (the class).  Just make sure to have a different class instance for each actual joystick so you can clean up different joysticks if you have different ones.
Comment: :)  I think you know what I meant :) e.g. use an Python feature to make it shorter/sophisitcated.  As you say - the old way I learnt in BBC Basic is still not a bad way of doings things :)
Answer: Perhaps you find this more pythonic:
def get(joyx):
   joyx_min = -200
   joyx_max = 200
   from collections import namedtuple
   wheel_section = namedtuple("wheel_section", "min, max, output_value")
   roulette_wheel = [ wheel_section(joyx_min, -50, -100),  wheel_section(-50,51,0), wheel_section(51, joyx_max,100) ]
   for section in roulette_wheel:
     if  section.min <= joyx <  section.max:
       return section.output_value
   return 255

your code is a very simplified version of the roulette wheel algorithm.
I'm not sure you should really do a full scale version of it though.
Update
A significantly shorter and prettier version that uses a lower bound algorithm:
from bisect import bisect_left

# an intentionally larger: maps also 50 and -50 for demonstrational purposes.
data = { -200 : -100, -100 : -50, -50 : 0, 50 : 50, 220 : 100 }
keys = list(data.keys())

print data[  keys[ bisect_left(keys, -79)  ]  ] # prints -100
print data[  keys[ bisect_left(keys,  15)  ]  ] # prints 0
print data[  keys[ bisect_left(keys,  67)  ]  ] # prints 50
print data[  keys[ bisect_left(keys,  250) ]  ] # prints 100

Comment: Like it but really looking for the one liner (if it existed) - ta :)
Comment: @SimpleSi This is an adaptation of the roulette wheel from genetic algorithms. Such things are mainly written in Java/C++. this is mainly usefull if you have more values than 3 (i.e. if you want to convert a float range into 10 distinct integer values). you could also perform binary search (smallest value larger than threshold) and map the found index to a set of discrete values. I could fit this into a (rather unreadable) lambda.


Difference between Haversine and Euclidean Distance

Question: I am fairly new to this geo distance. My use case is to find short distances as a person walks. So I will have 2 sets of (lat,lon)s. Now to find the distance I could use Euclidean distance easily. Looks like the distance conversion will be like this:
6371000. * Sqrt[dx^2 + dy^2]] * pi / 180 meters

So I wrote a simple code to find out the comparison:
import math
from haversine import haversine
test = [
[lat,lon,lat,lon],
...
[lat,lon,lat,lon]
]

for x in test:
  dist = math.hypot(x[2] - x[0], x[3] - x[1]) * 6371000*math.pi/180
  hv = haversine(x[0:2],x[2:4])*1000
  print('eucledian: %0.3f' %  dist, '\thaversine: %0.3f ' % hv, '\toffset: %0.3f' % (hv - dist),'m')

My Results looked like this:
eucledian: 0.127    haversine: 0.111    offset: -0.015 m
eucledian: 0.273    haversine: 0.219    offset: -0.053 m
eucledian: 1.875    haversine: 1.715    offset: -0.159 m
eucledian: 2.460    haversine: 2.387    offset: -0.073 m
eucledian: 0.961    haversine: 0.881    offset: -0.080 m
eucledian: 0.099    haversine: 0.084    offset: -0.016 m

So the question is which one is accurate and what causes the difference?
What is the most accurate distance formula to be used? The distance in my case is less than a meter.
Comment: I don't know what you're pushing into this, but you can't use `hypot` that way.  Degrees (and subparts of degrees) are different in longitude and latitude, except right at the equator, because degrees of longitude shrink as you get closer to the poles, and degrees of latitude don't.  You need to convert first to rectangular coordinates (in meters), then apply `hypot` to the difference in x, y, and z coordinates.  But are you sure you're meant to be expressing the endpoints of a distance of a few meters in longitude and latitude?!
Comment: @user923227: I read that.  But this is not valid for longitude and latitude, because those degrees are not equal in general.  It works for the Cartesian plane.
Comment: I haven't looked at your code in detail, but keep in mind that haversine gives you great-circle distance (along the surface of the Earth), whereas the Euclidean metric gives you straight-line distance (through the Earth).  That may account for the discrepancy.
Comment: But the great-circle (as the crow flies) distance will always be *greater* than the Euclidean (as the worm digs) distance.
Comment: Then in this case using the euclidean distance formula is more accurate as the distance is a straight line distance around one meter at most.
Comment: @user923227: Wha-ah?  The error should not be so large on that small a distance.  I'd be more concerned about roundoff errors.  If I get a chance, I'll take a closer look at this. What are your test lat/lons?
Comment: Hi @BrianTung, I looked at the url pasted above: "The distance conversion will be like this: https://stackoverflow.com/questions/45842996/what-is-the-unit-of-measurement-for-distance-of-esri-function-st-distance-return/52979177#52979177"
Comment: @BrianTung - What do you mean when you say - longitude latitude degrees are not equal in general?
Comment: @user923227: For instance, at a latitude of 40 degrees, each degree of longitude is about 53 statute miles, and at a latitude of 70 degrees, each degree of longitude is about 24 statute miles.  But a degree of latitude is always about 69 statute miles (there's some minor variation because the Earth is not a perfect sphere).  Why this is true should be evident if you look at a globe: The lines of longitude are maximally far apart at the equator, and converge at the poles.
Comment: @BrianTung Thanks for explaining. In my case the distance is in the order of meters. My lat. lon values have 7 decimal places. Then Haversine distance  formula should be used or is there any other formula to be considered?
Comment: https://gis.stackexchange.com/questions/58653/what-is-approximate-error-of-pythagorean-theorem-vs-haversine-formula-in-measur#:~:text=Using%20the%20Pythagorean%20formula%20on,suppose%20it%20ought%20to%20work.&text=Distances%20along%20lines%20of%20longitude%20will%20be%20reasonably%20accurate.
Answer: The haversine formula is an equation important in navigation, giving great-circle distances between two points on a sphere from their longitudes and latitudes.
Using the Pythagorean formula on positions given in latitude and longitude makes as little sense as, say, computing the area of a circle using the formula for a square: although it produces a number, there is no reason to suppose it ought to work.
Most often people answer "no, the Pythagorean theorem only works on a 2D Euclidean plane." Rarely, however, do people mention the effect of scale and location on the sphere on how inaccurate the Pythagorean theorem is.
The basic idea being at very small scales, the surface of a sphere looks very much like a plane. At very large scales, it distances along the surface are more curved and therefore the difference between the incorrect Pythagorean Theorem and the correct Haversine Formula is greater.
Comment: https://gis.stackexchange.com/questions/58653/what-is-approximate-error-of-pythagorean-theorem-vs-haversine-formula-in-measur#:~:text=Using%20the%20Pythagorean%20formula%20on,suppose%20it%20ought%20to%20work.&text=Distances%20along%20lines%20of%20longitude%20will%20be%20reasonably%20accurate.


Calling onUpgrade() in SQLiteOpenHelper

Question: I know that this has been asked a million times. However, I do not find a way to call onUpgrade() within my subclass
I have an SQLite DataBase already built in a SQLite Manager which works properly. I would like the user to create an additional table within the app. So, as far as I have read, I have to do it in onUpgrade
Here is my code:
String DB_PATH =null;

private static String DB_NAME = "CompositionFoodTable_LatinAmerica";

private SQLiteDatabase myDataBase;

private final Context myContext;

public FoodDataBaseHelper(Context context) {

    super(context, DB_NAME, null, 2); //Constructor with newer version
    //However I am not sure about this because when I run a query within the manager
    //to check the version, it throws 0
    this.myContext = context;
    DB_PATH = context.getApplicationInfo().dataDir + "/databases/";
    // I am not calling getReadableDatabase() or getWriteable(). They destroy my
    //current version

}

@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {

    //NOT BEING CALLED
    // Drop older plates table if existed
    String CREATE_PRODUCT_TABLE = null;
    try {
        db.beginTransaction();
        for (int i = oldVersion + 1; i <= newVersion; i++) {

            CREATE_PRODUCT_TABLE = "CREATE TABLE IF NOT EXISTS PRODUCTS ( " +
                    "ID INTEGER PRIMARY KEY AUTOINCREMENT, " +
                    "NAME TEXT, " +
                    "DATE TEXT, " +
                    "SERVING_SIZE_G TEXT, " +

                    "H20_PERC TEXT, " +
                    "ENERGY_KCAL TEXT, " +
                    "PROTEIN_G TEXT, " +
                    "TOTAL_FAT_G TEXT, " +

                    "CARBS_G TEXT, " +
                    "TOT_DIET_FIBER_G TEXT, " +
                    "ASH_G TEXT, " +
                    "CALCIUM_MG TEXT, " +

                    "PHOSPHORUS_MG TEXT, " +
                    "IRON_MG TEXT, " +
                    "THIAMINE_MG TEXT, " +
                    "RIBOFLAVIN_MG TEXT, " +

                    "NIACIN_MG TEXT, " +
                    "VIT_C_MG TEXT, " +
                    "VIT_A_EQUIV_RETINOL_MCG TEXT, " +
                    "MUFA_G TEXT, " +

                    "PUFA_G TEXT, " +
                    "SATURATED_FATTY_ACIDS_G TEXT, " +
                    "CHOLESTEROL_MG TEXT, " +
                    "POTASSIUM_MG TEXT, " +

                    "SODIUM_MG TEXT, " +
                    "ZINC_MG TEXT, " +
                    "MAGNESIUM_MG TEXT, " +
                    "VIT_B6_MG TEXT, " +

                    "VIT_B12_MCG TEXT, " +
                    "FOLIC_AC_MCG TEXT, " +
                    "FOLATE_EQUIV_FD_MCG TEXT, " +
                    "EDIBLE_FRACTION_PERC TEXT)";

            db.execSQL(CREATE_PRODUCT_TABLE);

            // create plates table
            db.setTransactionSuccessful();
        }
        } finally{

            db.endTransaction();
        }
            // Future schema changes has to go into this loop

}

Rest of my methods:
 /**
 * Creates a empty database on the system and rewrites it with your own database.
 * */
public void createDataBase() throws IOException{

    boolean dbExist = checkDataBase();

    if(dbExist){
        //do nothing - database already exist
    }else{

        //By calling this method and empty database will be created into the default system path
           //of your application so we are going to be able to overwrite that database with our database.
        this.getReadableDatabase();

        try {
            copyDataBase();

        } catch (IOException e) {

            throw new Error("Error copying database");

        }
    }

}

/**
 * Check if the database already exist to avoid re-copying the file each time you open the application.
 * @return true if it exists, false if it doesn't
 */
private boolean checkDataBase(){
    boolean checkdb = false;
    try{
        String myPath = myContext.getFilesDir().getAbsolutePath().replace("files", "databases")+File.separator + DB_NAME;
        File dbfile = new File(myPath);
        checkdb = dbfile.exists();
    }
    catch(SQLiteException e){
        System.out.println("Database doesn't exist");
    }

    return checkdb;
}

/**
 * Copies your database from your local assets-folder to the just created empty database in the
 * system folder, from where it can be accessed and handled.
 * This is done by transferring bytestream.
 * */
private void copyDataBase() throws IOException{

    //Open your local db as the input stream
    InputStream myInput = myContext.getAssets().open(DB_NAME);

    // Path to the just created empty db
    String outFileName = DB_PATH + DB_NAME;

    //Open the empty db as the output stream
    OutputStream myOutput = new FileOutputStream(outFileName);

    //transfer bytes from the inputfile to the outputfile
    byte[] buffer = new byte[1024];
    int length;
    while ((length = myInput.read(buffer))>0){
        myOutput.write(buffer, 0, length);
    }

    //Close the streams
    myOutput.flush();
    myOutput.close();
    myInput.close();

}

public void openDataBase() throws SQLException{

    //Open the database
    String myPath = DB_PATH + DB_NAME;
    myDataBase = SQLiteDatabase.openDatabase(myPath, null, SQLiteDatabase.OPEN_READWRITE);

}

@Override
public synchronized void close() {

        if(myDataBase != null)
            myDataBase.close();

        super.close();

}

@Override
public void onCreate(SQLiteDatabase db) {
    // SQL statement to create plate table

}

Answer:
However, I do not find a way to call onUpgrade() within my subclass

You don't call onUpgrade() yourself. SQLiteOpenHelper will call onUpgrade() if and when it is needed.

I have an SQLite DataBase already built in a SQLite Manager which works properly.

If you want to package a SQLite database with your app, please consider switching to SQLiteAssetHelper.

I would like the user to create an additional table within the app. So, as far as I have read, I have to do it in onUpgrade

No. onUpgrade() is for when the developer ships a new version of an app that requires a new database schema. It is not for tables, indexes, or anything else added on the fly based upon user input. For that, call execSQL() yourself, on SQLiteDatabase, at an appropriate point.
Comment: How can I call `execSql()` without affecting my current database?

Calling onUpgrade() in SQLiteOpenHelper


SSH'ing to server failes after setting ipv4 rules in sysctl.conf

Question: Good morning guys,
i have been trying to establish a secure connection through IPsec vpn between our server and my machine to test the VPN. i have been following this tutorial
Site So Site Ipsec VPN
but in step 2:

$ cat >> /etc/sysctl.conf << EOF
echo net.ipv4.ip_forward = 1
net.ipv4.conf.all.accept_redirects = 0
net.ipv4.conf.all.send_redirects = 0
EOF
$ sysctl -p /etc/sysctl.conf

the guy wants us to add some ip forwarding to our sysctl.conf file but when i add it and reboot my OS (XFCE) i can no more connect to my server through SSH
when i connect it says

connection to ip.ip.ip.ip port:22 timed out
Comment: I deleted your answer as requested. You might wan to contact SE to [merge your accounts](https://askubuntu.com/help/merging-accounts).
Answer: Since you have set a private tunnel ensure your vpn config for both the servers is correct.
I think the issue is either with the firewall or your vpn configuration rather than any parameters in sysctl
Answer: I think I figured it out, when you forward some IPs, you have to do it both on the server and the PC, I only did it on the PC when I asked this question.


Drupal 7 form submit handler not executing

Question: In my module, I create a form with a validate and submit handler.  The first field is a text input field, and the second is a file upload field.
My validate handler is getting called and exiting fine. My submit handler never executes.  I'm taken back to my form, with an error complaining that I need to enter a value in my upload field (as I set it to be required).
I am new to Drupal.
Answer: In Drupal 6, file upload fields cannot be required. You should set required = false or else you'll get this error. I think that it's the same in Drupal 7. You should write your own code in the validation handler to check if the file was uploaded.
Comment: Also, you can use **managed_file** element type instead of **file**, it'll help you get rid of all the upload management stuff.

here's the drupal documentation: http://api.drupal.org/api/drupal/developer--topics--forms_api_reference.html/7#managed_file
Comment: What is the advantage of the managed_file element?  For this form, I am taking an upload, calling file_save_upload(), getting back the fid, stuffing it in my form_state so I can process it in my submit handler.
Comment: The advantage is that you write less code and that the file is uploaded via AJAX
Comment: I'm not following you regarding AJAX.  Can you help me conceptualize the process?

I don't see an option to close the thread.


What are the rules for migrating content from Stack Overflow?

Question: The first question from Stack Overflow has been migrated. This makes me wonder what are the rules for migrating content from Stack Overflow to here.
I started answering Drupal questions on SO when there were only 300; the count now is about 5000. At first I was very strict trying to close questions that weren't programming related. But there weren't enough people with high enough reputation that bothered to make it happen. At the end, I gave up and just answered them instead.
There are a lot of good, medium and poor questions about Drupal on Stack Overflow that really doesn't belong there. The reason is that they aren't programming related. Like the question I linked to above, it's a good question about something that's quite hard, but in it's core it's more about making a module do a task, than how to code it.
Will it only be the diamonds from Stack Overflow that can migrate questions or can we help with the process? What is the official policy? My guess is that the SO team would like to keep the programming related questions about Drupal on SO.
Answer: I gave this a trial run in practice. I have a lot of rep there which might have helped.
The question Display the title of related nodes from taxonomy in block was asked at SO, but since it doesn't really belong there not being programming related, I tried flagging it posting that it should be moved here.
It seems it happened less than an hour after I posted. I don't think we should go through all the Drupal questions that has been asked at SO. But it might be a good idea to flag all the new questions asked at SO, that doesn't really belong there. I believe it is in the SE team's interest to keep SO on topic, which we will be helping while promoting this site.
Answer: Quite a few medium-level questions get drown on SO (where only easy Drupal questions gets answered usually) while they would fit fine here: for example https://stackoverflow.com/questions/5277408/ only got 11 views despite I even added a bounty on that guy's question to help him out (it was barely 5 views before).
Therefore I think it would be interesting for such non-beginner questions to migrate now, without waiting for the end of the beta.
Answer: Generally, folks wait until the beta becomes public to start migrating questions here.
You've got enough rep on SO that you have access to the mod tools, so if you see a Drupal question over there that you think belongs here, I'd say migrate it.
Comment: Only moderators can migrate questions to any SE sites; other users can only flag a question for moderator attention, and ask the question is migrated.
Answer: I am not sure if this can be called rule, but generally only recent questions are migrated. Questions that have been asked before a SE site existed are generally not migrated to the SE site.
I think the question should rather be: Between the recently asked question we find on SO, which ones would we like to see migrated on drupal.SE?
drupal.SE's rate of questions per day is actually lower than the minimum reported in Area 51. drupal.SE needs help to get more questions asked, and migrating questions from SO would help with that, if we choose the right questions that are migrated.
Answer:
The reason is that they aren't programming related.

These are prime candidates for migration: if they're off-topic on SO now, then moving them here gives them a chance to get answered rather than closed, and helps to promote this site as a resource to users who might be unaware of it.
That said, if you're gonna go through questions on SO and start flagging for moderator attention, it's a good idea to heed kiamlaluno's suggestion and stick to questions where the OP has been recently-active. Otherwise, you're liable to end up migrating a dead question that won't bring its author along with it.
After the beta, you can afford to be a bit more liberal with this: the definition for the site will be better defined, and there's less risk of inadvertently offending users who feel their questions are on-topic for SO.
Of course, posting a comment suggesting the author of a question on SO might find this site useful for future questions is fine, even if you can't get a moderator to migrate it.


What is this tool's name/use?

Question: My uncle left me this tool.  Looks like a tire chain tightener or something you'd hook and stretch.  Anyone know the name of this tool?
Comment: looks like a german tickler. /s
Comment: What type of work was your uncle known to undertake?
Comment: maybe a spring hook for removing and installing springs
Comment: Can we get a pic from a different angle to see what that piece nearer the handle is?
Comment: It looks like a bar that I use to lift motors so I can add shims. But this would only be if the tip was some what flat
Comment: Looks like a lever: place the curved arm through (wire loop or end of spring) then put the curved inside of the hook onto the (pin or lever) where it's supposed to. Then pull the handle until whatever #1 is pulled "over the top" and engages on whatever #2.
Comment: It looks rather like a Xtra-Large version of my dental hygienists's tools.  Maybe this is for cleaning large animals'  teeth.   [no not really]
Comment: I think I saw that used at the end of 'Braveheart'.
Answer: It's called a Snap-Up lever. It's used to secure weight distribution hardware from a vehicle to a tow-behind trailer, RV, etc. Video of it in use here: https://youtu.be/FYFYcqxlJzc?t=334

What is this tool's name/use?


How do you stop a particle effect? (SKEmitterNode)

Question: I currently have this code in a collide statement where if collide with object then this particle happens but how do I stop it? As it goes on forever whereas I only want to happen a couple of times per contactetc
SKEmitterNode *emitter =  [NSKeyedUnarchiver unarchiveObjectWithFile:[[NSBundle mainBundle]     pathForResource:@"ff" ofType:@"sks"]];
emitter.zPosition = 0;
emitter.particlePositionRange = CGVectorMake(0, self.size.height);
emitter.position = CGPointMake(self.size.width, self.size.height/2);
[self addChild:emitter];

Answer: When you use the particle-editor you can set the maximum number of particles to create. It's the field below "Particle Texture".The official description is:
"The maximum number of particles that the emitter creates over the emitter's lifetime. After this number is reached, no more particles are created by the emitter. Enter 0 to remove particle limits."
Also see: Particle Emitter Editor Guide
Of course, you should remove the emitter-node from its parent after it created the maximum number of particles. This can be done by creating an action-sequence that waits for a few seconds and removes the emitter-node from its parent [SKAction removeFromParent].
Comment: `This can be done by creating an action-sequence that waits for a few seconds and removes the emitter-node from its parent [SKAction removeFromParent].` waits a few seconds after the particle was created? Is there any trigger to run a sequence after particles have finished?
Comment: Wow so deceptively SIMPLE! thanks for that man feel a bit stupid now :)
Comment: Is:-  sparkEmmiter.particleLifetime = 0 worth full for that?
Comment: @Raksha thats not actually correct, particleLifetime is the lifetime of each particle, to set the number of particles emitted to 50 you have to set: `sparkEmitter.numParticlesToEmit = 50`
Comment: I know it's slightly off-topic, but what about making the emitter start? Do you set the birth rate to 0 and then when you want to make it start set it to what it needs to be to start emitting?
Comment: @SSHThis did you find out if there's a trigger or callback when the particles are done emitting?
Answer: Use setParticleBirthRate:0 to stop emitting particles. This is the most realistic way to turn off an emitter.
If you want it to disappear immediately then use removeFromParent.
If using setParticleBirthRate remember the original value to turn it back on later. for instance.
@implementation GameScene
{
    SKEmitterNode *rocketfire;
    float rocketfire_birthrate;
}

// ...
-(void)init {
    // ...
    rocketfire_birthrate = rocketfire.particleBirthRate;
}

// turn on the emitter (thrust rocket) when the screen is touched
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
    [rocketfire setParticleBirthRate:rocketfire_birthrate];

}

// turn off the emitter on touches ended
-(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
    [rocketfire setParticleBirthRate:0];
}

Answer: SWIFT 4:
I think I have a slightly better approach for turning it off:
1) Put the birth rate to 0:
pEmitter.particleBirthRate = 0

2) Run a delay action for the lifetime:
let waitAction = SKAction.wait(forDuration: pEmitter.particleLifetime)
pEmitter.run(waitAction, completion: {
    pEmitter.removeFromParent()
})

NOTE: Might not be 100% accurate if you have a range of partilcelifetime.
Comment: `let waitAction = SKAction.wait(forDuration: pEmitter.particleLifetime + (pEmitter.particleLifetimeRange/2.0))`
Answer: This is similar to the answer here provided by Tapir, with the exception that I don't use the selector.  I'm not sure if that is required in previous versions but in ios 10 I don't see my node counts increasing and it does work.  ie. add an emitter, pop a specified number of particles and then remove the emitter.  In this case, I've modified it to add a single particle.
-(void) gainPoints:(int)x  y:(int)y {

NSString *pPlus1Path = [[NSBundle mainBundle] pathForResource:@"PlusEmitter" ofType:@"sks"];
SKEmitterNode *pEmitter = [NSKeyedUnarchiver unarchiveObjectWithFile:pPlus1Path];

// Place the emitter at the specified position
pEmitter.position = CGPointMake(x,y);
pEmitter.name = @"plus1";
pEmitter.particleLifetime = 1;
pEmitter.particleBirthRate = 1;
pEmitter.numParticlesToEmit = 1;
// Send the particles to the scene.
pEmitter.targetNode = self.scene;

[self addChild:pEmitter];

SKAction *pRemoveNode = [SKAction removeFromParent];
SKAction *pWaitForSecsN = [SKAction waitForDuration:1];
SKAction *pSequence = [SKAction sequence:@[pWaitForSecsN,pRemoveNode]];
[pEmitter runAction:pSequence];

}
Answer: For those who want to freeze a particle emitter on a specific part of the animation, instead of removing it from screen, you can pause the emitter:
emitter.isPaused = true

Answer: when pause you need :
emitter.hidden = true

when restart you need :
emitter.hidden = false
emitter.resetSimulation()

Comment: SKEmitterNode does not support a hidden property.
Comment: @boehmatron sorry sir! are you sure about this??
SKEmitterNode inheritance from SKNode which have a hidden property.

check and test!!! please!!
Comment: hey @Tritmm zou are right - sorry for that. I was trying the hidden property again in another separate project and it worked as described,... I will correct your rating as soon as possible. Sorry for that. This was not intended.
Comment: @boehmatron haha. no problem! this is your small mistake and i get a same mistake sometime. good day to you!


Saving List as String

Question: I've been trying to save a list of data as Strings, but when I try a method .toString on List, it returns address in memory instead of data.
public class Item {

    Integer price = 20;
    Integer modelNumber = 100;
    String description = "Description";
    String title = "Title";
    Boolean wasBought = true;
}
public static void main(String[] args) {
    List<Item> data = new ArrayList<>();
    data.add(new Item());
    System.out.println(data.toString());
}

Comment: Answer, because this will get boring fast: create a method `toString(): String` in your `Item` class, otherwise it will print out a reference to the object instance. Use `String.format(formatString, fields...)` to do so.
Comment: "*trying to save a list of data as Strings*" how (and why - what are you trying to achieve)? What do you mean by ["doesn't work"](https://web.archive.org/web/20180124130721/http://importblogkit.com/2015/07/does-not-work/)?
Comment: "Boxed" classes should arguably not be used for fields, unless they can remain uninitialized. Use `int` and `boolean` instead.
Comment: See Object.toString(). All IDEs can generate a toString(). Start there please.
Answer: You need to override toString function in your Item class. Add the following snippet into your Item class:
@Override
public String toString() {
    return "Item{" +
            "price=" + price +
            ", modelNumber=" + modelNumber +
            ", description='" + description + '\'' +
            ", title='" + title + '\'' +
            ", wasBought=" + wasBought +
            '}';
}

Output:
[Item{price=20, modelNumber=100, description='Description', title='Title', wasBought=true}]

Answer: You can convert List to json format string by json utils, e.g. jackson or fastjson, in case you may need to convert it to Objects later.
Comment: Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer).
Answer: Simply use Lombok  (Add Lombok jar into classpath)  @ToString annotate for Item class, it will do the needful output  https://projectlombok.org/features/ToString

Saving List as String


What are the system requirements of Widelands?

Question: Widelands looks like an interesting game, but I can't find the system requirements anywhere on their site. What kind of CPU and graphics card do I need?
Comment: @bwarner: I don't have the machine right now. Also, since it took half an hour to install, it would be good if this information was easily googlable.
Comment: It's free.  Why not just download it and see whether it runs acceptably on your machine?
Answer: I can't speak to what the requirements are, but I remember playing it happily on my Dell 640m which is:

Intel Core Duo 1.66Ghz
1Gb RAM
Intel Onboard Graphics
Ubuntu 9.10

The laptop itself is almost 4.5 years old and was fairly low budget back then.
Answer: From the Widelands website:

Widelands will work with most any operating system, including Windows, Linux, and MacOS. All modern versions of these operating systems are supported, but Widelands will run on many outdated versions as well. It does not use any fancy frameworks.
At least 800 MB of RAM are recommended for fluent gameplay; less than 300 MB will likely not work.
Widelands requires a graphics card that can handle OpenGL version 2.1 or higher.


I cant get the inferno fork!

Question: I have pretty much every single hard mode weapon, but I have killed a bunch of diabolists, and haven't got one! Is there a way to increase the drop chance?
Answer: The Inferno Fork drops from Diabolists post-Plantera.
While the official wiki rates the drop rate as 5%, or 7.5% on Expert Mode, a different wiki rates the drop rate as 2.5%.
This means that, on average, you should have to kill anywhere from 20-40 Diabolists, although you could get unlucky and have to kill more.
While enemies are tougher in Expert Mode, drop rates increase, so that may be a suitable option to increase drop chance.
Answer: I don't think it's a problem with the game, but it's a problem with luck. I haven't gotten an Inferno Fork yet, and I killed like what, 80 something Diablos? Anyway, the best way to get them is find somewhere they spawn and put a Water Candle down and drink Battle Potions consecutively. Using a minion or two might help you battle faster. Another trick is to pinch your screen so your avatar is close up if you're a Melee player. It somehow increases the spawn radius for monsters and gives a better chance for more Diablos. That's what me and my friend did to get one. He took it before I did though.
Answer: It can take anywhere from 2-30+ kills of diabolists to get the drop. It is very rare, so they don't just drop them every time! On Mobile, I don't think there's a way to increase the chances. I would keep trying at it and keep killing the diabolists!
If you have already killed or you end up killing around 50 and still nothing, you might want to see if there is maybe a problem, but from what I can see, it's natural to have bad luck with drops!

I cant get the inferno fork!


What is the preferred way of transpiling when some npm dependencies are written in es6 and some aren't?

Question: What is the preferred way of transpiling when some npm dependencies are written in es6 and some aren't? Most examples of babel/webpack say to exclude the node-modules folder but that means none of the dependencies will be transpiled, but it does mean that some npm dependencies written in es6 will be transpiled again.
Is there a preferred solution for this?
I am aware of include/exclude but was hoping for more clarification on the subject but am currently using this:
exclude: /node_modules\/(?!(es6-dependency)\/).*/,

Answer: Indeed! The include property in the loader object to can accept an array of absolute paths in addition to an array of regexp's. This would allow you to parse the module you know are es6 and still let you exclude node_modules.

What is the preferred way of transpiling when some npm dependencies are written in es6 and some aren’t?


Google Line charts Customizing vAxes with string and define position

Question: I try to implement a Line Chart with string on xAxie and vAxie.
For vAxie I want to start to 10eme and finish with 1er value. Is it possible to switch these values?
Today :
10eme
9eme
8eme
7eme
6eme
4eme
3eme
2eme
1er
     1 journee / 2 journee / 3 journee / ...
Target :
1er
2eme
3eme
4eme
5eme
6eme
7eme
8eme
9eme
10eme
     1 journee / 2 journee / 3 journee / ...

<!DOCTYPE HTML>

Answer: it is ok I found a way to do it with direction: -1 in vaxis option.
here the result.
Thank you

<!DOCTYPE HTML>


Generalized perfect numbers

Question: Given any $k \in \mathbb{Z}$, does there exist solutions to  $\sigma(n)=kn$, where $\sigma(n)$ is the sum of divisors of $n$?
Perfect numbers correspond to $k=2$. Is there some sort characterization of these numbers?
$\text{For instance, similar to the following statement:}$
$\text{$n$ is an even perfect number iff $n=2^{p-1}(2^p-1)$, where $2^p-1$ is a prime.}$
$\text{For $k=3$, for $n \leq 100,000$, $n=120$ and $n=672$ satisfy.}$
$\text{For $k=4$, for $n \leq 100,000$, $n=30240$ and $n=32760$ satisfy.}$
Interestingly for both these case, we have $k \mid n$
(similar to the conjecture that all perfect numbers are even).
$\text{The }$asymptotic$\text{ for the sum of divisors function does not rule out $k$ has to be finite.}$
Comment: They are called [multiply perfect numbers](http://en.wikipedia.org/wiki/Multiply_perfect_number).
Comment: That's a lot of $\LaTeX$.
Comment: +1 If I remember right, it is conjectured that the answer is yes. Interesting is, that it is not known, if there are perfect odd numbers.
Comment: See OEIS [A005820](http://oeis.org/A005820), [A027687](http://oeis.org/A027687), [A166069](http://oeis.org/A166069) and links from those
Comment: @bof Thanks. This is a good piece of information.
Answer: As far as I know, existence of $k$-perfect numbers is open except for specific small $k$.
Your second conjecture, though, is false: $n=459818240$ satisfies $\sigma(n)=3n$ but $n\equiv 2\pmod 3$.
Comment: @Henry they are multiples of $4$ (Both end in $68$).
Comment: Yes, you are right. I checked this number now. Good.
Comment: @Leslie: you are correct and I clearly need some sleep.

Generalized perfect numbers


How can I make Terraria easier to play with controllers?

Question: Since I can't really into WASD due to some issues with my left hand, and I have some issues gaming with a keyboard and mouse even without that, I was hoping to find something that suited it more for a controller like with the way they did the Xbox port.
It wouldn't be for competitive/online play, so I'm not worried about that very much, I just can't actually survive very well in most cases right now.  I have to be twice as powerful as recommended usually just to function in an area without dying every few minutes.
Even if I can just set up the "directional cursor" type thing that they have on the Xbox port say for a toggle for when I'm exploring (and go back to regular for building) and a way to cycle through the hotbar items without hitting the number key I'd be set since I can set up the rest via XPadder.
Edit: To clarify for any user that has not played Terraria on console,

Front bumper buttons generally move you back and fourth through your immediate inventory.
Left trigger acts as the grappling hook
Right trigger acts as the "use" button
Inventory items can be quick-mapped to the D-pad.
The cursor has two modes:

A grid-based mode, where you use the analog to move a mouse cursor around your character, within the range of manipulation.
A direction mode, where you push the analog stick in a direction. For example, if you push in any direction and mine through dirt, the player will generally proceed to mine a passage of 3-units-width in the given direction.

Pressing the right analog stick down swaps back and forth between the two modes.
Comment: From a student game developers point of view, I couldn't see there being much difficulty in setting up the console-controller scheme. I can't comment on the ability to modify Terraria, but it is definitely possible. If somebody has done it yet is a different matter
Comment: Tried adding a description of how it works on the console. Chances are, those well versed in the computer version will be inexperienced the the console version, and not be able to relate as easily. I think direct button abilities might be redundant, as any custom controller set up should allow this.
Comment: Thankyou.  A bunch of those features aren't completely necessary for my purposes but if someone can set up tweaks or something for any/all of those it might help others as well.
Comment: It is definitely a good idea. I personally have kept to the console version for how efficient the control scheme works, for me.
Answer: As of version 1.3.1, the PC version of Terraria has official controller support. It has presets for PS4 and Xbox One controllers, as well as custom support.
Comment: Thanks for the answer in here.  I was aware of it but other people finding this question might not be and I had forgotten about this question a while ago so I didn't think to come in and update.
Comment: No problem! I came across this question a few minutes before discovering controller support myself. :)
Answer: I had this same question a few weeks ago when update 1.3 came out, and I picked Terraria up again.
I highly recommend checking out the XInput Game Support Mod. It can be a little quirky to hook up, and as of now (few weeks after 1.3 Terraria released) it has a few bugs that they're trying to patch quickly. However, it helped my hand cramps a lot, as using an xbox360 controller is a lot less physically straining for me.
The forums can explain the setup better than I can.
Link is here on the Terraria forums: http://forums.terraria.org/index.php?threads/xinput-gamepad-support-mod.1260/


I'm having a problem with navbar mobile view

Question: My navbar, although it looks responsive, has a problem with the mobile view:
Comment: Welcome to Stack Overflow _ Please add a "Minimal, Reproducible Example" of your code to this question, Please take a moment to visit the Help Center and specifically the section on 'Asking' for more details >>> stackoverflow.com/help/minimal-reproducible-example
Comment: Could you provide some code?
Answer: we might need to know how your code is looking at the moment but apparently most navs that use an unorganized list and have the same effect that yours, which is to spread text from left to right, I think should look something like this:

<button>Button</button>

home

about

contact

css
nav {
height: 80px;
width: 100%;
background-color: black;
}

ul {
display: flex;
justify-content: space-around;
align-content: center;
}

li {
margin: 12px;
padding: 8px;
color: white;
}

button {
height: 80px;
width: 100px;
color: white;
border-radius: 5px;
font-size: 1rem;
}

I mean something close to this but typically that is a standard alignment for the most part.


How can convert a dictionary file (.dic) with an affix file (.aff) to create a list of words?

Question: Im looking at a dictionary file (".dic") and its associated "aff" file.  What I'm trying to do is combine the rules in the "aff" file with the words in the "dic" file to create a global list of all words contained within the dictionary file.
The documentation behind these files is difficult to find.  Does anyone know of a resource that I can learn from?
Is there any code out there that will already do this (am I duplicating an effort that I don't need to)?
thanks!
Answer: According to Pillowcase, here it's an example of usage:
# Download dictionary
wget -O ./dic/es_ES.aff "https://raw.githubusercontent.com/sbosio/rla-es/master/source-code/hispalabras-0.1/hispalabras/es_ES.aff"
wget -O ./dic/es_ES.dic "https://raw.githubusercontent.com/sbosio/rla-es/master/source-code/hispalabras-0.1/hispalabras/es_ES.dic"

# Compile program
wget -O ./dic/unmunch.cxx "https://raw.githubusercontent.com/hunspell/hunspell/master/src/tools/unmunch.cxx"
wget -O ./dic/unmunch.h "https://raw.githubusercontent.com/hunspell/hunspell/master/src/tools/unmunch.h"
g++ -o ./dic/unmunch ./dic/unmunch.cxx

# Generate dictionary
./dic/unmunch ./dic/es_ES.dic ./dic/es_ES.aff 2> /dev/null > ./dic/es_ES.txt.bk
sort ./dic/es_ES.txt.bk > ./dic/es_ES.txt # Opcional
rm ./dic/es_ES.txt.bk # Opcional

Comment: Great! I share the generated file (it's unsorted) for those whom want a **unmunched spanish dictionary** and have not access to a linux terminal: [es_ES.txt](https://www.4shared.com/office/PL_9bh_diq/es_ES.html)
Answer: You need a utility called munch.exe to apply the aff rules to the dic file.
Answer: These could be Hunspell dictionary files. Unfortunately, the command to create a "global" or unmunched wordlist only fully support simple .aff and .dic files.
From the documentation.
unmunch: list all recognized words of a MySpell dictionary

Syntax:
unmunch dic_file affix_file

Try it and see what happens. For generating all wordforms for one word only, look here.
Answer: As other answers have pointed out, the command-line program unmunch, from Hunspell, supposedly does what you want. However this program is outdated and very buggy. See this answer for more detail and alternatives.


How to prove that equality is an equivalence relation?

Question: Probably, it's a elementary question, but I would like some explanation.
Everyone knows that equality relation is (i) reflexive, (ii) symmetric and (iii) transitive, that is, satisfies
(i) $x=x$;
(ii) $x=y\Rightarrow y=x$;
(iii) $x=y$ and $y=z\Rightarrow x=z$.
I'm interested in to deduce these properties from some appropriate definition of equality. Fraleigh's algebra book presents the following

Definition. Let $X$ be a nonempty set. The equality relation in $X$ is the subset $$\{(x,x);\;x\in X\}\subset X\times X.$$

Let $\mathcal{R}$ be the equality relation in $X$.
By definition, $x\mathcal{R}x$ for all $x\in X$. So, $\mathcal{R}$ is reflexive.
Question 1. How to write a formal proof to the symmetry and the reflexivity?
Fraleigh denotes the equality relation by $=$ and, after the definition, says "Thus for any $x\in X$, we have $x=x$ but if $x$ and $y$ are different elements of $X$, then $(x,y)\notin =$ and we write $x\neq y$".
Question 2. Has the above comment any sense? For me, it sounds like "if $(x,y)\notin =$ then $(x,y)\notin =$".
Thanks.
Comment: did you get the answer? I have the same problem.
Comment: @juso Unfortunately not.
Comment: oh...sad.. I posted the same question as you. but I also didn't get any satisfying answers yet. before I asked a question, I had googled it and found your question. but I couldn't understand skyking's answer
Comment: @juso I think I have an answer now. I posted it in your post ([here](https://math.stackexchange.com/a/4225202/70305)).
Answer: This looks trivial, but if it needs a proof it isn't - you can't rely on trivialities then. It depends on actual definitions and the proof will look different depending on the exact definitions.
It all depends on the definition of your set-building notation. The notation $R=\{(x,x): x\in X\}$ actually depends on the notion of equality (of pairs) already. It means that $(u,v) \in R\Leftrightarrow (u,v)\in X^2 \land \exists x\in X: (u,v)=(x,x)$ (or do you have another definition?). It then falls back on the corresponding property of the equality notation (not the same as the equality relation $R$).
For example $(u,v) \in R$ means that there's an $x$ such that $u=x$ and $v=x$, but to get from there to $u=v$ you need to use symmetry and transitivity of $=$ (ie that $v=x\Rightarrow x=v$ and $u=x\land x=v\Rightarrow u=v$).
The reflexivity, symmetry and transitivity of equality follows from it's definition $u=v \Leftrightarrow (\forall \xi:\xi \in u \Leftrightarrow \xi\in v)$ and it will be reduced to the similar property of the $\Leftrightarrow$ notation. That is $p \Leftrightarrow p$, $(p \Leftrightarrow q) \Rightarrow (q \Leftrightarrow p)$ and $(p\Leftrightarrow q) \land (q\Leftrightarrow r) \Rightarrow (p\Leftrightarrow r)$
Answer: So the equality relation just means that things are "equal" when they're the same (like $x$ and $x$) and "not equal" when they're not the same (like $x$ and $y$).
You've already shown it's reflexive.
For symmetry, suppose that $$x=y$$ Then $$x=x$$ so "switching" :) :) $$y=x$$
For transitivity, suppose $x=y$ and $y=z$. Then $$x=y=z$$ so $$x=z$$ This is one of those proofs that seems so obvious its more confusing to just not formally prove it.
EDIT: on second thought, the best way to think about it is as a partition. The "equality relation" partitions each element into their own private cell. How anti-social.
Comment: Your first proof is unclear. On what ground do you come to the conclusion that $y=x$? It definitely doesn't follow from $x=x$ alone, and it can't follow from $x=y$ alone (or it would be circular reasoning).
Comment: The proposed proof of transitivity appears circular--it looks like transitivity is being assumed.


Network interface change required for IPv6 enablement on systemd based linux system

Question: I am trying to enable IPv6 support for my framework which uses systemd linux system. So,
Currently my network interface file(/etc/systemd/networkd/eth0.network) is something like this for DHCP enabled connection:
<code>[Match]
Name=eth0
[Network]
DHCP=yes
[DHCP]
RouteMetric=0

and this as static IP setting:
[Match]
Name=eth1
[Network]
Address=x.x.x.x/n
</code>
Does this network interface require any change for supporting IPv6? I am following the resources available here: https://wiki.archlinux.org/title/systemd-networkd but, unfortunately couldn't find much.
Can someone please help me with this or share any resources available for better understanding?
Answer: There are some packages which can help you to configure ipv6 by example the net-tool package  has some tools like ifconfig and route which help you to configure IPv6 on an interface.
Look at the output of ifconfig -? or route -?, if something is shown like IPv6 or inet6, then the tool is IPv6-ready.
Auto-magically check:
<code># /sbin/ifconfig -? 2>& 1|grep -qw 'inet6' && echo "utility 'ifconfig' is
¬ IPv6-ready"
</code>
Same check can be done for route:
<code># /sbin/route -? 2>& 1|grep -qw 'inet6' && echo "utility 'route' is IPv6-ready"
</code>
If your current network was configured to use IPv4 and you are not suffering of ip address exhaustion you could  keep your IPV4 and DHCP   ,The IPV6 protocol was deployed to have more public ips and avoid the public ip exhaustion due the limit of IPV4  address available on the internet.
However if you are thinking start to migrate to IPv6 because is easier to configure and maintain than ipv4, and you don't want keep fighting with complicated subnetting rules, then make sense deploy a DHCPv6 in your LAN to start a smooth transition, So to start with this new deployment you can consult this link to find more details about DHCP and DHCPv6
Comment: By any chance u can explain when to use [Network]
DHCP=ipv6 or ipv4   ..... DHCP = yes does the same thing right?
Comment: @shandilya, IPv6 DHCP is different than IPv4 DHCP, using multicast and automatically assigned link-local addresses, and it does not assign things like a default gateway that must come from the RAs. Also, the RAs actually allow or deny the host to use stateful or stateless configuration.


How do you go to the Big Moth Cave guarded by Dinogator in Scarlet Pillars?

Question: I have read in several article that you can make Dinogator busy by make him eating another FOE. But, how do you lure another foe to be eaten by Dinogator?
Answer: After several times launching food to nearby sheep, I found that the sheep interested on mushroom.
There's a sheep near the Dinogator who always move within 3 spaces back and forward, you can lure the sheep by launching the mushroom 2 tiles away from his path, when the sheep eat the food you give him, the Dinogator will be attracted to eat the sheep and move towards him, and that's your chance to enter the cave.
Comment: I think any sort of vegetation works. You also don't necessarily have to launch it you can just drop it as long as it's on the corner where the peninsula he's running on connects. And provided you don't run into him!
Comment: I throw it just to make the way to the cave shorter


How to stay safe on Ubuntu

Question: I am a complete noob to linux. And I have installed ubuntu on my laptop.
My concern is Security. A lot of sources online say I don't need any anivirus software, can someone explain why this is? I relaise people dont make as much linux malware but is this enough of a reason?
If I should get something what should I get?
Also is it worth to get a sandboxed browser or a fully fledged VM for surfing (this can include going)
Finally should I uninstall windows 7 (dual booting via partition) and no longer use it (is it a sfatey concern?) I was only going to keep it for emergencies
Comment: You don't need anything. Browsers are sandboxed. Everything else is crap.
Answer: The best security is the person using the computer. Use some of the addons mentioned, be careful which sites you visit and download from, do not click on links unless you know them.  The best anti-virus/malware will not protect you from yourself or from stupid people who leave all your information on an open database.
Answer: You should remove windows 7 or using it offline. Ubuntu don't need antivirus software because the Linux structure is secure and softwares are packaged and hosted on Ubuntu repositories (servers). You can steel install ClamAV (command line) and ClamTk (graphical).
You can also install addons on your web browser (uBlock origin, Ghostery, HTTPS everywhere) and in thunderbird (Enigmail) to stay secure online.
Comment: Would you say a VM is worth it for browsers?
Comment: VM won't add any security.
Comment: With regards to the windows. What if I do a fresh install of it and only ever use it for remote desktoping into work? Im gonna try and get linux working but this is a backup. What are the risks with this approach?

How to stay safe on Ubuntu


confidence intervals - a bad confidence interval

Question: I had a question for confidence intervals:
the situation in the question :so we have a number of scatter plots with each showing an
estimated regression line (based on a valid model) and associated individual 95% confidence intervals (CI) for the regression function at each x-value, as well as the observed data. A professor asks 'I don't understand how 95% of the observations fall outside the 95% CI as depicted in the figures'.
Briefly explain how is is entirely possible that 95% of the observations fall outside the 95% CI as depicted in the figures.(We weren't given actual figures)
Anyway I thought that it may have been due to the fact that a lot of outliers affected the regression line calculated, and so a confidence interval formed from a bad regression line would be bad - resulting in 95% of observations falling outside the 95% CI.
I guess a good one would look like this: https://stats.stackexchange.com/questions/47563/plotting-the-fitted-values-and-their-confidence-intervals, where most observations are inside the confidence interval.
I also considered that some gauss assumptions were violated; such as the zero conditional mean assumption. So then the coefficients and their standard errors would be invalid, resulting in an invalid confidence interval. Still, 95% of observations falling outside the CI seems ridiculous.
Does anyone know the real reason(s) why this could be the case?
Comment: There is a difference between a confidence interval for the mean and a confidence interval for a single response (also called a prediction interval). Make sure you have the appropriate interval as it is not reasonable to expect 95% of your observations to fall within the 95% confidence interval for the mean response.
Answer: In a classical frequentest setting, the probability statements regarding a confidence interval relates to the (random) bounds of the interval. For example, take the common confidence interval for the mean, $\mu$, of some normal data generating process. We have $$P\left(\overline{y} - 1.96 \frac{\sigma}{\sqrt{n}} < \mu < \overline{y} + 1.96 \frac{\sigma}{\sqrt{n}}\right) = 0.95$$
Notice that $\mu$ is not treated as random, it is 'fixed' as there is only one true mean. The probability statements we make corresponds to the lower and upper bounds of the interval, that is, $\overline{y} \pm 1.96 \frac{\sigma}{\sqrt{n}}$, since these bounds depend on $\bar{y}$ (let's for the moment assume we know $\sigma$), then it could be entirely possibly (due to sheer 'luck') for a specific sample, we obtain a value for $\bar{y}$ that results in the entire interval lying completely outside the majority of the observations. However, what the confidence interval does say is that during repeated sampling, 95% of the times we should expect to see the interval encapsulating the true mean.


Solving Laplace's Equation on $(-\infty, 0)\times S^1$

Question: I'm interested in solving
$$\begin{cases}
\Delta u(x,\theta) = 0 & x < 0 \\
u(0,\theta) = f(\theta)
\end{cases}$$
for some sufficiently nice prescribed $f$, and $u$ periodic in $\theta$ with period $2\pi$. Here $x$ and $\theta$ are both real. I've tried considering an ansatz of the form $u(x,\theta) = a(x)\sin(\theta)$. Plugging this into the PDE gives $a''(x) - a(x) = 0$, so $a(x) = e^x$. But then the boundary condition implies that $a(0) = f(\theta)/\sin(\theta)$, and we are in trouble unless $f(\theta) \equiv 0$. I also tried an ansatz of the form $u(x,\theta) = a(x)f(\theta)$, but plugging this into the PDE gives $\frac{a''}{a} = -\frac{f''}{f}$, which I'm not sure how to handle.
I also considered using Green's function for the halfspace. If we did not require $u$ to be periodic in $\theta$, then we would be able to write down the solution
$$u(x,\theta) = -\frac{x}{\pi}\int \frac{f(\eta)}{x^2 + (\theta - \eta)^2}\,d\eta,$$
but it's not clear to me how to modify this to make it periodic.
Any hints on how to proceed?
Comment: Is $x$ supposed to denote the position vector, $\mathbf{r}$? And in that case do you mean $e^{\Vert \mathbf{r} \Vert}$ by $e^x$?
Comment: Sorry, I should have specified that $x$ and $\theta$ are both real scalars.
Comment: The $(x,\theta)$ is a bit confusing.... Why are you combining Cartesian and polar coordinates?
Comment: Because I am interested in solutions on $(-\infty,0)\times S^1$, where $S^1$ is the unit circle. Here the Laplacian is in $x$ and $\theta$, i.e., $\Delta u = u_{xx} + u_{\theta\theta}$.
Comment: Sorry I misunderstood what was meant by $S^1$. My apologies.
Answer: Hint:
Use separation of variables
$$u(x,\theta) = X(x)\Theta(\theta),$$
as you have noticed, then note that in the resulting
$$\frac{X''}{X} = -\frac{\Theta''}{\Theta} = \lambda,$$
both sides must be the same constant, giving you the two ODEs
$$
\begin{align}
\Theta'' &= -\lambda \Theta,\qquad\Theta(0) = \Theta(2\pi) \\
X'' &= \lambda X.
\end{align}
$$
When we solve the first ODE, we should get
$$
\Theta(\theta) = A\cos(\sqrt\lambda\theta)+B\sin(\sqrt\lambda\theta),
$$
assuming $\lambda>0$.
From $\Theta(0)=\Theta(2\pi)$, we get that $\lambda$ has to be a positive perfect square, $n^2$. We cannot determine anything more about $n$ yet, apart from it being an integer. However, note that changing the sign of $n$ does not affect the solution, so WLOG, we can assume $n > 0$.
The other cases ($\lambda<0$ and $\lambda=0$) are straightforward;  you will find that $\lambda<0$ is incompatible with $\Theta(0)=\Theta(2\pi)$, and that $\lambda=0$ fits in nicely with our existing solutions.
$$
\begin{align}
\Theta_n(\theta) &= A_n \cos(n\theta) + B_n \sin(n\theta)&n>0\\
\Theta_0(\theta) &= A_0 &n=0
\end{align}$$
We can then solve the second ODE:
$$
\begin{align}
X_n(x) &= C_ne^{nx} + D_ne^{-nx}& n>0,\\
X_0(x) &= C_0 + D_0x &n=0.
\end{align}$$
Taking linear combinations, we get a bunch of solutions to the PDE (ignoring the initial conditions):
$$
\begin{align}
u(x,\theta) &= \sum_{n=0}^\infty \Theta_n(\theta) X_n(x) \\
&= C_0 + D_0 x + \sum_{n=1}^\infty (A_n \cos(n\theta) + B_n \sin(n\theta))(C_ne^{nx} + D_ne^{-nx})
\end{align}
$$
Normally, there is also a boundary condition of the form $\lim_{x\to-\infty}u(x,\theta)=0$ or $u_x(0,\theta) = g(\theta)$. If we had the first condition, we could set all the $D_n=0$.
At this point, so long as $f(\theta)$ has a Fourier series (which we know because it is sufficiently nice), we can satisfy the initial conditions.
Comment: So I tried something like that, but I'm still having trouble accounting for the boundary condition, which tells us that $X(0)\Theta(\theta) = f(\theta)$ for some given $f$. Then we might want $X(0) = 1$ and have $\Theta(\theta) = f(\theta)$, but then we're not guaranteed that $\Theta''  =-\lambda\Theta$, which is where I'm getting stuck.
Comment: @Phil I'll add the next steps: ignore the boundary condition involving $f(\theta)$ until the very end; focus on getting an infinite number of solutions to the $\Theta$ ODE, and thus, the entire PDE. Then use linear combinations to get your final answer.
Comment: Ah, this is perfect, thank you so much!