Cython code for adaptive binning

Question: Here is my Cython code used for adaptive binning. The calcAdaptiveBinnedRateMap function is called from another Python script. The script is compiled using Cython but the speed I am expecting is still not great. How can I improve the speed of execution?
import numpy as np
import scipy.ndimage.morphology as ndimmor

#define sampline rate and alpha
cdef float samplingRate = 30.0
cdef double alpha = 0.0001 #skaggs and sachin use this value while Jim uses 0.001

"""
runs the iteration for adaptive binning till the criteria mentioned in Skaggs et al 1996 is met
INPUT: spike map, occupancy map, alpha, Number of occupancy (Nocc), Euclidean distance transform (dists)
OUTPUT: Nspikes (number of spikes), Nocc (occupancy count)
"""
def mexAdaptwhile(spikeMap, occMap, alpha, Nocc, dists):
    #initialize the variable
    cdef int Nspikes2 = 1
    cdef double rsq = 0
    cdef int EnoughPoints = 0
    cdef int Nspikes = 0

    #find the row and column count for occupancy map
    cdef int rowLen = int(np.shape(occMap)[0])
    cdef int colLen = int(np.shape(occMap)[1])

    #while the radius is less than 200 and enough points are not covered
    while rsq<200.00 and EnoughPoints==0:
        r = np.sqrt(rsq)
        #need to set these Nocc and Nspikes to zero, otherwise the two for loops above add the same spikes over again.
        Nspikes = 0
        Nocc = 0
        for i in range(rowLen):
            for j in range(colLen):
                #if the distance is less than radius
                if dists[i,j]<=r:
                    #add Nspikes
                    Nspikes = Nspikes + spikeMap[i,j]
                    #add occupancy
                    Nocc = Nocc +occMap[i,j]
        #if number spikes is greater than 0, then set nspikes2 = number of spikes
        if Nspikes > 0:
            Nspikes2 = Nspikes
        #check for the condition from skaggs et al 1996
        if (alpha*alpha*Nocc*Nocc*rsq*Nspikes2 > 1):
            EnoughPoints = 1 #set the flag to end the loop
        #keep increasing the radius
        rsq = rsq + 1
        #output occupancy = occupancy
        Noccout = Nocc
    return Nspikes, Noccout

"""calculate adaptive binned rate map
INPUT: spikemap, occupancy map (both of them just binned for 2cm/4cm no other operation applied on them)
NOTE: occupancy is still in terms of number of frames
OUTPUT: adaptive binned rate Map which is color adjusted
"""
def calcAdaptiveBinnedRateMap(spikeMap, occMap):
    #set unoccupied occupancy and spike corresponding to unoccupied position = 0
    spikeMap[0,0] = 0
    occMap[0,0] = 0

    #find the row, col index of minimum occupied and maximum occupied pixel
    row, col = np.where(occMap)
    minrow = np.min(row)
    maxrow = np.max(row)
    mincol = np.min(col)
    maxcol = np.max(col)

    #select the best fitting rectangle according to occupied area
    occMap = occMap[minrow:maxrow+1,mincol:maxcol+1]
    spikeMap = spikeMap[minrow:maxrow+1,mincol:maxcol+1]

    #matrix of zeros same size as of occupancy map
    z = np.zeros(np.shape(occMap))
    #variable to hold adaptive binned rate map value
    abrMap = np.copy(z)
    #variale to hold adaptive binned occupancy map
    abrOcc = np.copy(z)

    #check to endure if number of spikes is greater than 1
    if np.max(np.max(spikeMap))>0:
        #iterate over the values
        for x in range(int(np.shape(occMap)[1])):
            for y in range(int(np.shape(occMap)[0])):
                if occMap[y,x] > 0:
                    #pretend there's atleas 1 spike, and 1 occ.needed to avoid 0 threshold.
                    Nspikes2 = 1
                    Nocc = occMap[y,x]
                    d = np.copy(z)
                    d[y,x] = 1
                    #computes the Euclidean distance transform of the input matrix.
                    #For each pixel in BW, the distance transform assigns a number that is the
                    #distance between that pixel and the nearest nonzero pixel of BW.
                    dists = ndimmor.distance_transform_edt(d==0)
                    # function to keep on iterating while the condition mentioned in Skaggs et al 1996 is met
                    Nspikes, Nocc = mexAdaptwhile(spikeMap, occMap, alpha, Nocc, dists)
                    if Nocc < 12: #occupancy cutoff = 0.4seconds
                        #if less than 0.4 seconds set it to 0
                        abrMap[y,x] = 0
                        abrOcc[y,x] = 0
                    else:
                        #else equal to number of spikes/occupancy map
                        abrMap[y,x] = samplingRate*float(Nspikes)/float(Nocc)
                        #adaptive binned ocuupancy map = nocc
                        abrOcc[y,x] = Nocc

    #find the maximum value of adaptive binned rate map
    cmax = np.max(np.max(abrMap))
    if cmax > 0:
        #minimum = maximum value found above/60
        cmin = -(cmax/60.0);
    else:
        cmin = -1;
    #set adaptive binned rate map = cmin wherever adaptive binned occupancy map = 0
    abrMap[abrOcc==0] = cmin

    #return the adaptive binned rate map
    return abrMap

Comment: _the speed I am expecting is still not great, How can I improve the speed of execution?_ - What does this exactly mean? How many days does this function need to complete and to how many days would be optimal for it to run?
Comment: Crosspost of http://stackoverflow.com/q/42324609
Comment: Please update the title so it describes what the code is doing.
Comment: Did you profile your code?
Comment: I am still a learner, will do the profiling asap and get back
Answer: Make sure to declare all variables with Cython (otherwise the lines with such variables basically run with Python-speed). Especially important for the "for"-loop variables (i.e. i, j, x, y).
One can also use cython -a mycode.pyx to create an annotated HTML page that shows, which lines are running with C or Python speed, respectively.

Cython code for adaptive binning


3D manipulator stuck on left side of split viewport

Question: I'm using Blender 2.8. I split my viewport but accidentally moved the 3D manipulator to the right side- I don't know how I moved it nor how to move it back to the left side. The ride side is in rendered view. When I try to use the measure tool,  manipulator and other tools on the left side, I get an alert that says 'gizmo hidden in this view'.
Comment: Can you show on picture whats wrong ? Or go to C:\Users\UserName\Application Data\Blender Foundation\Blender and delete folder 2.8X
Comment: @SlobodanVidovic There is no need to delete that folder, it wouldn't fix the described problem anyway.
Answer: It appears that you've hidden the gizmos in the left viewport, which is why the Move gizmo is invisible and the Measure tool gives you an error message. Enable them by clicking the Show Gizmos icon shown below.

Ensure that the following options are enabled in Viewport Gizmos.

The exact error message is "Gizmos hidden in this view" which is printed by view3d_ruler_add_invoke() (view3d_gizmo_ruler.c) when the Measure tool is used and v3d->gizmo_flag has the V3D_GIZMO_HIDE or V3D_GIZMO_HIDE_TOOL flags set. V3D_GIZMO_HIDE is set when Show Gizmos is disabled and V3D_GIZMO_HIDE_TOOL when Active Tools in the Viewport Gizmos options is deactivated.


Place and/ or plane identification

Question: I am trying to identify both the place and the type of plane in this photograph. My father is inthe centre middle row (William Bone), who as far as I know stayed around Leeds during the war - I assumed that this photo was taken at Avro, Leeds but am not sure, and i haven't been able to track down any records for the factory there. However, i would be intereted to know what type of plane they are stood in front of.
Answer: The plane is a Fairey Barracuda, a torpedo/dive bomber of the Royal Navy. They were produced from 1941 to 1945.
Comment: I agree - the high wing placement is definitely more like the *Barracuda* than the *Battle*.
Comment: I think you're right - I missed the airbrake visible under the wing.
Comment: Many thanks ! Now just need to see if I can confirm these were maintained at the Avro factory in Yeadon, Leeds.
Comment: I can't find any source that Avro Leeds produced Fairey Barracudas. But Blackburn in Leeds did at least built major parts for the Fairey Barracuda.

Place and/ or plane identification


Using Customizer API vs Custom Meta Box for custom content

Question: I just started diving into the wordpress world and i'm trying to add custom content to a website, i looked at the Customizer API and Meta box and they seem to be both able to add what i want which is custom content but i don't know which one of them is suitable for that.
I'm trying to add list of services to a services page that i've created.
Comment: If you want to just add a list why not use the List Block?  https://gogutenberg.com/blocks/list/
Comment: @RiddleMeThis im not trying to add a list as in a normal list there custom blocks thats show each services with a title and description and icon
Answer: Like you mentioned, you could potentially use either one.
In your situation, I would probably lean towards using a meta box.  The Customizer is separated from your pages and posts, meaning you would have to go into Appearance > Customize to edit your list. While with a Meta Box, you can have that display directly on your page's edit screen.
There are obviously more differences between the two but that would be the main one for me.  You can read more about the Customizer here and Meta Boxes here.
Answer: Neither!
Neither of these really make sense
Why Not A Metabox/Post Meta?
What you're describing is not an attribute of a page, so it doesn't make sense as post meta shown in a metabox.
Additionally:

You can't link directly to post meta
Adding post meta to site search is difficult, and makes search 100x slower
And if you did manage that, users wouldn't see the service they wanted, they'd just see the generic services page
You'd have to write all the code to store and save it, then write it all over again to display it. Plugins can make it easier but it's still a pain in the arse
Only your theme would be able to display the data
Metaboxes are kind of legacy meh with the new block editor. It's all about custom blocks and sidebar panels now

Why Not A Control In The Customizer?
It also isn't a site wide control to customize how your site behaves and looks, so it doesn't go in the customizer! Besides:

Those get stored as options and theme mods, so it doesn't scale as the list of services gets longer
The newer iterations of the block editor are introducing the full site editing interface that replaces the customizer
It's not easy to develop for

What you're describing is content.
So, you have 2 options that depend on just how in depth your services are.
Page Content
If you're literally just listing them all on a page, why not just have a services page that lists them? You could use column blocks to do the classic image on the left, text on the right thing, cover blocks if you wanted a whole section, or even build your own block!
But, if you want to be able to link to a specific service, or have an entire page for a service, the next option would be better suited
A Service Custom Post Type
Use register_post_type to register a service post type. You'll get lots of free stuff ( they can be turned off when calling register_post_type too:

You'll get an archive to list services at /services ( configurable )
Free templates ( single-service.php and archive-service.php anybody? )
An entire new section of WP Admin in the sidebar dedicated to Services
Free REST API endpoints ( set show_in_rest to true )
RSS feeds!
Dedicated URLs ( yoursite.com/services/gardening? )
Basic integration with SEO plugins
Post meta! Now you can have featured images and all sorts of information about the services stored. So much more flexibility
Child posts! What if your services had sub-services? Perhaps that gardening service has multiple specialities to hire

With a CPT, you could even register a custom taxonomy to organise them! Wouldn't it be nice to have a Service Type taxonomy? A County taxonomy for where the services are available? With their own URLs! yoursite.com/services/county/derbyshire?
On top of all that, if you put the registration code in a plugin, the services post type will work with every theme!
Comment: They don't link to anything there just small boxes that shows on the services page (page-services.php) and the home page.
Comment: i didn't understand what did you meant by there not an attribute of a page ?
Comment: Well content is content, it belongs in the content. That's what gets indexed, searched, etc. Attributes are things about an item/thing, not the thing itself. So for example, the price of a product, the colour of a book, etc, information about the post that isn't the content/title itself. If these are just small boxes, then use content, be that blocks, shortcodes, images, etc
Comment: If i use custom blocks dose that mean you have to edit the services in every pages they show up on because i want them to show up on the home page as well as the services page ?
Comment: this is what im trying to do
Comment: https://i.imgur.com/GQKCja0.png
Comment: You can use a reusable block if you want it to appear in more than one place, but at this point we're no longer discussing WP development, but how to use the block  editor


what should I do when CDF is really high?

Question: I noticed today on Bitminter that the CDF is over 99% and the block session has been running for almost 12 hours now. what causes such a high CDF and is there anything that can be done about it?
Answer: CDF is a measure of the pool's (bad) luck in the near past. By the nature of randomness (and how it applies to the process of mining), every pool will have times of good and bad luck, and nothing can be done to fix that.
If you are mining at a pool using a hopping-proof method such as PPLNS or DGM, you don't need to do anything when the CDF is high. The CDF represents the pool's luck in the past, but your reward for continued mining depends only on the pool's luck in the future, and thus the CDF has no effect.
Answer: CDF will sometimes go high, indicating bad luck. Bad luck happens with all pools and miners, and there is really no cure for it, just like there is no cure for lottery tickets that aren't winners. Each hash is like a lottery ticket with a tiny chance of winning a block. If you have bad luck it will take a lot of lottery tickets before you find a winning one.
With more hashpower the bad luck rounds will pass faster. But there will always be rounds with high CDF that take a lot of hashes before the block is found.
Answer: Having a CDF of 99% just means that you've only had 1% to exceed such a long session. There is nothing exceptional about it - in particular, 1 in 100 sessions will inevitably take that long.
Comment: The should actually display the CCDF which is 1 - CDF because this is actually the semantics that one would be interested. c.f.: https://en.wikipedia.org/wiki/Cumulative_distribution_function#Complementary_cumulative_distribution_function_(tail_distribution)


kml network link styling

Question: I have a kml network link (parent) that loads a second kml file (child) that contains a set of polygons.  Currently the style of the polygons is set to a url within the child kml file.  I would like to be able to modify the style of the polygons at the level of the network link, without having to change the childs xml.  Is this possible?
Answer: Loading styles with a network link doesn't work. Well, it works, but
probably not as intended. Remove the network link in your.kml,
and instead of  use
. You might need to use an
absolute URI to reference styledefs.kml depending on how your.kml is
normally accessed.

kml network link styling


What are these streaks in negative scans I got back from a lab?

Question: I'm a beginner that's getting back into film photography after many years. I just received scans of my negatives and noticed some of them have streaking while others do not. I feel like this may have happened when the film was developed but I'm unsure. Perhaps it's the camera, the film or something I did? The film is Kodak Tri-x 400.
Comment: Look at the actual film.  Are these artifacts on the negatives too, or just in the scans?
Comment: Did you develop the negatives yourself? If so, did you use any wetting agent, squeegee the negatives, how did you dry them etc.  And are all the streaks in the same orientation?
Comment: Thank you for the responses! I sent the film to a Los Angeles photo lab to be developed and scanned. Some photos have the streaks and some do not. The streaks appear uniform. Based on the feedback, I'd guess it's the scanner as well. I'll be getting the negatives and a contact sheet in the mail soon so I'll definitely look closely at those. Thank you!!!
Comment: possible duplicate of [Why do my scanned images have lines across them?](http://photo.stackexchange.com/questions/15149/why-do-my-scanned-images-have-lines-across-them)
Comment: @thomasrutter you can if it is an A4 scanner with a negative scanning attachment (ie lightbox). Epson V370. HP Scanjet G3110. He didn't specify the type of scanner either.
Answer: Because the streaks are all in a perfect vertical orientation my bet is that the scanner is to blame.  While it's possible for streaks to happen while processing the negatives I feel that's pretty unlikely to result in the same thing.  And it won't be the camera.
Possibly the scanner was not properly cleaned or maintained.
The only way to be sure is to scan some of the same negatives with someone else, using a different scanner.  If the streaks are no longer there you can confirm that it was a scanning issue.
Answer: I am getting the same problem.  I bought a 100' roll at Henry's last Winter when it was half price.  I wonder if they know something  we don't.
Tried  Ilford HP5, Fomapan 400 no problem.  Went back to tri-x  and the streaks are back. Definitely the film is problematic
Answer: As noted, since the streaks are on some scans but not others, and presuming they don't show in the actual film, they occurred during scanning.
It's very likely the lab had some ripple in the power supply for the scanner, and if that's the case, they'll have had other customers affected.  You should contact the lab, show them the image you included above and any others, and point out that this problem seems to be in their scanner.  At the least, they should offer to rescan your negatives for free.
This may also be a hint to start processing your own negatives: you don't need a full darkroom, and you can buy the equipment needed (barring chemicals) for around $100 -- that's probably less than the cost of paying for process and scan (with shipping priced in) on five rolls.  I learned to process my own film at age nine -- it's easy.  There's a lot to know, but you don't have to know all of it to process Tri-X.
Once you have negatives, you can scan with a DSLR or even a top end smart phone camera, or you can buy a used film scanner for another $100 or less -- and then, if there's a problem, you can solve it yourself instead of having to ask how someone else screwed up.
Answer: some say its the static charge released by the holding tape on the 120 roll films, when pulled away from the backing paper in the dark there is always a static charge that is released, possible film fogging causing streaks..
Comment: This isn't fog from a light source of any kind -- it's too regular and not broad enough.  This is a scanning fault.


How can I print to a hp officejet j5780 printer without the color cartridge?

Question: My color cartridge is out and I want to print a gray scale picture.  However, the printer flashes replace cartridge (when the cartridge is in), and insert cartridge when I take it out.  I don't have a spare color cartridge and the black and white is fine.  I'm printing in gray scale but can't get the printer to get past the error message?  Any ideas?
Answer: This question was answered by pointing out that a color cartridge is sometimes necessary for greyscale printing.
A different printer was discussed, but the reasoning may be the same.
Comment: I was able to print from Windows 7 by going into the Color tab and specifying not only gray scale, but that the gray scale only use the B/W cartridge.


Can I go back to the rest of the level once I beat Mom?

Question: Am I really leaving behind everything on the Depths 2 after I enter the boss room? I had left behind a blood donation machine and a full health pill and everything else!
Comment: I want to say "no" you can't - but there's probably some glitchy way to do so (ie, telepills or similar).
Answer: Nope you can't revisit the rest of the level, not without some sort of teleportation.  From the BoI Wikia article on Mom:

You can't leave the room without teleporting, as the door is gone, so make sure to check every room and pick up every item you want before encountering Mom! (A door to the devil room may appear after a teleportation.)


What does it mean that Jacob had two concubines?

Question: The Wikipedia article on the 12 tribes of Israel mention that Jacob had two wives, Leah and Rachel and two concubines  Bilhah and Zilpah. What does the word concubine mean here? Is it like a mistress?
Comment: [con·cu·bine
/ˈkäNGkyəˌbīn/
noun
HISTORICAL
(in polygamous societies) a woman who lives with a man but has lower status than his wife or wives.](https://www.google.com/search?q=concubine&rlz=1CDGOYI_enUS861US861&oq=conc&aqs=chrome.0.69i59j69i57j0i433i512j69i60j69i61j69i60.1284j0j7&hl=en-US&sourceid=chrome-mobile&ie=UTF-8)
Comment: This is a technicality aimed at presenting all 12 tribes as coming from only Lea and Rachel to explain future dynamics. Initially, those two were two female servants given to Jacob as dowry. As slaves had no legal status, everything they bore belonged to their master, so technically, their 4 kids were legally Jacob's. The problem is that there's a prohibition on laying with a slave in Judaism, so some try to harmonize it by presenting Bilha and Zilpa as Jacob's rightful wives also.
Answer: The word used in various pesukim in the Torah is פִּילֶ֣גֶשׁ (Pilagshim) and literally means "concubine". The Yerushalmi Talmud (Ketubah 5:2) asks the very same question, "what is the difference between a wife and a פִּילֶ֣גֶשׁ (concubine)?":

What is a wife and what is a concubine? Rebbi Meïr says, a wife has a ketubah, a concubine has no ketubah. Rebbi Jehudah says, both have a ketubah. A wife has a ketubah and the ketubah stipulations; a concubine has a ketubah but no ketubah stipulations.

Similary, in the Gemara (Sanhedrin  21a), Rav Yehuda cites Rav and explains:

What is the meaning of "wives" and what is the meaning of "concubines" in that verse? Rav Yehuda says that Rav says: Wives receive a marriage contract and betrothal; concubines are taken without a marriage contract and without betrothal.

The Ra'avad (Hasagot HaRaavad; Mishneh Torah; Hilchos Ichus 1:4) explains that the word concubine (Pilagshim, פִּילֶ֣גֶשׁ) is comprimised of the two words "פי שגל" (Pi Shagal) which means " a woman who serves both domestic and "marital" functions":

קודם מ''ת וכו'. כתב הראב''ד ז''ל אין קדשה אלא מזומנת והיא המופקרת לכל אדם אבל המייחדת עצמה לאיש אחד אין בה לא מלקות ולא איסור לאו והיא הפילגש הכתובה בפסוק ובעלי הלשון דורשין פילגש מלה הפוכה ומורכבת פי שגל עומדת לפרקים למשגל ולשמש את הבית ופעמים למשכב. וי''ס שכתוב בהם פילגשים בלי קידושין עכ''ל:

See further: INSIGHTS INTO THE DAILY DAF


Should the row numbering of a table update if a row gets removed?

Question: I have a table with automatic row numbering and the user can delete rows.
My question now is if the row numbering should update if a row gets removed. Are there any UX drawbacks from doing so?
I imagine that it might seem odd to have number gaps.
Answer: What are the row numbering for? Are they simply a way to identify the data within the table? If so users are comfortable with the row numbers identifying different data when the table is sorted. And there are many programs in which users update and delete information, there should not be a problem in having the row numbering update.
The only use case where there would be a problem would be when table row numbers refer to specific data - functioning almost as a unique identifier - then, in that scenario, one could not update the table row number.
Comment: If row numbers refer to specific data, then wouldn't you say they're not really row numbers but part of the data?
Comment: Would I? Absolutely. I was just trying to clarify the question.
Answer: Identifiers?
Does the user need to refer to the row numbers in other places? Does the user need to keep part of a row's information in their memory? If so, since keeping things in memory requires mental work, could you redesign the task to reduce the cognitive load?

Alternate identifiers? How long must a row number remain associated with specific data—is it seconds or hours? If it's for a long duration, then wouldn't you say the row numbers are part of the data? And, if so, perhaps the data has other identifying numbers or names that can more permanently be used instead of row numbers.
Checklist?
Is the purpose of the numbers simply to help the user track which rows have been dealt with? There are other design solutions to help users do that. Consider a check box, for example:

Counting
Does the number add value to the experience by counting the quantity of rows completed and remaining? If so, can progress be inferred by the user's action and then auto-calculated, numerically or visually?

Help with scrolling?
In the case of horizontal scrolling, row numbers could (be a kludge to) help users confirm that they're looking at the intended row. In this case, freezing the identifying column and reducing the number of columns might have the same effect. One way to reduce the number of columns is to combine data. Here's an example that displays data from four columns in one:


Data Link Messaging Protocol

Question: Is there a way to exchange messages between two hosts in the same VLAN referring only to the respective MAC addresses? I am thinking of a sort of equivalent to the Phone utility in a VMS network.
Answer: I'm not familiar with VMS 'Phone' but I'm very skeptical about it using L2, maybe DRP or NSP.
But to answer your question, yes that is possible, you probably need superuser privileges to inject as 'raw socket'.
If you're familiar with some programming language shouldn't be more than one hour exercise to send/receive messages via L2 header + arbitrary payload.
I guess one software that could be used is 'hping3', I'm sure there are others.
Why you would want to do so, other than curiosity and 'because I can' escapes me. As there is linklocal IPv4 addressing and service discovery protocols which you can use to automatically discover and use services in LAN over IP.
Comment: For curiosity I then recommend looking into windows socket programming, I'm sure you'll get kick out of seeing your 'MAC Chat' work :)
Comment: Thank for your prompt, comprehensive reply. Yes, it is mainly curiosity that made me ask the question. Since the switch does not need IP to forward frames, I thought it would be logical to ignore the Internet and Transport protocols altogether for communications within the home network. If I get your answer right, the pervasiveness of TCP/IP would make such an approach futile.
Comment: +1 from me, I would recommend you try and program something your self. I'm not super knowledgeable on Windows programming, but I have done this for Linux already. I can send you some code for Linux if you require.

Data Link Messaging Protocol


External Hard drive with magnet built into the enclosure

Question: I recently bought two Hitachi HLSMPUA3201ABB external Hard drives. They come with a USB key attached to the enclosure with a magnet. It's not a very strong magnet but I can't help wondering whether the drive would last longer without it. Should I consider returning it?
Answer: It won't damage your HDD, don't even give it a second thought.
See here for reasons why.

The only magnets powerful enough to scrub data from a drive platter
  are laboratory degaussers or those used by government agencies to wipe
  bits off media. "In the real world, people are not losing data from
  magnets," says Bill Rudock, a tech-support engineer with hard-drive
  maker Seagate. "In every disk," notes Rudock, "there's one heck of a
  magnet that swings the head."

There are magnets inside the hard drive also and are not shielded in any way.
Comment: Thanks. Would have realised if I stopped to think. Guess I was being over-paranoid about my fifty bucks. :)
Comment: Don't they put [mu-metal](http://en.wikipedia.org/wiki/Mu-metal) around the motors in a hard drive to route the magnetic field away from the platters?
Comment: Sensible people are cautious with their money. Its worth asking if you're not sure. Imagine if the answer had gone the other way and you hadn;t asked :-)
Comment: The armature that moves the heads on a hard drive uses a very powerful magnet on both sides of the voice coil, they are not shielded, and they sit very close to the platters, Joe is right, it takes a super magnet to have any effect on data...http://www.reuk.co.uk/Hard-Disk-Drive-Magnets-For-Wind-Turbines.htm
Answer: It will be fine. Harddrives even contain magnets.


Deleted Answers not Disappearing

Question: In my question, on the main U&L site: Check if SSH is Enabled or Disabled in Solaris 11, I have deleted my own answer, but it hasn't disappeared. Why has it not gone? It has gone red though.
Answer: Deleted items are only soft deleted. You can still see them, we moderators can still see them, but it is not visible to the general public.
Comment: Note that it's not just moderators: users with 10k rep and above see other people's deleted answers too.
Comment: Thank you for that. It just was confusing in the beginning, cuz as I deleted it, I still saw it, and it looked like other people could still see it, but was highlighted red.
Comment: It is a nice feature that not only moderators can see them, but the person who deleted it, too. That way I can safely remove my answers without worrying that I might be able to use what I wrote later on. If there just was no -10 rep penalty, then everything would be perfect... :-/

Deleted Answers not Disappearing


How many times must I beat the mysterious monk in the inn at Dice Poker to get his relic?

Question: In Flotsam's inn in Chapter 1, there's a monk in the basement of the inn who claims he has a mysterious relic that he can't use, and that only those blessed of good luck may have it. As a result, we have to play at Dice Poker. Unfortunately, my luck's not that great, so I tend to win only every other game, and it seems like you need a winning streak to get the award, since when I beat him he says that my luck's not quite good enough to obtain it yet.

How many times must I beat him to get the award? What is the award?
Comment: PFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFT WANT
Comment: I beat him once and got it. Next time you have the game open, go the main menu and look under "extras". The mystic relic is actually a coupon for Good Old Games, to purchase (among other things) The Witcher 1.
Comment: @Mana did it work?
Comment: @Raven Okay, I got it too; after winning three times in a row through save-loading. It mentioned that I beat him using two pairs...maybe that's the trigger? Or perhaps it's based on your net total earnings(including losses) from him. Only problem is that the only thing in the Extras menu for me is the Credits, nothing about a coupon.
Comment: @Mana - well, it's *some* option on the main menu. Let me find it on mine... Nope. Once you get it, it appears under the credits option.
Comment: @Raven That's distressing. I did it again and still no coupon.
Comment: You're just looking for a link called GOG, which, when clicked, will take you to the good old games website.
Comment: The trigger is winning with a certain combination of dice, probably the two pairs you mentioned. I read that somwhere, but I haven't played with the monk myself.
Comment: Yeah, the two pairs of dice is what does it. Furthermore, even though the award isn't showing up for me, I found the site by finding someone posting in a forum with this similar problem. I'd answer but am not going to for a bit since: 1. I dislike self-answering and 2. I'm not sure if it's a great idea to link to a website giving you discounts on games.
Answer: It turns out that neither a sum of money nor a streak of victories is the trigger for earning his "relic"; instead, you must win against the monk in Dice Poker with a dice hand of two pairs. This requires a fair amount of luck, since the only hand two pairs beats is one pair or two pairs of a lower total sum. If you're worried about losing money, save/loading before playing him is effective.
The reward for this is a link in the Extras menu to a site which also acts as a link to a discount on 11 different Atari games, including Outcast, Master of Magic, Independence War 2, and Master of Orion 1+2. The site that this link went to is now defunct and redirects to a spam site, and I'm not sure if this option is available anymore in the game since the special offer has concluded.
Comment: I don't think it should be closed -- lots of people are still playing, still encountering the monk, and not knowing that his offer is no longer valid. The question is still valuable. Maybe we need to add an answer reflecting Krazer's comment.
Comment: @Mana You can't get this "relic" anymore, since the GOG promotion has ended.
Comment: Wrong again, I have won with every type of hand multiple times and still no go with the Relic. I have had multiple wins with two pairs, even rolled two pairs on first roll and didn't roll again the second time, won the hand, and no relic. Same with rolling all dice again on the second turn, not saving one of them the first hand, won, no Relic. So at this point it is all guessing.
Comment: @Nicknelson That's weird. Okay, thanks for the heads up; I'm gonna unaccept this.
Comment: @QAzer Good to know; thinking I should close this as too localized then.
Comment: Confirmed that winning with two pairs does not make a difference.


how to communicatie rocketmq and rocketmq directly?

Question: I have two network envionments (such as NETWORK -A and NETWORK -B). Now, I deployed rocketmq-a in the NETWORK-A  and  deployed rocketmq-b in the NETWORK-B, how to communicate  rocketmq-a and rocketmq-b directly?
Comment: What do you mean communicate? Do you mean rocektmq-b is a slave of rocketmq-a?
Comment: The communicate mean that rocketmq-a can send messages to rocketmq-b. Rocketmq-b is not a salve of rocketmq-a. For example: rocketmq-a in a network environment in New York,rocketmq-b in a network environment in London.Does rocketmq-a send messages to rocketmq-b?
Comment: The broker itself can not send messages. What I understand is that, you have a service A in New York subscribed topic from rocketmq-a,which is also in New York. And  service A needs to send messages to the rocketmq-broker in London, is that so?
Comment: Service A needs send messages to the rocketmq-a,which is in New York. And rocketmq-a needs to send messages to the rocketmq-b,which is in London. (Service A----->rocketmq-a------>rocketmq-b----->Service b)
Comment: What do you mean rocketmq-a needs to send message? Broker can not send messages, only client can send message, do you mean you want to replicate the message to rocketmq-b?
Comment: yes,Rocketmq-a needs to send message. I want to replicate the message to rocketmq-b. Please,can i  replicate the message to rocketmq-b? you said: " only client can send message" , do you mean rocketmq-a' client  send message to rocketmq-b?
Comment: please check my answers
Answer: According to your comment, you have two rocketmq clusters and one message should replicate to another rocketmq cluster.
So this is a message replication.
you have two choices:

Implement a send message hook
Use a messageStore plugIn that extend AbstractPluginMessageStore and load it using broker configuration

Both of them needs to implement replication by yourself.

However, if you make them the same broker group, it is very easy.
Just make rocketmq-b as a slave of rocketmq-a, and deploy them in different machine room.
Then rocketmq-b will only provide read operations and always replicate the data from master


Is it possible to check how close we are to our API call limit before making a call through the API?

Question: We use Salesforce to manage our website logins & access to our products. If something goes wrong with our site or it gets attacked, we quickly go over our API call limit which means that our store & site go down. Is it possible to check where we are in terms of our API call limit so we can stop calling Salesforce before there's a problem (we're calling the SOAP API)? I've been looking through the developer docs & haven't been able to find anything that might help.
Answer: There is a header returned for both the SOAP API and REST API. See the documentation for details.
Responses appear as:
REST (header)
Sforce-Limit-Info: api-usage=18/5000

SOAP (SOAP header in XML payload)
<soapenv:Header>
    <LimitInfoHeader>
        <limitInfo>
            <current>5</current>
            <limit>5000</limit>
            <type>API REQUESTS</type>
        </limitInfo>
    </LimitInfoHeader>
</soapenv:Header>

Comment: its in the soap api as well (in fact was in the soap api before the rest api). limit info is returned as a response soap header.
Comment: @superfell Thanks for that. I'd never seen in the documentation previously; every time I looked for it, I couldn't find it. I've found the related documentation and updated this answer.


Why wasn't Odinforce Thor strong enough to beat Thanos in Endgame straight up?

Question: I mean, was the pizza and video games that bad for his overall powers? Or was Thanos really that much stronger? Captain Marvel and Scarlet Witch both overpower Thanos during their little 1 on 1s. Why was Odinforce Thor no match for an Infinityless Thanos?
Comment: Don't forget that an older Thanos kicked Hulk's ass in a 1v1 fight without using an infinity stone, too.
Comment: doesn't Thanos have the Power stone when he defeats Hulk?
Comment: @ChrisDafnis - It's explictly stated by the directors that Thanos wasn't using it (and also shown in the film that it's not lit up). He's just stronger and more agile and a better fighter than Hulk.
Answer: I don't think it's the pizza and video games so much as Thor has not been training or fighting in the intervening years, meanwhile he's going up against a Thanos younger than the first Thanos who defeated him in Infinity War. If you take a boxer and have him not train for years, then put him immediately back in the ring, you're probably not going to see his best effort in a match with someone roughly on par with him in his prime.
We saw in Ragnarok that even a powered up Thor still isn't powerful to defeat some beings like his sister Hela, so he's definitely not unbeatable.
Re: Scarlet Witch & Captain Marvel
Scarlet Witch fights better at a distance and Thanos is a close fighter, so obviously she had the advantage in that fight. He couldn't attack her and she could lock him down and attack at will.
As for Captain Marvel, we saw in Infinity War that the Infinity Gauntlet does not make you invulnerable to surprise attacks, and it could be simply that Captain Marvel blitzed Thanos and she was an unknown factor for him. Sort of like how Thor ambushed Thanos even with the gauntlet and nearly killed him.
Answer: Maybe 5 years of boozing and pizza resulted in more than 100 or so pounds of belly fat. And maybe 5 years of sitting around caused the loss of some muscle fiber, although I would argue that he is effectively in his 20's when compared to our life time (1500y ÷ 5000y = .3 times 100y for us makes him 25-30y equivalent). 5 years for him is about 1 month equivalent. No 25 year old loses any significant conditioning in 1 month.
His problem is mental:

He lost big time to Thanos once.
He failed to stop him the 2nd time.
He killed him when he (Thanos) was a shadow of his former self.
He spent 5y considering himself a failure to the entire universe.
He is given to panic attacks when things get tough.
His mother is the only one to talk sense into him at this point and she is dead.

All this makes him much less effective as a warrior than he was 5y before. This fight 5y before and Thor would have taken Thanos apart. He only lost the original battle because Thanos had the Power Stone.


What benefits do the different gems provide? How does quality boost it?

Question: What benefits do the amethyst, emerald, topaz and ruby provide when socketed?  How is this affected by the quality of the gem?
Answer: The complete details for each gem type and quality level appear on the official guide: http://eu.battle.net/d3/en/item/gem/
In short:
<code>           Helm       Weapon            Other
Amethyst   +%Life     +Life per hit     +Vitality
Emerald    +Gold      +Critical Damage  +Dexterity
Ruby       +XP        +Damage           +Strength
Topaz      +MF        +Thorns           +Intelligence
</code>
+MF means Magic Find.
Comment: Actually, jewels from 1 to 7 are dropped in game. Perfect Square and higher ones must be combined or purchased.
Comment: Also the quality or level of the gem refers to the level the Jeweler needs to be to work with it. They are , in the order of lowest to highest: Flawed(1), Normal(2), Flawless(3), Perfect(4), Radiant(5), Square(6), Flawless Square(7), Perfect Square(8), Radiant Square(9), Star (10), Flawless Star(10), Perfect Star(10), Radiant Star(10). Jewels from levels 1 to 5 are dropped in game, anything above needs to be combined.
Answer: This website has a pretty good guide to gems.

Amethysts give you life percentage when socketed into helms. When socketed in other equipment, amethysts give you Vitality. When socketed into weapons it gives lifesteal.
Rubies increases the experience you gain per kill when socketed into helms. When socketed in other equipment, rubies give you Strength. When socketed into weapons gives +max/mix damage.
Emeralds give you extra gold from monsters when socketed into helms. When socketed in other equipment, emeralds give you Dexterity. When socketed into weapons it gives crit chance.
Topazes give you better change of finding magical items when socketed into helms. When socketed in other equipment, topazes give you Intelligence. When socketed into weapons it returns damage taken.


The most amazing thing (was/were) the people who

Question: Which one is correct?
The way I see it, the subject is 'the thing' which is singular thus it should carry 'was', no matter what follows. However, there seems to be a lot of people who use 'were' instead.
Is 'the people' the subject in this sentence?
Comment: Verbs agree with their subject. The subject is generally the noun phrase before the first auxiliary verb, except in special constructions like questions. The subject here is singular third person, so the verb is _was_.
Comment: The most amazing thing**s were** the people...
Comment: I cannot upvote you guys so I'll just say thank you.
Comment: @Ian MacDonald The '[most amazing] thing' here is generalised; 'things' does not work. Compare 'It's us'. The subject outranks the complement in dictating the agreement of the verb.
Answer: Your point is right. The correct way is

The most amazing thing was the people who...

I tried to think about the other specific possibilities. Sometimes we use "were" in the case of the subjunctive mood, however, it is used after "if, as if, wish, suppose". Here is not that case except if it is like

(I wish) the most amazing thing were the people who...

"I wish" was not said, but meant.
Comment: Thank you for your comment. As you noted, this is not a subjunctive sentence. Just plain old simple past.


Arduino and stepper motor

Question: How arduino stepper library handles stepper motor with ULN2003? I mean, for controlling stepper motor one actually needs four pwms. It can be reduced to two by encoding, or maybe even to one by using other techniques. But could you, please, clarify how arduino does it? I could not find the low level code for that from arduino to inspect.
Comment: why do you believe that you require PWM signal to control a stepping motor?
Comment: For not blocking the main code. Like PWM with DC motor.
Answer: There is generally a stepper example in the arduino Compiler, you can find the code there, or look at the stepper library
However arduinos can't control steppers directly, but they send signals to stepper drivers, which then send the correct voltages to the stepper to rotate in a specific direction and rotate at a specific frequency.
Arduinos are basically 'bit banging' namely they send a single high and low signal at a specific frequency and duty cycle, which determines the rotational speed of the motor itself. One line is high/low for direction, another for the signal. The advantage is you can count how many times you bit banged, and have an open loop position control system for easy NC applications
No-one would use the analog pins on an arduino to control stepper motors.
4wire stepper motors have A and B coils that require specific timing to excite (read, step) the motor and a large amperage/voltage requirement. Hence the drivers.
Considering read the wiki about steppers to get a better idea about them.
Comment: I mean 28BYJ-48 motor. Can't we control speed? I mean stepper motor rotates with certain speed. And at each sampling time we just change its speed, not give step commands.
Comment: Speed is a function of steps. $\omega=2 \pi f$
Comment: Yes, but when you give certain number of steps it is gonna stop after doing that. But we want it to rotate continuously until we change speed.
Comment: Like PWM, it gives same duty cycle until you change it,
Comment: So you've have to write a function that continuously bit bangs that allows you change freq at will. You'll have to do some math ;)
Comment: Please read the stepper library, there are examples
Comment: Ok, but I don't want it to block the main code.
Comment: What you are saying is good for position control, but not for speed control I think.
Comment: If you would read and understand you'll realize they're the same and is only a question of your ability to understand how to code it.
Comment: I would expect a command like runmotor(speed).
Comment: Otherwise, you can write a function which steps motor with a certain speed yourself.
Answer: Here is Arduino library code specifically for the 28BYJ-48 stepper motor using the ULN2003 controller board.  The readme discusses the various driver modes and how they work.  It's not done with PWM like a servo motor (where PWM is a repeating square wave control signal). Rather it is done by energizing the coils in the motor such that they attract to magnets.  Energizing in a specific pattern will move the motor from magnet to magnet, thus turning the spindle.
There is an example sketch for implementing a differential drive robot using two 28BYJ-48 stepper motors.  There is an example sketch that uses a LM393 optical encoder to calculate the steps per rotation of the stepper motor.

Arduino and stepper motor


Why were Hiro's powers so sporadic?

Question: In the show Heros, a character named Hiro has the ability to manipulate time (even time travel).  However, in the first season his control over time travel is very sporadic, and it stays like this for a long while.  Other characters that develop their powers go through this sporadic span, but quickly master their new powers.  Is there a canon reason as to why Hiro's powers are so much more difficult for him to control?
Comment: @AlasdairCM: You are perhaps correct that DFork42 might get a good answer on scifi.  However It is on-topic both here and scifi.  Generally its discouraged for one site to take another site's question if it is on-topic in both.  If it was off-topic here we would have to close it and for DFork42 to ask on scifi as we are a beta site and cannot migrate.
Comment: I would have thought that this question is more suited for scifi.stackexchange.com
Answer: The show Heroes was originally written as a one season series, so a lot of the stories and characters were were not thought out in a way that would lead to more development. The second season of Heroes was affected by the writers' strike. Story lines were dropped in the middle of development and writers were changed. It caused a lot of inconsistent plots and resolutions. It was shown in Season One that his own confidence in his abilities seemed to affect them. When he was in Vegas he seemed to lose his powers, because he had lost confidence in his ability due to the killing of Charlie the waitress and his inability to stop or change the outcome. He later seems to master or at least have control over his powers, as well as the ability to use a katana by the end of Season One.
It's also shown in Season One that in the future he masters the English language and also has gone years without letting anyone know he could time-travel as well as teleport. In later seasons Hiro seems to lose his powers for reasons that aren't always given. When thrown back in time to Japan he can't get back to his own time. Later on he is reduced to the mental state of a child and given a brain tumor which is killing him.
The real reason this happens is inconsistent writing. Also Hiro and Peter both had extremely strong powers. They both could have potentially solved any conflict with their powers. So the writers had to start writing weaknesses that they didn't have before. Peter was only able to keep one power at a time. Hiro's ability to use his powers become more sporadic.
The canon reason as far as Season One goes is that Hiro's power is one of the greater ones and much harder to control properly. The easiest for him to do is teleport and stop time. Using time travel effectively seems to be the hardest. Future Hiro has an extensive 3-D time chart that he has used to figure out exactly how to change the future for the better. So even with mastery of his powers he is struggling to try to change time. The only way he can do it is to time stop Peter on the subway and give him a vague message "Save the Cheerleader, save the world". Also it seems that the further back in time Hiro goes the longer it takes him to use his powers again, almost like they need to recharge.
Comment: I don't quite agree with the recharge idea as to me, stress/emotions may come into play with him being trapped in feudal Japan.  And as far as Peter's *weakness* he didn't have one, they had to write in his father with his ability to steal abilities so that when he got his synthetic power, it would be different a la 1 power at a time.  I do, however, agree that inconsistent writing was the death of the series, as sad as it is.
Comment: The first time Hiro goes back in time to the dinner and meets Charlie he is stuck there unable to use his powers for a while. Also when Charlie is killed he jumps through time a lot to try to save her. It's possible that this drained him though I do feel that confidence is the main factor in his powers consistency.
Answer: The argument can be made is that some people who have powers just have better control over them than others.
Looking at Michah, he seemed to have his power under control at a very young age whereas his mother could only tap into her power while her split personality is active.
Peter couldn't control his power until Claude forced him into controlling it by tossing him off a building.  While his brother, Nathan, seemed like he was flying forever once he learned how to control it in a short time.
Heroes tries a very human approach to the powers used and I believe this helps portray that by showing people that just have better control over their abilities than others just like some people are just smarter than others and other skills of the sort.
Answer: It's the writing.
But, if you were to put in the context of the show, it just breaks down to the extent of the control of your powers.
I couldn't comment otherwise on this entry.  That is the only reason I entered it as an answer.  Am I missing where I can comment or is there some other reason that I have not discovered yet.
Also, before Peter could control his powers, he would randomly grab/copy the power of another 'special.'  Once he ran into Claude, he figured out how to 'access' each of the powers he had 'filed away'/absorbed.
Comment: Hi.  I had forgotten that someone with 1 reputation can't make a comment - so I have re-established your answer as you have added to it.  However in general an answer like 'its the writing' or 'that's just the way it is' is never going to get many upvotes.

Why were Hiro’s powers so sporadic?


How to create an average with turn around values

Question: A compass value goes from 0...360°. Normal averaging routines generate a huge error, when the compass value transits from 359 to 0, or back.
I'm too stupid, creating an algo, which can handle this transition.
Comment: How do you *want* it to handle that transition?  The behavior, if not the implementation.  (Example(s) would be helpful here.)
Comment: I basically think of a moving avg of 10 samples, but for the example just 4. Say  I turn right: 340,345, 350, 355 [°] avg = 347.5; Then 345, 350,355,360 avg= 352.5, the problem occurs already here, if I use 0 instead of 360. avg would become 262.5; finally 350,355,0,5 avg should be 357.5 but becomes 177.5; last 0,5,10,15 avg= 7.5
Comment: Under what conditions should you use 360+x in the average instead of x?
Answer: The answer is here:
Angle average
I take no responsability for the content under this link.


Segmentation Fault after 2.3.3 upgrade

Question: I was going to update from 2.3.2-p2 to 2.3.3-p1. I ran the composer update and everything worked. Now when I run any command it says segmentation fault. In working with my host this is what they have found-
I am seeing that that before it segfaults it is looping over the env.php and config.php over a thousand times.
Reviewing the stace, I am seeing that it is timing out on fd5 over and over between each call.
It looks like it is looping through resolving the store code and setting the locale.
How can I resolve this?
Answer: If anyone else run across this here is the answer-
rm -rf var/cache/* var/page_cache/* generated/*

Segmentation Fault after 2.3.3 upgrade


Should a infrastructure library by loosely coupled to another infrastructure layer?

Question: Is there any smell associated with having say a File.IO library being loosely coupled to the logging library?  Or should they be kept separate and only combined in the application services?
Answer: Loosely coupling is beneficial in all circumstances, but you should also be aware of the additional complexity it may introduce. If you apply the Dependency Inversion principle (read Robert C. Martin's book on Agile Principles for an excellent discussion), you might consider the File.IO library to define an abstraction (e.g. an interface) that it needs for logging. You can then provide an implementation of that abstraction using your preferred logging library. To be clear, that's not the same as using the abstraction offered by the logging library in the File.IO library. Then you would still be locking them together.
Answer: Loose coupling is a meaningless term without high cohesion. In your domain, you log in domain specific terms. Take a look at the blog of Isaiah Perumalla, especially test-driven-design-using-mocks


Using a previously determined detective quantum efficiency for a detector

Question: I am doing a radiation damage survey on a few different materials and will need the Detective Quantum Efficiency (DQE) when calculating the dose. I will be using the same detector for each sample and was wondering if it would be sufficient to acquire the DQE once, or even use a previously determined DQE, rather than recalculating it for each sample. My thinking is that since the detector is the same for each sample the DQE shouldn't fluctuate appreciably.
Answer: Short version: It's better to measure it in situ and shortly before (or better before and after) taking data.

Explanation
Quantum efficiency can be a function of various operating parameters, so you would need to know that the previous measurement was done using the same parameter you plan to use.
Various classes of detectors can experience changes in their actual quantum efficiency for various reasons: radiation damage; current erosion; mechanical, chemical, or thermal damage at a minimum.
It is also possible that the previous measurement intentionally or unintentionally folded some acceptance features into their reported QE.
For these reasons it is better to measure the QE

explicitly for the data taking you plan
in the configuration you will be using
under the operating parameters you will be using
in close temporal proximity to the data taking

But, as always, you have to balance the risk against and the costs. If you know that the device was previous testing in a configuration compatible with the one you intend under operating condition compatible with those you intend, and has been stored with due care to protect if from things that could damage it (which could include humidity, bright light, intense radiation fields, mechanical shocks, and others depending on the nature of the detector), and you don't have a lot of money/time then you might decide to chance it.
Comment: Any idea what kind of variance I would be looking at if I were to chance it? Or is that an unrealistic thing to guess at?
Comment: That really depends on the type of detector, what might have gotten to it, and how severe the damage is. When things are going well these are usually small changes (a few percent of the previous QE, maybe up to 10%), but there isn't really a limit.


Illustrator CC: join overlapping anchor points only

Question: A lot of the PDFs I end up working with are exported as thousands of completely separate lines, which creates performance problems in my workflow further down the process. The lines appear to be joined, but if you take one anchor off you will see they are in fact disconnected segments.

What I want is to join all the lines together, but only if they have overlapping endpoints, and nothing else. For this, the Ctrl + J (Join) operation creates excess lines for non-overlapping anchors.

I realize there is a free "Join overlapping anchor points" only script from
shspage.com, but it doesn't work for Illustrator CC.
There was also the Shift + Ctrl + Alt + J join from Adobe's Blog which was helpful, but ended up not being what i needed either, since this will only work when I have two endpoints selected. This is more along the lines of what i'm looking for, but labour intensive when working with thousands of points.
Any of the pathfinder operations typically don't work with the massive amounts of complex shapes that come from floor plan drawings.
Compound lines or groups aren't an option either, since both of the endpoints still exist.
Is there an updated script or feature for Illustrator CC I can use to achieve this, or am I going to have to look into updating the script from shpage?
Answer: Try cmd + shift + alt + j
This should average the positions, and then join, meaning you don't get the horrible extra vertices.
To make a script to do this you'll need to seek out vertices that are close together and joinable, by your own rules, then average them, then join them.
I don't know of a script to do this.
In other apps, this activity is known as "welding" of vertices.
3ds Max has a very good tolerance based welding system, which works by distance, and reduces vertices, over all lines.
So, if you're on a PC, you could download a trial of this, and import your pdfs as illustrator files, select all lines, do a weld with a low tolerance, and then export as illustrator files to go on with in your favourite drawing program.
Comment: Comments are not for extended discussion; this conversation has been [moved to chat](http://chat.stackexchange.com/rooms/48340/discussion-on-answer-by-confused-join-overlapping-anchor-points-only-illustrator).
Answer: If you no longer have to edit your floor plans then pathfinder/unite is the way to go. Select all the lines. Expand fill and stroke (they can no longer be lines in order to unite, the need to be shapes that look like lines) then pathfinder/unite, ungroup and done (cleanup if necessary). All the lines that were touching are now a combined shape. All the independent lines retain their independence. I hope this is what you were looking for.


Choose whether to save when quit

Question: I am using notepad++ V6.4.2. When I close a file, it seems to save defaultly without asking me. How can I configure to get the save/not_save option back?
Comment: @James Thanks. I updated to the new version and get what I want.
Comment: NP+++ doesn't have an auto-save option AFAIK (they do have a backup system, but that's not the same as what you're explaining).  There ARE a few plugins that will do auto-saves.  Have you ensured you don't have a plugin installed/enabled that's doing it?
Comment: @yliueagle: You might want to update Notepad++ to the latest version as it is at v6.6.7 now. The version I have does show the behaviour you have described but I was able to change it using the method I have given in my answer.
Answer: Notepad++ isn't actually saving the file automatically. If you open the file in another editor you will see that your changes have not been committed to the original file. It is using its own temporary copy of the file to hold the changes that have been made.
However, you can prevent Notepad++ from behaving this way by un-checking Settings->Preferences->Backup->Enable session snapshot and periodic backup.
Edit: As Rob has pointed out, this applies to version 6.6 and later where this feature is turned on by default and doesn't require add-ons.
Comment: I thought this too, but apparently that was only enabled in 6.6 ( http://notepad-plus-plus.org/news/notepad-6.6-release.html ) and he's running 6.4
Answer: In Settings->Preferences->Backup->
I "disabled session snapshots" and now it ask me when I close notepad++ if I want to save the file changes.
Answer: Deselect the option "Remember current session for next launch" will work as in Notepad.
Comment: Session management and File Save management are independent. If I have "Remember current session for next launch" enabled or disabled I'm still prompted to save modified files when closing

Choose whether to save when quit


Simple quicksort implementation in C++

Question: #include <iostream>

using std::cout;
using std::endl;

int arr[] = {3,4,2,1,-5,116,31,4,0};

void QuickSort(int start,int end);
int Partition(int start, int end);
void Swap(int * , int *);
void PrintArr();

int main(int argc, char* argv[])
{

    PrintArr();

    QuickSort(0, sizeof(arr)/sizeof(int));

    PrintArr();

    return 0;
}

void QuickSort(int start,int end)
{
    if(start >= end) return;

    int index = Partition(start , end);

    QuickSort(start, index - 1);
    QuickSort(index + 1, end);
}

int Partition(int start, int end)
{
    int index = start;
    int pivot = arr[end-1];
    for(int i = start;i < end - 1;i++)
    {
        if(arr[i] <= pivot)
        {
            Swap(arr + index,arr + i);
            index++;
        }
    }

    Swap(arr + index, arr + end - 1);

    return index;

}

void Swap(int *a , int *b)
{
    if(*a != *b)
    {
        int temp = *a;
        *a = *b;
        *b = temp;
    }
}

void PrintArr()
{
    for(int i = 0;i<sizeof(arr)/sizeof(arr[0]); i++)
        cout<<arr[i] <<" ";

    cout<<endl;
}

Comment: It would be great if you made some introduction to your code and the algorithm, as well as list any particular concerns you have about the code, if any. If it would be C, it would be pretty great implementation. Unfortunately, without iterators, it's not like standard library algorithm.
Comment: Uncommented code, and not quite literal. No mention of Lomuto/Hoare. No motivation for the check in `swap()`. Jumping between passing pointers and indices with global variable use.
Answer: Writing an implementation of quicksort is fairly easy. Writing a good implementation that works at least reasonably well with almost any input is much more difficult.
Your uses a choice of pivot element that's pretty well know for bad behavior. By choosing the last element in a range (or the first) you essentially guarantee that it runs in \$O(N^2)\$ if the input is sorted. One typical way of preventing this problem is to use a "median of three" to select the pivot element--that is, look at the first, middle and last elements, and use the median of those three as the pivot.
There's one more minor detail there though: you don't just want to choose the median of those three and use it as your pivot. If those three elements are out of order (with respect to each other) you want to sort them, and write them back to the array in their sorted order. This improves behavior (somewhat) during the recursive calls.
Another subtlety that important to correct behavior (rather than just performance) is to use the correct order for your recursive calls. To assure against stack overflow, you always want to sort the smaller of the two partitions first. In conjunction with tail call elimination (which compilers have practiced for years) this can eliminate the possibility of stack overflow. If you want to be even more certain about it, you can change the final recursive call to iteration, so it's not up to the compiler to eliminate the tail recursion.
C++ adds another interesting twist, at least as soon as you start to deal with sorting collections of arbitrary types of objects (rather than just int). In this case, a user may well have written their own swap function that they expect you to use to swap objects of a particular type. Otherwise, you normally want to use std::swap rather than writing a swap of your own. To select between those correctly, you normally want to put using std::swap at the beginning of your partition function, and then use unqualified calls to swap (e.g., do not explicitly call std::swap). This way if the user has written a swap in the same namespace as the type you're sorting (and named it swap, like they should) your sorting routine will find that via ADL, and use it. Otherwise, it'll find std::swap because of the using std::swap;, and use that. This gives the behavior we want: use their swap routine by preference, but use std::swap if they haven't provided one.
A few other points: of course, the standard library has std::sort built in, which is typically implemented as introsort (which is just a quicksort that keeps track of recursion depth, and switches to a heap sort if quicksort is doing poorly for the input it's been given).
This code doesn't really look/feel much like most people expect C++ to be written. Right now, you're mostly using (and passing) indexes into the array. In C you'd more likely use pointers. In C++, you'd probably want to use iterators instead (though you can pass pointers as iterators). In C++ you'd also normally want something like this to be template, so it can be applied to almost any type of object, not just int. In addition, you'd typically allow the user to pass a comparison function so (for example) if they want to sort Person objects that don't support comparison using <, the user can still sort by passing (for example) a lambda expression saying they want to sort by a person's last name and first name (and default to std::less<T>, so if < is defined, it can be used by default, though the user can still pass a different comparison if they want).
Comment: Putting items inspected in pivot selection in order: How does this _improve [behaviour …] during the recursive calls_? I'd expect the interjacent _partition_ to necessarily do that. Excellent point about `std::swap()`.
Comment: The point about 'the correct order for your recursive calls' is incomplete, hence wrong: the order itself has absolutely nothing to do with the correct behavior. The incorrect behavior can be avoided (so the correct behavior guaranteed) by performing a recursive call on the shorter partition first and then NOT performing a recursive call on the longer one,  but using a tail recursion instead (i.e. processing it at the same level of recursion).
Comment: @JerryCoffin You said: _To assure against stack overflow, you always want to sort the smaller of the two partitions first_. That does not suffice. If you perform both recursive calls, then the maximum recursion depth will depend solely on partitioning pattern (which results from the input order and partitioning algorithm) and not on the choice which subpartition to sort first. The key step, and the reason of choosing the shorter partition first, is NOT recuring on the longer one, either explicitly or by automatic truncation of a tail recursion.
Comment: @JerryCoffin Nope. Suppose the array has N items and `Partition()` returns N. Then the first recursive call handles the zero-item partition, the second one handles the N–1 partition. **Inside** the second call the N-1 array similary gets partitioned into 0 and N-2 parts. The first call handles the trivial, shorter part, the second one handles N-2 items **at the second level of recursion**. And so on, until the single-item subarray gets handled at the **(N-1)**-th level of recursion. So ordering the calls _alone_ does not prevent the worst case of recursion depth.
Comment: @JerryCoffin If one draws a tree of calls, corresponding precisely to the results of partitioning at every stage, the ordering the calls corresponds to swapping the left and the right subtree of any chosen node in the tree – but it does **not** affect the depth of any node, leaves among them. And the depth of each node is precisely the depth of recursion in the corresponding step of the algorithm. The worst-case example from my comment above makes the tree degenerated to a list. Reordering the calls may make the list to zig-zag or to go straight, but it can not reduce its length.
Comment: @CiaPan: My apologies--you're absolutely correct. I've edited.
Comment: @JerryCoffin No need to apologise, I don't take offence. :) We are all humans and each can err. Hence (I hope) we are all here to learn from each other, not to fight or demonstrate one's superiority. Also my aim was not to embarass you but rather help you provide a better answer. The more because this is the one with a green tick,  so many people may read it and learn from it.
Answer: Global Variables
Whether this is C or C++, global variables such as arr[] are always a bad idea. Global variables make writing and debugging code very difficult and allow for unintended side affects. The array arr should be defined in main and passed to all of the other functions.
Using std::ANYTHING
You as a software engineer may in your career write your own cin and cout. To do this you would have to have your own namespace so that std::cin and std::cout did not break your code. Including the namespace in the symbolic identified identifies which symbol you are using. This allows you to write programs and libraries that have the most meaningful names.
Use Container Classes
C++ has a great many container classes, some of which are std::vector, std::array, std::queue and std::stack. These container classes reduce the amount of code you need to write, and provide functionality such as the size of the array so that you don't have to write sizeof(arr)/sizeof(arr[0]). It would be much simpler to use the containers provided by the Standard Template Library.
Comment: Actually, this is one of those situations where there's a strong case to be made that to do the job correctly, you *must* have `using std::swap;` (or `using namespace std;`, though that's generally inferior).

Simple quicksort implementation in C++


Firefox title bar doesn't go away in fullscreen mode

Question: I just upgraded Iceweasel to Firefox 45.2.0 (with apt-get dist-upgrade) on my computer which runs Debian 8 (Stable). When I switch to fullscreen the window title bar doesn't go away. I didn't have this problem in Iceweasel. Any clues? I use the window manager Blackbox and fullscreen works correctly with other applications.
Answer: It has been two years since the question was asked, however, recently I run into exactly same issue (running Firefox full screen on Blackbox).
This Github issue explains why it happens.
In short:
It is not a Firefox issue. It is a Blackbox issue. It can be fixed by applying patch given in the linked Github issue. Or, if you are not comfortable with changing source code and recompiling the Blackbox, the workaround is to:

Maximize the Firefox window first.
Enable fullscreen mode on Firefox.

In this case the title bar disappears.
Disclaimer: I created the linked issue and the patch.
Answer: While in full screen mode, if you right-click at the very top of the screen, is there a checkmark in front of "Hide Toolbars"? If not, go ahead and click that to turn it back on. The corresponding preference in about:config is browser.fullscreen.autohide (default value is true).
Comment: Thanks for your reply. However, the problem is not that the *tool bar* doesn't go away; it's the window title bar (provided by the window manager) that keeps showing.


Is apartment co-signer responsible upon death of tenant?

Question: If someone co-signs for an individual to get into an apartment, and does not live with the person in the apartment. Then, years later after the person in the apartment has renewed the lease at least 5 times without the co-signer's consent or involvement, the tenant dies... is the original co-signer in any way responsible for any remaining rent or cleaning fees?
Comment: If the co-signer didn't sign the current lease, then no, not responsible.
Answer: There was presumable a separate co-signer agreement document, so let's take this sample to be representative. In this case, note that it states "This Cosigner Agreement shall remain in full force and effect throughout the term of the lease period regardless of any extensions and/or changes in terms unless specified otherwise in writing by Landlord". That lease would have expired years ago, and with it, the obligation embodied in the agreement; the landlord presumably renewed the lease without a co-signer, in subsequent years. The only imaginable way that a co-signer agreement could still be in force would be if it explicitly said the agreement automatically renews, until terminated in a specific way. There are state laws regarding automatic renewal clauses, so if there is such a clause, then its enforceability would depend on things like not conspicuous the clause is and whether the deadlines are legally acceptable in that state.
Comment: This makes sense and is in line with what I was thinking as well. It did not seem to make sense to me that a co-signer could potentially be held perpetually captive if a person were to continually renew a lease. Otherwise it would seem each lease renewal would also need the consent of the co-signer.


Two Flask Applications at same time

Question: I need to test two Flask Apps in my browser at the same time. By standard, Flask runs the app in the localhost:5000. So, a good alternative would be changing the address of one of the apps. Is that possible? If so, how to do it?
Answer: You can set the addres and port for your app
app.run(host='0.0.0.0',port=12345)

As long as the port numbers don't clash you can run seperate instances of flask apps on the same computer
Comment: Solution for me was simply to add --port 5001 to flask run (see answer by Grev Li)
Comment: You also have to change the name of the `session` cookie otherwise the two apps will overwrite each other `session` state: https://stackoverflow.com/a/52406954/380038
Comment: I tried doing app.run(host='0.0.0.0',port=12345) and changing the session, but still get socket.error: [Errno 48] Address already in use. What else should I try?
Answer: Since version 0.11, flask run is the recommended method to start a development server. In your case, open a new terminal, then run the same app on different port:
$ export FLASK_APP=my_app2  # use "set FLASK_APP=my_app2" on Windows
$ flask run --port 5001

Two Flask Applications at same time


Is there a difference between ことがある and ものがある?

Question: This has been split from this question..
So what are differences between two? Are there times where they can be interchangeable or can they only be used in certain situations?
I saw this about ことがある.
Comment: Would you have a sentence that confuses you? Or when you think that you can switch both ?
Answer: For ものがある:

(plain form verb/i adjective/na adjective+な)+ものがある (Kanji 物がある, but I think it's usually written in Hiragana), can mean:

とても〜だ
なんとなく〜感じる
〜という感じがある
〜ように感じられる

and is used in regards with things the speaker felt, for expressing feelings while describing the characteristics of something, or that a certain characteristic can be seen, for example:

半年前にいなくなったねこが帰ってきた。わたしにとって特別うれしいものがある。
    "The cat which disappeared half a year ago has returned. To me it's special, and I feel very happy."
この文章はまだまだ未熟だが、しかし随所にキラリと光るものがある。
    "This sentence has still got some way to go, but it twinkles at every turn."
この絵には人を引きつけるものがある。
    "This painting feels like it pulls a person into it."

You can also use 見られる, 認められる etc in place of ある here.
(Sources: 日本語文型辞典, どんな時どう使う日本語文型辞典500, the Kanzen master JLPT 2 grammar book).
It can also mean "there is a thing (generally a tangible thing)" (with the Kanji 物がある).
ものがある can also mean "there is a person" (written with the Kanji 者がある)

For ことがある:

It can mean "there are times when..." when expressed as plain form verb+ことがある and "there are times when it doesn't" when expressed as plain negative verb+ことがある
It can express that something has been experienced when expressed as plain past+ことがある, and that something hasn't been experienced when expressed as plain past+ことがない.
It can also mean "there is a thing (generally abstract)" as well. (It is structurally ambiguous between an appositive clause and a relative clause)

The question you linked to describes these usages in more detail, so I think I might leave those for now.
There are probably many other different usages too, but the two are generally quite different to each other as far as I know. I think as a (possibly broad generalization) that ものがある tends to be about feelings and tangible things and ことがある tends to be about abstract things, experiences and occurrences etc.

Is there a difference between ことがある and　ものがある？


Should I store my EONs outside?

Question: I live in an apartment, and my two 15" EONs are taking up a bunch of room. I have some covered, semi-insulated space outside that could accomodate them, but I'm worried that changes in temperature might create problems with the electronics. I live in California, where it can get pretty hot sometimes but never too cold (it rarely drops below freezing). Am I safe in doing this?
Answer: You should worry just as much about protecting your equipment from humidity. Humidity will affect the speaker cones, the electronics inside, and everything else too in more extreme cases.
Changes in temperature will cause expansion and contraction. Since different materials expand and contract at different rates, that can break down the cones and the electronics too.
Dust will affect the cones, connectors, and the general finish.
Finally bugs and spores may regard various parts of your speakers as sources of nutrition, a great place to put the next generation into this world, or a great place to call home.
These are, of course all worst case scenarios. But electronics tends to be expensive, so why take any chances? For these reasons, I store all electronics indoor at room temperature. If you must, here's what I recommend:

get big trash bags, the kind made with thicker and tougher sheets
get some packets of silica gel to pack with the speakers
you saved the original boxes, right? otherwise wrap each speaker + silica packets in liberal amounts of bubble wrap.
get packing peanuts to fill around the speaker in the trash bag
seal the trash bag with duct tape

The silica gel will absorb the humidity that's trapped in the bag when you seal it--when the temperature drops, this humidity will condensate. And vaporize when it heats up again. And condensate... The packing peanuts will protect against shocks and trap air that acts as insulation to slow down temperature changes.
Comment: Thanks - just going to play it safe and keep them inside :)
Comment: @Melee your music is awesome so make sure your equipment stays that way too :D
Comment: haha, thanks WB! The important bits (the Moog) are very well protected.

Should I store my EONs outside?


MavensMate not listing metadata with namespace prefix

Question: I am using MavensMate sublime text plugin. It doesn't list the apex classes and other metadata which I have packaged in a managed package with a namespace prefix.
Comment: Can you provide more detail. Are you trying to pull the metadata from an org that has the managed installed or are you pulling from the namespaced org? What are the expected results? What are the actual results?
Comment: I am pulling the data from namespaced org. MavensMate doesn't list metadata objects which I have added to managed package. I tried force.com ide and it lists them
Answer: There is a setting to ignore packages called mm_ignore_managed_metadata
Set this to false.
Comment: @vishesh it looks like this should be marked as the answer?


How to overcome 2000 records limit for external object

Question: I am able to fetch for each soql only 2000 records(Due to Governer limitis) for external objects. but i want to fetch the remaining records and pass the remaining list also to vf page to display the records.
Please let me know how to overcome this governor limit issue and display all the records in Vf page.
Comment: This technique is called `list of lists`. Check the answer of @krishsfdc
Answer: You can do so by this steps:

Get the count of external object.
Divide this by 2000, use this value in the for loop condition.
In the loop query the object and add the records to a list.
for every iteration add the records to the list.
One more thing to take of is that, put the offset 2000 * n, where n = 1,2,3.. in the query so that the records will not be duplicate.

After this steps you will get all the records to display on the vf page.
Hope this helps you!!
Comment: Hello,Count() is not supporting for external objects.Any suggestion can helpful here
Answer: If this is a Visualforce page you can use the readOnly attribute to allow the display of upto 1 million records like so:
<apex;page readOnly="true">
As the name suggests, you can only use this to view the records, not perform any action on them.
Comment: is it for external lightning connect objects?
Comment: @susanoochidori For display yes
Comment: Yes It is the limitation for external object.


Adding Information to Maintenance mode message

Question: I'm trying to setup my maintenance mode message so that it will display a twitter feed and a facebook like box to my sites facebook page. I want to do this so I have a place to send information to the people who need it or want to keep up to date while I do something that could have the site in maintenance for an extended period of time. I'm just wondering how I would set that up and if it's possible in the default maintenance mode settings of if I have to do something else, like a separate page or module.
Answer: If you just wanted to add some text I'd say go into the admin settings of /admin/config/development/maintenance and update the text but if you want to add dynamic code like a facebook Iframe like button you're probably better off adding the code to a custom maintenance-page.tpl.php in your theme. Grab the code from Facebook and twitter and paste.
Just add it below the line that reads
<code><?php print $content; ?>
</code>
Drupal api reference - https://api.drupal.org/api/drupal/modules!system!maintenance-page.tpl.php/7
Comment: Thanks, I'll add that to my themes I use, should make things easier


Use by date on cacao butter

Question: I have just used cacao butter 6 yrs out of date to make raw chocolate adding honey and raw cocoa powder. I didn't realise until after I had made the chocolate how out of date it was. Is it OK to eat?  The cacao butter looked fine.  I had it in the fridge all that time in a sealed plastic container.
Comment: By 'out of date' do you mean it's past its "Use By" or past it's "Best Before"?
Answer: I wouldn't eat it if I were you. I don't think it is safe to eat if it is 6 years out of date. I recommend you to throw it and make another one with new ingredients.
Comment: Your statement may or may not be correct. It is customary here to find some references to back up anything you claim. Do you have any  links to sources?

Use by date on cacao butter


What determines which buffer is current after kill-buffer?

Question: Since moving to Doom emacs and Centaur tabs, I have an issue I can't seem to solve. If I have say two tabs/buffers open in the order A-B and am visiting A. I open another buffer C and am visiting it. Buffer list/tabs look like A-C-B. If I kill buffer C, I am now visiting buffer B. I always want to be visiting the previous buffer I was in when I opened a buffer (in this case, A). This only happens when there is a buffer/tab to the "right" of the new buffer I open. It is driving me mad. It is particularly annoying in dired mode when I open a file to have a quick look, kill it and then I'm not back in the dired buffer but some other buffer to the "right". It must be something to do with centaur tabs perhaps as it didn't do this before I switched to Doom emacs.
Comment: The same scenario in vanilla Emacs produces `C-A-B` for the buffer list and when I kill `C`, I am back in `A`. So you are probably right about Doom/Centaur tabs (or something else). Start with vanilla Doom and no add-ons and if that works, add Centaur tabs and try with it. If it still works, then you'll have to go through all your add-ons systematically, perhaps by bisecting your init file (although I know almost nothing about Doom, so take this with a grain of salt).
Answer: Found the culprit. Centaur tabs adds something to kill-buffer-hook. Putting this in my config stops it doing what it's doing:
(remove-hook 'kill-buffer-hook 'centaur-tabs-buffer-track-killed)


Ionic serve / ionic run not reflecting changes

Question: Both ionic serve and ionic run are not reflecting any of my latest changes. ionic serve is showing them from a few hours ago, and ionic run is showing them from about an hour later. Since then, I've discarded all my changes, and created a new branch from the parent--yet it's still showing those same versions from a few hours ago on the first branch. In short, there's code showing up that I don't have in any files in this, or any, branch. And no uncommitted changes.
Your system information:

Cordova CLI: 6.5.0
Ionic CLI Version: 2.2.2
Ionic App Lib Version: 2.2.1
ios-deploy version: 1.9.0
ios-sim version: 5.0.8
OS: macOS Sierra
Node Version: v6.10.1
Xcode version: Xcode 8.3.1 Build version 8E1000a

I've tried things including ionic state restore and ionic state reset as well as removing and adding platforms back manually.
Also, this is what shows up in my console currently:
Static file server running @ http://localhost:8000/index.html
CTRL + C to shut down

200 /service-worker.js

Whereas it previously displayed a list of html, css, etc. requests when the page loaded. Currently, I can make it work as expected by unregistering and removing all ServiceWorkers at chrome://serviceworker-internals/ and chrome://inspect/#service-workers
Comment: Clear your cache on Safari
Comment: @SouravDas -- using Chrome. Cleared cache but no change.
Comment: Have you updated your ionic CLI, npm install -g ionic
Comment: Yeah--no change.
Answer: @stephen, it's been some time now, but I faced a similar issue before. Turns out I had registered the service worker that ships with projects created with the CLI, check your index.html and see if the lines that register the service worker are commented out. If they are you may be having a different problem, if they aren't and you didn't plan to use a service worker, comment them out again, and on your browser (you said chrome), after running ionic serve, open "Inspect" (Ctrl+Shift+I), go to the "Application" tab - "Service Workers" and unregister it.
This happens because the service worker that ships with new projects created using the cli will cache all resources, next time you update your code the browser will load the previous version, that's why you don't see the changes.
Hope it helps
Answer: Open the developer console, right click on the button to reload the page and click on empty cache and reload in a forced way (Last option).


Does the mass affect the speed if friction is 0

Question: A block $m_1$ strikes another stationary block $m_3$ inelastically . Another block $m_2$ is kept on $m_3$.Neglect the friction Between all contacting surfaces. Since $m_2$ is kept on $m_3$ and all the surfaces in contact are smooth and impact between m1 and $m_3$ is inelastic ,$m_1$ and $m_3$ will move together toward right and $m_2$ will not move toward right. But at the time of impact $m_2$ will also affect speed because to its mass is added ,should I include mass of $m_2$ to find final combined speed of $m_1$ and $m_3$.
Answer:
Consider an impulse of J acting on blocks m1 and m3, the impulse does not act on m2 because there is no friction between any surfaces nor is there any other direct contact
force.
Hence by Applying Low of Conservation of Momentum,i.e
m1v1-m1vf=J
m3vf=J
where vf is the final velocity of the system, We can calculate the final velocity.


My son is 8 and will not poop unless I'm 10 ft away from him. Anybody deal with this?

Question: My son will only poop with me in the house. I have to walk him in. He has made progress but still won't poop in public bathrooms. I have only left 3 times in his life and he has held it the whole 3, 4 , and 5 days!!! This leads to extreme distress on his mine and my mom who is watching him. Nothing helps. I've been nice, mean, rewards, bribes. EVERYTHING. Nothing works. His fear of everything bathroom related started when he was 3. We have made major progress but are at standstill with this.
Comment: What triggered his fear?
Comment: Bladder shyness is a thing. Bowel shyness may be a related condition.
Answer: Have you tried video calling to ease the parting blow?
Start by video calling him from one room over. He knows exactly where you are, and knows you're there for him. Then, once he's comfortable with that, move to further away in the house. Slowly progress to where you can call when you're gone on a trip and he can continue to go. Then, work on switching video calls out with regular calls, so he can hear your voice but not see you. If he can handle that, then have him text you when he's going to go and respond to that. Over time, hopefully he'll gain increasing levels of independence and not feel a need to let you know every time he needs to go.
Answer: While I didn't have to deal with anything like that, I do have three kids, so I'll give my own advise based on what I'd do in similar situation.
First of all, try to find the root. Something happened when he was three, that started this behavior. It might have been anything, so it's impossible to guess and only your son might still remember and tell. Knowing this, you can try to "fix" the root and that would be ideal. Better consult with specialist (children psychologist), but without knowing the root cause of the behavior, nothing even a specialist can do.
Assuming that by now he does not remember the trigger, I'd try one or more of these:

Explain to him that part of being adult and "becoming a man" is being able to poop anywhere, even without having your parents nearby. Kids love to feel "adults" and this should be a good incentive.
When you're away and he has to poop, talk with him over a cellular phone while he's in the toilets. This is of course only mid-level solution, allowing you to be away, and assuming he will go along with it to begin with. But better than having him hold for days.
Friends. Assuming he has a "best friend", or at least other boy whom he trusts and respects, talk with the friend's parents, and together with them instruct the friend how to approach your son and try to convince him to poop in the school's toilets. Sometimes kids would prefer listening to a friend their age rather than their parents, so this has chance to work in my opinion.


Acer Aspire L5100 monitor keeps going blank

Question: My monitor keeps going blank and \i have to keeep switching it on and off or unconnecting and reconecting. I have sent for a new cable but I fear it may be the monitor. Will any Acer monitor fit ?
Answer: Not necessarily any Acer monitor, but any monitor at all (from any manufacturer) that connects via DVI or HDMI.  My research suggests that a VGA monitor won't work, though, and they're the most commonly-available sort, so check before you buy.


Is there any other form of coinbase transaction?

Question: Could miners intentionally change the output address or reduce the output value before forming a block
Answer: A block must have exactly one coinbase transaction as its first transaction. This transaction may collect the transaction fees and create new coins according to the subsidy. It can assign those funds to one or multiple outputs. If the block includes any segwit transactions, it also has to include an op_return output with a witness commitment.
There have been multiple instances in which miners have collected less funds than they would have been allowed to. For example block 501,726 failed to collect any mining reward at all.
The only time when the coinbase transaction can be changed is before a block is found. Miners routinely amend the coinbase's extranonce during the mining process to add more entropy to their block candidates. Once a block template produced a valid block, the coinbase is fixed, since changing any byte in the block would change the header and the header's hash would no longer fulfill the difficulty requirement.
Answer: To my understanding, a miner will define the output address for the payout of the coinbase transaction prior to solving the hash and sharing the new block. Changing the output value of the coinbase transaction would break protocol rules and the block would be invalid and not added on top of the chain.


How to set default graphics card Windows 10 desktop. GTX 960 and GT 1030

Question: I am having trouble with a few things regarding my current setup in my gaming PC.
Ever since I've had this computer, it's had a GTX 960 and everything worked perfectly, however trouble arose a few days ago after I added a GT 1030 to my system. I am using the GT 1030 for a small amount of bitcoin mining, it's not like I'm trying to make a huge amount of money, I'm just using my gaming PC to make a small amount to pay for cheap games. At first, I was thinking that everything would work fine, both monitors are plugged in to the GTX 960 and nothing is plugged into the GT 1030.
I first discovered an issue when I attempted to play Minecraft. I've done this many times before and I've seen good FPS, however this time I was getting 20-30 FPS windowed mode and 10-15 FPS fullscreen. I didn't know why this would happen. I'm mining on the 1030, not the 960 and so it shouldn't have an effect on gaming. I pressed F3 in Minecraft to see system information and it said it was using the 1030 for graphics. It shouldn't be doing this and even Nvidia's GPU activity states that javaw.exe (Minecraft) is running with the 960 and not with the 1030. I looked online and found information on using the Manage 3D settings option in the Nvidia control panel to set the preferred graphics processor. I tried this however, I didn't have this option. After googling for a while, I discovered it was only available to gaming laptops and I'm on a desktop.
I decided it wasn't too bad since it's Minecraft and I don't really care about Minecraft, but the true extent of this was made apparent when I attempted to play Pokemon Ultra Moon on Citra, a 3DS emulator. I was getting poor performance (10 FPS) when emulating at 2000x1200 resolution, I did this the a few days ago and got full speed emulation, however 1/3 speed emulation is impossible to use. I didn't want it to be the bitcoin mining, but I disabled it and citra ran at full speed immediately and when re-enabling it, it shot down again.
For Bitcoin mining, I am using Nicehash and have selected only the 1030 to mine. I've used process explorer and process hacker to check the GPU activity and it's the 1030 that's being using 100%, not the 960. I don't have a preferred graphics option in my Nvidia control panel and I'm not going to stop Bitcoin mining since I want a fix to my actual problem instead of a work around.
I've been searching the internet for 3 days seeing if I could find anything, but I couldn't.
All information for "choose default graphics card" or "choose between two graphics cards" or "see which GPU is being used" is giving me information for laptops. I really want to be able to tell all programs to use my 960 while Nicehash mines with the 1030.
I hope I get an answer that will fix my problems,
Thanks
Comment: The reason the info you're finding is for laptops is because laptops are the systems where switchable graphics are an issue, mostly due to power considerations. What you SHOULD be looking at is what changed on your computer a few days ago that precipitated the change.
Answer: Since the games are displaying via a cable attached to the "wrong card," (the game is rendering on one GPU and displaying via the other), then this means you have SLI enabled. You don't seem to want that, so you need to disable SLI so that the GPUs act as discreet devices.
I don't use multi-gpu setups but I have heard rumours that sometimes the SLI configuration is missing in the control panel and sometimes swapping slots or uninstalling nvidia drivers and reinstalling will fix that. Note swapping slots may not be desirable depending on the lanes configuration of your PCIe interfaces.
Side note: presuming that bitcoin mining won't impact game performance is not a safe bet. Even minor disk access can cause stuttering that is often worse than simply reduced framerate.
Comment: For googling on your own, try "nvidia disable SLI"