Show pdf file into browser without Adobe Reader

Question: I need to open pdf file into browser without Adobe Reader. Is there any API with php which open PDF files into browser.
Regards
Comment: As long as I know, there is no way to display a PDF in the browser, without PDF-Viewing Engine like Adobe Reader, except when you reneder the pdf to html (like google-docs does). But I don't know any library which does this. Maybe there is one (maybe googles is open-source) - I am interested too!
Answer: No.
PHP runs on the server. The only "browser API" it has access to is HTTP.
If you want to render a PDF on the client, then the client needs a PDF renderer. There are JavaScript PDF readers, but I can't comment on their cross-browser support or maturity.
Answer: If you pdf files are put online and not restricted, you can try using Google Doc Viewer. It's a very nice way to put the Viewer in  so that it can be combined with your web page.

https://docs.google.com/viewer
Answer: You can use SWFTools to convert PDFs to Flash. But SWFTools default skins are not looking good at all, so you can check Flexpaper as a viewer.
In case you are going to make your own skin, then could be useful to read: SWFTools (pdf2swf) to properly work with Flex
Another solution is pdf.js (as Quentin point out), but AFAIR this script was not usable(back then, when I looked for) for PDFs with complex structures (complex gradients for example).
If you need to publish documents as "private" you should look at services as Issuu or you will have to protect files from downloading.
Answer: It is not feasible to view the PDF files without a viewer like Adobe Reader. If you just don't want to use Adobe Reader, you may try a PDF viewer plug in for web browser from some other company.
However, if you do not want to use a viewer at all and want to write/build your own viewer then a better option is to convert the PDF to scalable images and then show them on the web page using image tags. You can also create such a viewer using JavaScript.
Even you can find many already available JavaScript based viewers which can show those images.


I have duplicate contacts, Google Contacts not helping!

Question: I have several contacts in my phone which are duplicates. For example I have one contact "John Smith" which contains my friend John Smith's phone number. Then I have another contact name JohnSmith87 which is my friend John Smith's email address. And then I have another contact called JohnSmithin which is my friend John Smith's skype account. I'd ideally like to merge all of these into one contact. I tried Google Contacts, but when I searched, only contacts with a phone number stored in them would show up. Please help!
Answer: I have a quick step-by-step guide to help you "join" your contacts - in other words, take two separate contacts and make them one!

Open the People application.
Navigate to one of your duplicate contacts (any one will do) and tap it to open it up.
In the top-right corner, tap the 3 dots. This is the settings menu. Select "Edit".
Again, in the top-right corner, tap the 3 dots. Select "Join".
Android will now ask you to select which contact to join this contact with. Select one of the other duplicates of this contact and Android will join the contacts into one contact!

Rinse and repeat until all of the duplicate contacts have been "joined" into one single contact.
Comment: I don't think this applies to the [Google Contacts app for Android](https://play.google.com/store/apps/details?id=com.google.android.contacts).
Answer: About Google Contacts, are you sure that JohnSmith87 (the contact with no phone number) is not in the Other Contacts section?
If that's the case, you can select the contact, click the "Add to my contacts" button and than go back to My Contacts section.
Now you have both contacts and you can select them and merge.
I find much more easy and quick to manage my contacts from the web than from my device.


Is there a way to assign a keyboard shortcut to focus windows in GNOME based on their location?

Question: I basically want to keep using GNOME but emulate the i3 WM behavior that allows you to focus windows based on their location, e.g.  to focus the window to the right of the current one,  to focus the one of the left, etc. I looked into wmutils, which almost works, but it doesn't work with GNOME. Is there another way to do it?
Comment: Which window manager are you using? Metacity (the Gnome 2 default)? Mutter (the Gnome 3 default)? Something else?
Comment: The default window manager, I think. Whatever that is. I think I'm using the very latest GNOME, not the one from last decade.
Answer: Long answer short: use the extension Put Windows (''Move focus using the keyboard'' says it all)
First you check that it is really not currently possible

The feature does not seem to be listed in the GnomeShell CheatSheet, neither in Gnome3 > Keyboard. Sadly there does not seem to be an exhaustive list of keyboard shortcuts anywhere.
I went to extensions.gnome.org and searched for an extension that would do what you want but all I found is an extension called 'switcher' that is not what you want. You should search thoroughly there before doing anything else because I did not went through 90 pages of results. Actually there is an extension to do that, it's called ''Put Window'', the OP found it after I wrote this answer, so what is below is kept for information purpose.
You could decide to use Alt-tab and be done with it, that seems to be the Gnome3 way

Then you try to make it possible by yourself
I see 3 ways of doing things:

Create a Gnome3 extension (but I am not sure that you would have all functions that are needed to implement what you want). I did not try to do that.
Modify Gnome3 (but that is probably not the answer you are expecting). I did not try to do that.
Use X11 / Wayland / Mir to do that. I will explain below what I tried to do with X11. Beware, X11 will soon be legacy software ! And it might currently not be possible to do that with Wayland / Mir (but I did not check)

I tried to do that with X11 using xdotool
This solution is not fully working. It's more a hack for fun than anything else
You can try my demo select.sh script. It's a bash script around 200 lines so I do not put it here but I will explain how it work below.
To use it:

install xdotool on your system, it should be in your repo :)
git clone https://gitlab.com/gabrieldevillers/xdotool-i3ization
go to Gnome3 > Keyboard > Shortcuts > Personal shortcuts
and add 4 entries with commands respectively /path/to/select.sh *direction*
where *direction* is respectively up, down, left or right

Problems of the script:

It's slow (but usable: try it)
windows must not overlap. It's a condition that I used to replace the fact that I had no way to tell if a window is visible to the user (see questions "Computing the visible area of a partly hidden window" and "X: Find out if a window is visible to the user i.e. not covered by others" on this very website). This need is due to the big difference between i3 and Gnome3: with Gnome3 windows can overlap (and they do overlap really often).

Algorithm of the script:

Get a list of potential windows: they must have a name, be on the same workspace (optional ? but beware there is a bizzare workspace with code "-1"), not be in the list of windows that you excluded (maybe optional, I started with that and kept the possibility), be visible (in the sense of X11, that means not reduced, you know, like in Gnome2!)
Filter this list to get the windows at the correct location (this part of my script has a lot of room for improvement)
Take the one that is the closest to you (here again you can improve my script)
Comment: This is awesome. I didn't know about `xdotools` before, so that's great. The script doesn't quite work for me, gives `X Error of failed request:  BadWindow (invalid Window parameter)`, but it gives me more than I need to go on to make something like this myself. You can make the script a little faster probably by using the `--shell` option of xdotool with `eval`. Also it turns out the shell extension is probably this one:
https://extensions.gnome.org/extension/39/put-windows/
Comment: Great, you found the extension :) I edited my answer to add it. Thanks, I will implement your suggestion next time I'll play with xdotool.
Answer: As an old I3 user I've been missing this feature. I've failed to find a solution to this problem and so I decided to write a gnome extension to solve it. Instead of using the "xdotool", it uses the internal gnome libs. Hopefully, it will be working in both X11 and Wayland.
https://extensions.gnome.org/extension/4627/focus-changer
As keyboard-driven users, I hope you will also find it helpful.


jQuery - is it bad to have multiple $(document).ready(function() {});

Question: Is it bad to have multiple $(document).ready(function() {}); on your page? I have a website where I load different things at different times. I fire off those partial postback functions inside $(document).ready() but i have about 4 or 5 on the page at once. Is this a bad practice? Specifically, will it cause any performance issues?
Answer: This answer is no longer relevant. Please see other posts below for more up-to-date jQuery $.ready() impacts. This post is over 3 years old.
See: http://jsperf.com/docready/11

The answer is no! You can litter them as much as you want (note the
  word litter). They just become a queue of events that are called when
  the ready event is triggered.
http://www.learningjquery.com/2006/09/multiple-document-ready
Answer: The answer is actually "Yes it deters performance":
http://jsperf.com/docready/3
Comment: You're drawing conclusions based on your opinion.  The answer is that there is a performance hit (everything has a performance hit) and that hit should be weighed against the benefits of it.  Even with IE8 it would take 20K $.ready calls to slow down my page by 1 second.  The 50 - 100 that I do use would result in an increase of about 0.0025 seconds on IE or 0.000125 seconds on Chrome.
Answer: No it is fine to have as many as you want. A shorter, much more elegant way to do this is $(function(){}) though.
Answer: If it's on the same page I would personally put them all in the same place so that you can't be caught out by forgetting one of the things happening on load.
I doubt the performance implications are that significant though. Have you tried benchmarking the page with them all together and apart?
Answer: If any of them throw an exception, it blocks the rest from running. This can be very difficult to debug with code "littered" across multiple source files (esp. 3rd party libraries).


How to use eglot to set analyze path for python project?

Question: I'm trying to use eglot on gem5, but I've noticed that I need to specify the analysis directory as src/python, and I understand that it seems to be possible to set this by setting eglot-workspace-configuration, but I'm not sure how to go about this.
Answer: As far as I can find here, you can use 'project.el facilities' to set the root dir for an 'eglot project'. Then, the initial comment of the project.el file mentions that the VCS project type can also be used for 'non-VCS controlled directories' via the project-vc-extra-root-markers variable (refer to its docstring for more info).
So I would advise you to try creating a .dir.locals.el file in that src/python directory containing:
((nil . ((project-vc-extra-root-markers ".dir-locals.el"))))

As you are creating the .dir-locals.el file anyway, you can also immediately use it as a project-vc-extra-root-markers, but you could use some other marker (i.e. filename in the src/python dir) also.
Now visit a file in the src/python directory and do M-: (project-root) to see if the new project root directory is recognized. If not, then try again after restarting Emacs (restarting will clear the vc-file-prop-obarray 'cache').
If the previous step returns the 'correct' project root dir, then start eglot. I hope now eglot indeed uses this project root as your 'analysis dir'. Good luck!
Comment: Thank you for your answer, I recently found out that in gem5 projects there are both cpp and python languages, and simply using `src/python` as the project directory causes clangd to fail, and I wanted to ask if there's any other way to make python lsp analyze only the `src/python` directory


Pattern with colored squares in 3x3 grids

Question: This is a question from log 155 test posted on a sub/reddit
https://www.reddit.com/r/cognitiveTesting/comments/115haor/log155_statistics_200_attempts/
Answer: The answer is

First step is to realize

 anywhere you see a square with an arrow it implies it has the exact pattern as the square with the same full color. The full color actually represent the last figure of each row (hidden). Also you can see that blue is connected to the white square, red is connected to the light grey square and yellow is connected to bit darker grey square and green is connected to the dark grey square (in other words blue row 1, red row 2, yellow row 3 and green row 4.) Here is an image to illustrate it:

Now let's solve each row,

 by replacing each full colored (except the last one for now) square with the last figure. There are four different patterns going on. Here are explanations for the patterns:
  And each square with an arrow changing color of course according to it's row color (which also is implied by the two cells on each side of the arrow).

Lastly

 If we make each row only to consist of their row color (replacing the arrow squares and full colored squares), we get:    So our answer is F.


Blog Architecture Design, using MVC and DDD

Question: I'm designing a blog architecture on asp.net mvc. Lets say i only have 2 entities: post and comment. do i need a controller and a repository for each one? how goes the mechanism for displaying a post with it's comments? do the post controller looks in the posts repository for the post, then asks the comment controller to retrieve all the comments connected to this post, gets them from the comments controller and passes them to the view? or maybe i should write a service which is responsible for querying both repositories and returning the results to the posts controller, which passes them to the view?
Answer: Perhaps the first thing to note is what features will your blog have and make available for its primary functions :

editing
subscription
comments
authenticating users - eg identifying the blog owner and posters.

What other ideas will yourblog have ?
Are you going to try out some new Kool ideas that you might not have seen elsewhere ? If so like what ?
The first questions that need answers are your requirements then you can start worrying about architecture and technology stacks and how to codethis or that type questions. Either way your ideas and questions are most eagerly wanted here :)
Answer: I'm not sure what ORM you are using, but I would only have a single repository for Posts.  When I ask for a Post, all the comments should be attached (lazily or eagerly loaded depending on specific instance).  In DDD terms I think you'd describe it as the Posts entity is the root of the 'Posts' aggregate if you want to view it that way.
I don't think there is anything wrong with having two repositories in a single controller though.
Answer: You can checkout examples such as

Kigg
Oxite
Answer: You might be interested in this other post discussing ASP.NET MVC + CSLA + DDD . It provides nice examples of projects using them together.


Legality of product photos for my online retail store

Question: I own an online retail grocery store and I have taken quality photos of the goods I'm selling. I'm wondering if I'm violating any copyright laws for taking the photos of copyrighted/trademarked products (e.g. Cheetos, Doritos, etc)? Thank you!
Answer: Yes you should gain permission from the copyright and trademark holders of the products. All packaging will have copyright as copyright is assigned to work upon creation, not upon registration, although in the USA registration prior to any infringement gives possibility of extra recompenses.
All packaging will have some trademark on them too as that is how you know what is in the box and/or who made it.
The contents of the packaging (the usable product) should be trademark and copyright free, there may be some very rare cases where the product is trademarked, e.g. froot loops may be trademarked as the multicolored loops are very recognizable and if they are not trademarked, Kellogg will have tried to trademark them and failed.
IANAL but personally I would class what you are doing as a type of fair use, assuming you are not in any way pretending to be someone other than the retailer of the product. There are thousands of shops, big and small, that do what you want to do and none of them have any issues regarding copyright so I doubt you will either.
TLDR technically you should gain permission, in reality you are probably fine not getting permission on the condition you are respectful in how you frame the products
Answer: Certain of their product images are protected by copyright. One way to check is to see if the product shows up in the copyright registry, which is the case with various Cheetos and Doritos products. So that would mean you need permission.


where is the Form Web Part in Sharepoint Designer 2010?

Question: How do i add a form webpart in sharepoint designer 2010.
What i'm after is filter the list based on date using 2 textboxes
startdate and enddate.
Any ideas solution to this.
Thanks in advance
Answer: The Data Form Web part in SharePoint 2007 is called Data View Web part in SharePoint 2010. You will be able to add the Data View web part into a page using SharePoint designer 2010.
These are the steps that would help you in acheiving the result.

Convert Data View to XSLT Data View
Create a Parameter for the Data View
Filter the Data View Using the Parameter
Drop Date Filter Web Part on Page
Connect Parameter on Data View to Date Filter

There are certain blog posts which can help you achieve the date filtering that you are looking for.
http://geekswithblogs.net/SoYouKnow/archive/2009/09/16/sharepoint-date-filter-filtering-a-list-by-greater-than-or.aspx
http://davecavins.com/2009/09/filter-by-date-range/
Comment: Thanks Deepu.I'm not using Sharepoint Enterprise so i dont have OTB date filter.Right now i'm trying to use a html form(with a custom datepicker)
Answer: You need to click on Insert DataView and then select Empty Data View It'll get the form WebPart
Then you need to click inside the DataForm WebPart and add a Data Source
Once the data source is added you can select the columns you want to add for your view
Hope this helps


How can I add 'SB-900' tag?

Question: I'd like to ask a question related to Nikon's SB-900 speedlight. However suggested tags are only 'SB-600' and 'SB-700'. I'm not able to add a new tags as my reputation is less than 300.
Answer: You can't until you get the rep. Just ask your question, someone will tag it appropriately if it makes sense to do so. If it's not really specific to the SB-900/910, then it probably shouldn't be tagged that way, so let's see first.
Having said that, I'm not entirely sure there's value in individual speedlight version tags. The SB-900/910 being a case in point, bit of a tag quagmire.

How can I add 'SB-900' tag?


Viewing Final Score after Game End

Question: Is there any way to view the final score given at the end of Game Dev Tycoon after the game's end?
Answer: Not really. It is only shown once you have reached the time duration of the game you set (such as 25 years,30 years,or 35 years). After that you'll never see it again.
Answer: You can press ESC to open the main menu and then click on High Score to see all your previous scores.

Viewing Final Score after Game End


Funk Strumming While Fretting High Up the Neck Produces Odd Tones

Question: I recently started to dabble into Funk Rhythm. I'm making decent progress, but I have noticed that when trying to play chords around the 12th fret using Funk strumming, the chord sounds 'off', like the strings are out of tune. When I play a chord with a normal strumming pattern, everything sounds fine. But only when I try funky strumming does the sound of the chord degrade. I also noticed it's more likely to happen with some chords like a minor seventh. I don't have this problem on lower frets, and I don't think intonation is the culprit, but I could be wrong. I have an Epiphone Les Paul Custom with D'addario Nickel Wound 10 - 46 strings.
Comment: The first thing to do is use an accurate electronic tuner to test the 12th fret harmonic against the fingered 12 fret note for all strings. That will at least confirm that intonation is probably not the problem.
Comment: @JohnBelzaguy When using a tuner, you don't have to play the harmonic. Just tune the open string accurately and the check what the tuner says at the fretted 12th fret.
Comment: @ToddWilcox Yes Todd, I'm aware of that. The reason I like using the harmonic is it allows you to reference the same pitch by ear as well.
Comment: Is it possible that when you get to that register playing in that style you are pressing harder with the fretting hand? Maybe you are inadvertently bending the neck a bit and pulling the strings sharp…
Answer: Usually, when a guitar goes progressively out of tune, the further up the neck you play, it's down to intonation. Meaning the bridge/saddles are out of synch with the frets.
The common way to check this is to compare the 12th fret fretted note on each string with its harmonic. They should be exactly the same pitch. The harmonic cannot be moved, and neither can the length of the nut to the 12th fret.
However, the total string length can be, by adjusting the saddles under the strings. That will bring the node (harmonic 'dead spot') in line with that 12th fret, putting everything in tune all over the fretboard.
Often folk think the line of the saddles should be straight and parallel to the frets. Not so. For various reasons, the 1st string (thinnest) is always shorter, and the bass sting always longer.
You could also benefit from having an action low enough that the strings don't get stretched when pressed down. That will manifest itself more around the 12th fret, making them sharp, if that action is too high.
Often folk will take their guitar to a luthier if they're uncertain what all that's about.
Comment: I going to end up bringing it to a tech. Thanks for the information!
Answer: I can only speculate: if the frets around the 12th are a bit dislocated, related to where they should be, the length of the string may be too short or too long, so it sounds a bit "out of tune". // This could also cause slightly mismatches in pitch when transposing from string to string (neglecting each strings individual sound characteristics and sensitivity to the potential causes I describe here.)
A different cause may be that you change tension inside the string, e.g. from pressing it to the fret. (Both change the strings resonance frequency. // You could hear this effect by applying hammering technique to the strings, or simply from bending with fret-fingers.)
And it's also possible that the age and conditions of your strings become audible (wear, too new etc.)
To verify, try some of the following:

if you can, move your pattern from a lower string/fret 12 to a higher string (transposition)
on/around fret 12 try varying finger position and/or the way and strength you apply to press the string to the fret(s)

Finally, just to line out, perhaps you're a "victim" of the Pythagorean comma. String instruments follow physics, which leads to some trouble in terms of where pitches should ideally be, e.g. as ratio of string length would "dictate". Throughout millenia many attempts were made, none completely satisfying as I read it, and only recently, compared to that time scale, we adopted the well temperament, which is a compromise with theory of "ideal" frequency ratios. // But I think, the 3 causes above are more likely.
Answer: If it's not intonation, then it could be overtones ringing out on strings that you think are fully muted but are not quite fully muted. This would explain why it's only when you play funk, because funk has a lot of fast alternating between muted and fretted playing.
It's hard to keep strings from ringing at the 5th, 7th, and 12th frets with left hand muting alone. This is because the first three natural harmonics are there, which means your muting could accidentally just be touching the harmonic on one or more strings.
A couple ways to work on this are to spread your hand a bit and/or move it up or down slightly when muting, which presents the challenge of getting back to the chord. Another very common trick used by funk guitar and bass players in the recording studio and sometimes live is to wrap something around the strings at the first fret to add extra muting. A hair scrunchy is a popular choice, and I've used a sock loosely knotted around the top.
One more tactic is to play in Eb or Bb or a key that doesn't use much fingering near the harmonic points.


Recommended specs for a single-country OSM tile server

Question: What specs would you recommend for an OSM tile server dedicated to serving tiles for a single, small country (e.g., Portugal only)? Total server load is estimated to be no more than two/three users accessing tiles at the same time.
Comment: If below 5 users you can use a normal windows pc. Though linux would be better http://switch2osm.org/serving-tiles/manually-building-a-tile-server-12-04/
Answer: As mapperz pointed out, your load is probably small enough that anything you have will do. If you have some flexibility though, try for fast disks (ideally SSD) and more memory. I suggest fast disks and memory because these are likely to be the limiting factors (for the postgres database instance).
It is interesting to look how openstreetmap does it: http://wiki.openstreetmap.org/wiki/Servers documents their servers. Given their load, it isn't really a lot of machines doing the tiles work...
Answer: For users who are looking for such requirement. Here is simple solution to create all openstreetmap tiles for a single country osm-for-my-country.
There are scripts for all tasks on a Linux machine:

Install all necessary software like osm2pgsql, postgres, mapnik, kosmtik etc
Download your country data
Download and install map style openstreetmap-carto
Create all tiles for your country
Update tiles on daily basis
Serve tiles with node.js or you can serve these offline map tiles with any simple http serevr or apache


Are swift classes inside struct passed by copy during assignment?

Question: If I have a struct in swift with inside a class attribute and I copy the struct object, is the class attribute copied or passed by reference?
Answer: Passed by reference. You can test it. Declare:
class A{}
struct B { let a = A()}

then:
let b = B()
print("A = \(unsafeAddressOf(b.a))")//0x0000600000019450
let b_copy = b
print("A = \(unsafeAddressOf(b_copy.a))")//0x0000600000019450

Comment: To make it work with swift 5 use:
print(Unmanaged.passUnretained(b.a).toOpaque())
Comment: Why isn't init called again?
Comment: Will it increment the reference count also?
Comment: of course it will increment the reference count of a by one
Answer: All properties of a struct are copied (as if you assigned (=) each property of the old struct to the corresponding property of the new struct) when the struct is copied, regardless of type.
When you say "class attribute", I am assuming you mean a variable of reference type. (The type with the same name as a class denotes a reference type for references that point to objects of that class.) Copying a value of reference type (a reference) produces another reference that points to the same object. Note that "objects" are not values in Swift -- there are no "object types" -- rather, objects are always manipulated through references that point to them.
Comment: Objects can be represented without reference that points to them if it is a value type object (struct) and it has less then 3 words (ivars) in it's contents. Type of those ivars must allow them to be be allocated on stack. In other case object will be allocated on the heap with corresponding pointer. Source https://developer.apple.com/videos/play/wwdc2016/416/
Answer: I tested the above experiment in swift 5:
Let's see the result:
class A {
    var id: Int
    init(id: Int) {
        self.id = id
    }
}

struct B {
    var grade: Int
    var a: A
}

Experiment based on the result:
var a = A(id: 1)
var a_copy = a

var b1 = B(grade: 2, a: a)
var copy_b1 = b1

print(b1.a.id)
b1.a.id = 5
print(copy_b1.a.id)

print(b1.grade)
b1.grade = 3
print(copy_b1.grade)

Output:
1
5 // call by reference, same result
2
2 // call by value, no change in result

Conclusion:
struct does copy when we create another object of it. It copies its struct property (call by value) but refer the same instance of class property (call by reference)
Do experiment via address:
Do an Experiment on Class:
var a = A(id: 1)
var a_copy = a

withUnsafePointer(to: &a) { (address) in
    print("address of a (class) = \(address)")
}
withUnsafePointer(to: &a_copy) { (address) in
    print("address of a_copy (class) = \(address)")
}
withUnsafePointer(to: &a.id) { (address) in
    print("address of a.id (struct) = \(address)")
}
withUnsafePointer(to: &a_copy.id) { (address) in
    print("address of a_copy.id (struct) = \(address)")
}

Output
address of a (class) = 0x0000000114747f80
address of a_copy (class) = 0x0000000114747f88
address of a.id (struct) = 0x000060000285a390
address of a_copy.id (struct) = 0x000060000285a390

Observation 1:
Both instances of the class are referring to same location of its property.
Let's do the Experiment on struct:
print("\n\n\n")
withUnsafePointer(to: &b1) { (address) in
    print("address of b1 (struct) = \(address)")
}
withUnsafePointer(to: &b1.grade) { (address) in
    print("address of b1.grade (struct) = \(address)")
}
withUnsafePointer(to: &b1.a) { (address) in
    print("address of b1.a (class) = \(address)")
}
withUnsafePointer(to: &b1.a.id) { (address) in
    print("address of b1.a.id (class) = \(address)")
}

Output:
address of b1 (struct) = 0x0000000109382770
address of b1.grade (struct) = 0x0000000109382770
address of b1.a (class) = 0x0000000109382778
address of b1.a.id (class) = 0x0000600001e5cfd0

print("\n\n\n")
withUnsafePointer(to: &copy_b1) { (address) in
    print("address of copy_b1 (struct) = \(address)")
}
withUnsafePointer(to: &copy_b1.grade) { (address) in
    print("address of copy_b1.grade (struct) = \(address)")
}
withUnsafePointer(to: &copy_b1.a) { (address) in
    print("address of copy_b1.a (class) = \(address)")
}
withUnsafePointer(to: &copy_b1.a.id) { (address) in
    print("address of copy_b1.a.id (class) = \(address)")
}

Output:
address of copy_b1 (struct) = 0x0000000109382780
address of copy_b1.grade (struct) = 0x0000000109382780
address of copy_b1.a (class) = 0x0000000109382788
address of copy_b1.a.id (class) = 0x0000600001e5cfd0

conclusion: both &b1.a.id and &copy_b1.a.id are referring the same address.
Answer: Seems, we have to consider modifying the object (as the optimizer will use the copy-on-write technique)
Value Type (User) contains Reference Type (Address)

observation:

On assignment of value type, any value type (ex: User) that contains a reference type (ex: Address), that reference type (ex: Address) is always passed as a reference.

Reference Type (User) contains Value Types (Address)

observation:

On assignment of reference type, any reference type (ex: User) contains value types (ex: Address), that value types (ex: Address) point to the same parent reference object (ex: User) (parent may contain many references - ex: both u1, u2 refers to same memory address).


selenium click stop working after several iteration

Question: I have a test that clicks on a preview link > opens up a window and I do some sort of test in that newly open window. I then close that window and click on the preview link again and repeat.
Let's say the test follows this pattern for 100 times. Once it hits say 10th times, clicking on the preview link to open the new window doesn't seem to do anything. I don't see a new window opening, and the code seems to still be running. It doesn't break, no exceptions are thrown, etc When I stop the code execution, it seem to have moved on past the line of code that clicks on the preview link... This happens in firefox and chrome
Can someone explain what may be happening?
Answer: It'll be difficult without the code you're using. Other helpful items would be if there's a browser that the test always works on, and what version of Selenium you're using.
That said, are you testing for your WebElement being visible and enabled as well as not null before you click? If it's in a clickable state (for example, visible, but disabled), WebDriver will click on it without throwing an exception, and nothing else would happen.


Getting asked to interview - when should I bring up my living situation?

Question: I'm a software developer about to graduate college, and I have been getting quite a few calls about jobs which are both local and far, far away from me. I'm not sure when I should bring up that I can't leave my current location (my significant other is attending graduate school, and we've just signed a lease, for example). Should I tell the interviewers right away that I can only work for them if I work remotely, or should I go through the process first? I lean more towards the former because I'd feel really bad wasting interviewer / recruiter time that could be spent elsewhere, but this is something that's new to me. How do I approach the situation? I would really like to work for some of these places that are asking me to go through their process!
Comment: Are you applying to jobs that specifically list that they allow remote work? And is this an absolute *"No I will never relocate no matter what the offer"* or *"I would prefer to work remotely, but am willing to reconsider if the right offer came up"*?
Answer: I would approach this by deciding (on a case-by-case basis, if necessary) your own answer to this question:
Why would I consider going through this effort if I know the job is for another location?
There are a few answers I can think of.
A. I am hoping that if they really like me, they'll let me work remotely.
This one is fairly easy.  You should just mention this up front and avoid wasting their time.  The reason I suggest this is that I've never found an example where a company was willing to accept remote workers but didn't know it yet.  They either know that they can hire remote workers, and are prepared to do so, or they want everyone on site.
So, let them know up front and let them tell you which they are.
B. I like the company so much, that if I get the job, I'll take it and move, in spite of my restrictions.
In this case, you should take the interview, and you really don't need to mention anything up front.  Instead, you need to start figuring out how you'll handle your obligations so you can move.
In my experience, if you aren't local, companies are prepared for it to take a little while for you to wrap things up and move.  Some are more flexible than others. Some will make it easy for you to do so with relocation assistance, some will leave you on your own.  But either way, they know that this will come up in the conversation.  You can have it early, but if you know you want the job, you don't really need to.
C. I am hoping that if they really like me, and I tell them I can't move, they'll blow me out the water with an "offer I can't refuse".
See B.  However, I believe this to be fairly unlikely unless you are in a very specialized industry.  Hiring is an optimization task for most companies.
 They go outside their local area when they know it can pay off.  And it pays off when the expected value exceed the additional cost: interview travel expenses, relocation, additional screening time.
The expected value is based on the average candidate. In my experience, companies are unlikely to perceive your individual value as much higher than the average for your role, so it's unlikely they will go to extraordinary lengths to hire you.
D. There aren't any conditions under which I can imagine taking the offer.
It's flattering to be asked to interview, but if your case falls in this category, be honest and skip it.

Summary: It sounds like you really only fall into category A.  As I said above, I can't see any reason to not just mention your conditions up front.  Both of you are fairly fixed in the matter, and you are unlikely to gain anything in negotiation by not revealing your intentions.
Comment: Thank you. I appreciate the breakdown and showing me other things I wasn't even sure about yet myself. I definitely fall into category A at present.
Answer: Yes, absolutely. You tell them immediately - in fact, you tell the recruiter before you even get there - say you cannot move for some time and that the recruiting company will have to accept this. Those that do not want a remote worker then do not need to waste their (and your) time in interviewing you for a position that you will never take.
Forget negotiating or anything like that, unless you're really hot property (eg some CEO candidate that ends up "working" from home 5 days a week...) then you have to fit into their requirements, and if they don't allow remote workers then there will be no position for you there.
Once you have revealed this information, the ball is in their court. If they still want you for interview - go for it (and remember you may go to some that said, "come to interview anyway" only to find they have a 100% no remote work policy, or that even the interviewer will be surprised you came - big companies often screw communication up like this), but if they've asked you to come, its entirely their responsibility to suggest a suitable solution.
Answer: Software developers can be very rare, especially specific skillsets. A lot of employers are willing to pay whatever it takes to hire certain skillsets, which is why they've taken the initiative to contact you, instead of the other way around. If there are more than two people contacting you, that's a sign that your skills are in high demand.
You should first try to make it clear where you live and that you're not moving because of your significant other. Sometimes employers hope that you're willing to move if the pay is high enough. Some even offer living space and hope that you'll take it. Make your situation clear, but don't negotiate the conditions until they bring up the topic of pay. That way, they won't be rudely surprised.
You hold the edge in negotiation here, so request what you like.
You can negotiate for probation, meaning that either of you can leave on short notice. Employers tend to like this in countries where it's expensive to fire a poor worker, and when they're worried about the performance of an unrecommended employee.
If those jobs are within uncomfortable travelling distance (e.g. a 1-2 hour commute), negotiate a very high salary which you're willing to take to do that job. Best case, you'll get that very high salary but have to wake early and sleep late. However, don't be insultingly high. Request a comparable salary to people with uncomfortable working conditions, like offshore engineers.
If you're doing probation, you can ask for partial remote work. If your expected salary is $5k/month, ask for say, $3k with two days per week working remotely. And then request the proper $5k/month salary at the end of your probation (which means that they approve of your performance). That's an extremely good deal to many employers because they get 'free labor' and no risk. You're also playing the 'free trial' sales tactic, and people are very reluctant to switch after a free trial.
Comment: Thank you for the information. In my email I've made it very clear of my situation and that I have the intention of following through their process if they are willing to accept remote work, by answering all of their questions in addition to telling them that I can't really move.


Is it better to wear one pair or two pairs of socks while hiking?

Question: From personal experience I tend to wear two pairs of socks, normally some running socks and then my hiking socks on top of that. It helps me avoid blisters. Quite a few of my friends thinks this is nonsense. But with well worn-in boots I always tend to get more blisters if I wear only one pair. Does anyone know if there is any scientific reason for this? or is it just an old wives tale?
Answer: Hiking blisters are from friction.  When things shift, your sock is more likely to stay with your boot than your foot as the two fabrics (or leather and fabric) will catch each other.  This leaves the sock moving against your foot, which causes friction.  When you wear two socks, specifically a smooth liner and a wool hiking sock, the outer sock moves against the inner sock instead of against your foot and less friction is created.  Less friction = fewer blisters.
For the same reason, two pairs of wool won't work as well as what you currently do because the wool is likely to bind and behave like one sock instead of two
Comment: I've always had two pairs, and never even known why. Thanks for this info !
Comment: @brentonstrine I would not use silk, its not as durable. A good synthetic or synthetic-cotton mixture should work well.
Comment: So silk is a better liner if you have wool socks? Or synthetic?
Answer: There are a lot of unspecified variables involved here... type of socks, fit of the shoe/boot, type of shoe, conditions you are hiking in, etc.
But in general, double-socking may offer the following which may help prevent blisters:

reduced friction - assuming one sock is a thin slick liner sock which tends to stick to your foot while the outer sock sticks to the boot thus keeping the rubbing happening  between the two.
moisture control - a liner sock can help wick moisture away from your foot. Dry feet are happy feet.
additional padding - can prevent hot-spots and pressure points (or can create them, depending on the fit of the shoe)
can help take up space - shoes that fit too big can rub more
leech control - two pairs of tight woven socks have served me well for 2 years in the tropics
warmth - adds additional insulation (though if your boot is a tight fit, this can actually work against you as you decrease circulation/air space...)

If the question is whether double-socking is better, that is unanswerable and totally a question of personal preference. If 2 socks work for you, and reduce blisters, go for it. For other people's feet / shoes, 1 sock may be better. I've even worn 3 socks when my shoes were big enough, and I have hiked with people who wore no socks without issue...
If the question is whether two socks are proven to reduce friction - even that depends on the fabric of the socks, the material and fit of the boot, the foot, and the environment (hot, cold, wet, dry, etc...).
Comment: It would be great if people who down-vote provide some feedback as to why...
Answer: FWIW Ten years ago everyone in the Canadian Forces were issued wool socks.  Now they are all issued two-pair sock systems. Personally I never once got blisters with wool socks but I always kept my boots tight.
Answer: Two pairs of socks reduces friction and absorbs more moisture, both of which help prevent blisters.
Personally, I prefer thin neoprene socks underneath thick wool socks.
Answer: The esoteric "answer":
Try footwraps.
Advantages:

dirt cheep
can be wrapped in any preferrable way, to provide the most padding against the most aggressive edges of Your shoe
at a short break(5min) - re-wrap the footwrap in the opposite direction i.e. the cloth, that is wet from the sweating feet goes up against the ankle and calf to dry out and vice versa
at lunch break(30min) - put the footwraps in the sun and wind. A footwrap has a lot more surface area than a sock!
at night - let the footwraps aerate - they will be fine for another day, due to abovementioned property
a (clean) rectangular piece of cloth could have much alternative uses than a ... pair of socks

Disadvantages:

can take up to 1 minute to put them on
I have heard of only cotton as materilal. If you can afford proper technologically-advanced socks, I would expect foot wraps to be inferior (provided breathable boots are used).

stolen from Wikipedia
Comment: +1 I never heard about this before, but I really like the concept :) Will ask a question about how to bind them.
Comment: @amphibient it is. But if properly wrapped, they not only do not create hotspots; to the contrary - they allow you to put additional padding on hotspots of the shoe itself. This is targeted at **lower-end boots** - the 200EUR ones never have hotspots.
Comment: this looks really messy and a lot of work + the creases can cause uncomfortable and blister-inducing lumps inside your shoes
Answer: I wear two socks every day. In fact they're just cheap cotton socks that I buy from Walmart. Although my friends think I'm ridiculous for doing this, it does decrease friction, it aborbs sweat, my feet blister much less, less callouses, more cushion, less stink. My friends even challenged me to go back to one pair of socks for a while, but it bothers me too much, so after trying it, I never went back to single socks again. Again, this is just experience with cheap cotton socks.
Answer: My opinion is that using two pairs of socks is nonsense - there will be folds then, resulting in stronger impact of friction and more blisters. It would be better to use good "functional" socks that keep the foot dry. I think the moisture is the worse thing for blisters.
Comment: I agree that it's good to have functional socks, but I think "nonsense" is a bit strong.  I gave the down vote solely for the "nonsense" part because I think it's a bit dismissing of the other viewpoints.


Knuth's 5 volume TeXbook A,B,C,D and E

Question: Can I freely download the Knuth's 5 volume set books COMPUTERS and TYPESETTING in pdf and the source of TeX and METAFONT that these book contain and a compiler for the sources that would understand them ?
If so, from where ?
Comment: No, you cannot. The TeXbook is copyrighted by Addison-Wesley and _only_ its source is freely available for direct reading, not for compiling (as a matter of fact, you get an error if you try to do so). I'm not sure about the other volumes, but I believe the rules are not too different.
Comment: I'm pretty sure that the sources of volumes A-D are included in (the full) TeX Live.  I don't know of any public source of volume E (the Computer Modern fonts), since it was largely created from separately produced "diagrams" of the character images, and (I believe) pasted up.  The Metafont code for the characters is included in TeX Live.
Comment: @StephenE.Sun Welcome to tex.sx.  This is TeX's tuneup year, and there *will* be updates.  I have learned that there will be updated copies printed, so please wait for updated information.
Comment: @PhelypeOleinik Thank you for the clarification. And the sources are available for the direct reading from where ?
Comment: As of now (1/20/2021), all 5 volumes (A through E) are back-ordered through Pearson's web store! You will get an e-mail from Pearson saying that if the back-ordered item(s) could not be fulfilled by one month, your order will be cancelled! I just checked Amazon.com, the price of a new copy (vol A only) is almost $1000!
Answer: No, you cannot.
All the books in Computer and Typesetting are copyright of Addison-Wesley and cannot be distributed without permission. Knuth, however, has made all the sources to these books and his programs freely available for people wanting to learn how to use TeX and METAFONT. However the sources (of The TeXbook and The METAFONTbook, at least) make it clear that you are not allowed to try to make the PDF yourself. If you do, you are greeted with an error (and an endless loop):
This is TeX, Version 3.14159265 (TeX Live 2019) (preloaded format=tex)
(./texbook.tex
! This manual is copyrighted and should not be TeXed.

Volume A, The TeXbook is copyrighted by Addison-Wesley and only the source is freely available for direct reading. The very first lines of texbook.texsay:
% This manual is copyright (C) 1984 by the American Mathematical Society.
% All rights are reserved!
% The file is distributed only for people to see its examples of TeX input,
% not for use in the preparation of books like The TeXbook.
% Permission for any other use of this file must be obtained in writing
% from the copyright holder and also from the publisher (Addison-Wesley).

Which means you can read the source, as learning material, but you cannot run tex on the source. As a matter of fact, you get an error if you try to do so.
Volume B, TeX: The program, is distributed in PDF (only the documented source) and you can access it with texdoc tex, and the source is available from CTAN.
Volume C, The METAFONTbook is released under the same license as Volume A. At the beginning of mfbook.tex you see:
% This manual is copyright (C) 1986 by the American Mathematical Society.
% All rights are reserved!
% The file is distributed only for people to see its examples of TeX input,
% not for use in the preparation of books like The METAFONTbook.
% Permission for any other use of this file must be obtained in writing
% from the copyright holder and also from the publisher (Addison-Wesley).

and you also get an error if you try to tex it.
Volume D, METAFONT: The program, is distributed in PDF (only the documented source) and you can access it with texdoc -l mf and then selecting mf.pdf, and the source is available from CTAN.
Volume E, Computer Modern Typefaces, is distributed scattered among the sources of the Computer Modern fonts (CTAN page). I don't know if there is an available PDF version of this one.
Comment: No downloadable pdf version of volume E, and no ebook version is listed at the publisher's site.
Comment: A couple of notes: For Vol (A) and (C), note that the sources of texbook and mfbook are best used with a physical copy of the book by your side, for looking up how something was done. For Vol (B) and (D) (the programs), note that the physical books have a small amount of additional introductory material, also every two-page spread has a useful "mini-index" of just the variable names that occur on (or index entries relevant to) those two pages. Also, for all of these (A), (B), (C), (D), what's available online is missing Duane Bibby's illustrations which are present in the physical books :-)
Comment: For Volume (E), an earlier version of "The Computer Modern family of typefaces" was [published as a Stanford Report in 1980](http://i.stanford.edu/TR/CS-TR-80-780.html) (PDF [here](http://i.stanford.edu/pub/cstr/reports/cs/tr/80/780/CS-TR-80-780.one.pdf) and [here](http://i.stanford.edu/pub/cstr/reports/cs/tr/80/780/CS-TR-80-780.two.pdf)) -- the typefaces have undergone many changes since then, but this should give one a rough idea of what is in the book.
Comment: @user2925716 Well, that's what those are. Volume B contains the documented source of TeX and Volume D, of METAFONT, so they will definitely be more technical, and Volume E is pure METAFONT code describing the Computer Modern fonts. Even the double dangerous bend paragraphs in _The TeXbook_ don't tell you about the gory details of TeX's implementation. Volume B dives right into them. It's... advanced :-)
Comment: @ShreevatsaR Thanks for your comment! Indeed, a physical copy would be ideal. One day I'll have mine :-) I have read about the introductory material of volumes B and D in an answer of yours here, some weeks (months?) ago. I can't seem to find that now...
Comment: @PhelypeOleinik I was disappointed by enormous technicalities of the books B,D and E, they were unlike A and C which were joy to read. B,C and D are full of unintelligible Pascal-like metacode which moreover cannot be modified and run.I don't think it will pay to buy the other volumes B,D and E.
Comment: There is a pdf version of Volume E, *Computer Modern Typefaces*.

Knuth's 5 volume TeXbook A,B,C,D and E


Can I start a 6-month internship in Germany under a Schengen visa?

Question: I am a non-EU student currently studying in France, where I am residing with a French residence permit (titre de sejour), which in theory lets me do a 90-day internship in Germany. I have received an offer to do a 6-month internship in Germany, but the start date is too close and I am worried my visa will not be processed in time. Would it be possible to start the internship and work for up to 90 days until I receive my visa, and then finish it when/if I receive my visa within those 90 days?
If not, is it possible to sign a short-term internship contract (60 to 90 days) and then sign another, longer-term contract that starts as soon as the first one ends, and do the first one without a visa while I wait for the visa for the second internship to be processed? Thank you.
Comment: This is a question that you should ask the employer, since they will be the one that will have to pay a **very large fine** if they don't get it right.
Answer: French residence permit (titre de sejour), DOES NOT let you do a 90-day internship in Germany or in other country than France.
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: a few facts:  (talking about compulsory internships!)

An EU residence permit acts like a tourist visa in other EU countries.

An internship is a type of employment; a foreign permit doesn't allow you to work in Germany.

The employer must obtain the labour office's approval for the internship (unless the internship is for less than 90 days).

You still need a national visa for an internship (up to 90 days or more).

The visa must be applied for at the competent German embassy (France).

Volontary internships are considered regular employment (immigration law).
Answer: No. The Schengen (tourist) visa does not allow you to work, and cannot be converted to a work visa. This is explicitly disallowed, and some immigration offices (like Berlin) explicitly warn you about this when you apply for a residence permit.
§5 Abs. 2 AufenthG: https://www.gesetze-im-internet.de/aufenthg_2004/__5.html
Comment: Where would that be *explicitly* disallowed?
Comment: I fail to see the relevance of the new link. This is about residence permits, the legal basis for Schengen short stay visas is completely different (it's an EU regulation), it says nothing one way or the other about working on a short-stay visa. What is indeed disallowed (in Germany and in many other places, with a few exceptions) is to transition from a short-stay visa to a long-stay residence permit but that's not the question at hand (the OP has already applied for a visa).
Comment: I updated my answer
Comment: A schengen tourist visa and a residence permit are completely different things.


How can I target text-based browsers?

Question: I'd like to include mark-up that makes it easier for users of text-based browsers (links, elinks, lynx) to consume my site.  I'll be able to serve this special version of the site based on useragent, however what mark-up features do text-based browsers handle especially well?
Comment: You might want to look at general accessibility guidelines: http://www.w3.org/TR/WCAG20/
Answer: Your best bet is just to make heavy use of CSS for all the formatting. It's unlikely that text-based agents will support everything, so providng you drop all style info in an external stylesheet (mostly for ease of maintenance), and just use class attributes where needed, then you'll probably find the site degrades gracefully. Most (all?) browsers come with some form of developer toolbar so you can disable styles within, say, Firefox, IE, Chrome [whatever] on demand and you'll get an idea how it's likely to be seen by text-only browsers.
The only thing to be careful of is tables -- lynx doesn't support them, but other text-based browsers do (to a greater or lesser extent). Again, just make sure the page degrades gracefully as far as it possibly can.
Ultimately using CSS for all your layout and a chunk of your formatting should mean that most worries related to text-based should be resolved.
Answer: I don't know any special markup you would need for that. Maybe just less markup than usual. Use JS as little as possible since they have only marginal support. Any markup that is there to make site look "nice" in modern browsers when using CSS and fancy alignment is most likely worthless there and may be hindrance. Depending on content you might want use simple text. Or old style pages(quite some GNU pages like this). Example in on-line version of "Art of Unix programming" (http://www.faqs.org/docs/artu/index.html), very simple design that is easy to read and render anywhere. No fancy or any implied design, just text some links and you. Though it might not be suitable for all types of content. Basically keep it as simple as possible and try to avoid fancy layouts, or any layouts at all since some of these browsers simply render block elements one after another and menus that would be on left or right get to bottom or take up whole first screen with no content showing until one scrolls down. In my opinion horizontal top menus work best. And of course see how it looks for your self by testing and navigating there a bit.
Answer: You can check for the user agent string. Here is a comprehensive list. You could check for lynx, links, elinks and w3m. However, it's better not to check for the agent string at all, and keep the html clean and simple. Some of the text-mode browsers, like elinks, does have some javascript support. The CSS-support varies, but the underlying html would still work.
Some text-mode browsers, like links, have a graphic mode, where images can be shown as well.
If you stick to , ,
,
,  and use alt="..." for any images, you can't go wrong.
Answer: To best server text-based browsers, ensure that you use simple, semantic markup. Keep the mantra "Content is King" in mind as you build your site, and design the structure around  the content rather than around a visual template.
When your content takes precedence, your page will be uncluttered by the extra markup and visual elements that may confuse the text-based browsers.

How can I target text-based browsers?


What is an appropriate layer size for the first layer?

Question: What is considered a 'good' layer height for the first layer? Should it be relatively smaller than the other layers, or should it be considered relative to the nozzle diameter? Can the community suggest an appropriate layer height for the first layer with justification?
Answer: It all depends on the bed flatness you can ensure. Do you have a super flat bed? Then you can use the first layer identical to other layers. You don't trust or you can't guarantee flatness? then increase the first layer thickness up to 25%.
Keep in mind that "bed flatness" depends on three elements:

intrinsic flatness (milled aluminum tooling plate or glass bed, vs rolled and wavy aluminum plate?)
rigidity of the X and (for coreXY) Y rails/rods plus the weight of the print head (do you have thin rods or a heavy print head, which gets closer to the bed when in the center? or stiff rails and lightweight head which bends only by few microns?)
availability and accuracy of the bed levelling (are you doing bed levelling? It can compensate for the previous effects if properly done).

Depending on the three factors you may need to print a thicker first layer to ensure that the printed layer is never too thin or too thick, or you may ignore the issue.
Ellis' Print Tuning Guide: First Layer Squish may help as well, after you decide which first layer thickness to use.
Answer: As most answers here: "That depends on your preference and needs"

If you prioritize bed adhesion you might want to compensate for an uneven bed surface/ level and maximize the layer height, which is around 60/75% of your nozzle width. (typical .3mm layer height for .4 nozzles). Couple this with a 200% initial layer width for optimum stickyness.
If you prioritize for quality you might just use the same layer height as the other layers, although the layer height difference is hardly ever noticeable.

I can't think of a reason to make the first layer height lower than the other layers. It would just make the bed leveling more difficult and add no detail.
Answer: If the first layer is so thin the bed clearly shows through, your extruder is skipping steps unable to push enough filament, or the nozzle drags over the bed surface, you're too low.
If the cross-section profile of the extruded thread of filament is round, first layer of a print results in separate threads of filament with gaps in between or parts bulging, detached from the bed, filament doesn't form clear sharp corners where it turns 90 degrees, or becomes detached, you're too high.
The right height is when the filament is smeared somewhat flat, but still with noticeable thickness. And considering inaccuracy of printer rails, bed, drive trains, achieving such profile throughout the entire bed surface, never getting into 'too thin' or 'too thick' is what you strive for. Whether it's 0.07 or 0.13mm, doesn't really matter, what matters is it doesn't go below or above the range at any point of the bed.
A typical 0.4mm nozzle with 0.1mm first layer height is most likely to achieve this, but when in doubt, too thin will only result in dimensional inaccuracy and thinner bottom; too high will result in poor adhesion and may end up with the whole print detaching from the bed.


how to add values to a dictionary inside a dictionary of a property list

Question: I am currently creating a controller class for my plist.in this plist I have a root dictionary that has several types in it (Number, String and Dictionary), In my controller class I check for a plist then add it to the documents so I can read and write to it.
From here I read whats in my current plist and pass those values over to tempvars I have set up in this class.
This is what my read method looks like in my plist controller class.
-(void) readPlistData
{
    // Data.plist code
    // get paths from root direcory
    NSArray *paths = NSSearchPathForDirectoriesInDomains (NSDocumentDirectory, NSUserDomainMask, YES);
    // get documents path
    NSString *documentsPath = [paths objectAtIndex:0];
    // get the path to our Data/plist file
    NSString *plistPath = [documentsPath stringByAppendingPathComponent:@"EngineProperties.plist"];

    // check to see if Data.plist exists in documents
    if (![[NSFileManager defaultManager] fileExistsAtPath:plistPath])
    {
        // if not in documents, get property list from main bundle
        plistPath = [[NSBundle mainBundle] pathForResource:@"EngineProperties" ofType:@"plist"];
    }

    // read property list into memory as an NSData object
    NSData *plistXML = [[NSFileManager defaultManager] contentsAtPath:plistPath];
    NSString *errorDesc = nil;
    NSPropertyListFormat format;
    // convert static property liost into dictionary object
    NSDictionary *temp = (NSDictionary *)[NSPropertyListSerialization propertyListFromData:plistXML mutabilityOption:NSPropertyListMutableContainersAndLeaves format:&format errorDescription:&errorDesc];
    if (!temp)
    {
        NSLog(@"Error reading plist: %@, format: %d", errorDesc, format);
    }
    // assign values
    self.protocolSignature = [temp objectForKey:@"Protocol"];
    self.requestNumber = [temp objectForKey:@"RequestNumber"];

    //How do I add the dictionary values here?
}

The reason I put the data into variables is because latter I am going to use these values to test against checks I want to perform against my db.. making sure of things like i am receiving the correct request number etc.
UPDATE:: my idea to add them to the dictionary inside the root dictionary would be something like this. which i think is not even close but it might give you a better clue to what I am trying to do.
self.cacheValue = [temp objectForKey:@"Cache Value"];
self.manufacturers = [cacheValue objectForKey:@"Manufacturers"];
    self.models = [cacheValue objectForKey:@"Model"];
    self.subModels = [cacheValue objectForKey:@"SubModels"];

any help would be greatly appreciated.
Comment: Can you give a basic example of the plist?  I'm not really following it in your example.  It sounds like you want to use a NSMutableDictionary?
Comment: I have updated with a screen shot of my plist as above, as you can see I am trying to figure out how to code the Cache Value dictionary and its sub values
Answer: I believe you want to do the following:
Define your cacheValue property in the .h as a mutable dictionary.
NSMutableDictionary *cacheValue;

Serialize the plistXml as a NSMutableDictionary:
// This is the root Dictionary
NSMutableDictionary *temp = (NSMutableDictionary *)[NSPropertyListSerialization propertyListWithData:plistXML options:NSPropertyListMutableContainersAndLeaves format:NSPropertyListXMLFormat_v1_0 error:&error];

Since everything is mutable, you can now read, update, insert, delete any part of the dictionary or its subcontents.  For instance, grabbing the Mutable Dictionary "Cache Value" is just:
self.cacheValue = [temp objectForKey:@"Cache Value"];

Remember to check that the object is not nil in case there isn't a value for the key.  The key needs to be exactly as it appears in the plist.
Updating a value in the Mutable Dictionary is easy:
[self.cache setValue:@"New Value" forKey:@"Sub"];

And finally, to save the changes in the root Mutable Dictionary back to the plist:
/*
 The flag "atomically" specifies whether the file should be written atomically or not.
 If flag is YES, the receiver is written to an auxiliary file, and then the auxiliary file is renamed to path.
 If flag is NO, the dictionary is written directly to path.
 The YES option guarantees that path will not be corrupted even if the system crashes during writing.
 */
[self.temp writeToFile:plistPath atomically:YES];

Hope this helps, cheers!
Comment: okay thank you I am going to attempt this implementing your solution now. I will let you know how I go :)
Comment: thank you for teaching me about `NSPropertyListMutableContainersAndLeaves`.


Moving object in only one axis

Question: I am a near total newb with a frustrating issue. Doing Blender Guru's tutorial making a donut and cup, I am trying to move the saucer in line with the cup/mug. It seems totally easy. I align it properly on the X&Y axes then proceed to move it on the Z using (G)(Z). Confusingly, it also moves forward on the X. I tried not touching the mouse and also hit the two keys at the same time thinking that I am nudging it. Time and again, it moves on multiple axes.
Comment: You've got to know _which_ Z you're constraining to. (Global, Local, Normal, etc) That space is changed in the  Transform Orientation drop-down in the header. Tapping Z _twice_ should always put you in Global coordinates.
Answer: Make sure your using the global axis which is located at the top of your screen in the middle
Answer: Thank you for the information on checking that I'm using Global. The problem persisted regardless. It appears that the issue was that I had 'Snap to' on. With the peek into the fact that there are multiple constraints, I'm working my way through the Udemy Blender Encyclopedia course to see the super basic stuff that I missed by jumping into online tutorials.
Answer: Is there a way to set the axis you want, and then using the arrow keys the users can nudge along the selected axis?
Comment: This does not provide an answer to the question. Once you have sufficient [reputation](https://blender.stackexchange.com/help/whats-reputation) you will be able to [comment on any post](https://blender.stackexchange.com/help/privileges/comment); instead, [provide answers that don't require clarification from the asker](https://meta.stackexchange.com/questions/214173/why-do-i-need-50-reputation-to-comment-what-can-i-do-instead). - [From Review](/review/late-answers/160207)

Moving object in only one axis


Once a package is deployed, are the components immediately visible?

Question: I created a VF page, packed it and deployed to a staging org. I am not able to see my VF page in the staging org. Is this supposed to be this way or I should usually be able to see it immediately? I could see my package in my Package Manager, but I it is not installed, so I suppose I should install it now in order to see the page
Comment: Once successfully installed, all components are immediately available. Are you sure you saw "Installation successful"? Sometimes, you'll get a message that installation will occur asynchronously and you'll be notified by email when it completes. Once it completes, the page will be there.
Comment: I used the CLI to deploy. After the deploy command I received a Status: Successful. I am not sure if this necessary means that it was installed or just deployed. If so, I am not sure how to install now. If not, then there must be something wrong
Comment: No, it's all in real time. Once you see success, it's available. Did you make sure it's in your package.xml? Any errors or warnings? There's a lot of things that can go wrong with the CLI if you're not used to using it.
Comment: This is a screenshot of the CLI: https://imgur.com/a/pubcv
It shows that the unpackages.zip was deployed, which contained my package.xml. In regard to errors, however, I noticed that when in the Package Manager, I click on the package name itself, I see something like:

Bad References Found
Please press Recompile All or edit and resave the following items

Screenshot:
https://imgur.com/a/0ofEX
Answer: The pieces are there. The community needs to be activated or deployed or published or whatever it's called.


How to test my makefile for all supported configurations?

Question: As you know, make is dynamic and makefiles can be written to build for different environments and configurations. How can someone test such makefiles? Since its totally infeasible to explicitly run it on each supported environment/configuration?
Answer: All you can do is the best you can do; test on as many of the supposedly-supported configurations as you can.


How to change priority of program in system monitor?

Question: I'm trying to change priority of processes so the games I play have a higher priority for performance reasons, but I cant figure it out how to that. I've done some searching and found that you have to change the programs "nice" value (or something like that), however I always get lost and confused when following their explanations.
Answer: To change priority of a process, open system-monitor with root privileges. But if you are using Ubuntu 18.04+, GNOME system monitor which is installed by default is a snap package which fails to open with root privileges. So, install gnome-system-monitor` from APT first. Run:
sudo snap remove gnome-system-monitor
sudo apt install gnome-system-monitor

Run GNOME System Monitor with root privileges:
sudo -H gnome-system-monitor

Right click on the process for which you want to change priority.


Ways to connect 14 AWG to small PCB solder tabs

Question: I have 14 AWG wires that need to connect to the + and - of the below PCB board.
What way should I connect it to provide the cleanest look? Is there some sort of connector I can attach the wire to first, then solder to those tabs?
Comment: [Screw terminals](http://www.jameco.com/z/OSTTC022162-On-Shore-Technology-Connector-Terminal-Block-2-Position-200-5-08Mm-Spacing-Top-Screw_2120647.html) might be a good type of connector for this.
Answer: Those tabs are designed to have wires soldered directly to them. Trim the insulation so that it comes to the end of the board and the wire overlaps the entire pad. Pre-tin the pad and the wire and just melt the wire into place.
The two circular holes at the one end are for the XT60 connector which you will find on many LiPo batteries.
Answer: As this appears to be a voltage regulator powered by a LiPo battery, you should ensure that whatever connector you use prevents you from accidentally shorting the battery cables. For this reason i would avoid the screw terminals.
It also needs to prevent you from accidentally reversing polarity. The XT60 connector in the picture ensures both, so my 1st thought would be to use the same connector and an extension cable. Since the vias are plated I believe this is not too hard and it just might fit. If it does, read ahead. Otherwise you can skip the rest of my answer.
To help the solder fill the gaps, clean the via (hole) and the connector with something like isopropyl alcohol, check you have the correct polarity (the connector it the right way around so when the battery connects + goes to + and - to -). Apply some solder on both surfaces first and then solder the connector directly on the PCB. This last step might be a bit tricky if the inside of the XT60 connector legs fit too close to the sides of the vias in which case I would only tin the outer ends of the vias slightly - just to make better thermal contact when I touch the soldering iron.
If the gap between the connector legs and the via is to large, you could try filling part of it with some copper wire before soldering.
Comment: I am sure Molex makes a rectangular 2 pole PCB mount connector made of opaque white nylon which is polarized but i can't remember what it's called. Hopefully this will remind someone else.


Make this form send a php database query by setting Jquery Variables?

Question: I'm trying to convert jquery actions into variables that would eventually be sent off to a php query to search the database.
I'm thinking that some things such as text inputs can be stored as strings, while I'm unsure how I should treat checkboxes.
For example:
I have a checkbox such as 'please include all that interests you":
Beer
Wine
Sweets
Should I make each label a seperate TRUE/FALSE boolean in the database?
See my complete jsfiddle form and try to advise me (mind though,I'm a begginer in php,mysql and jquery :) )
Thank you everyone!
http://jsfiddle.net/pufamuf/TYT92/
Answer: You can use json for store all option.
For example you can store your form in a json string and pass it with jquery ($.ajax)
<code>{"hobbies": {"football": true,"cricket": false,"basket":true}}
</code>
try with http://braincast.nl/samples/jsoneditor/
and using json_encode and json_decode in php.
Answer: You can store those checkboxes variables as tiny int or Boolean in the database Or you can store them in a single column (text) data type as json format like this [{"beer":0,"wine":1}] .and that's in case of increasing those options in the future and also you can use json_ encode  json_decode to convert array to json format in PHP


Research schedule for postdoc application in mathematics

Question: I am currently applying for a postdoctoral research grant and one of the requirements is a schedule of research work.  In experimental fields such as biology I can imagine how such schedule may be structured, say from this to that date conduct this or that experiment. In mathematics where no hypotheses are tested in the same sense as in experimental fields, no data are collected (in general) and detours or changes in approach are not uncommon, how can such a schedule be outlined?
Comment: If this is about the grant applications from Academy of Finland, which is possible given the timing of the question, then the format is the same for all academic subjects. It includes mandatory discussion of ethics and data management, also. I suppose other funding opportunities might be similar.
Comment: This seems like an excellent question I'd ask my former (or current if that's the case) PI about. Surely they've written a fair share of research grants.
Comment: This sounds very strange for mathematics for exactly the reasons you mention. Are you sure they want an actual timeline?
Answer: I have never served on a grant committee, but I have experience as an applicant. Even though you obviously do not have any experiments or data collection planned, you surely have some idea of what you want to do, and how you want to approach that. And you know how many years you have available. By estimating the relative difficulties in each step, you should be able to come up with a rough idea of a timeline. What I believe they want to see is that you are able to give a realistic estimate of how difficult your proposed research is and how much time it will cost. You also might have different somewhat indepdendent projects in mind. Are you going to do the sequentially, or in parallel? Maybe you plan a research visit to another university. Answering such questions gives you a rough schedule that you can include in your proposal. I don't think it has to be very long or detailed.
Clearly during the course of the research it might be necessary to change the plan, because things did not work out as anticipated. But that is no different in other disciplines I am sure, and the reviewers are surely aware of that.
In short, the main goal in my opinion is that you should be able to show that you have a realistic assesment of how your proposed research can be completed in the alloted timeframe.


System of ODE - fundamental matrix

Question: I'm not sure how a definite integral is used in this context. Say I have the system $\vec{z}^{'}(t) = A\vec{z}(t) +\vec{a}(t)$ where A is a matrix.
Then the inhomogeneous solution is generally $\vec{z_p}=\Phi(t)\int \Phi^{-1}(t)\vec{a}(t)dt$ where $\Phi$ is the fundamental matrix. I can find the integration constant using given initial values. But I sometimes see it written like this:
$\vec{z_p}=\Phi(t)\int_{t_{0}}^t \Phi^{-1}(m)\vec{a}(m)dm$ Where m is some dummy variable and $t_0$ is that of the initial condition. How does that generally get us the same result as the indefinite integral?
Answer: Analogous to the usual calculus result, for a vector-valued function the definite integral
$\int_{t_0}^t \vec{F}(m) \; dm$ is one antiderivative of $\vec{F}(t)$, and the general antiderivative is $\int_{t_0}^t \vec{F}(m)\; dm + \vec{c}$ where $\vec{c}$ is an arbitrary vector.  So your $\vec{z}_p$ is one particular solution of the differential equation (that subscript $p$ stands for "particular"), and the general solution is
$\vec{z}_p(t) + \Phi(t) \vec{c}$.

System of ODE - fundamental matrix


oracle-adf: Inserting the value of an input box

Question: I'm working with Oracle ADF and I can not get a simple feature, practically, the value of an input box (from a binding) must be stored on the database in a table other than the original? How do I go about using the ADF? Do you have ideas, example?
Answer: maybe create a separate EO/VO for the other table and simply copy the value from one bound field to another? I assume you have a button to commit changes. The backing bean code could copy the values, or use a setActionListener tied to the button to copy the values.
Answer: It can be done both programmatically and using adf-bindings. which one do you want?Be specific on what you ask


For normality testing, should biological replicates be averaged or should all values of each subgroup be evaluated as independent data points?

Question: I have performed an in vivo study evaluating splenic white:red pulp ratio as determined by AI on histopathologic slides (neural network trained and validated per published guidelines).  The questions being posed are what impacts do radiation source and/or dose have on splenic lymphodepletion as measured by white:red pulp ratio. The experimental design is four sources of radiation, each with four different doses. Each source/dose combination has 3-5 biological replicates (individual mice).  When assessing for normality, should these biological replicates be averaged, then assessed for normality (4 values for each source or dose) or should all values of each subgroup (source and dose) be tested for normality as independent data points (resulting in 14-20 values for each source or dose)? Ultimately I'm trying to decide if parametric testing (two way ANOVA with Tukey multiple comparisons) should be used or no parametric testing (Krystal-Wallis with Dunn's multiple comparisons).
Comment: Please tell us what you are assessing for Normality and why.
Comment: What method requires normal data?  Some (like OLS) require normal errors for some purposes.
Comment: Please register &/or merge your accounts (you can find
information on how to do this in the **My Account**
section of our [help]), then you will be able to
edit & comment on your own question.
Comment: Please also say more about the data: How do you measure the "splenic white:red pulp ratio"? What hypothesis are you trying to test? My guess is that there will be a better way to accomplish your goals than with the ANOVA or linear regression that you seem to have in mind. Please provided this information by editing the question itself, as comments are easy to overlook and can be deleted.
Answer: Choosing whether to do a parametric or non-parametric test based on an initial assessment of normality is not good practice. See this page for extensive discussion. Even if you were to evaluate normality, that is best done on the residuals between observed and predicted values after building a model, not on the original values before modeling.
It's probably risky to do a standard parametric ANOVA when the outcomes are ratios, as you have here. It might be OK, depending on the details of the data, but if there are extremes of lymphodepletion at some dose/source combinations then it probably won't work well. As Frank Harrell points out, a proportional odds ordinal regression model is a useful semi-parametric generalization of Kruskal-Wallis and similar non-parametric tests. In your case it could quite easily handle your 4 source by 4 dose experimental design.
Answer: "Replicates" in bioassays are usually used as a method for reducing measurement noise, and sometimes as a way to decide on whether a run of the assay was a technical success. The variation between technical replicates is of little interest and so the technical replicates are typically averaged to give a single datum that is used in statistical analyses.
The variability of interest will be the variability between mice. Use the averages of your technical replicates and you will have one measurement per mouse. Using technical replicates as individual data points is often called 'pseudo-replication' and it is a very bad thing in many circumstances.
Having said that, a sample of 3 to 5 mice is far, far too small for any meaningful result from a test for normality. Many would argue that it is far too small for a meaningful result from any experiment, but I will allow that some biological effects are so large that a tiny sample like that can occasionally suffice.
Comment: @dipetkov I would guess that it would probably not matter much, but would advise researchers to nail down their protocols for experiments in preliminary runs. The preliminary data can be analysed, but only to give indicative results that are used to design the 'proper' experiments. Good experimental design is far better than band-aid statistical approaches.
Comment: Averaging technical replicates simplifies the analysis for the reasons you describe. However, what if there are different (& known) number of replicates per experimental unit (mice)? Should this be taken into account because the average measurements have different std. error?


Is the effective nuclear charge only defined for valence electrons?

Question: I've just been taught about the effective nuclear charge and screening effect in school. I'd like to ask and confirm if the effective nuclear charge is only defined for valence electrons. If not then why don't we consider the repulsion from the electrons further away from the nucleus than the test electron, which by common sense should add to the attractive force by nucleus?
Comment: In chemistry you often worry only about the outermost electrons. In atomic physics they worry about more of them (e.g. levels leading to x-ray generation). As you have noticed, trying to pack all the effects into one parameter (effective nuclear charge) doesn't work so well for all of the electrons.
Answer: $Z=Z_{eff}+\sigma$, where $\sigma$ is shielding constant calculated according to Slater's rule. Since Slater's rule can be applied to any electron regardless of whether or not it's a valence electron, $Z_{eff}$ and $Z$ can be defined for any electron too, $Z$ in particular remaining constant. In his paper, which I have attached below, Slater states that the approximations to the wave functions that he gives have been obtained empirically, and do not involve any of the outer electrons.
References:
https://chem.libretexts.org/Courses/Mount_Royal_University/Chem_1201/Unit_2._Periodic_Properties_of_the_Elements/2.06%3A_Slater's_Rules
Original paper by JC Slater ($1930$):
https://web.archive.org/web/20120323031605/http://astrophysics.fic.uni.lodz.pl/100yrs/pdf/04/008.pdf
Comment: @Buck Thorn thanks for the feedback. I have edited.
Comment: Can you please elaborate how the Slater's rules explain the effect of outer electrons empirically?
Comment: Explain, as in according to slater's rules the calculation of shielding constant only involves inner electrons. That is what I meant.
Comment: This still doesn't answer the question. Why don't the outer electrons matter?
Comment: The use of the word "think" makes this sound opinion-based. If you remove that and expand on your last sentence plus add some references this would be greatly improved.


Finding a directory in a Linux Terminal

Question: How can I find a particular directory in a terminal window in Linux? I think it involves using grep, but I'm not sure how.
Comment: you have to provide at least some search criteria, "particular" is a bit vague. one can find items on the disc based upon names, relation ships, sizes, content, etc etc.
Comment: removing `find-in-files` tag since you are locating a directory, no file-content-search is implied.
Comment: What do you know about the directory that would allow you to find it?
Answer: Would you be looking for something like this?

find . -type d | grep DIRNAME
Comment: what's wrong with `find . -name DIRNAME -type d`?
Comment: @honk, Nothing `:-)` -- the OP seems to like `grep`; and we all like variety
Comment: whats the difference?
Comment: Five years later I did notice the answer in the comment was slower to process than the original answer. Maybe a glitch. Anyone? Bueller?
Answer: If you want to find a particular directory that might be anywhere on your computer, the following will work, but it might take a while.
find / -name DIRNAME -type d

Comment: And, if you want to `find` within the working directory -- replace '`/`' with '`.`' -- could get quicker.
Answer: If you have it installed, locate is designed for this.
Google "man locate"
Comment: Though locate won't provide you real-time results, but instead returns the results it gathered while updatedb was last run. If the filesystem doesn't change much, then it isn't a real problem and locate is very fast.
Comment: -1 Locate is designed to find files, not directories. Or is there an option I am not aware of?
Comment: locate works just fine for directories.

Finding a directory in a Linux Terminal


If we open a file using a program, but then later securely delete that file, is it possible for that file to be recovered via that program?

Question: Or I open a video using vlc media player, and later delete it securely. Does vlc "retain" some of the parts of that video even after deletion?
Comment: There's not enough info to say. It depends on the program (does it read in the whole file, or only part? Does it write temp data anywhere? Does it cache data in memory? Does it release memory to the OS when done with it?), and also on what you did (did you close the file in the program? Did you close the program entirely? When you "securely deleted" the file, what process did you follow?), and even on the OS configuration (do you use a swap file / swap partition? What is the disk caching behavior? Has released memory been either wiped or overwritten?)
Comment: Do you mean you open the file in VLC, then delete the file from disk, but you still have the file open in VLC? Or do you mean you open the file in VLC, close VLC, and then delete the file?
Comment: @CBHacking I think that could work as an answer
Comment: I know I can't see the file in vlc after its deleted, but can someone with sufficient technical skills recover it from vlc?
Comment: In my opinion I would avoid writing a file at all. VLC accepts data from stdin or a named pipe (e.g. with a long random name of the pipe). So you could VLC like a streaming player and never write a file to the file-system. If no file is written (and VLC has no disk cache or something like that) it is more secure than if you write a file and then try to delete it's content. https://wiki.videolan.org/Uncommon_uses/
Comment: @voila what do you mean by "see the file." You mean see the name of the file in a list of recent files? Or see a thumb nail of a video frame associated with the video? Or what?
Answer:
If we open a file using a program, but then later securely delete that file, is it possible for that file to be recovered via that program?

Because "a program" could be any program, it is impossible to say for sure. We would have to know the details about what the program does. And it could do anything. For example, this hypothetical program could write a temporary copy of the file to disk in a different location, in which case, yes you could recover the file "via that program."
It is common for programs to use temporary file space. Operating systems often provide an API for just this purpose.
Because there are so many (infinite) possibilities, no one can provide a definitive answer. But, nevertheless, I will try to answer at least partially below.

Or I open a video using vlc media player, and later delete it securely. Does vlc "retain" some of the parts of that video even after deletion?

Again, we can't say for sure. But, we can talk about some ways the file might or might not be retained.
First, as pointed out in the comments, "securely" deleting a file is not always possible. And the feasibility depends not only on the operating system, and the application-level tool (e.g., sdelete), but also on the storage media controller (e.g., Flash controller might not wipe a physical block even when the OS thinks the data is gone).
Second, the inner workings of VLC are complex and it is difficult to know everything it does with the file data. Certainly, one would assume it reads the file data into a memory buffer (in RAM) and the data is retained for at least a while around when the video was played and VLC is running.
If VLC is not shutdown, it's not unreasonable to think that you could recover at least part of the video file data from RAM. But, less likely the whole video file would be stored in RAM unless it is a small video, just due to RAM being much more limited than disk storage.
Third, it's possible that VLC makes temporary files to cache some data. If it caches part of the video to disk than it could be possible to recover part of the video even after VLC is closed (provided it doesn't clean up the temporary space).
Finally, some video metadata might be logged or otherwise stored by VLC. If VLC stores this data to disk, and they contain video metadata, then at least that portion of information about the file might be recovered. Based on some of your comments it seems like VLC stores some metadata such as the filename or thumbnail images and then presents those to the user. This metadata is presumably stored to disk if it is persisted across restarting VLC. (Metadata like this could also be persisted by the operating system rather than the application, e.g., Window's recently used file lists.)
These points illustrate a few more reasons why it is difficult to give a definitive answer, but hopefully these points help you understand the situation and provide a partial solution to your problem.
Answer: As an addendum to hft's excellent answer, VLC has historically been shown to continue playing files that have been corrupted/written over, as seen in this Vault7 leak. The media player was just a vector to demonstrate the root cause: retention of the "deleted" file in the filesystem read cache (which has now been refactored - the behavior shown was on a Windows XP system).


How is an elevator kept in constant velocity if theres no net force acting on it?

Question: I get that forces are what accelerates an object but if the tension force was equal to the force of gravity and the object was already in motion, would it really just move up? Hard to picture.
Comment: If the tension in the cable is balanced by the weight of the elevator, there is no *net* force and thus no acceleration. It is important to consider all of the forces acting upon the elevator.
Comment: This is Newton's first law in action. You say that you understand that forces are what cause acceleration, so I am confused about what you are asking.
Comment: I'm just confused because the cables will need to pull up the elevator and thats always a force so even if the tension is keeping the elevator from falling you have another force with the pulling of the rope by the mechanism on the top.
Answer: That's exactly how Newton's first law works. No net force = no acceleration. Note that "no net force" means that the cable has a tension equal to the force of gravity - and moving that cable under tension does require work to be done. So the elevator doesn't move "for free".
Think about a puck sliding on an air hockey table. Almost no net force, it glides along...
Comment: You apply a net force to get the elevator moving initially - after that it keeps going at constant speed - that's the idea of inertia. If you were in a parallel elevator moving up you would see the elevator appearing to be stationary and you would it be surprised - as you saw the tension in the cable balancing the force of gravity.
Comment: @GiancarloGatti  You need to think about two different time intervals during the motions: 1) an interval during which there is a non-zero net force so that the object accelerates, followed by 2) an interval in which the individual forces have changed so that there is zero net force and the acceleration ceases and the velocity is constant.
Comment: I guess what im not picturing is what keeps it moving. So I assume the force is the tension of the rope, but what abt the pulling up of the elevator isnt that counted as a force? I get the first law but to get the puck moving there has to be a force applied to it first and then we can say theres no net force in the "ideal" situation
Answer: The answer to your questions is ..... Yes it will go up with uniform velocity if the tension force is equal to the force of gravity given that it already has an upward velocity. As the lift gradually rises it increases the tension force slowly and then decreases it to the previous value (that it had when it was at rest). Yes force of gravity changes with height but that little change is little enough to be neglected. And after that just like @Floris said its Newton's first law. When both the forces are equal there is no force regulating it's velocity and hence its value does not change. It rises up with a constant velocity.
Answer: Even if there is no friction, we have to keep pushing on the elevator to stop if from falling down, pulled by gravity. But if it were far out in empty space, away from all gravity, the elevator would keep moving with constant speed in a stright line when we stop pushing.
What keeps the elevator moving is inertia. This is difficult to picture because it doesn't happen in real life, only in ideal situations such as empty space. In real life everything slows down and stops when we don't keep pushing it. That is because there is always some other small force like friction or air resistance which is present whether we push or not.


Do 2 bachelor's degrees look bad for PhD admissions?

Question: I am currently doing my second bachelor's degree after having gotten very sick towards the end of my first and not being able to take the classes that I wanted, or the sufficient research experience for a PhD. Does this look damningly bad for graduate admissions? I am also a little bit older and my grades towards the end of my first degree aren't so great (went from a 3.95 to a 3.2). Sorry in advance if this is a silly question, but I'm pretty nervous and don't know where else to look.
Comment: Best of luck to you Albert! Stay well, and in the meantime consider sharing what these two majors are and which area, if you currently have one in mind, you're eyeing for graduate work.
Comment: Thank you so much! My first degree was in Computer Science and my second is in Mathematics & Statistics. I'm broadly interested in probability & information theory, and am currently excited by the theoretical foundations of deep learning and cryptography, although I can't pick between the two yet!
Comment: What will you do with the answer? Since you're already doing it, are you going to stop? Or are you asking whether you should even apply?
Comment: I think I'd try regardless but just wanted to see if I'm being delusional, or if I should lower my expectations for where to apply just given my history.
Answer: There is nothing inherently problematic about getting two degrees. There is certainly nothing problematic about getting sick.  You appear to have went back to school a second time so the first is only loosely relevant.
One should not be generally concerned about "extra" education when you are going for a PhD. (I have met people with multiple PhD's in different subject areas.) Perhaps if you had 3 or 4 undergraduate degrees I may wonder about the intensity of the programs or if you were better served by outside activities/internships - but this can all be explained with a good letter.