Is there a Wikipedia API just for retrieve the content summary?

Question: I need just to retrieve the first paragraph of a Wikipedia page.
Content must be HTML formatted, ready to be displayed on my website (so no BBCode, or Wikipedia special code!)
Comment: Wikipedia doesn't use BB code, it uses its own wiki markup code.
Comment: It doesn't work for every wikipedia article.
https://ro.wikipedia.org/w/api.php?action=query&format=json∝=extracts&titles=FC+Barcelona&exintro=1&explaintext=1&exsectionformat=plain
Answer: There's a way to get the entire "introduction section" without any HTML parsing!  Similar to AnthonyS's answer with an additional explaintext parameter, you can get the introduction section text in plain text.
Query
Getting Stack Overflow's introduction in plain text:
Using the page title:
https://en.wikipedia.org/w/api.php?format=json&action=query&prop=extracts&exintro&explaintext&redirects=1&titles=Stack%20Overflow
Or use pageids:
https://en.wikipedia.org/w/api.php?format=json&action=query&prop=extracts&exintro&explaintext&redirects=1&pageids=21721040
JSON Response
(warnings stripped)
{
    "query": {
        "pages": {
            "21721040": {
                "pageid": 21721040,
                "ns": 0,
                "title": "Stack Overflow",
                "extract": "Stack Overflow is a privately held website, the flagship site of the Stack Exchange Network, created in 2008 by Jeff Atwood and Joel Spolsky, as a more open alternative to earlier Q&A sites such as Experts Exchange. The name for the website was chosen by voting in April 2008 by readers of Coding Horror, Atwood's popular programming blog.\nIt features questions and answers on a wide range of topics in computer programming. The website serves as a platform for users to ask and answer questions, and, through membership and active participation, to vote questions and answers up or down and edit questions and answers in a fashion similar to a wiki or Digg. Users of Stack Overflow can earn reputation points and \"badges\"; for example, a person is awarded 10 reputation points for receiving an \"up\" vote on an answer given to a question, and can receive badges for their valued contributions, which represents a kind of gamification of the traditional Q&A site or forum. All user-generated content is licensed under a Creative Commons Attribute-ShareAlike license. Questions are closed in order to allow low quality questions to improve. Jeff Atwood stated in 2010 that duplicate questions are not seen as a problem but rather they constitute an advantage if such additional questions drive extra traffic to the site by multiplying relevant keyword hits in search engines.\nAs of April 2014, Stack Overflow has over 2,700,000 registered users and more than 7,100,000 questions. Based on the type of tags assigned to questions, the top eight most discussed topics on the site are: Java, JavaScript, C#, PHP, Android, jQuery, Python and HTML."
            }
        }
    }
}

Documentation: API: query/prop=extracts
Comment: It is very recommendable to use **&redirects=1** which redirects automatically to content of synonyms
Comment: How can I get information from this JSON response if I don't know pages number. I can't access JSON array containing "extract"
Comment: @cglacet yup.  Just use the `pageids=` query parameter like so `https://en.wikipedia.org/w/api.php?format=json&action=query∝=extracts&exintro&explaintext&redirects=1&pageids=21721040`
Comment: @LaurynasG You can cast the object to an array and then grab it like this: $extract = current((array)$json_query->query->pages)->extract
Comment: @LaurynasG, @MarcGuay You can also add `[indexpageids](https://www.mediawiki.org/wiki/API:Query#Getting_a_list_of_page_IDs) as a parameter to the URL to get a list of pageids for easier iteration.
Comment: I got the json output from the wiki call and then casted the json to array
$data = json_decode($json, true). Then I tries to get the 'extract' using `$extract = current((array)$data->query->pages)->extract;`. but "Notice: Trying to get property of non-object" keeps on coming.
Comment: Is there a way to make the same request using the pageid instead of the title?
Comment: One more question... on e.g. openstreetmap i get a wikipedia entry e.g. like: `de:Stüdlhütte`. How would I need to put that into the query for it to return me a proper result?
Answer: There is actually a very nice prop called extracts that can be used with queries designed specifically for this purpose.
Extracts allow you to get article extracts (truncated article text). There is a parameter called exintro that can be used to retrieve the text in the zeroth section (no additional assets like images or infoboxes). You can also retrieve extracts with finer granularity such as by a certain number of  characters (exchars) or by a certain  number of sentences (exsentences).
Here is a sample query http://en.wikipedia.org/w/api.php?action=query&prop=extracts&format=json&exintro=&titles=Stack%20Overflow
and the API sandbox http://en.wikipedia.org/wiki/Special:ApiSandbox#action=query&prop=extracts&format=json&exintro=&titles=Stack%20Overflow to experiment more with this query.
Please note that, if you want the first paragraph specifically, you still need to do some additional parsing as suggested in the chosen answer. The difference here is that the response returned by this query is shorter than some of the other API queries suggested, because you don't have additional assets such as images in the API response to parse.
Caveat from the docs:

We do not recommend the usage of exsentences. It does not work for HTML extracts and there are many edge cases for which it doesn't exist. For example "Arm. gen. Ing. John Smith was a soldier." will be treated as 4 sentences. We do not plan to fix this.
Comment: What is "prop"? Property?
Comment: The first link is (effectively) broken. There isn't "extracts" or "extract" on that page.
Comment: Yes, prop is short for property. Updated the link.
Answer: Since 2017 Wikipedia provides a REST API with better caching. In the documentation you can find the following API which perfectly fits your use case (as it is used by the new Page Previews feature).
https://en.wikipedia.org/api/rest_v1/page/summary/Stack_Overflow
returns the following data which can be used to display a summary with a small thumbnail:
{
  "type": "standard",
  "title": "Stack Overflow",
  "displaytitle": "Stack Overflow",
  "namespace": {
    "id": 0,
    "text": ""
  },
  "wikibase_item": "Q549037",
  "titles": {
    "canonical": "Stack_Overflow",
    "normalized": "Stack Overflow",
    "display": "Stack Overflow"
  },
  "pageid": 21721040,
  "thumbnail": {
    "source": "https://upload.wikimedia.org/wikipedia/commons/thumb/a/a5/StackOverflow.com_Top_Questions_Page_Screenshot.png/320px-StackOverflow.com_Top_Questions_Page_Screenshot.png",
    "width": 320,
    "height": 144
  },
  "originalimage": {
    "source": "https://upload.wikimedia.org/wikipedia/commons/a/a5/StackOverflow.com_Top_Questions_Page_Screenshot.png",
    "width": 1920,
    "height": 865
  },
  "lang": "en",
  "dir": "ltr",
  "revision": "1136271608",
  "tid": "a5580980-9fe9-11ed-8bcd-ff7b011c142c",
  "timestamp": "2023-01-29T15:28:54Z",
  "description": "Website hosting questions and answers on a wide range of topics in computer programming",
  "description_source": "local",
  "content_urls": {
    "desktop": {
      "page": "https://en.wikipedia.org/wiki/Stack_Overflow",
      "revisions": "https://en.wikipedia.org/wiki/Stack_Overflow?action=history",
      "edit": "https://en.wikipedia.org/wiki/Stack_Overflow?action=edit",
      "talk": "https://en.wikipedia.org/wiki/Talk:Stack_Overflow"
    },
    "mobile": {
      "page": "https://en.m.wikipedia.org/wiki/Stack_Overflow",
      "revisions": "https://en.m.wikipedia.org/wiki/Special:History/Stack_Overflow",
      "edit": "https://en.m.wikipedia.org/wiki/Stack_Overflow?action=edit",
      "talk": "https://en.m.wikipedia.org/wiki/Talk:Stack_Overflow"
    }
  },
  "extract": "Stack Overflow is a question and answer website for professional and enthusiast programmers. It is the flagship site of the Stack Exchange Network. It was created in 2008 by Jeff Atwood and Joel Spolsky. It features questions and answers on a wide range of topics in computer programming. It was created to be a more open alternative to earlier question and answer websites such as Experts-Exchange. Stack Overflow was sold to Prosus, a Netherlands-based consumer internet conglomerate, on 2 June 2021 for $1.8 billion.",
  "extract_html": "
Stack Overflow is a question and answer website for professional and enthusiast programmers. It is the flagship site of the Stack Exchange Network. It was created in 2008 by Jeff Atwood and Joel Spolsky. It features questions and answers on a wide range of topics in computer programming. It was created to be a more open alternative to earlier question and answer websites such as Experts-Exchange. Stack Overflow was sold to Prosus, a Netherlands-based consumer internet conglomerate, on 2 June 2021 for $1.8 billion.
"
}

By default, it follows redirects (so that /api/rest_v1/page/summary/StackOverflow also works), but this can be disabled with ?redirect=false.
If you need to access the API from another domain you can set the CORS header with &origin= (e.g., &origin=*).
As of 2019: The API seems to return more useful information about the page.
Comment: Is it possible to also query by a wikidata ID?
I have some json data I extratcted which looks like

  `"other_tags" : "\"addr:country\"=>\"CW\",\"historic\"=>\"ruins\",\"name:nl\"=>\"Riffort\",\"wikidata\"=>\"Q4563360\",\"wikipedia\"=>\"nl:Riffort\""`
Can we get the extract now by the QID?
Comment: This also includes "type" which is excellent if you need to know if what you searched has a "disambiguation".
Comment: I am getting CORS error while trying to access this link from my Angular based application can anyone tell me how to resolve that.
Comment: Can this be used to load the summary of more than one page?
Comment: What @SouravChatterjee asked for, can this API be used to search by page ids? Seems not
Answer: This code allows you to retrieve the content of the first paragraph of the page in plain text.
Parts of this answer come from here and thus here. See MediaWiki API documentation for more information.
// action=parse: get parsed text
// page=Baseball: from the page Baseball
// format=json: in JSON format
// prop=text: send the text content of the article
// section=0: top content of the page

$url = 'http://en.wikipedia.org/w/api.php?format=json&action=parse&page=Baseball&prop=text&section=0';
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_USERAGENT, "TestScript"); // required by wikipedia.org server; use YOUR user agent with YOUR contact information. (otherwise your IP might get blocked)
$c = curl_exec($ch);

$json = json_decode($c);

$content = $json->{'parse'}->{'text'}->{'*'}; // Get the main text content of the query (it's parsed HTML)

// Pattern for first match of a paragraph
$pattern = '#
(.*)
#Us'; // http://www.phpbuilder.com/board/showthread.php?t=10352690
if(preg_match($pattern, $content, $matches))
{
    // print $matches[0]; // Content of the first paragraph (including wrapping
 tag)
    print strip_tags($matches[1]); // Content of the first paragraph without the HTML tags.
}

Comment: But if you search "coral", the result will be something not required. Is there any other way, so that only the p tags with smmary can be picked up
Answer: Yes, there is. For example, if you wanted to get the content of the first section of the article Stack Overflow, use a query like this:
http://en.wikipedia.org/w/api.php?format=xml&action=query&prop=revisions&titles=Stack%20Overflow&rvprop=content&rvsection=0&rvparse
The parts mean this:

format=xml: Return the result formatter as XML. Other options (like JSON) are available. This does not affect the format of the page content itself, only the enclosing data format.
action=query&prop=revisions: Get information about the revisions of the page. Since we don't specify which revision, the latest one is used.
titles=Stack%20Overflow: Get information about the page Stack Overflow. It's possible to get the text of more pages in one go, if you separate their names by |.
rvprop=content: Return the content (or text) of the revision.
rvsection=0: Return only content from section 0.
rvparse: Return the content parsed as HTML.

Keep in mind that this returns the whole first section including things like hatnotes ("For other uses …"), infoboxes or images.
There are several libraries available for various languages that make working with API easier, it may be better for you if you used one of them.
Comment: I dont want the content parsed ad HTML, i just want to get the "plain text" (neither wikipedia code)
Comment: Adding `&redirects=true` to the end of the link ensures you get to the destination article, if one exists.
Comment: The API doesn't offer anything like that. And I can understand why: because from the API's perspective, it's not clear what exactly should this "plain text" contain. For example, how should it represent tables, whether to include "[citation needed]", navigational boxes or image descriptions.
Answer: This is the code I'm using right now for a website I'm making that needs to get the leading paragraphs, summary, and section 0 of off Wikipedia articles, and it's all done within the browser (client-side JavaScript) thanks to the magic of JSONP! --> http://jsfiddle.net/gautamadude/HMJJg/1/
It uses the Wikipedia API to get the leading paragraphs (called section 0) in HTML like so: http://en.wikipedia.org/w/api.php?format=json&action=parse&page=Stack_Overflow&prop=text&section=0&callback=?
It then strips the HTML and other undesired data, giving you a clean string of an article summary. If you want you can, with a little tweaking, get a "p" HTML tag around the leading paragraphs, but right now there is just a newline character between them.
Code:
var url = "http://en.wikipedia.org/wiki/Stack_Overflow";
var title = url.split("/").slice(4).join("/");

// Get leading paragraphs (section 0)
$.getJSON("http://en.wikipedia.org/w/api.php?format=json&action=parse&page=" + title + "&prop=text&section=0&callback=?", function (data) {
    for (text in data.parse.text) {
        var text = data.parse.text[text].split("
");
        var pText = "";

        for (p in text) {
            // Remove HTML comment
            text[p] = text[p].split("


How do I batch edit field values in my attribute table?

Question: I'm using QGIS.  I have an attribute table that has some very long attribute names because of a join I did, and it seems to be causing errors when I try and select values using an expression and export them as a new shapefile (see the screenshot).  What I would like to do is remove the "CensusACSBlockGroup_" from each column title, but there are a lot of fields. Is there a way to edit the columns and remove this from all of them at the same time?
Comment: https://gis.stackexchange.com/questions/380404/why-is-my-join-not-working#comment623325_380404
Answer: "CensusACSBlockGroup_" seems to be a prefix set during the table join. To change the prefix, you do this in the Layer properties / Join tab, check the box Custom field name prefix and insert a prefix. I stick to the rule to have the prefix imp_ , so I always know that fieldnames that start with this are fields imported by a table join. If you uncheck the box, no prefix will be set.
Comment: Can you use this to edit after the join has been made, or do you have to redo the join?
Comment: The fieldnames change, becaus the prefix changes, so if you have linked the fieldnames somewhere, you probably must change them everywhere you used the old fieldnames


Mono WCF Problems with IClientChannel

Question: I'm new to mono but have been asked to look into running an existing .NET client application of ours using mono for Linux, Android and/or MacOS.
The server/client uses WCF duplex communication with NetTcpBinding. I've created a much trimmed down version of the client to try to analyze which of the fundamentals of the connection to the server will work in mono (I'm running mono v2.10.8).
The first problem I had was that a cast to IClientChannel. The factory.CreateChannel result on the client side was giving an InvalidCastException. But I managed to get around this by creating a helper interface that implements the service contract and IClientChannel
public interface IMySessionChannel : IMySession, IClientChannel {}
... and using this in my ChannelFactory
_factory = new DuplexChannelFactory<IMySessionChannel>(....)
But I'm still having a bit of a problem. I've added event handlers for the Closing, Closed and Faulted events of IClientChannel which write a message to screen on the client side when receiving the events.
Everything works fine on Windows, but when running the client in mono (still on the windows machine just running the mono command prompt) and shutting down the server, the events don't seem to come through to the client.
Am I missing something in this? Is there a general issue with IClientChannel interface in mono? The calls to the server are working as are the callbacks, but I'm just having some issue with IClientChannel.
Thanks in advance for any help!
Answer: There was bug #4511 related to DuplexChannelFactory in Mono, which prevented the channel from being cast to IClientChannel.  I fixed that last week, but it's possible that there are other problems.
If you're still having problems, could you please file a bug report with a test case?

Mono WCF Problems with IClientChannel


Whats the Definition of different layouts in webpage that is Two Column,Three Column ,Multi Col,Border Layout and Two Panel Layout?

Question: Definitions needed for Two Column,Three Column ,Multi Column,Border Layout and Two Panel Layout which will be helpful in documenting Technical Design document
Comment: "Two column layout", "Three column layout", "Multi column layout", "Border layout" and "Two panel layout". There isn't anything more fancy to describe them. Don't complicate something that describes exactly what it refers to.
Comment: @EvilClosetMonkey You should put that as an answer to the question intead of a comment. I guess you're an information Architect who have done a lot of work with labeling ;-)
Comment: @BennySkogberg - I feel bad posting such a thing as a full blown answer. I'll try to beef it up some. :)
Answer: User Experience shares a principle with many other practices that tells us to not overcomplicate things. The KISS principle.
From Wikipedia:

KISS is an acronym for "Keep it simple, stupid" as a design principle noted by the U.S. Navy in 1960. The KISS principle states that most systems work best if they are kept simple rather than made complicated; therefore simplicity should be a key goal in design and unnecessary complexity should be avoided. The phrase has been associated with aircraft engineer Kelly Johnson (1910–1990). The term "KISS principle" was in popular use by 1970. Variations on the phrase include "keep it short and simple" and "keep it simple and straightforward".

To best describe a layout when authoring a design document, you want something that is simple and easy to understand when describing a layout such as this:

download bmml source – Wireframes created with Balsamiq Mockups
"Two Column Layout" is simple, spot on descriptive and is very difficult to misinterpret. KISS at it's best!
Similarly, we have the following:

download bmml source
"Three Column Layout" and "Border Layout" are spot on descriptive. Don't overcomplicate something that describes exactly what it refers to!
But what about "Two Panel Layout"? Well, I'm not sure what you mean there. What makes it different than a "Two Column Layout"? Draw a picture in your document, label it "Two Panel Layout" and describe the differences therein. Everyone now knows what it is.


Advice for a career in healthcare management

Question: I have a bachelor's degree in Applied Nutrition and Dietetics and an MBA from a AACSB accredited university. I have about four years of work experience in the field of healthcare management. I have worked in corporate (pharmaceutical) and government (health) sectors. I am interested to further my education to sharpen skills specific to healthcare management. Is it a right career choice to go for a second Master's degree in Healthcare Administration (MHA)? or is it advisable to go for a Ph.D program in healthcare management? What would be the pluses and minuses of getting a second Master's degree (MHA) after MBA in terms of more employ-ability?
Any advice would be appreciated. Thank you!
Comment: What do you mean by _more employ-ability_? Industry or academia? If Academia, PhD is a must. If industry, I am not sure PhD is worth it.
Answer: Just some thoughts and hopefully others will provide more ideas for you. I am answering with the assumption that you're in the US.
First, I don't think a Master in HCM is going to be a good fit. These programs want to prepare workforce for the HCM but you have already done that with real experience under your belt. Unless their syllabus contains a good amount of materials that you absolutely want to learn, or you feel that you're lacking the theoretical base for a PhD, I wouldn't suggest that.
PhD program seems sensible. And I'd also suggest checking out programs such as DrPH (Doctoral in Public Health) degree which usually gears toward applied rather than theoretical. I believe a DrPH selection committee will value you more than a PhD committee does. Regardless, since you want to come back out and work rather than stay in academia, look for a large mix of applied components with perhaps 30-40% research training.
As employment potential... I guess that depends on what you want to be. But generally, if I am to read a resume of an HCM candidate, I'd value experience and knowledge in:

Program monitoring and evaluation
Health economics
Cost effectiveness analysis
Statistics, biostatistics, or econometrics
Qualitative methods
Leadership training and conflict management
Budgeting and management of organization
Grant writing and management

That should open up some doors. Save some credits to specialize (it's better to have a broad research/work interest and a focus one, because funding streams are different in these two levels.) For instance, if you want to work in some large hospital, you may add a couple courses (or summer training or capstone project) in clinical trail management and electronic medical record. If you want to serve more specific group such as undeserved Hispanic population in California, then you can add a couple more components in health equity, community participatory research, and coalition management.
I guess my ultimate confusion is that you have already worked in HCM for 4 years, which means you were/are employed. What prompted you to get more employ-able? What is that extra thing you want? If you want to advance to the management position, then I'd perhaps suggest checking what kind of degrees these people have, and perhaps talk to a couple seniors and mentors in your company.
Regardless, I'd suggest opting for a slower pace and complete your degree while keeping the job. The affordable health care act is going to be an experience and you should keep involved in the field while studying. Apply what you learn back to your office, make your company treasure you (or even invest more in you.) When the degree is done, and if you're not happy enough to stay, then consider leaving.


Low Filament Sensor for Creality CR-10?

Question: I have been playing with my CR-10 for about a month now and I was wondering if there is a low filament sensor available for the CR10.
I found this listing on Amazon, Creality 3D Printer CR-10 S4 with Filament Monitor Dual Z Rod Screws 400x400x400mm, which is for the larger model which has a built in low filament sensor, and I was wondering if the sensor could be bought separately and installed on my CR-10.
Alternatively, I have had a look around and only found this, XCSOURCE 1.75mm 3D Printer Filament Detection Sensor Module Filament Run Out Pause Monitor for 3D Printer DIY Kit TE720. By looks of it, it needs to be attached to the main board in the control box.
Can anyone tell me if this would be compatible?
Comment: Have you had a look at your controller board?  Most importantly, does it have a large Atmel 2560 Chip?, that signifies the CR-10S board, that *can* accept the filament detector.
Comment: Hi HuwD, I have reworded your question to remove the opinion based part from it. I have assumed that you want to know how to get a filament sensor upgrade working. If I am wrong, then please feel free to roll back the edit. Join us in [chat](https://chat.stackexchange.com/transcript/message/46957019#46957019) if need be.
Answer: TL;DR
You need to have the version 2.x controller board (and the associated CR-10S firmware) to use the filament sensor. If you do not then you will need to upgrade your controller board.

Board Comparison
For an excellent breakdown of the boards, read Creality CR-10 and CR-10S Models – What Printer do you have.
There appear to be two basic model versions of controller board, which use different firmware:

Controller board v1.1.2 (or v1.1.3 with additional filter capacitor) which uses CR-10 firmware. These have a small Atmel ATmega1284P chip, and one Z-axis stepper connector;
Controller board v2.0 (or v2.1 with extra fan ports) which uses CR-10S firmware. These have a large Atmel ATmega2560 chip, and two Z-axis stepper connectors.

See the section Board examples at the bottom of this answer for a visual comparison of the two boards.
It is the v2.x (CR-10S) board that has the filament detector, which uses the X+ endstop connector:

To quote part of the page:

Please make sure you know what printer you have. There are 8 DIFFERENT models from Creality. There are 2 different boards across these models. The easiest way to identify what one you have is if it has a filament sensor or not. If it does then you have a CR-10S machine. If it does not then it is a CR-10.
Just because you have a CR-10 S4 or CR-10 S5 that does NOT make it a CR-10S.
The S4 and S5 sizes come available with either board versions. Again the main way to tell is if you have a filament sensor from Creality or not. Whether you have Dual Z or not does NOT matter. What matters is what board is in the enclosure.
Typically every CR-10S board came with a filament sensor. So if you don't have a filament sensor then it is the CR-10 and you need use the CR-10 firmware. However we have seen some CR-10 Mini machines ship with CR-10S boards. Use the below pictures of the boards that are in the wild to identify what model you have. The important thing is to use the correct firmware for the board that is in your machine.

Separate upgrade
With respect to the first question, you would be best off contacting Creality directly, via their customer support, to see if the sensor is available separately. This would probably make for the least painful method of implementing the filament sensor.
Alternatively, there is this kit, Creality CR-10S Upgrade Kit, for $120:

Best Upgrade Kit for your Creality CR-10 3D Printer contains Dual Z axis for Stability in 3D Prints & Filament Monitoring Alarm Protection (Sensor) which alerts you when the filament has ran out or broken for Smart 3D Printing

There seems to be a dual-Z option, for an extra $80

Hacked solution
For the second question, the XCSOURCE 1.75mm 3D Printer Filament Detection Sensor Module Filament Run Out Pause Monitor for 3D Printer DIY Kit TE720,

the instructions state that it is designed principally for Lerdge control boards:

Instruction:

When you are using a Lerdge brand motherboard: The green light on the motherboard will turn off when the filament runs out, the
motherboard will stop printing until you supplement the filament and
continue printing. (Please connect to the M-sensor Interface)
When you are using other brand motherboard: The Detection Module uses the level transition detection method. While there still have
filament in the module, the detection port shows as high level; when
there is no filament in the module, the detection port will transform
to low level as "Filament Run Out Command" which will stop the
printing, so you will have time to supplement the filament and
continue printing.

So, it is not particularly clear as to whether it will work with your board - for it to do so, your board would need to have:

A compatible input (i.e. X+ endstop);
The compatible firmware (CR-10S), and;
Use compatible logic levels (i.e. active LOW to shutdown printing).

If not, then given point #2, it would appear to require additional external logic, or microcontroller, to sense the transition to LOW and then shutdown the printer.
For example, this chap on Thingiverse, Cr-10 Filament Sensor Bracket & Tutorial, states that they bought a sensor off eBay, that looks similar, and they provide a printable mount and instructions on how to use it with a CR-10. However, it is not a standalone affair as shown in the CR-10 S4 - because an additional Raspberry Pi and OctoPrint is required.
To use this particular sensor with your board, you would need to:

See if which controller board you have - either the CR-10 or the CR-10S compatible board (see Board Comparison above). If it is the CR-10S therefore it has the compatible input (X+ endstop), and firmware, needed for the filament sensor,

Enable the use of the sensor, if necessary, in the firmware (either by the UI if possible or uploading new firmware) and;

Check whether the CR-10 controller board uses active LOW to detect a lack of filament (or again, this may be a UI, or firmware, setting)
You could test this last point yourself, by applying a LOW level voltage (i.e. grounding) to X+ endstop input on the control board (after checking the UI/firmware for appropriate settings), and see if that halts/pauses the print. If not, try a HIGH level (5 V). If it is active HIGH then you simply need to use an inverter (i.e. 4069), between the sensor and the X+ endstop connector.

Board examples
There are two principle board options, v1.x and v2.x, the latter has dual Z stepper motor connectors and the former does not .For example:
Version 1.x, for CR-10 firmware - Motherboard Controller DIY Creality 3D® CR-10 / CR-10S 3D Printer CR-10 Upgrade Control Board12V (CR-10S Mainboard)

Version 2.x (2.1 in this case) with Dual Z stepper connectors, for CR-10S firmware -  Luxnwatts CR-10S Mainboard Replacement Controller Board Upgrade V2.1 Motherboard For Creality S4 S5 3D Printer

Low Filament Sensor for Creality CR-10?


about predict the class for a new datapoint

Question: I have a new data point and want to classify it into the existing classes.I can calculate pairwise distance for the new point to all existing points(in the existing classes). I know using KNN would be a straightforward to classify this point. Is there a way I could randomly sampling existing classes and then correlated the new point to a potential classes without calculating all pairwise distances?
Answer: Since you have your clusters set up already you should be able to calculate cluster centroids and then determine the distance between a each cluster centroid and the new data point. You could follow the same process with random samples of each cluster.
Comment: Thanks! But one thought about using a cluster centroid, it would require each cluster has similar volume/or radius. if all potential clusters are significantly differ in volume, I do not sure the method can work in the case?
Comment: @tomc4yt how do you calculate the distance of a new data point from existing cluster centroid using sql?
Answer: I think you need to take a step back and figure out what you're trying to do at a higher level.
How were the existing classes built? If they were built by clustering unlabeled data, then with this new data point you're continuing with the clustering process.
If the existing classes are labeled data, then k-NN is one possible classification method, and there are plenty more (decision trees, naive bayes, neural networks, etc.).
If you're doing clustering, then there are several ways of assigning a point to a cluster, among measuring the distances from the point to cluster centroids is one. There's also single-linkage (distance is min of distances from point to points of cluster), complete-linkage (max of distances). These different methods will give clusters with different shapes and there's no universally best approach. You could test them with points that are already in clusters... but then if you're certain of what classes they re in, then you have a classification problem.
So... if it's classification, then you can use k-NN, that's similar to the idea of assigning a point to a cluster according to distance. But it's not defined as finding the nearest cluster, it's defined as finding the classes of the k nearest points, then applying a vote or something. 1-NN is basically like single-linkage clustering. kNN does require finding the most similar (training) data points to your new data point. Sampling is definitely sub-optimal, but it may be good enough if you classes are well separated. If the cost of calculating distances is high, then one way of reducing the cost of calculation is the idea of skyline clustering: use a cheap distance metric to determine a subset of points that are likely to be among the k nearest neighbours, then compute these neighbours using the more expensive distance metric.
Finally, if you will be classifying many points and not updating your model, it may be worth training a model (e.g. a decision tree) on the existing classes.
Comment: Thanks a lot! your are really inspiriting! are there standard/classical methods to check/quantify if the classes are well separated or overlaps?
Comment: I would say classes are well separated if you can train a classifier on them and it gets very high accuracy. But if you can do that you probably don't need to do any sampling for k-NN... Or if when you apply k-NN, the top-k classes are consistently the same... you could try k-NN on a subset of your data, then try the "sampling" way, and try to quantify your loss.


Is there any "singlet state" for 3 or more spin 1/2 particles?

Question: Every system with $N$ or more electrons lies in a Hilbert space $H=H_{\text{space}} \otimes H_{\text{spin}}$, with $H_{\text{space}}=H_{\text{space}}^{1}\otimes\cdots\otimes H_{\text{space}}^{N}$ and $H_{\text{spin}}=H_{\text{spin}}^{1}\otimes\cdots\otimes H_{\text{spin}}^{N}$, $H^i$ being the $i$-th particle space. So the system has a state $|\Psi\rangle = |\Psi\rangle_{\text{space}} \otimes |\Psi\rangle_{\text{spin}} \in H$.
What I couldn't come up with is an antisymmetric spin ket $|\Psi\rangle_{\text{spin}}$ when there was more than 3 electrons. This would mean that the only way of antisymmetrizing $|\Psi\rangle$, for $N\geq 3$, is by antisymmetrizing only the spatial part. I think it's strange, since for $N=2$ we do have an antisymmetric spin ket (the singlet state), so why wouldn't be such kets for $N\geq 3$?
Ignoring the spatial part, and assuming $N\geq 3$, if we want to describe $N$ identical spins $\sigma_k = \pm$, we need to antisymmetrize the ket $|\sigma_1\rangle |\sigma_2\rangle \cdots |\sigma_N\rangle$ in the following way
\begin{equation}
|\Psi\rangle_{\text{spin}} = \frac{1}{\sqrt{N}}\sum_{p \in S_N}sg(p)|\sigma_{p(1)}\rangle |\sigma_{p(2)}\rangle \cdots |\sigma_{p(N)}\rangle
\end{equation}
Let's take, for example, the following ket (which we want to antisymmetrize)
\begin{equation}
|\phi\rangle=\underbrace{|+\rangle\cdots|+\rangle}_{n}\underbrace{|-\rangle\cdots|-\rangle}_{m} \quad (n+m=N)
\end{equation}
If we only look at the permutations $p$ which don't change $|\phi\rangle$, we end up with a subgroup $S_n S_m\subset S_N$, made up of:
$S_n$ = permutations $\alpha\in S_N$ which don't change the "$\underbrace{|+\rangle\cdots|+\rangle}_{n}$" part and don't touch the "$\underbrace{|-\rangle\cdots|-\rangle}_{m}$" part
and:
$S_m$ = permutations $\beta\in S_N$ which don't touch the "$\underbrace{|+\rangle\cdots|+\rangle}_{n}$" part and don't change the "$\underbrace{|-\rangle\cdots|-\rangle}_{m}$" part
With $S_n S_m$ being all the permutations of the form $\alpha \circ \beta$
But the thing is that half of the elements of $S_n$ are even and the other half are odd, so the following sum is zero:
\begin{align}
A(|\phi\rangle) \stackrel{\text{def}}{=} &\sum_{p\in S_n S_m} sg(p) |\phi\rangle = \sum_{\alpha\beta\in S_n S_m} sg(\alpha\beta) |\phi\rangle = \sum_{\alpha\beta\in S_n S_m} sg(\alpha)sg(\beta) |\phi\rangle = \\
= &\sum_{\alpha\in S_n}\sum_{\beta\in S_m} sg(\alpha)sg(\beta) |\phi\rangle = \underbrace{\left(\sum_{\alpha\in S_n} sg(\alpha)\right)}_{0} \sum_{\beta\in S_m}sg(\beta) |\phi\rangle = 0
\end{align}
And a similar computation could have been done to every permutation of $|\phi\rangle$, so, noticing that the original ket $|\Psi\rangle_{\text{spin}}$ is a sum of terms like $A(|\phi'\rangle)$, with $|\phi'\rangle$ being permutations of $|\phi\rangle$ which do change it (unlike before), it turns out that $|\Psi\rangle_{\text{spin}} = 0$ for every $N>2$ ! (with $|\Psi\rangle_{\text{spin}}$ antisymmetric)
Answer: Group theoretically, the number of singlets contained in the composition of N=2m doublets is
$$
\frac{(2m)!}{m!(m+1)!}~~,
$$
so 1 for N=2, 2 for N=4, 5 for N=6, etc, and 0 for odd N, of course.
You see this from direct plug in of the general formula for the Kronecker product of N doublets, eqn (19) of Zachos 1992. You should be able to recognize the sequence as the diagonal of the Catalan triangle , so Catalan numbers.
The multiplicities of arbitrary products of arbitrary reps can be gotten by integrating representation characters over the SU(2) group invariant measure and possess interesting properties, e.g. Curtright et al 2017.
Answer: For any even number of spin $1/2$ particles there is at least one state with zero total spin. However, this state is not attained by antisymmetrizing all the spin states, because as you said, this is simply impossible for $n > 2$ particles; the antisymmetrization gives exactly zero. You're getting yourself confused thinking about spatial wavefunctions, which have nothing to do with the problem.
Explicitly, consider $4$ particles. Suppose the first two are in an antisymmetrized singlet state, and the last two are as well. Both the first two and last two individually have no spin. Hence the combination of both of these pairs also has no spin. This is an example of a singlet state, and it is not constructed from antisymmetrizing all four spins, which would be impossible.
Comment: @adiselann No, only the total wavefunction must be antisymmetric, so presumably the position wavefunction compensates. However, since the position wavefunction can always take care of things, we can ignore the antisymmetrization postulate as long as we ignore the position wavefunction as well.
Comment: Look at a beryllium atom. It has 4 electrons with zero spin and zero angular momentum: $[He]2S^2=1S^22S^2$. The pairs of electron each occupy different radial quantum numbers.
Comment: That 4-particle state you give is not totally antisymmetric. Why is it possible to have such state? Isn't it forbidden by spin-statistics theorem/symmetrization postulate?
Answer: Yes : Four particles with spin $\;\frac12\;$ give two singlets
\begin{equation}
\boldsymbol{2}\boldsymbol{\otimes}\boldsymbol{2}=\boldsymbol{1}\boldsymbol{\oplus}\boldsymbol{3}
\tag{01}\label{eq01}
\end{equation}
\begin{equation}
\boldsymbol{2}\boldsymbol{\otimes}\left(\boldsymbol{2}\boldsymbol{\otimes}\boldsymbol{2}\right)=\boldsymbol{2}\boldsymbol{\otimes}\left(\boldsymbol{1}\boldsymbol{\oplus}\boldsymbol{3}\right)=\underbrace{\boldsymbol{2}\boldsymbol{\otimes}\boldsymbol{1}}_{\boldsymbol{2}}\boldsymbol{\oplus}\underbrace{\boldsymbol{2}\boldsymbol{\otimes}\boldsymbol{3}}_{\boldsymbol{2}\boldsymbol{\oplus}\boldsymbol{4}}=\boldsymbol{2}\boldsymbol{\oplus}\boldsymbol{2}\boldsymbol{\oplus}\boldsymbol{4}
\tag{02}\label{eq02}
\end{equation}
\begin{align}
\boldsymbol{2}\boldsymbol{\otimes}\bigl[\boldsymbol{2}\boldsymbol{\otimes}\left(\boldsymbol{2}\boldsymbol{\otimes}\boldsymbol{2}\right)\bigr] & =\boldsymbol{2}\boldsymbol{\otimes}\bigl[\boldsymbol{2}\boldsymbol{\oplus}\boldsymbol{2}\boldsymbol{\oplus}\boldsymbol{4}\bigr]= \left(\boldsymbol{2}\boldsymbol{\otimes}\boldsymbol{2}\right)\boldsymbol{\oplus}\left(\boldsymbol{2}\boldsymbol{\otimes}\boldsymbol{2}\right)\boldsymbol{\oplus}\left(\boldsymbol{2}\boldsymbol{\otimes}\boldsymbol{4}\right)
\nonumber\\
& =\boldsymbol{1}\boldsymbol{\oplus}\boldsymbol{3}\boldsymbol{\oplus}\boldsymbol{1'}\boldsymbol{\oplus}\boldsymbol{3'}\boldsymbol{\oplus}\boldsymbol{3''}\boldsymbol{\oplus}\boldsymbol{5}
\tag{03}\label{eq03}
\end{align}

Note that
\begin{equation}
(2j_{\alpha}\boldsymbol{+}1)\boldsymbol{\otimes} (2j_{\beta}\boldsymbol{+}1)=\bigoplus_{j_{\rho}\boldsymbol{=}\boldsymbol{\vert} j_{\alpha}\boldsymbol{-}j_{\beta}\boldsymbol{\vert}}^{j_{\rho}\boldsymbol{=} j_{\alpha}\boldsymbol{+}j_{\beta}}(2j_{\rho}\boldsymbol{+}1)
\tag{04}\label{eq04}
\end{equation}


Disable highlighted UIControl state of a UIButton

Question: I have a UIButton, I want to disable its UIControlStateHighlighted if the button is in selected state. With that I mean, if the current state of UIButton is ControlStateSelected then on touch down, its state should not change to highlighted which is the default behavior of a UIButton.
Comment: Possible duplicate of [How to disable the highlight control state of a UIButton?](http://stackoverflow.com/questions/2259905/how-to-disable-the-highlight-control-state-of-a-uibutton)
Answer: [button setBackgroundImage:[UIImage imageNamed:@"button_image"]forState:UIControlStateNormal];
[button setBackgroundImage:[UIImage imageNamed:@"button_image_selected"] forState:UIControlStateSelected];
[button setBackgroundImage:[UIImage imageNamed:@"button_image_selected"] forState:UIControlStateSelected | UIControlStateHighlighted];

Third line is the trick here, it will disable the highlighted state of UIButton if button is already in Selected State
Comment: this wonderful answer should be referenced if your purpose is to remove the control's Highlight state , not only remove the highlight effect on click
Answer: Uncheck "highlight adjusts image" in IB, Also make sure that button type is set CUSTOM in IB
Answer: if(button.selected == YES)
button.adjustsImageWhenHighlighted = NO;
else
button.adjustsImageWhenHighlighted = YES;

Hope this helps
Comment: Hi, thanks for reply. But even after setting utton.adjustsImageWhenHighlighted = NO; highlighted state is evoked
Answer: just two things:
UIButton *btnTransparentComponent = [UIButton buttonWithType:UIButtonTypeCustom];
btnTransparentComponent.adjustsImageWhenHighlighted = NO;


how can i achieve a ootb mail sending functionality x days before a column value

Question: I have a date field column called review date. I want to send a email to document owner 30 days before the review date so that the doc owner publishes the document by then. How can I achieve this using OOTB options?
Answer: You can create a workflow in SharePoint Designer that applies to each document. Workflow would pause until a certain date and then an email is sent to the doc owner that reminds them to publish it. Just be aware that you can't change the review date once the workflow has started. If you do, you will need to stop and restart the workflow on the document.
Answer: As I understand from your tags , you are using a Retention Information Policy. So to can achieve that as OOTB you will face the following main two issue :

You can use your Review Date but not with before condition where retention policy is not to accept minus value as shown.

You will need to create a custom workflow to your custom list to send an email to the document owner and this is not considered OOTB as you need.

So to overcome the above issues follow the mentioned steps below:

Try to add to your custom list a new field as Actual Reminder Date that is less than the review date with 30 days (or any period that you need) . but you should note that it's should be manual because if you create it as calculated field it will not be listed at Time Period drop-down as shown at the above image.
Create a simple workflow to your list to send the email to the owner field of the doc in your different library. (you can check how to create this workflow as mentioned here)
build your retention Policy in your custom list as the following

Go to List Settings of the custom list that have the review date from type date.
Go to "Information management policy settings"
Select a content type as Item
Check Retention
Add a retention stage:
"This stage is based on a date property on the item": to your new field Actual Reminder Date + (1) days;
At Action , Select Start a workflow and select the workflow that  you already have created before.


Will deleting all current post tags cause SEO or Webmaster issues?

Question: I have several thousand tags currently and want to completely re-do all my post tags.  As a result, a lot of the current ones won't be used again.  Before I insert the new tags, I want to delete all the current ones from the tag admin panel.  Will doing so cause any SEO or Google Webmaster issues?  I don't want Google coming along and saying "I can't find 500 of your index tags...PageRank-2."
Answer: PageRank is per page, not per site and only reflects the link popularity of a page, nothing more. So removing those pages won't directly affect the PageRank of your remaining pages. It will indirectly affect their PageRank as every page inherenty has PageRank and by removing those pages you will not be "passing" PageRank from them to your other pages. But that will be offset by your new tag pages so this really is a non-issue.
Also, pages are removed from the Internet all of the time. Just expect Google to report lots of 404 errors in your account once those pages are deleted.
Answer: Well tag pages in WordPress for example are usually indexed. I'm not sure what application you are running but I would check to see if those tag pages are indexed. Go into your analytics and see what the top landing pages are from organic searches and search for the word tag or tags to see if any of your tag pages are ranking high for some keywords.
The tag pages may also be helping with internal relevant links. Depending on how unique, and how much content you have the tag pages being mostly relevant for that tag linking to posts could possibly be helping rank the post pages.
I would first see where the tag pages are ranking as well as other pages on my site, from there i would determine which tags to keep and which to get rid of
Answer: I recently removed 1700 tags from my blog, after 1.5 weeks my Google rankings tanked quite badly and my homepage doesn't appear for one of my niche target keywords, when it was previously #4, instead there is a blog article of mine at #10.
I believe I did not redirect tag pages correctly and this caused the drop in rankings and large rise in my angst.
I wish I had not touched the tags at all, even though many of them were really not adding value for the user, there were synonyms and even some misspellings.
Still it's obvious Google thought of them as having value!? Mine seems to be a case of spamming Google with tag pages greatly benefiting SEO.
I checked the tag page values on analytics and found no traffic going to them, nor were there incoming links to them.
How did you end up going with your tag management efforts?
Comment: This appears to be more like commentary as to what you experienced versus an answer to the question (which is the format of this site, as apposed to a forum with back and forth discussions). Additional questions inside of answers are also not really condoned (again due to the format). Can you edit this into more of a direct answer to the question, and remove your question at the end? You can use your own experience as part of the answer. Thanks.


How do I effectivly an profitably, make a career out of independent freelancing?

Question: I've been researching a lot about freelancing, an to my surprise, I'm a little interested in becoming an independent freelancer! In accordance I am inquiring on how to become a successful freelancer that actually makes a profit, an is actually worthwhile?
Answer: This very much depends on your personal circumstances and the business domain in which you want to offer your services.

Do you have sufficient experience for someone to hire you?
Can you find and keep clients?
Are clients in that business segment used to outsourcing work?
Do you have a sufficient financial buffer?
Local laws, regulations and taxation may also need to be considered
Answer: Freelancing as?  I was in a similar circumstance.  It depends on what industry you are offering services in, but you might find it helpful to consider yourself as a "consultant."
(Such as) If you are freelancing as a writer/copywriter- create a website or freelance website profile page as an actual business/agency instead of titling yourself "Freelancer."
I am in a mix of Healthcare and Legal and I.t. world- so, it was better to market myself as a Legal/Medical Consultant and then list the services I offer as such...  Just an idea.  Look into making a CV or PowerPoint Pres (link) that's publicly available, helps boost legitimate points when businesses are evaluating your professional presence.
Answer:
Have a skill or ability others would want to utilize
Advertise/market your ability/skill to get others hopefully contacting you
Seek out customers and "sell" them on your skill/ability
Fulfill projects successfully leaving happy customers who hopefully
pass on your name to others seeking the same skils/abilities
Repeat


why does drop-out increase training time?

Question: The textbook I am reading just says that dropout tends to increase the total training time by 2~3 times but does not explain why. Can someone provide an intuitive explanation?
Comment: Does this refer to any particular type of neural network, convolutional or recurrent, for example?
Comment: I've also noticed this behavior ~ are you reading deep learning with python by any chance?~ The time/epoch is going from 10 to 120 seconds =( This seems a bit extraordinary to me.
Answer: Suppose all the weights of a network are fixed at some value. If you mask some of these weights, the loss will likely be different than if you mask a different set of these weights. This is what dropout is doing: it's an additional source of randomness. This means that the estimation of the loss is noisy, so the estimation of the gradient is noisy, so the optimizer will move in directions which are influenced by this noise.
This increases training time compared to a network trained without dropout because the to find a local minimum because sometimes the noise will cause the optimizer to move away from a local minimum instead of towards it. When this happens, the optimizer must make additional steps to move back in the correct direction. These additional steps require more iterations, and therefore more training time.


Conditionals slower than operators?

Question: I want to make my application faster. I tried to replace an If condition with operators.
The If condition is
list = Range[4000];
Table[If[list[[i]] == 4000, Print[1], Print[2]],
{i, 4000}]; // AbsoluteTiming

Output is

{7.739443, Null}

Using operators:
Table[(list[[i]] == 4000 && (Print[1]; True) || Print[2]), {i,
4000}]; // AbsoluteTiming

Output is

{3.194183, Null}

Both give the same output but the execution time using operators is faster than If condition. Can you tell me which one is useful that does not have future problems as well?
Comment: I didn't edit the last sentence of your question. Could you explain what you're asking?
Comment: I know Operator condition is faster than If condition but i don't know will is affect the originality of if condition when we need to use nested if condition. Note: I know need to use more operators when we use Nested If condition.
Comment: What are you trying to accomplish? I'm assuming that the goal of your function isn't to print out 4000 numbers to the notebook, In that case you should provide a better example since almost all the time spent here is used by the print statements.
Comment: I want to show the time taken to print number as an example, you just delete the output except AbsoluteTime.
Comment: I understand that you just delete the output, but why are you timing how long it takes to print 4000 numbers? If you have any sort of real usage, where you need to show the user 4000 numerical values you would never print them one at a time to the notebook. It seems like a very odd example.
Comment: I was just wanted to show the difference between If condition and Operators using print function, I don't bother about printing values.
Comment: `Print` is a poor choice of function to achieve comparative timings in this context. Additionally, if you look at the output from your two timing examples you will see they are not identical. Perhaps you have an example more relevant to you actual problem ?
Answer: Just to illustrate what the comments are getting at, consider these variations below.  First, the three If calculations are consistently faster than the corresponding operator versions.
Second, the time it takes to execute Print is highly variable (see below).  Finally, let me add that operators are limited in their possible values (for example, Or yields True or the last value).
All of these variations calculate the same list of True or Null values.
list = RandomInteger[{1, 10}, 10^6];
iflist = Table[
    If[list[[i]] == 4, True,], {i, Length@list}]; // AbsoluteTiming

{0.889342, Null}

iflist2 = Table[If[i == 4, True,], {i, list}]; // AbsoluteTiming

{0.567959, Null}

iflist3 = If[# == 4, True,] & /@ list; // AbsoluteTiming

{0.863577, Null}

oplist = Table[(list[[i]] == 4 || Null), {i,
     Length@list}]; // AbsoluteTiming

{0.963072, Null}

oplist2 = Table[(i == 4 || Null), {i, list}]; // AbsoluteTiming

{0.627932, Null}

oplist3 = # == 4 || Null & /@ list; // AbsoluteTiming

{0.950945, Null}

Note the form Table[.., {i, list}] is fastest in both cases, showing that the speed of If versus operator is not the major factor here either.

Here are the results of a few runs of the original code with Print.
There is difference between the two calculations: the first makes a list of all Null, while in the second all but the last element is True.  I tested a variation in which they calculate the same result, but clearly that difference is unimportant.
oldlist = Range[4000];
Table[If[oldlist[[i]] == 4000, Print[1], Print[2]], {i, 4000}]; // AbsoluteTiming

{23.495759, Null}
{68.451701, Null}
{22.523382, Null}

Table[(oldlist[[i]] == 4000 && (Print[1]; True) || Print[2]), {i, 4000}]; // AbsoluteTiming

{8.112765, Null}
{17.992601, Null}
{81.830045, Null}

Compare with a version that calculates the same list as the previous example:
Table[If[oldlist[[i]] == 4000, Print[1]; True, Print[2]], {i,
    4000}]; // AbsoluteTiming

{9.473233, Null}
{46.342906, Null}
{21.116975, Null}

Conditionals slower than operators?


Did the Easterlings have fortifications or kingdoms like the west did?

Question: During the fourth age Aragorn and his son were said to have finally subdued the easterlings and allowed them to return to their great empire. So my question is did the Easterlings have kingdoms and fortifications as great as the west did?
Answer: Tolkien wrote so little about the East that we honestly don't know.
One thing we do know is that the Easterlings were not a single people and not a single culture.  For example, from Appendix A:

The Wainriders were a people, or a confederacy of many peoples, that came from the East; but they were stronger and better armed than any that had appeared before.

So we therefore can't make this kind of blanket statement about them.  In other words: some Easterling cultures may have had such kingdoms, but other Easterling cultures may not.
Comment: I don't think so, your questions are interesting. And we have Darth Satan here who is encyclopedic and that is also interesting...
Comment: Is it bad that im asking so many questions?
Comment: @user31546 - there's no such thing as too many good questions and I'm happy to answer where I can.
Comment: @user31546 - it's probably bad if you (a) hit a question limit or (b) have questions that are primarily downvoted or 0-upvote. It seems that neither of these apply to you, so you're probably fine


Defining a function with multiple implicit arguments in Scala

Question: How can I define a function with multiple implicit arguments.
def myfun(arg:String)(implicit p1: String)(implicit p2:Int)={} // doesn't work

Comment: In the question text you are asking about a function. In your code snippet, you have a method. Are you asking about a function or a method?
Answer: They must all go in one parameter list, and this list must be the last one.
def myfun(arg:String)(implicit p1: String, p2:Int)={}

Comment: If it were a class the syntax would be class MyClass ()(implicit p1: String, implicit p2: Int) { }
Answer: There actually is a way of doing exactly what the OP requires.  A little convoluted, but it works.
class MyFunPart2(arg: String, /*Not implicit!*/ p1: String) {
  def apply(implicit p2: Int) = {
    println(arg+p1+p2)
    /* otherwise your actual code */
  }
}

def myFun(arg: String)(implicit p1: String): MyFunPart2= {
  new MyFunPart2(arg, p1)
}

implicit val iString= " world! "
implicit val iInt= 2019

myFun("Hello").apply
myFun("Hello")(" my friend! ").apply
myFun("Hello")(" my friend! ")(2020)

//  Output is:
//      Hello world! 2019
//      Hello my friend! 2019
//      Hello my friend! 2020

In Scala 3 (a.k.a. "Dotty", though this is the compiler's name) instead of returning an auxiliary MyFunPart2 object, it's possible to return a function value with implicit arguments directly.  This is because Scala 3 supports "Implicit Functions" (i.e. "parameter implicitness" now is part of function types).  Multiple implicit parameter lists become so easy to implement that it's possible the language will support them directly, though I'm not sure.
Answer: There is another (IMO simpler and more flexible) way to achieve a similar effect:
// Note the implicit is now a Tuple2
def myFun(arg: String)(implicit p: (String, Int) ): Unit = {
  println(arg + p._1 + p._2)
  /*otherwise your actual code*/
}

// These implicit conversion are able to produce the basic implicit (String,Int) Tuples
implicit def idis(implicit is: String, ii: Int): (String,Int)= (is,ii)
implicit def idi(s: String)(implicit ii: Int): (String,Int)= (s,ii)

// The basic implicit values for both underlying parameters
implicit val iString = " world! "
implicit val iInt = 2019

myFun("Hello")
myFun("Hello")(" my friend! ")
myFun("Hello")(" my friend! ",2020)

// Output is:
//     Hello world! 2019
//     Hello my friend! 2019
//     Hello my friend! 2020

// If we add the following implicit,
implicit def ids(i: Int)(implicit is: String)= (is,i)

// we can even do
myFun("Hello")(2020)

// , and output is:
//     Hello world! 2020

Using a Tuple as the underlying representation for the parameters is not a good idea because the implicit conversions could interfere with other uses.  Actually, implicit conversions to any standard type (including library ones) usually create trouble in any non-trivial application.  The solution is to create a dedicated case class to hold the parameters instead of a Tuple.  An important advantage is that they could be given names much more meaningful than _1 and _2.


How to get vulnerabilites by product name and version

Question: I have a list of software installed on workstations which contains product name and version, for example my list contains Mysql Workbench 6.3.8. Searching in CVE Details I found out that this software has one vulnerability CVE-2017-3469. Is there any automated tool to do this kind of search in most popular vulnerability databases? What are the others vulnerability databases that I should search?
Comment: Possible: https://security.stackexchange.com/questions/157641/public-vulnerability-feed-with-cvss-v3
Answer: Vulnerability Management tools are designed to do this very function. They usually are able to scan devices and lookup versions against known patch levels as well as CVEs.
There are a great many to choose from with a wide range of features.
The most crucial sources to check beside the CVE database are:

Exploit-DB
Metasploit exploit repository

There are also a number of tools that can take a csv file of product names and versions and look them up in these sources (or you can make your own).
Comment: I'd add seclists (oss-sec/full-disclosure) as a critical source. It's far more important than those two as they are limited to pre-weaponized exploits.
Answer: A tool to use would be a vulnerability scanner such as OpenVAS, Nessus or even Metasploit.  Now not all 3rd party software will be in there.  Other than that, there are scripts on github that offer some assistance.
A good site to search manually or script it https://cve.mitre.org/find/
For Linux: https://github.com/clearlinux/cve-check-tool  (need a local copy of CVE cache)
A tool for local Database of CVE https://github.com/cve-search/cve-search

Furthermore.
Nmap has an NSE script for this called Vulscan. It can help you to map the version information you obtain from a target machine with the vulnerability database, such as:

CVE from www.cve.mitre.org
OSCDB www.osvdb.org
scip VulDB www.scip.ch/?vuldb
www.SecurityFocus.com
www.securitytracker.com
Answer: I found the NIST site (mentioned in schroeder comment) quite useful to search for all CVE for a specific version without installing a vulnerability scanner.
Just choose the "Search Type = Advanced" and you will have a CPE section where you can choose the Vendor, Product and Version.
Example if you want to search a particular version of e.g. Apache Log4j vulnerability:

it will return:

For automating the requests, I suggest to read their Developers' section, you can register to get an API Key
Answer: https://vulners.com/ to search for a product version number.
Vulners basically enumerates CVE's and vulnerability reports as well as security focused blogs and posts from across the internet. You can then search for anything that may be contained in these documents.
I started using it due to their robust API, which makes things even easier. I believe they have a method of setting up a vulnerability scanner as well.


What does "overpowered" do in Time Clickers?

Question: What does "overpowered" mean in Time Clickers?
Answer: From a Reddit post on r/TimeClickers (emphasis mine):

Overpowered activates when your team dps is 10^7 times higher than the
  wave dps and has the effect of reducing the time between each wave.
  The higher above this threshold, the stronger the effect, up to a
  point. It's worth leaving your starting wave at the minimum level and
  leveling your starting gold significantly to boost yourself through
  the early levels very quickly. Additionally, you clear waves fast
  enough that you can build up a significant timer of active abilities
  before running out. I currently have overpower until around level 250
  which leaves me with close to 10 minutes of ability time.
Comment: I saw that too, but "build up a significant timer of active abilities before running out" doesn't fit the current build of the game's mechanics.
Answer: If you ever see "overpowered", then your starting level is too low. You are wasting your time compared to starting at a higher level.


How can multiple receivers decrypt message with public key

Question: If i encrypt a message with private key put the public key on server and send message to 2 enteties, how can the second one encrypt the message when the first one has the public key ?
Answer: Public key is meant to be namely public, means it should be available to everyone. I suppose that by saying that you put it to the server you mean you make it possible to download public key from your server.
Everyone who wants to decrypt your message will download public key from your server, where you put it, and will decrypt the message.
I'd suggest you to check the what you are trying to reach by such scheme.

Confidentiality? Everyone will be able to decrypt such messages. That's why you cannot reach confidentiality by using such scheme. If you need confidentiality, i.e. if you want that nobody except the receiver is able to decrypt the message, then you can use other scheme: Use public key of receiver-1 to encrypt messages to receiver-1. Then nobody except receiver-1 will be able to decrypt them. Messages to receiver-2 encrypt with pubic key of receiver-2. I don't go on details about hybrid encryption here.
Non-repudiation? It might be used for non-repudiation, because no one could produce such encrypted messages except you, the owner of the private key. Where as the idea is basically correct, a direct implementation would be insecure. See details here: encryption+decryption vs. signing. Instead of encryption+descryption use standard algorithms for digital signature like ECDSA.
Comment: Thank you i misunderstood the public key transmission
Comment: @TemmmBebkd: See update.
Answer: As mentallurg says in his answer, the public key is meant to be public.
I assume the question you mean to ask is "How can someone send a message encrypted to two different recipients, using their public keys?"
The answer is hybrid encryption. The message itself is encrypted with a symmetric key, which I will call the "Data Encryption Key", or DEK for short. For each recipient, the DEK is then encrypted with the pubic key of the recipient. The public key, used to encrypt the DEK, is sometimes called the "Key Encryption Key", or KEK for short.
So, for a message sent to two recipients will look like this:
<code> Key Container 1    Key Container 2    Data Container
┌──────────────────┬──────────────────┬─────────────────────────┐
│ DEK, Encrypted   │ DEK, Encrypted   │ Data, Encrypted with    │
│ w/ public key of │ w/ public key of │ the Data Encryption Key │
│ Recipient #1     │ Recipient #2     │ (DEK)                   │
└──────────────────┴──────────────────┴─────────────────────────┘
</code>
The recipient will then see this message, and attempt to decrypt the first key container with every private key they have available. If decryption fails for all of them, they move on to the second container, then the third, and so on, until one of two things happens:

Every key container has been attempted and none could be decrypted.
One container could be decrypted successfully.

In the first case, the decryption fails. In the second case, the DEK will then be used to decrypt the data in question.
Answer: Skipping over the public-key / private-key mixup that @mentallurg addressed; what you are referring to is often called "hybrid encryption" or "enveloped data".
The core idea is this:

The main advantages here are:

Performance: AES is much faster than RSA at bulk encryption, so even though there's an extra layer of crypto here, it's actually much faster for large documents.
Key rotation: By decoupling the content encryption keys from the recipient's public keys, you can use a different AES key for each for each document, which is a good thing for a number of different reasons.

One of the cool things this scheme lets you do is add more recipients by simply giving them a copy of the AES data encryption key (DEK):

This is exactly how S/MIME email does it; you'll notice that the size of the encrypted attachment only grows a small amount as you add more recipients; that's because you're only adding another copy of the encrypted data encryption key (DEK), not re-encrypting the whole content.


Can I use subliminals to get taller? Is it permissible? I just want to get a little bit taller

Question: I don't want to change anything in my appearance, I just want to get a little bit taller through programing my sub-conscious mind, I've heard that our subconscious mind has a unique power to break the barriers for our desires....I just want to get a little bit taller through subliminals, because I feel very insecured about my height....is this permissible in Islam?
Answer: Yes it is haram to use subliminals as you are attempting to change your appearance. Allah has made every human unique so why change what you have. Be blessed with what Allah has provided you. I am also a bit self conscious about my height but I try not to think about it as Allah has blessed me with everything I have. Trying to change your appearance is also a sin as you are trying to change what Allah has created.
Set steady to the fitrah created by Allah for us: (Ar-Ruum 30:30)
"So set thou thy face steadily and truly to the Faith: (establish) Allah.s handiwork according to the pattern on which He has made mankind: no change (let there be) in the work (wrought) by Allah. that is the standard Religion: but most among mankind understand not."
Comment: I also have unwanted body hair which is way too excessive...My doctor has said that I have hormonal imbalance and having excess skin hair is one of it's symptoms, I also have a disease because of this hormonal imbalance, this whole thing is a disease, and I am very insecured about my body hair, so I don't think it is a part of my appearance, since it comes from a disease and can be cured in no time, but I don't have enough money for that, so can I try out subliminals in this case?
Comment: @Usman I don't think attempting to change appearance is haram? By that logic skinny people cannot work out because it's attempting to change appearance (It's not haram). By that logic eating Nutritious food in order to get taller is also haram (it's not haram). i think it's only haram to change appearance through surgery, tattoos etc. Subliminal is purely to give a placebo effect and therefore not haram.  Unless you believe in LOA then it's shirk
Comment: Working out is completely different in terms of you work naturally to increase muscle growth through  working out and eating. There are many sources which state that the use of subliminals aren't allowed.


Convergence of $\int^\infty_0 \frac{e^{-\sqrt x}}{1+x}dx $

Question: I would like to know if the improper integral
$$\int^\infty_0 \frac{e^{-\sqrt x}}{1+x}dx \qquad (1)$$ is convergent or not. I tried substitution and integration by parts but got no simplification. So, I wonder if someone more experienced is looking at this integral, does he immediately see the right approach (e.g., the right substitution)? Maybe there is a criterion for convergence I can apply here?
I have the same problems with $$\int^\infty_1 \frac{\log(x)}{1+x}dx \qquad (2)$$ to find the right substitution.
Any help is appreciated. Thanks.
Answer: For $(1)$ I think a comparison is what you want. Note that $$\frac{e^{-\sqrt{x}}}{1+x}<\frac{e^{-\sqrt{x}}}{x}< \frac{e^{-\sqrt{x}}}{\sqrt{x}}$$ for $x \geq 1$. and hence $$\int_0^\infty \frac{e^{-\sqrt{x}}}{1+x}dx = \int_0^1\frac{e^{-\sqrt{x}}}{1+x}dx+\int_1^\infty \frac{e^{-\sqrt{x}}}{1+x}dx \\ < \int_0^1\frac{e^{-\sqrt{x}}}{1+x}dx+ \int_1^\infty \frac{e^{-\sqrt{x}}}{\sqrt{x}}dx$$ where $\int_0^1\frac{e^{-\sqrt{x}}}{1+x}dx$ is clearly finite. See if you can do something with number $(2)$ along these lines.
Edited for user84413's observation.
Comment: @bd1251252 sometimes you cannot evaluate integrals exactly by hand because a closed form doesn't exist. I'd guess that is the case here. But a computer should get a good enough proximation. Fortunately the comparison test gives us an upper bound, so we might conjecture the approximate answer of the original integral :)
Comment: Excellent comparison +1
Comment: I just worked it out by hand and made total sense. But now, is it possible to determine the exact value this integral converges to, and not just prove it converges?
Comment: (This is a good idea, but I think the comparison is only valid for $x>1$.)
Comment: You're right, and then this comparison works fine.
Answer: Hint: Compare the integral with a integral known to converge, even one whose integrand has a closed-form antiderivative.

 For example, for (1) we have $0 \leq \frac{e^{-\sqrt{x}}}{1 + x} \leq e^{-x}$ on $[1, \infty)$, so we can write $$0 \leq \int_0^{\infty} \frac{e^{-\sqrt{x}}}{1 + x} dx \leq \int_0^1 \frac{e^{-\sqrt{x}}}{1 + x} \,dx + \int_1^{\infty} e^{-x} \,dx,$$ but both of these integrals converge. Alternatively, we can observe that $0 \leq \frac{e^{-\sqrt{x}}}{1 + x} \leq e^{-\sqrt{x}}$, so $$0 \leq 0 \leq \int_0^{\infty} \frac{e^{-\sqrt{x}}}{1 + x} dx \leq \int_0^{\infty} e^{-\sqrt{x}} \,dx,$$ which we can show converges, e.g., by evaluating explicitly with the substitution $x = u^2$.
Answer: Exact value?  Well, Maple does it in terms of an "exponential integral" function
$$
\int_0^\infty \frac{e^{-\sqrt{x}}\,dx}{1+x} = e^i \mathrm{Ei}_1(i)
+e^{-i} \mathrm{Ei}_1(-i)
$$
Definition:
$$
\mathrm{Ei}_1(z) = \int_1^\infty \frac{e^{-tz}}{t}\,dt,\qquad\mathrm{Re}(z)>0
$$
and extended by analytic continuation.


Do neutron stars have an ergosphere?

Question: Ergospheres are a property of black holes, and do neutron stars have it? If yes, why seldom article mentions that; if no, why can't neutron stars have this ergosphere component?
Answer: Neutron stars are generally not compact enough to have an ergosphere. Typically, the radius of a neutron star is several times the Schwarzschild radius corresponding to its mass. The ergosphere however starts at the Schwarzschild radius.
Comment: @Jonas It is not so simple, since the horizon radius of a spinning black hole can be as small as half the Schwarzschild radius.
Comment: Well, thank you @mmeent, i see.
Comment: In addition, one could say that any object compact enough to have an ergosphere automatically become a black hole.

Do neutron stars have an ergosphere?


Latexdiff with two column layout

Question: I'm trying to use latexdiff-so on a document using the two-column Elsevier style. Unfortunately, latexdiff does not respect the column boundaries, and as a result some changes overflow deep from the left into the right column. Is there any way to fix this?
Comment: It is hard to say without a MWE but this probably is relates to citations because ulem does not play that well with citation commands. Try using -t CFONT (will lose you the underline and strike-out but still get color highlighting) or --disable-citation-markup option (changes to citations are no longer marked up with this)
Comment: No, the problematic line contains inline equations, but no citations. I'll try the options you mentioned later today, and see if I can put together a MWE. Thanks!
Answer: I have fixed the offending text by manually adding a line break in the output of latexdiff.

Latexdiff with two column layout


Free cross-database editing software

Question: Is there a free software that allows to edit database ER diagrams and export for different SQL database systems (e.g. MySQL, Oracle, SQLite, Microsoft SQL Server, etc.)?
Comment: @Fractaliste - the requirement to export ERDs to various systems is VERY precise (he even listed a minimum set). ERD also implies a GUI. And seriously... Android app for ERD?
Comment: Mh. I'll ask our DBA about that, I think he had something like this.
Comment: @Fractaliste DVK said it all, I don't think you need more info...
Do you only consider as quality posts those with huge amounts of text as oposed to simple straightforward questions?
Answer: It won't export to everything you want, but I've had a lot of good experiences with Oracle SQL developer data modeller (Not to be confused with Oracle SQL developer). I currently don't have a copy running so no screenshots, but I found it significantly easier to use in designing a database ERD than visio, and forward engineering DDL from it. Once you've created the ERD for a database, you simply have to tell it to export the DDL (file -> export -> DDL) and it'll generate the commands for creating the database for you.
It runs on windows and linux, as long as java is installed. It will allow you to design an ERD and convert that to the necessary DDL for Oracle, DB2 or MSSQL. It dosen't support mysql or sqlite (Oracle has mysql workbench for mysql - but I have no direct experience with it)
Answer:
SQL Power Architect: Data Modeling & Data Profiling Tool will allow you create ER diagrams and then forward engineer that diagram into DDL for Oracle 9i/10g, PostgreSQL, Microsoft SQL Server 2000, Microsoft SQL Server 2005, MySQL, IBM DB2, or HSQLDB (but not SQLite).
It won't allow you to edit an ERD created in a different program, although you can import / reverse engineer a database schema and edit that imported diagram.

(source: sqlpower.ca)

(source: sqlpower.ca)

(source: sqlpower.ca)

(source: sqlpower.ca)
Comment: Development on this tool has stopped.

Free cross-database editing software


Is there any way to programmatically determine in C/C++ how many parameters a Lua function expects?

Question: Is there a way to determine how many parameters a Lua function takes just before calling it from C/C++ code?
I looked at lua_Debug and lua_getinfo but they don't appear to provide what I need.
It may seem a bit like I am going against the spirit of Lua but I really want to bullet proof the interface that I have between Lua and C++.  When a C++ function is called from Lua code the interface verifies that Lua has supplied the correct number of arguments and the type of each argument is correct.  If a problem is found with the arguments a lua_error is issued.
I'd like to have similar error checking the other way around.  When C++ calls a Lua function it should at least check that the Lua function doesn't declare more parameters than are necessary.
Answer: What you're asking for isn't possible in Lua.
You can define a Lua function with a set of arguments like this:
function f(a, b, c)
   body
end

However, Lua imposes no restrictions on the number of arguments you pass to this function.
This is valid:
f(1,2,3,4,5)

The extra parameters are ignored.
This is also valid:
f(1)

The remaining arguments are assigned 'nil'.
Finally, you can defined a function that takes a variable number of arguments:
function f(a, ...)

At which point you can pass any number of arguments to the function.
See section 2.5.9 of the Lua reference manual.
The best you can do here is to add checks to your Lua functions to verify you receive the arguments you expect.
Comment: Well I did say I know what I am doing is not in the spirit of Lua :)  With functions implemented and called entirely within Lua it will work the way you say, however what I want is a way to robustify the Lua/C++ interface.  When you implement a C++ interface using Lua functions (using our custom Lua/C++ binding system) it makes sense to automatically enforce that the Lua functions that are being called from C++ implement the correct number of arguments.  That said I suspect that it isn't possible to do what I want.  Thought I'd ask all the same!
Answer: You can determine the number of parameters, upvalues and whether the function accepts variable number of arguments in Lua 5.2, by using the 'u' type to fill nups, nparams, isvararg fields by get_info(). This feature is not available in Lua 5.1.
Answer: I wouldn't do this on the Lua side unless you're in full control of Lua code you're validating. It is rather common for Lua functions to ignore extra arguments simply by omitting them.
One example is when we do not want to implement some methods, and use a stub function:
function do_nothing() end

full_api = {}
function full_api:callback(a1, a2) print(a1, a2) end

lazy_impl = {}
lazy_impl.callback = do_nothing

This allows to save typing (and a bit of performance) by reusing available functions.
If you still want to do function argument validation, you have to statically analyze the code. One tool to do this is Metalua.
Comment: Thanks.  I am going to take a look at metalua.  Static analysis of the Lua code might actually be better in my case than trying to do the checking at runtime.
Comment: You're welcome. If you do so, please drop a line to Metalua's mailing list (http://lists.luaforge.net/mailman/listinfo/metalua-list). It is likely that you'll get some valuable advice from Metalua author.
Answer: No, not within standard Lua. And is Aaron Saarela is saying, it is somewhat outside the spirit of Lua as I understand it. The Lua way would be to make sure that the function itself treats nil as a sensible default (or converts it to a sensible default with something like name = name or "Bruce" before its first use) or if there is no sensible default the function should either throw an error or return a failure (if not name then error"Name required" end is a common idiom for the former, and if not name then return nil, "name required" end is a common idiom for the latter). By making the Lua side responsible for its own argument checks, you get that benefit regardless of whether the function is called from Lua or C.
That said, it is possible that your modules could maintain an attribute table indexed by function that contains the info you need to know. It would require maintenance, of course. It is also possible that MetaLua could be used to add some syntax sugar to create the table directly from function declarations at compile time. Before calling the Lua function, you would use it directly to look up any available attributes and use them to validate the call.
If you are concerned about bullet-proofing, you might want to control the function environment to use some care with what (if any) globals are available to the Lua side, and use lua_pcall() rather than lua_call() so that you catch any thrown errors.
Answer: The information you ask for is not available in all cases. For example, a Lua function might actually be implemented in C as a lua_CFunction. From Lua code there is no way to distinguish a pure Lua function from a lua_CFunction. And in the case of a lua_CFunction, the number of parameters is not exposed at all, since it's entirely dependent on the way the function is implemented.
On the other hand, what you can do is provide a system for functions writers (be it in pure Lua or in C) to advertise how many parameters their functions expect. After creating the function (function f(a, b, c) end) they would simply pass it to a global function (register(f, 3)). You would then be able to retrieve that information from your C++ code, and if the function didn't advertise its parameters then fallback to what you have now. With such a system you could even advertise the type expected by the parameters.
Comment: You made some good points.  Although the system you propose in the 2nd paragraph is just as open to human error as the default case, eg in the normal case you have to rely on the coder to get the arguments right, in the second case the coder needs to get right both the arguments and the argument-metadata.


Why was my answer deleted?

Question: My answer to this question was deleted by Caleb 2 John 1:7 - Jesus Coming in the Flesh? and there appears to be no reason for doing so. So why was this deleted?
Comment: Biblical Hermeneutics is geared more towards textual analysis and "what does the text actually say?" type of questions. Christianity.SE is focused more on the doctrinal side, where the questions are more like "what do others say this text means?". Your answer definitely did not fit in the former category, so it is not an answer by this site's standards.
Comment: @El'endiaStarman My question was migrated from Christianity stack and was not asked on this site, so I'm not surprised that it does not fit here. Please read before passing legislation so you will know what is in the bill.
Comment: ...your question? It wasn't your question! It was someone else's question, and they wanted answers more along the lines of textual analysis. Their question fit into the scope of this site (BH) better than the scope of that site (C). So it was moved over to where it belongs.
Comment: @El'endiaStarman Please read the question you are answering. You are commenting on my question of why was my answer deleted and NOT THE ORIGINAL QUESTION.
Comment: I wasn't talking about your Meta question. I was answering it (albeit with a comment). 1Up's question fit better on BH, so it was migrated here. Your answer came along, but was deleted as it was not an answer. Then you complained about this on Meta.Christianity...about a deleted answer on BH. So THAT Meta question was migrated over here to Meta.BH. I comment-answered your now-BH Meta question about your deleted answer on 1Up's now-BH question, and gave you a good reason why it was deleted. I see no error on my part.
Comment: @El'endiaStarman The error on your part is that the answer was deleted on the Christianity site before it was moved to Hermeneutics. My question was specifically to Caleb since he was the one who deleted it to begin with. The Christianity site has become a place were it seems that questions and answers are perused for reasons to close them rather than reasons to answer them. People for the most part ask questions because they are seeking an answer to something that is of consequence to them. The site should be geared toward helping them not rejecting their concerns.
Comment: @BYE Your answer was NOT deleted on C.SE before migration. If I had done that it would not have showed up on BH (even in it's deleted state). As for the other aspects of your complaint, that would be something to bring up on C.SE but the site does not make it its purpose to address people's spiritual concerns. In fact it rather avoids that, and limits itself to a specific subset of all possible questions that can be dealt with in a specific fassion.
Answer: I deleted your answer as part of the migration from Christianity to Biblical Hermeneutics. I realize the target moved on you as the question was originally on a site where you answer might have been appropriate. However the question was not appropriate on that site (it should not have even been answered there).
Your answer would have been fine in the context of C.SE (if the question had called for it) but it is not appropriate for this site. You make a doctrinal case for a theological position reasoning from other Scriptures. That is all great stuff, but does not fit this site. The question specifically asks about the original meaning of one specific passage, a passage your answer does not even mention. In the context of this site, only an analysis of that specific text would be on topic.
If you'd like to answer the question here, please edit your answer to be appropriate for this site. That means removing the commentary at the top and presenting a textual rather than a a doctrinal case for your answer.
Comment: I must disagree with your statement that it does not address the poster's question, it specifically asks:   ***Some commentaries I have read concerning this verse states that "coming" refers not only to his past but future presence, returning in the flesh.***
Can this be clarified by someone who understands the original text? Does this imply that Jesus is returning in a flesh state?***
***How should this verse be understood regarding the past or future flesh state?***
Comment: Sorry that I misunderstood: **I deleted your answer as part of the migration from Christianity to Biblical Hermeneutics.** Perhaps it is due to my lack of higher learning, but as I read this question it belongs more on C.se than where you moved it to. As I read this question it is asking for Scriptural backup to whether or not Jesus will return in the flesh. At any rate the site seems to have metastasized into a place where no one really wants to help anymore and only tries bend everything to their concept. Perhaps this is no longer a site for me, continued;
Comment: continued: Since my reasons for using this site is to help others understand Christianity. That appears to no longer be the aim of the site. To my way of thinking if the site is to be of any use what so ever it needs to try to dispel any misunderstanding of Christianity and specifically the Bible which is the basis of Christianity.
Answer: While I cannot answer for Caleb, I suspect that it was deleted because you do not specifically address the question about the meaning of 2 John 7. That is, you presented a good argument that Jesus will return in the flesh, but you did not continue with that to answer the question about whether 2 John 7 should be taken that way or not (which is the question).
So just because Jesus is returning in the flesh (second coming) does not mean 2 John 7 is referring to that necessarily; it may still be referring to simply the past event (His incarnation). That is what the question is asking, so that needs to be addressed in your answer.
Comment: @BYE You seem to still be missing the point. In short, you need to specifically address 1 John 7 in your answer, whatever view you hold to for its meaning. Specifically does "coming" refer to the fact that He _has come_ or is it referring to the fact that He _will come_ or possibly both. That will then answer the question of what 1 John 7 is asserting. Is it a polemic against Gnostics who did not believe Christ ever came in the flesh to begin with (as the other answer argues) or is it against those refusing to believe He will come again? Or both. Whatever your position, relate it to 1 John 7.
Comment: @BYE: Now I beg to differ. If you do not believe "How should this verse be understood regarding the past or future flesh state?" is not asking for an ***explanation of the verse***, then I don't know how else the OP could have stated it clearer that he _is_ asking for explanation. Of course, explanation often includes the necessity of background in order to explain.
Comment: I beg to differ with you. if you read the question it specifically asks:        Some commentaries I have read concerning this verse states that "coming" refers not only to his past but future presence, returning in the flesh.

Can this be clarified by someone who understands the original text? Does this imply that Jesus is returning in a flesh state?

How should this verse be understood regarding ***the past or future flesh state?***
Comment: @BYE what are you differing with me on? I agree that is what the question is asking. What I am saying is, the answer you gave only argued that there _is_ a future flesh state, without addressing whether 1 John 7 should be taken as referring to that future state or the past state. Having established the validity of a future flesh state (as you did), which demonstrates 1 John 7 _could_ be referring to the future, you need to then argue specifically that 1 John 7 _is_ referring to the future state rather than the past incarnation.
Comment: I disagree because: Luke 24:39  Behold My hands and My feet, that it is I Myself. Handle Me and see, for a spirit does not have flesh and bones as you see I have." is unambiguously the past.
Comment: @BYE - correction on my part, all my 1 John 7 references above are wrong. It is 2 John 7 that is the question.
Comment: You are misreading the question; the Scripture was quoted as the reason for his consternation; but the question was asking for background and not explanation.
Comment: @BYE: But my whole point here in answering was to inform you what you needed to do to get your answer "undeleted." I don't have time to debate any more about that. Fix it or not, its your choice.
Comment: @etal getting my answer undeleted is not what the site is supposed to be about it is to the best of my knowledge supposed to help others understand Christianity. If it is only here to bolster ego's you can count me out. Although I am not a fanatic about evangelism, I do feel that I have the **obligation to help others to have sufficient information to make an educated decision about Christianity.**

Why was my answer deleted?