How to write an interpreter?

Question: I have decided to write a small interpreter as my next project, in Ruby. What knowledge/skills will I need to have to be successful?
I haven't decided on the language to interpret yet, but I am looking for something that is not a toy language, but would be relatively easy to write an interpreter for.
Thanks in advance.
Comment: @Svante:  "Lisp" is a family of languages, characterized by a handful of functions.  It wouldn't be that difficult to write an interpreter for a very primitive Lisp.  I haven't used Ruby, but it's likely to have more actual requirements and more complicated syntax (in that almost everything has more complicated syntax than Lisp).
Comment: anonical list of compiler/interpreter references: http://stackoverflow.com/questions/1669/learning-to-write-a-compiler. And besides that there are multiple duplicates. Serious: http://stackoverflow.com/questions/1770813/ http://stackoverflow.com/questions/1604103/ http://stackoverflow.com/questions/1500004/ http://stackoverflow.com/questions/1446065/ Fun: http://stackoverflow.com/questions/1777582/ http://stackoverflow.com/questions/1253258/
Comment: huh? If not decided on the language, how can you know? Some may be very simple to interpret, even using libraries...
Comment: I think that it is much easier to write a Ruby interpreter in Lisp than vice versa.
Comment: Svante, I'm not so sure about that.
Comment: and http://stackoverflow.com/questions/453870/suggestions-for-writing-a-programming-language http://stackoverflow.com/questions/294852/references-needed-for-implementing-an-interpreter-in-c-c http://stackoverflow.com/questions/41785/learning-resources-on-parsers-interpreters-and-compilers
Comment: @dmckee: I had looked at most, if not all of the questions you suggested before I asked this, but I found that most of them focused on writing a compiler, not an interpreter.
Comment: All the ones I liked except the first are *interpreter* questions, and the problem is the same one.
Answer: You will have to learn at least:

lexical analysis (grouping characters into tokens)
parsing (grouping tokens together into structure)
abstract syntax trees (representing program structure in a data structure)
data representation (assuming your language will have variables)
an evaluation loop that "runs" your program

An excellent introduction to some of these topics can be found in the introductory text Structure and Interpretation of Computer Programs. The language used in that book is Scheme, which is a robust, well-specified language that is ideally suited for your first interpreter implementation. Highly recommended.
Comment: The answer to that question depends on many factors, the most important of which are: (a) the experience level of the person doing the implementing, and (b) the choice of language to interpret. Also perhaps (c) the choice of implementation language. As a total rough guess, for an intermediate programmer learning the techniques, I might say a couple of weeks of dedicated work.
Comment: Thanks for the great answer. Just curious, how long do you think it will take to complete a simple working interpreter?
Answer:
I haven't decided on the language to interpret yet, but I am looking for
  something that is not a toy language, but would be relatively easy to write an
  interpreter for. Thanks in advance.

Try some dialect of Lisp like Scheme or Clojure. (Now there's an idea: Clojure-in-Ruby, which integrates with Ruby as well as Clojure does with Java.)
With Lisp, there is no need to bother with idiosyncracies of syntax, as Lisp's syntax is much closer to the abstract syntax tree.
Comment: Clorure sounds like a language Scooby Doo would dig.
Comment: It's been done http://www.springerlink.com/content/q3n77q7172831288/ and http://onestepback.org/index.cgi/Tech/Ruby/LispInRuby.red
Answer: This SICP chapter shows how to write a Lisp interpreter in Lisp (a metacircular evaluator). In my opinion this is the best place to start. Then you can move on to Lisp in Small Pieces to learn how to write advanced interpreters and compilers for Lisp. The advantage of implementing a language like Lisp (in Lisp itself!) is that you get the lexical analyzer, parser, AST, data/program representation and REPL for free. You can concentrate on the task of getting your great language working!
Answer: There is Tree top project wich can be helpful for you http://treetop.rubyforge.org/
Answer: I had a similar idea a couple of days ago. LISP is by far the easiest to implement because the syntax is so simple, and the data structures that the language manipulates are the same structures that the code is written in. Hence you need only a minimal implementation, and can define the rest in terms of itself.
However, if you are trying to learn about parsing, you may want to do a more complex language with Abstract Syntax Trees, etc.
If you want to check out my (literally two days old) Java implementation of lisp, check out mylisp.googlecode.com. I'm still working on it but it is incredible how short a time it took to get the existing stuff working.
Answer: You can checkout Ruby Draft Specification http://ruby-std.netlab.jp/
Answer: It's not sooo hard. here's a LISP interpreter in ruby and the source is so small you are supposed to copy/paste it. but are you gonna learn LISP now? hehe.
Answer: If you're just doing this for fun, make up your own, simple language and just try it. My recommendation would be something like a really simple classic BASIC (no visual basic or object oriented stuff). With line numbers, GOTO, INPUT and PRINT and that's it. You get to do the basics, and you get a better understanding of how things work.
The knowledge you'll need?

Tokenizing (turning that huge chunk of characters into something more efficiently readable, effectively splitting it up into 'words')
Parsing (going over the tokens and building a data structure from it)
Interpreting (looping over the data structure and executing each command)

And for that last one you'll also need a way to keep around variables. Usually you'd just implement a "stack", one huge block of data where you can mark off an area at the end.
Answer: It's not implemented in Lisp, but I found Write Yourself A Scheme in 48 Hours to be a very useful document while I was starting out with Haskell (though I didn't get anywhere near finishing it after 48 hours; YMMV). It also gives you a lot of insight into interpreters in general.
Answer: I can recommend this book.  It discusses patterns for writing parsers and interpreters and more:
http://www.amazon.co.uk/s/ref=nb_sb_noss?url=search-alias%3Daps&field-keywords=language+implementation+patterns&x=0&y=0

How to write an interpreter?


Using non-metallic cable with this metal box having armored cable attached?

Question: I'm planning to using this existing outlet to add an additional outlet for a TV directly above. The kit I purchased has a plastic old work receptacle box. Can I use building wire (Romex) into this metal box to connect to the new box? And how do I ground the outgoing cable - can I ground it directly to this metal box using a pigtail?
Comment: FYI, "Romex" is a manufacturer, not a product, and while all the cool kids use it interchangeably with "non-metallic cable", it's confusing for everyone else and those in the international community. I've made some edits with that in mind.
Comment: Related: https://diy.stackexchange.com/questions/180485/adding-an-outlet-above-this-metal-box
Comment: While you're at it, pull those backstabs out of the outlet and use the side terminals.  Unless you like un eliab e.
Answer: You can't use Romex. You need AC cable.
Your jurisdiction does not allow the use of Romex cable for electrical wiring. Romex is a brand name of a type of plastic cable called NM-B.
I'm well aware that the Internet is full of instructables and videos that say to use Romex.  This is a cheaper wiring method that is not allowed in your town, for reasons.
This is obvious from the builder's use of AC type armored cable and backstabs.  The AC type with steel boxes is a deluxe wiring method the builder would not have used if it wasn't compelled by law.
If you have any doubts, go talk to your city's permit issuing office and ask them about wiring requirements there.
But I only know Romex, I don't know anything about AC cable
It's not that big a deal. You use AC cable obviously. The cable clamps appear to be built in to the existing metal box. You'll need to make a bottom entry because all the top holes are full, then loop upward.
So you'll need to get a metal box that has AC cable clamps built in.  The local electrical supply house can help.  If you bought from the local big-box, you can try there but their advice is terrible, so don't rely on clerks.  If you wonder why they're consistently terrible, it's because electricians and electrical supply houses constantly troll the big-box stores looking for competent clerks, and hire them away.
Comment: I'd just use a side KO on the open side of the box and a 90deg AC/MC connector to come up, instead of making that big, gnarly loop around to get at the bottom of the box
Comment: Also, I don't think stock NEC allows NM in the type of building he's in (mid-rise to hi-rise masonry (Type I construction) condo)
Answer: We can't tell from just a picture, but because the existing installation didn't use it then it probably isn't allowed. You haven't provided building type and occupancy to make an informed answer.
Below is a summary allowed use of Non-Metallic Sheathed Cable (often referred to by a brand name Romex), not application of all 800 pages of the code. You can view the NEC yourself at https://www.nfpa.org/codes-and-standards/all-codes-and-standards/list-of-codes-and-standards/detail?code=70 .
2017 NEC 334.12 says not allowed in any structure not permitted in 334.10 (1),(2), and (3).
334.10(1) One and two family dwellings and associated structures
334.10(2) Multi-family dwellings of Types  III,IV,and V construction
334.10(3) Other structures of Types III,IV,V
"Informational Note No.1: Types of building construction and occupancy classifications are defined in NFPA220-2015..or the applicable building code..."
Comment: Not allowed, Types III,IV,and V construction are structural wood.
Comment: The building is a condominium built in 2006 in Washington, DC. The floors are concrete and the studs are metal. The building has a basement level and 6 floors above. Can you tell from that description whether non-metallic sheathed cable is allowed?
Answer: NM (Romex) is no good in your building
NEC 334.12 point 1:

334.12 Uses Not Permitted.
(A) Types NM, NMC, and NMS. Types NM, NMC, and NMS
  cables shall not be permitted as follows:
(1) In any dwelling or structure not specifically permitted in
  334.10(1), (2), (3), and (5)

prohibits the use of NM in any building type or situation that's not expressly listed in NEC 334.10:

334.10 Uses Permitted. Type NM, Type NMC, and Type NMS
  cables shall be permitted to be used in the following, except as
  prohibited in 334.12:
(1) One- and two-family dwellings and their attached or
  detached garages, and their storage buildings.
(2) Multi-family dwellings permitted to be of Types III, IV,
  and V construction.
(3) Other structures permitted to be of Types III, IV, and V
  construction. Cables shall be concealed within walls,
  floors, or ceilings that provide a thermal barrier of mate‐
  rial that has at least a 15-minute finish rating as identified
  in listings of fire-rated assemblies.
Informational Note No. 1: Types of building construction and
  occupancy classifications are defined in NFPA 220-2015, Standard on Types of Building Construction, or the applicable building
  code, or both.
Informational Note No. 2: See Informative Annex E for determination of building types [NFPA 220, Table 3-1].
(4) Cable trays in structures permitted to be Types III, IV, or
  V where the cables are identified for the use.
Informational Note: See 310.15(A)(3) for temperature limitation of conductors.
(5) Types I and II construction where installed within raceways permitted to be installed in Types I and II construction.

For most posters here, this doesn't matter much, since houses are covered by 334.10 point 1, and most small apartment buildings and such are covered by 334.10 point 2, as typical wooden frame construction is Type V in the building code nomenclature system.
However, taller/heavier-built apartment and condo buildings, like yours, use Type I fire-resistive masonry construction in this day and age by and large, and as a result, cannot be wired using NM cable.  While some local codes require conduit for these jobs, others permit the use of metal-sheathed cables such as type AC and type MC, hence what you see here.
So, what should you do instead?
What I would do in this situation is use either a type MCI-A (preferred) or type AC (if you can't find type MCI-A, as it's still kinda newfangled) cable in 12/2 to make the run from the existing box to a new box for your TV receptacle.  Note that the new box will need to be a metal old work box, preferably one with integral clamps for type MC or AC cables, in order to ground the new receptacle correctly.
Furthermore, you'll need to pry out or punch out a 1/2" trade size (7/8" actual diameter) knockout either in the top or a free side of the box, then use a type AC/MC connector (straight for a top feed, 90° aka right-angle for a side feed) to bring the cable into the box.  The good news is that since the existing wire connectors have a spare hole in them, you can just plug the new hot and neutral into the existing connectors (with the breaker turned off, of course).
Once everything is wired up correctly, you can install a receptacle into the new box (preferably a self-grounding type receptacle as those can ground to the box,  otherwise you'll need to use a ground pigtail to a 10-32 screw into the back of the box to ground the receptacle), put a faceplate on, turn the breaker back on, and plug your TV in there.
Answer: Lucky for you, the person that used those wire connectors thought ahead and used 4-slots.  So, yes, all you have to do is cut out the area for the new box and drop a piece of romex from the new box to the existing box.  Then, connect the black wire to the connector with the blacks, the white to the whites, and as for the ground, I would add a 3 slot wire connector and pigtail the ground (run the green into one slot, run a  short length of wire from the connector to the existing outlet, and connect the ground from the new romex to the last slot).
Plastic boxes do not have to be grounded, you will simply connect the ground in the new box to the receptacle.
Edit- I would also consider using the screw terminals on the sides of the receptacle rather than the push in terminals on the back.  The black wire goes to the brass screw, the white to the silver.
Comment: That looks like a clamp back outlet, not backstabs....  also, romex might not be allowed  by code since armored cable is used
Comment: Good eye, I didn't notice armored cable was being used.
Answer: If you're in areas like Chicago or nearby suburbs, you might be required to use Armored cable or conduit. If your building uses metal studs, you might also be required to use armored.
If you're throwing caution to the wind and using NM anyways, I'll answer the second part

And how do I ground the outgoing cable - can I ground it directly to this metal box using a pigtail?

Your best bet is to drill a hole and add a grounding screw. Wrap the ground wire around the screw and then attach it to the outlet. Because the lip is folded, a grounding clip might be hard to attach.


How to add a field to the contact form in Drupal 7?

Question: I want to add a phone field and a company field to the contact form. How to overwrite the form in template.php? Thank you
Comment: This field should be static and has only one phone and companu value? Or every user can put their own personal data?
Comment: the user can put their own personal data
Answer: This module http://drupal.org/project/contact_field will do what you want and I have know about it since D6, but the last time I try it in D7 it was buggy.
So far the best alternative I have found that works all the time like a charm is the webform module http://drupal.org/project/webform as you will be able to add or remove fields as need it and the email support works well and you also get the bonus of storing all the contacts attempts in case your email server or service was down for any reason.
Comment: thank you.if i want to do it with some code in template.php.how do i do?
Answer: Why not you use hook_form_alter() to add those two fields into the contact form?
function MYMODULE_form_alter( &$form, &$form_state, $form_id ) {
    if( $form_id == 'contact_site_form' ){
        $form['message']['#weight'] = 2;
        $form['copy']['#weight']    = 3;
        $form['phone'] = array(
            '#type' => 'textfield',
            '#title' => t('Phone'),
            '#required' => TRUE,
            '#weight' => 1
        );
        $form['company'] = array(
            '#type' => 'textfield',
            '#title' => t('Company'),
            '#required' => TRUE,
            '#weight' => 1
        );
    }
}

You can alter the contact mail by using hook_mail_alter(). The variable $message['params'] contains the form values submitted.
/**
 * Implementation of hook_mail_alter
 * Override mail structure
*/
function MYMODULE_mail_alter(&$message){
    if($message['id'] == 'contact_page_mail') {
        $language = $message['language'];
        $params   = $message['params'];
        /*
        $message['to'] = $more_receipient;
        $message['subject'] = $subject_overridden;
        $message['body'][0] = $msg_body;
        $message['body'][1] = $param_to_msg_body;
        */
    }
}

Answer: There are the following modules which you can consider:

Contact Forms

Which expands the features of the site wide contact form. It eliminates the drop down category menu by generating a clean looking contact form.

Contact form fields
However it's minimally maintained and it needs work for 7.x and it's not ready yet for the production. Please find my fork with some fixes, however still it doesn't work perfectly.

Alternatively this should be straight forward via Drupal API:
/**
 * Implements of hook_FORM_ID_form_alter().
 */
function foo_form_contact_site_form_alter(&$form, &$form_state, $form_id){
    $form['location'] = array(
        '#title' => t('Your location'),
        '#type' => 'textfield',
        '#required' => TRUE,
        );

    $order = array('name', 'mail', 'subject','location', 'cid', 'message', 'copy', 'actions');

    foreach($order as $key => $field) {
        $form[$field]['#weight'] = $key;
    }
}

/**
 * Implements of hook_mail_alter().
 * This is where the mail being sent if edited. I just add it the the end of the message
 */
function foo_mail_alter(&$message) {

    if ($message['id'] == 'contact_page_mail'){

        $message['body'][] .= t('This is their location - ').$message['params']['location'];
    }
}

Source: contact_add_fields.module at GitHub


How do I derive a formula for the water level inside a container when it is filled up at a constant flow rate?

Question: When a container (e.g. Vase, Water Glass etc.) is filled up at a constant flow rate the water height changes differently over time depending on the shape of the container. This video shows some examples: https://youtu.be/GCjHRdcmd7Y .
When I fill up a container (e.g. a bottle), described by a solid of rotation with a certain function describing the bottle radius depending on the bottle height, there must be a way of deriving the function of the water height ober time. But how do I do that? Did someone ever do this or something similar?
Best Regards from Berlin
Answer: If the cross sectional area is $A(h)$ as a function of height $h$, then the change in volume $dV$ of liquid associated with a small change in the height of the surface $dh$ is $dV=A(h)dh$. So, from this, I hope you can deduce a relationship between $dV/dt$ and $dh/dt$, and setting $dV/dt=$ constant will give a differential equation which you may be able to solve for $h(t)$.
Answer: Mass conservation says that the rate of mass accumulated in the tank equals the mass flow rate $\dot{m}_{in}$ into the tank:
$$ \frac{dM_{tank}}{dt} = \dot{m}_{in}$$
where the mass in the tank at time $t$ is given by
$M_{tank} = \rho \pi \int_0^{h(t)}r^2(z)dz$
and $r(z)$ is the radius of your solid of tank shape as a function of height $z$, and $h(t)$ is the height of the fluid.
You can therefore easily calculate $h(t)$ and $dh/dt$ (how fast the height is changing) by solving
$$ \rho \pi\frac{d}{dt} \left( \int_0^{h(t)}r^2(z)dz\right) = \dot{m}_{in}$$
where $h(t)$ is the only variable changing with time.
If you want a more rigorous account of where these formulas come from, or how to do this more generally (e.g., for fluids entering and leaving, changing density, etc.), look up the Reynolds transport theorem for mass conservation.
Comment: Thank you very much! How may I credit you?


Special Characters replaced in data extension with SQL Query

Question: I used a series of queries in automation studio and filter activities in automation studio. What I did: Using SQL: copied my original data extension into a new one, added a new column and used a case statement to determine the value of this column. Using filters: filtered this data based on this new column.
In my original data extension, I had a lot of special characters (tildes, accents, etc.) in most fields (not in the primary key). Now, the new data extension with the added column replaced these special characters with weird question marks: �
I previewed emails using these fields and the � still showed.
Why does this happen and how do I fix it?
Answer: They are special characters that the DE doesn't recognize. Try using the HTML equivalent (i.e. instead of ® use <code>®</code>).
Reference link


How to disable Macbook's trackpad to not zoom?

Question: I went to Mac's Preferences for TrackPad and uncheck Zoom already, but if I go to Chrome or Firefox, and use two fingers to zoom, the page will still zoom in or zoom out.  It is troublesome because sometimes I mean to move the mouse cursor or scroll up or down but instead zoom in or out of the page instead, so hoping to disable it.
Answer: To disable the zoom of a web page you want to uncheck the "Pinch" action in the Trackpad Preference Pane as Screen Zoom is a different feature (For zooming in the entire interface). Myself I have it disabled for this exact same reason - I trigger it accidentally far too often.
Comment: yeah, it happens far too often than the real need to zoom in or out.  I think I need to zoom in or out a few times a day at most, but trigger this by it being too sensitive almost 30 times a day.
Answer: If you don't want to completely disable the "pinch" action, you might want to look into this. It will only disable this action in Safari, Firefox, Chrome and a few other programs.


Weird golden moths flitting around my head in Skyrim Dragonborn

Question: I noticed this after doing about 4 of the Hermaeus Mora quests involving books, where you get to choose a perk at the end. My character has a cloud of golden particles flitting around the head like moths, and various people in cities tell me to 'be careful with that spell'.
What magical effect causes this, and is there a way to turn it off?
Comment: Have you been to the Ancestor Glade recently?  I seem to remember one quest there has you attracting golden "Ancestor Moths" http://www.uesp.net/wiki/Skyrim:Ancestor_Glade
Comment: Would there be any clue under the "Active Effects" part of the magicka menu?
Comment: That was part of the Dawnguard quest to read one of the Elder Scrolls. I noticed this started after doing the Black Book quests.
I'm assuming it's due to some effect, but in the list of current effects enabled there's nothing related to ancestor moths.
Answer: That sort of effect is usually applied to healing effects, spells or powers.  If none of your active effects mention anything to do with healing, then you may have just encountered a bug.  Skyrim's not exactly the most stable game, after all ;)


"Take your guess, spurious at best": what does it mean?

Question: It's a part of the song Take Your Guess by Tom Rosenthal (lyrics:  https://www.azlyrics.com/lyrics/tomrosenthal/takeyourguessalternativeversion.html)
I don't understand this part of the lyrics (I'm not a native English speaker): "take your guess, spurious at best, can't you see it's all just chaos."
Who is supposed to 'guess', and what to guess? And does it say "it's best if your guess is spurious/fake"? It doesn't make sense!
Comment: Song lyrics are a really bad way to learn English, because they're usually written to sound catchy, not to be grammatically correct or easy to understand.  Many of them are intentionally ambiguous.
Comment: Well, i wasn't really trying to learn English through this song. I asked in this community because I thought being a non-native speaker it'd be best if I post here. By the way, I agree songs are not the best to learn the spoken English, but learning English (completely) should also include learning to understand art works (like songs and poems) which are in English language.
Answer: A caveat: song lyrics often have many possible interpretations, and this song especially is pretty ambiguously-worded; we don't get any completely unambiguous explanation of who is asking the question or what the guess is about.
(Though, from context, it seems that the guess in some way relates to the person the singer is referring to wanting to know the best way to live or the correct way to go about life: see lines such as I see a million ways and that's fine, which can be taken as meaning that there's no correct way to go about things.)
However, there is one part you're misunderstanding that I think will make the lyrics more clear: the phrase [X] at best when combined with an adjective or phrase that has negative connotations means that, even in the very best possible outcome or viewed from the very best possible light, the thing being discussed has that negative property. One example of this phrasing can be seen in this book excerpt:

Many parents also faced various persecutions from the party, suffering extreme stress at best and violence, imprisonment, or death at worst

So here, the book is saying that even under best circumstances the people suffered extreme stress. (And, under not-the-best circumstances, they suffered even worse.)
Taking this example and applying it to the lyric, we can see that the phrase take your guess, spurious at best means that, even in the very best outcome, the subject of the song's guess will be spurious (and in less-than-perfect situations, the guess could be even worse than spurious). The last part of the lyric, can't you see it's all just chaos is an explanation for the first part: because everything is chaos, any attempt at explanation will be useless and so the guesser's guess can only be invalid (or worse).
Answer: The song is about the unpredictability of life and how there's no universally right approach to it. You can spot this theme throughout the lyrics of the song. The whole song apart from the chorus follows this format:
"I didn't [do something or something didn't happen] how you said [I would do it or how something would happen], it [went the way it did] and that's fine"
It's saying that it's okay for things to turn out differently than expected or intended and to do things differently than what's considered normal or proper.
The lines "I look out the window somedays, I see a million ways and that's fine" and "I breathe in and then I breathe out, I've got a trillion doubts and that's fine" suggest uncertainty about the future, and/or the choices he has to face.
Therefore, by looking at the rest of the song, it becomes quite clear that the chorus is about the same thing.
"Take your guess, spurious at best" means that if you try to predict what the future holds, you will realise that your guess is spurious, or in other words false and unreal when compared to what actually will happen.
Don't you see it's all just chaos just means life is chaotic and full of unexpected twists and turns.


Calibration Freeze on D11

Question: I've read through similar posts, but haven't seen exactly the same issue. Built it once, and froze during several calibration attempts. Stripped it all down, rebuilt it very carefully and still have same issue. I've since downloaded Brick Controller 2 and all motors/functionality seems to be there and working correctly. Obviously it's a very clunky interface for controlling the model, so then tried again with Control+, but had the same issue that it will move the blade a little, then just seems to stop trying anything else. Any ideas?
Comment: I have the same issue. The calibration gets to about 3/4 of the way and then doesn't do anything. Have you managed to fix it?
Answer: I haven't got enough reputation to add a comment. I had the same issue running the Control+ app from my Android phone.
Installed the app in an iPad, worked first time.
I have also been victim to other posts saying it's my build quality. I tore the whole machine apart and started from scratch, facing the same issue and much hair pulling.
Dear Lego support, PLEASE fix the Android app for the D11!
Answer: I have also read similar messages: after calibrating the blade, the sound remains on, but then nothing happens.
Who has the solution. Build again? I already did that....
I found a solution: I installed the Control+ software, not on the phone, but on another device (a tablet in my case).
It works for me. Good luck.

Calibration Freeze on D11


How to use Machine Learning to create a "Draw-A-Person Test"

Question: The process revolves around a child's drawing. Each part of each drawing corresponds to a score as in the Draw a Person Test conceived by Dr. Florence Goodenough in 1926. The goal of the machine is to measure a child's mental age through a figure drawing task.
Answer: That's a very nice challenge!
As always, the hardest part is to get a labeled database (maybe by scrapping).
You'd probably need some thousands of drawings and their respective drawer age.
From there, you need to make an image regression model. Here is a simple example that predicts age from a face photo. It's the same principle, but applied to another database, with other relevant features to be learned by the model.


How to save profile photo with winter bash hat?

Question: Winter bash hat is disappearing when I save the profile picture to my computer. How can I save my photo with winter bash hat?
Answer: There is no built-in way to do that. You can take a screenshot of it and use an image editing program to select only the part with you and your hat.
Answer: Here's a bookmarklet:

javascript:(function(){var avatar=$(".user-header-left .gravatar-wrapper-128 img,#avatar-card .gravatar-wrapper-164 img");var hat=avatar.closest("a").find(".hat img");var ao=avatar.offset();var ho=hat.offset();var x=Math.min(ao.left,ho.left)|0;var y=Math.min(ao.top, ho.top)|0;var w=Math.max(ao.left+avatar.width()|0,ho.left+hat.width()|0)-x;var h=Math.max(ao.top+avatar.height()|0,ho.top+hat.height()|0)-y;var ctx=$("<canvas width='"+w+"' height='"+h+"'/>").css({display:"block",clear:"both"}).insertAfter("#user-info-container,#user-card")[0].getContext("2d");ctx.drawImage(avatar[0],ao.left-x|0,ao.top-y|0);ctx.drawImage(hat[0],ho.left-x|0,ho.top-y|0)})()

That'll draw your avatar and the hat onto a canvas. At least in Chrome you can right click -> save image on a canvas. Only works on profile pages, probably fails if you have "identicon" as your profile picture type, not tested a lot.
Answer: Just to add.... while it may seems that the bash site is saved after the event ends, do not trust that.
History shows that the old bash site is removed soon before the next one starts, so you cannot use the site as a repository, unless this year our request is accepted and we get an official statement that claims the site will stay.
That said, the other answers actually got it, there is no built in way to save a screen of the hat so you have to use whatever external program you prefer.


Salesforce Entry Data Object restrictions in Journey Builder

Question:
Is it possible to restrict Journey Builder to not have access to all Salesforce objects via the Entry data?
Is it possible to have read only access to a Salesforce object in Entry data but prevent any updates to the fields of the object via activities?
Answer: There are some granular permissions regarding how has access to these on the journey canvas, outlined in this help doc.

Some Marketing Cloud customers want their users to access Salesforce events but not Sales and Service Cloud activities. Some want the opposite experience. Two new Journey Builder permissions in Setup let you grant access to these features separately.

To restrict access by user to objects, you would need to look at "scope by user", but have not tested it with JB salesforce events

Scope by User
  This option configures data access on the Marketing Cloud Connect user initiating the send. Reports and campaigns that are visible to the user are available for selection as a target audience for sending. The list of subscribers returned is limited to what the user initiating the send has access to view.
Comment: Thanks for that, but not sure if the Scope by User is applicable in this scenario. The first part is good to know, however, we are strictly talking about removing the access to activities and Salesforce events. The scenario I'm looking at is read only access to the Salesforce objects in the entry... that means you can start the journey with on update/create account, lead etc. but you cant write anything back into those objects. I'm trying to understand how can that be achieved, or even a scenario where the entry data only allows you to pick e.g. account but not lead.


Adding a CUSTOM network to Gnosis Safe

Question: I want to add custom RPC settings so that I can view my PulseChain Testnet sacrifice balances, but there is no option to add a custom network. I went to the live chat and they said I would have the ask the dev's about it. I know that it is possible and need some help on how I can add a custom network.
Comment: GnosisSafe is limited to a few networks, You can deploy your own, or use a different multisig like https://safe.fantom.network/ for Fantom !
Answer: Did you try safe-infrastructure repo from safe-global?
https://github.com/safe-global/safe-infrastructure
Answer: The initial steps are:

Write an issue to add the custom network at https://github.com/safe-global/safe-singleton-factory/issues

The purpose of the first step is to employ a deterministic deployment proxy which allows the contracts' addresses to be predetermined

Deploy the Safe contracts on a custom network using https://github.com/safe-global/safe-contracts repository
Add the newly supported network to the safe-deployments repository located at https://github.com/safe-global/safe-deployments

This is because the Gnosis Safe SDK relies on an npm package associated with this repository

Adding a CUSTOM network to Gnosis Safe


Why wasn't Loki injured in the opening scene of Infinity War?

Question: During the opening scene of Avengers: Infinity War we see Loki completely uninjured as if he wasn't present on the ship of which we know that he was. Why wasn't he injured like Heimdall, Thor, and the rest?
Comment: "as if he wasn't present on the ship" — or as if he didn't fight, instead biding his time until he could use the trickery he's famous for.
Comment: Maybe Thanos' thugs were busy beating up Loki's illusions while the real Loki was sipping Asgardian beer.
Answer: Loki was a prisoner of the Black Order at the start of Avengers: Infinity War, likely by choice. Loki is not a fighter and so it doesn't make sense for him to get into a big battle with people who are fighters. Instead his talent lies in being a trickster and being sneaky.

Ebony Maw joined the Black Guard as they surrounded their prisoner—Loki, the God of Mischief himself.
Avengers: Infinity War - Novelisation

Click image to enlarge.
We see this later on after he has given up the Tesseract to Thanos, he starts trying to play the double agent again. He tries to make it seem as if he is Thanos' ally and then strike at the last second to take him down. And it almost worked if Thanos hadn't already had the Space Stone.

Loki: I consider experience, experience. Almighty Thanos, I... Loki... Prince of Asgard... [looks significantly at Thor] Odinson... the rightful King of Jotunheim... God of Mischief... do hereby pledge to you, my undying fidelity.
Avengers: Infinity War

So, he wasn't injured because he probably didn't join in on the fight, had he joined in, he would have been injured similar to Thor and Heimdall.
Comment: @TheLethalCarrot Both novelisation and film make it pretty clear that he is a prisoner. Note that in the image included, weapons are being pointed at Loki, and the scene in question involves Thanos literally torturing his brother to make him give up the Tesseract, which he initially refuses to give up.

It's only later when he offers to be a guide, after the Hulk fight, that he's pretending to try and get back into Thanos' good graces. What he does before he is captured (the question being asked here) is not being answered in this answer.
Comment: @DariM I've reworded the answer. I was watching it back on my phone last night with poor quality so missed a few details. The only thing I would say though is I wouldn't read too much into refusing to give up the Tesseract that's just Loki being Loki. Even if he was on Thanos' side then he'd probably still pretend he didn't have it.


Exotic isomorphism of matrix rings

Question: Let R and S be commutative rings with a 1 different from zero.  Let m and n be positive integers.  Assume the ring of m-by-m matrices over R is isomorphic to the ring of n-by-n matrices over S.  Does it follow that R is isomorphic to S?  Does it follow that m = n?  Does either of those follow from the other?  I'm interested in both where R,S are finite and where R,S are infinite.  (although the second question is trivial in the former case)
Comment: For the more general version of the question, the keyword is "Morita equivalence". In the more restrictive setting of commutative rings, Morita equivalence coincides with isomorphism.
Comment: 3x3 matrices of 2x2 matrices are the same as 2x2 matrices of 3x3 matrices, but 2 does not divide 3. Maybe revise the question?
Comment: Excellent points, I'll have to figure out how to make the question more what I was trying to get.
Comment: That should do it.  (R and S must be commutative now)
Answer: Yes and yes. Let $T=M_m(R)=M_n(S)$.
The center of $T$ is isomorphic to both $R$ and $S$.
The $1\times m$ matrices over $R$ form an $(R,T)$-bimodule and the $n\times 1$ matrices over $S$ form a $(T,S)$-bimodule. Tensor these over $T$ to get an $(R,S)$-bimodule. As an $S$-module the direct sum of $m$ copies of this is free of rank $n$. For a nonzero commutative ring this implies that $m$ divides $n$. (Tensor with a residue field to get a vector space of dimension $\frac{n}{m}$.) Likewise, looking at it as an $R$-module, $n$ divides $m$.
Comment: Even quicker: $M_m(R)$ is free of rank $m^2$ over its centre
(and rank of free modules is an invariant for commutative rings).
Comment: Going back to the noncommutative case, there are examples (with a classical, not pathological, flavor) where $M_2(R)=M_4(S)$ with $S$ commutative but $R$ is not $M_2(S)$ and indeed $R$ is not any $M_p(T)$ at all except $M_1(R)$. You can let $R$ be the endomorphism ring of an $S$-module $M$. Choose $M$ such that $M\oplus M$ is free of rank $4$ but $M$ has no nontrivial splitting. For example, let $S$ be the continuous (or real polynomial) functions on the $2$-sphere and take $M$ to be the corresponding sections of the tangent bundle.
Comment: I immediately, though wrongly, thought "invariant basis number", but I guess it's not a completely irrelevant concept; it seems that you're using it when you argue that $m$ divides $n$, and *vice versa*.
Comment: Good point, Robin.

Exotic isomorphism of matrix rings


Surrogate Court Petition for Probate NY Notification To Others In WIll

Question: I am in the process of filing papers with the surrogate court for petition of probate. I am just compiling all the needed information and such before I do so. I was told others named in the will need to be informed and listed.
What is the form called that is sent to the other people named in the will? Also, does a copy of each get submitted at time of submitting the paperwork?
Answer: A Notice of Probate, and an Affidavit of Mailing of Notice of Probate. This is part of a package of standard court forms, most of which, including that one, are usually submitted at the same time.
Parallel forms called a Notice of Application for Letters of Administration and an Affidavit of Mailing of Notice of Application for Letters of Administration are used when there is no will.
Comment: You guys were a huge help but I have another question:  https://law.stackexchange.com/questions/68173/surrogate-court-for-petition-of-probate-new-york-combined-verification-oath-a
Comment: Thank you for the response. So the first link you provided, Package of standard court forms, https://www.nycourts.gov/LegacyPDFS/FORMS/surrogates/pdfs/ADM.pdf, gets submitted along with this ? https://www.nycourts.gov/LegacyPDFS/FORMS/surrogates/pdfs/Probate.pdf
Comment: @explore99 You use the Probate package if there is a will, and there Letters of Administration if there is no will. Probate includes a request of letters of administration as well.
Comment: I truly appreciate the help. There is a will, person named me executor and there is property involved. So the Package Of Standard Court Forms(your original link) is all I need then? Do I still need to submit this one as well, https://www.nycourts.gov/LegacyPDFS/FORMS/surrogates/pdfs/Probate.pdf ,or is the package basically the same?
Comment: How are the other people notified? Is it a form I mail to them before submitting papers to the court and if so, what is it called?
Comment: @explore99 You need only the probate packet. I think that they are the same (but you should check). The notices are sent per the form packet contemporaneously with the submission of the probate application. If you appointed, you send another document called an "information of appointment" (or something similar) to the people the court determines are entitled to notice. Once appointed creditors receive notice as set forth in the probate laws.


Projection problem

Question: I have downloaded NCAR Community Climate System Model (CCSM) projections in shapefile format and want to look up maximum temperature. When I open it in QGIS having OSM as base map, it is shown as one point only (0,0) coordinates. When I open the attribute table, it looks normal and has lat and long as well. I have tried re/project the layer in the same projection as OSM basemap, but the reprojected one is still shown as that one dot.
Answer: There are two possible issues here.
Possible issue number one: The shapefile has the wrong CRS.
You can test for this issue by right-clicking on the layer name in the Layer Panel, and choosing "Zoom to layer." If the layer expands into many different points, but they're just way too close together, then you have this issue.
Solution:

Figure out what projection this layer is supposed to have. This information should be documented somewhere, for example:

Look in the file you downloaded and see if there's a file called "README" or "METADATA. It might have a .txt or .xml file extension.
Go back to the website where you downloaded the data and look for documentation.

Change the projection of the layer to its correct projection by opening the CRS tab in the Layer Properties window and selecting the correct CRS (as determined in step 1).

Possible issue number two: The geometry is not correctly stored in the shapefile.
Normally there wouldn't be a solution for this issue. But in this case, the attribute table has latitude and longitude in it. Assuming those lat/long values represent the correct location of each point, you can use them to recreate the point geometry. Of course if the lat/long in the attribute table are not actually the correct lat/long for each point, this solution will give you the wrong data.
Solution:

Make a copy of the DBF file (the portion of the shapefile that has the file extension .dbf).
Open it in a spreadsheet-editing program such as Microsoft Excel, and save it in CSV format.
Import the CSV file into QGIS through the "add delimited text layer" method. You can access this method through the Layer menu or from the button on the Layer toolbar that looks like a comma.
Answer: You could make a Right click ->Layer properties->Information screenshot of the layer.
Lat/Long does not sound like a projected layer.

Projection problem


How the data transfer from the action class to Jsp page in struts2

Question: How the data transfer from the action class to Jsp page in struts2.
Is any kind of stack is build inside the action class before its transfer its control to the jsp page , or there is something other mechanism is used for that.
Answer: Anshul,
You are some what correct in your implementation.For Struts2 we can see it in following manners

ValueStack
OGNL

Value stack is a virtual stack in Struts2 framework and a central place where all the data related to request processing will be placed by the Framework.In Struts2 Actions are also treated as a data carrier, so what exactly is happening is when the action done its work it is being placed on the top of value stack.
Lets we have something like this in Action
public class MyAction extends ActionSupport{

  private String firstname;
  private String lastname;

  public void setFirstName(firstname){
     this.firstname=firstname
  }

 public void setLastName(lastname){
     this.lastname=lastname
  }

public String getFirstName(){
   return firstname;
}

public String geLastName(){
   return lastname;
}

 public String execute() throws Exception{
             //action logic filling first name and last name from database etc.
             return SUCCESS;
 }
}

now when action will return after the logic framework will place action instance on the top of value stack and firstname and lastname will be on the top of it.
so now when we try to access these values in jsp something like
<s:textfield name="firstname" value= "%{firstname}"/>

here (%{firstname}) OGNL will come in to place and it will try  to see if there is a property in the value stack with name firstname,since action is on the top of value stack and it has property name firstname in it so OGNL will find it.
i hope this will help you
Comment: Thanks for the giving me greater idea about the value Stack. But sometime when i use OGNL expression it not print the value of the value stack..? like  This will not work in some cases,and its render the values by using
Comment: Yes!!! by default values are place on the value stack but you can place the value in session,attribute etc so in case value is not stored in value stack but in attribute den value= "%{firstname}"/> will not work since it only resolves to valuestack so we need to tell OGNL where to try to find the data value beside valuestack.Hope it will give you idea


Django: get path of local file from file chooser dialog without uploading?

Question: My django app is local. I'd like it to store "attachments" as full local file-system paths rather than uploading the actual files themselves. I don't want my user to have to find and copy these paths by hand, they are "untechnical" and that would be inelegant. Instead I'd like them to be able to just hit a browse button to pop up a file chooser dialog and just point it to the file on their local file-system. How might I go about this?
Deployment platform is Windows but development platform is linux (gnome 3) so I ideally I'd like a cross platform solution, even if that means separate blocks of code to handle each.
OK, this subject seems to be responsible for enormous wailing and gnashing of teeth amongst intranet developers, none of whom seem to have agood solution. Having mulled it over for a couple of days there seems to be two plausible strategies...
1) Write a java applet that...
    displays as a browse button
    opens a file chooser dialog when clicked
    upon ok being clicked sticks the full path into the appropriate place in the dom
2) As this app is single user and the server runs on the same machine...
    the server receives an ajax request
    IT opens a file open dialog and
    return the result to the browser via ajax
As a java novice I am hesitant to try and implement 1 although it seems the more elegant solution. I might try if I could find some existing code that did this or something similar though... anyone know of any? Failing that, for my particular need, 2 is going to be much faster to implement, if ugly as sin :/
Thanks,
Roger
Answer: I think it`s more javascript than a django question. You can`t retrieve path from browser. some of them will return D:\fakepath\file.jpg


How binding are encyclicals on practicing Catholic's beliefs?

Question: I am reading through certain encyclicals from Popes on economics, and I wanted to know how binding they are on my beliefs (if I were to be a Catholic who follows church teaching). Are they binding? Do I have to accept them unequivocally? Or are they merely opinions of the writers, that don't necessarily have to be adhered to in order to be in good standing with Rome?
Comment: related: "[Does the Pope teach infallibly ONLY when he speaks _ex cathedra_?](https://christianity.stackexchange.com/q/34712/1787)"
Answer: How binding are encyclicals on practicing Catholic's beliefs?
It will depend on certain factors involved in a particular encyclical. If the pope is providing teachings on faith or morals, than the particular encyclical would be morally binding. Thus Humanae Vitae is obviously very morally binding on Catholics.

As for the binding force of these documents it is generally admitted that the mere fact that the pope should have given to any of his utterances the form of an encyclical does not necessarily constitute it an ex-cathedra pronouncement and invest it with infallible authority. The degree in which the infallible magisterium of the Holy See is committed must be judged from the circumstances, and from the language used in the particular case. In the early centuries the term encyclical was applied, not only to papal letters, but to certain letters emanating from bishops or archbishops and directed to their own flocks or to other bishops. Such letters addressed by a bishop to all his subjects in general are now commonly called pastorals. Amongst Anglicans, however, the name encyclical has recently been revived and applied, in imitation of papal usage, to circular letters issued by the English primates. Thus the reply of the Archbishops of Canterbury and York to the papal condemnation of Anglican Orders (this condemnation, "Apostolicæ Curæ", took the form of a Bull) was styled by its authors the Encyclical "Sæpius officio". - Encyclical

In any case, Catholic encyclicals should be be received in the light of the Catholic faith and should be seriously taken for the insights the popes are expressing from an viewpoint of the Catholic faith.
Encyclicals should be embraced in a positive light and taken seriously, even if no moral issues are brought up in the papal document.

One area that I had assumed was clearly in the optional category was papal social teaching. But at Evangelical Catholicism, M.J. Andrew argues that's the latest encyclical is binding on all Catholics:

The error that both Leo XIII and Pius X are correcting is one that is still made today in Catholic circles, namely, that the social teaching of the Church is in someway optional, non-binding, and/or merely prudential. Indeed, in many respects our inclinations and political proclivities, which often are merely products of our locale and social environment, are met by a powerful counterweight in Catholic social teaching. And rightly so. If, as the two aforementioned popes assert, our social life (i.e., family, political, and economic activity) are primarily religious and moral in nature, then the Church, by virtue of her authority in matters of faith and morals, is our touchstone for learning how to conduct that social life . . . .

Yet, we still encounter the stubbornly persistent opinion among Catholics that the Church's social doctrine is not binding–and if it is authoritative, then it is not as important or consequential as doctrines of faith. But this position is certainly not to be found in Catholic teaching. Indeed, it is simply a pernicious prejudice.

Andrew proffers an intriguing argument (persuasive enough to convince this Protestant). But is he right? If so, why do so many Catholics ignore—much less dismiss—this encyclical?
Are Social Encyclicals Binding on Catholics?
Comment: @LukeHill workers have a moral right to be paid a just (fair) wage, so yes it falls into the sphere of morals!
Comment: "the wage paid to the workingman should be sufficient for the support of himself and of his family" (Pius XI, Quadragesimo Anno, no. 71)

Defrauding one's workers (or wage theft) is one of the sins that cry out to Heaven, as well.
Comment: Why does that "seem incorrect"? @LukeHill A just wage should factor in the principle of equity (value of the labor e.g. an astronaut should make more than a burger flipper), the principle of need (more expensive areas should have higher wages to compensate), and the principle of economic order (the wages should also match the prosperity of the company, so the same job at a big company would justly pay more than one at a small, struggling company)
Comment: So do questions on a subject like economics (for instance the teaching of a fair wage) constitute faith or morals? The line seems kind of vague.
Comment: thanks for clarifying. Maybe can you tell me what a just/fair wage is? Because to me that sounds like a rather incoherent term.
Comment: @SupportiveDante so if I work as a dishwasher and make $15 an hour, but have 6 children and my wife stays at home, I have had an injustice committed against me? That seems incorrect.
Comment: @LukeHill Does one get child support from 5he government also!? It can get complicated.
Comment: @SupportiveDante I said it seems incorrect because the idea that every job should be able to allow a man to support his family is most likely unattainable. If you put in all those factors then you are agreeing with me that there is more nuance than just "he should be able to support his family.
Comment: @LukeHill considering that a lay Catholic works primarily to support his family, it makes sense that the economy should reflect that, and it isn't all that outrageous a thought, for most of history families of eight or more lived just fine because the economy was built on small businesses and communities. We Christians believe that the secular sphere should be ordered toward and subordinated to the spiritual.
Comment: Echoing another comment, this seems to rely heavily on what defines 'faith and morals'. Can all of economics and science come under its scope? I find answers here https://christianity.stackexchange.com/questions/66379/what-is-meant-by-faith-and-morals-with-regards-to-papal-infallibility not very helpful, TBH.
Answer: Encyclicals are inerrant; otherwise, the Church would demand the faithful to assent to what might contain error, and the Church cannot lead one into error because the Church is indefectible. From Pope Pius XII's Humani Generis:

Nor must it be thought that what is expounded in Encyclical Letters does not of itself demand consent, since in writing such Letters the Popes do not exercise the supreme power of their Teaching Authority. For these matters are taught with the ordinary teaching authority, of which it is true to say: "He who heareth you, heareth me";[Luke, X, 16] and generally what is expounded and inculcated in Encyclical Letters already for other reasons appertains to Catholic doctrine. But if the Supreme Pontiffs in their official documents purposely pass judgment on a matter up to that time under dispute, it is obvious that that matter, according to the mind and will of the Pontiffs, cannot be any longer considered a question open to discussion among theologians.

Encyclicals can even contain ex cathedra (infallible) dogmas, such as Pope Pius XI's condemnation of contraception in his 1930 encyclical on marriage, Casti Connubii.
Answer: The scope of obedience due to the popes and their encyclicals is such that Pope St. Pius X was compelled to say this in his Address to the Priests of the Apostolic Union (Nov. 18, 1912) included in the official Acta Apostolicae Sedis 4 [1912], p. 695):

When one loves the pope one does not stop to debate about what he advises or demands, to ask how far the rigorous duty of obedience extends and to mark the limit of this obligation. When one loves the pope, one does not object that he has not spoken clearly enough, as if he were obliged to repeat into the ear of each individual his will, so often clearly expressed, not only viva voce, but also by letters and other public documents; one does not call his orders into doubt on the pretext – easily advanced by whoever does not wish to obey – that they emanate not directly from him, but from his entourage; one does not limit the field in which he can and should exercise his will; one does not oppose to the authority of the pope that of other persons, however learned, who differ in opinion from the pope. Besides, however great their knowledge, their holiness is wanting, for there can be no holiness where there is disagreement with the pope.

The most succinct explanation of a Catholic's reception of encyclicals is expressed in Humani Generis by Pope Pius XII:

Nor must it be thought that what is expounded in Encyclical Letters does not of itself demand consent, since in writing such Letters the Popes do not exercise the supreme power of their Teaching Authority. For these matters are taught with the ordinary teaching authority, of which it is true to say: "He who heareth you, heareth me" [Lk 10:16]; and generally what is expounded and inculcated in Encyclical Letters already for other reasons appertains to Catholic doctrine.
But if the Supreme Pontiffs in their official documents purposely pass judgment on a matter up to that time under dispute, it is obvious that that matter, according to the mind and will of the Pontiffs, cannot be any longer considered a question open to discussion among theologians.

Pope Pius XI echoes the same sentiment in Casti Connubii, n. 104:

Wherefore, let the faithful also be on their guard against the overrated independence of private judgment and that false autonomy of human reason. For it is quite foreign to everyone bearing the name of a Christian to trust his own mental powers with such pride as to agree only with those things which he can examine from their inner nature, and to imagine that the Church, sent by God to teach and guide all nations, is not conversant with present affairs and circumstances; or even that they must obey only in those matters which she has decreed by solemn definition as though her other decisions might be presumed to be false or putting forward insufficient motive for truth and honesty. Quite to the contrary, a characteristic of all true followers of Christ, lettered or unlettered, is to suffer themselves to be guided and led in all things that touch upon faith or morals by the Holy Church of God through its Supreme Pastor the Roman Pontiff, who is himself guided by Jesus Christ Our Lord.

There are hundreds of similar quotes on papal infallibility, private judgment, obedience and the like. Let an explanation by Fr. Joachim Salaverri in Sacrae Theologiae Summa IB: On the Church of Christ (1955) suffice:

Authentic magisterium (from [Greek] authentia = authority) is the
office of handing on doctrine instituted by a legitimate authority.
Therefore, it implies in the teacher the power and office of handing
on doctrine; but in the disciples [i.e. in the taught] the obligation
and right to receive instruction. Magisterium can be authentic in two
ways: in the broad sense and in the strict sense.
Authentic magisterium in the broad sense is that which by itself does
not have the power to demand from the disciple the assent of the
intellect. Such is, for example, the magisterium of a professor in a
university. Authentic magisterium in the strict sense is that which
has such power in itself to impose doctrine, that the disciples by
that very fact are bound to give the assent of the intellect, because
of the authority of the legate of God which the teacher makes use
of.

Here we see that obedience is due in virtue of the authority of the teacher and not only in his infallible charisma.
Considering the strictness of the obedience due to the authentic magisterium, one might be compelled to ask: "What if the magisterium is wrong?"
The answer, of course, is that the magisterium cannot be wrong in matters that pertain to salvation, and, even if it is wrong in some minor detail, a Catholic is perfectly safe in following the legitimate teaching authority, that is, he has moral certitude in following the teaching of the Church.
If a presumed Pope or council propose something manifestly contrary to revealed truth as their authentic teaching, they must be regarded as having lost all authority the minute they became heretics, and therefore are owed no obedience. This is confirmed by the below texts and many more, such as Cum Ex Apostolatus, Mystici Corporis, Pastor Aeternus, etc.:
Si Papa [1198], Pope Innocent III

"The Pope should not flatter himself about his power nor should he
rashly glory in his honor and high estate, because the less he is judged by
man, the more he is judged by God. Still the less can the Roman Pontiff
glory because he can be judged by men, or rather, can be shown to be
already judged, if for example he should wither away into heresy;
because he who does not believe is already judged. In such a case it
should be said of him: 'If salt should lose its savor, it is good for nothing
but to be cast out and trampled under foot by men.'"

Institutiones Juris Canonici [1950] - Coronata

"If indeed such a situation would happen, he [the Roman Pontiff]
would, by divine law, fall from office without any sentence, indeed,
without even a declaratory one. He who openly professes heresy places
himself outside the Church, and it is not likely that Christ would preserve
the Primacy of His Church in one so unworthy. Wherefore, if the Roman
Pontiff were to profess heresy, before any condemnatory sentence (which
would be impossible anyway) he would lose his authority."

St. Robert Bellarmine [1610]

"A Pope who is a manifest heretic automatically ceases to be a Pope
and head, just as he ceases automatically to be a Christian and a member
of the Church."

In conclusion, a Catholic should not trouble himself with finding faults in Encyclicals or disagreeing with them, but rather with fulfilling the will of the Church the best he can, recognizing his own inability and imprudence.


Android Application Library Project Where's the Jar?

Question: I just created android library project, marked as library but bin does not have jar files of the java classes.  Looked thru the project properties, don't see where you set for compilation build to output a jar file?  I want the jar to auto create every time project is built.
Answer:
Looked thru the project properties, don't see where you set for compilation build to output a jar file?

An Android library project does not "output a JAR file", per se.
If the library project is used by another Android project, the build tools will create a JAR file containing the compiled Java classes, but this JAR file is not designed for distribution. Instead, those same build tools will incorporate that JAR file, plus the library project's resources, as part of the host app's build process.


How can I defer updates in Windows 10 Home?

Question: I prefer knowing what each update does and reading about its impact (including whether it is causing widespread problems for people) before allowing it to be installed on my system. How can I do this in Windows 10 Home?
Comment: Note: Since this is bound to be controversial, please ensure that comments are on-topic and not mere complaints or rants.
Comment: You could always block it from communicating with the update servers.
Comment: https://superuser.com/a/1208908/49345
Answer: Bad news, you can't. With the new servicing model being introduced with Windows 10, new features will be released whenever they're ready. You can choose between the slow and fast rings but according to Microsoft:

Windows 10 Home users will have updates from Windows Update
  automatically available. Windows 10 Pro and Windows 10 Enterprise
  users will have the ability to defer updates.

So the ability to defer updates is now a feature restricted to Windows 10 Pro and Enterprise only.
[Of course this might be changed later if there is a lot of hue and cry over it, or an unofficial workaround may be found.]
For reference here's the upgrade matrix:

Source: Windows 10 Specifications (see Feature deprecation section)
Comment: Windows updates have caused issues in the past (see http://www.infoworld.com/article/2889295/microsoft-windows/20-epic-microsoft-windows-auto-update-meltdowns.html or http://www.computerworld.com/article/2491256/malware-vulnerabilities/microsoft-urges-customers-to-uninstall-blue-screen-of-death-update.html). Would it be feasible to set **firewall rules** to forbid connections to MS servers (and possibly others, such as Akamai.com), with perhaps a batch script to disable the rule(s) after an update has been shown to be safe?
Comment: @DrMoishePippik: That might work, although automating it might be difficult given that the block duration will vary for different updates. Also I'm sure turning off updates will be allowed even if deferment isn't.
Comment: According to http://www.cnet.com/news/windows-10-home-edition-may-force-updates, "you're presented with two options in how updates are installed -- either install updates automatically or notify you to schedule a restart. " Note that there is no option to *turn updates off*; that is reserved for Pro/Enterprise editions. Perhaps the final release would change.
Comment: @DrMoishePippik: If there's no option to turn updates off that's even worse, but the author also doesn't seem to know how Home will behave for sure ("But overall, the new Updates screen *may give us a clue* as to what Windows 10 Home users will see").
Comment: As of July 27th there might be a solution.  [KB3073930](https://support.microsoft.com/en-us/kb/3073930) while designed for the Insider Preview users going forward after July 29th can be used for the time being by any Windows 10 user.  The use of the tool to block certain updates might make you ineligible for security updates, this onl should be used, to block issues caused by an update once they happen.
Answer: I just upgraded to Windows 10 Home Single Language from Windows 8.1 Single Language a few minutes ago and I have the Defer upgrades setting available by default under Settings > Update and security > Windows Update > Advanced options. I am using Build 10240

I googled a bit and according to Neowin (which itself cites WinSuperSite), with cumulative update KB3081448 released on August 27, Microsoft has pushed the ability for Windows 10 Home users to disable automatic updates for Windows Store apps.
However, even though I'm a Windows 10 Home user, for some reason I have the option to defer upgrades in Windows Update settings. I'm not sure yet if it actually works though. I guess I'll find out.
Comment: This is not true. At least today, Win 10 Home users only have the option to pause updates for 35 days maximum, that's all. And it evidently cannot be used again before you install the updates then.


When does the ISIS gang get slap-happy?

Question: I watched the second half of Archer: Vice (Season 5), and across multiple episodes one ISIS employee would pelt another with a quick flurry of slaps punctuated by a final larger blow.  It seems like it just started out of nowhere, so I might have missed an episode, but when did this slapstick routine start?
Comment: @mmatthews is correct, it just started in Season 5. The other seasons had their own "thing" like holding up a finger while downing a bottle of booze, saying the word "Phrasing", etc. Each season has it's own quirky thing.
Answer: This slap pattern started in Season 5.  I'm not sure exactly what episode, but it is definitely in Season 5.  I think it is within the first 4-5 episodes.
I've watched Seasons 1-4 many times over (as they are on Netflix), and while there is slapping, the pattern of many light slaps ending with a larger slap is not present.

When does the ISIS gang get slap-happy?


Why do gold ETFs follow the overall stock market?

Question: Many of the same overall trends and features exist in gold ETFs as in the overall stockmarket. For example AAAU shows similarity to SPY. As seen here, why would an investment in a gold ETF follow the same trends as the overall stockmarket?
Comment: It's important to differentiate between investing in physical gold, and companies related to gold (mining, storage, etc.)
Comment: @BernhardDöbler The word "seen" in this case was intended to be taken as "observed", or "witnessed", in the sense of  "as evidenced by this example". Though if you are interested in charts, compare the last 3 months at https://www.marketwatch.com/investing/fund/aaau/charts
Comment: Are you implying that they should not correlate because gold and the market do not correlate?
Comment: You write *As seen here*. Where do I look?
Answer: Why wouldn't they?
Companies that mine and produce gold products have shareholders, executive leadership, workers, labor challenges, HR departments, etc... just like every other company in the S&P 500.
They also have customers that may slow or cancel orders due to economic uncertainty, just like every other company on the S&P 500.
Comment: AAAU https://www.aaauetf.com/ is holding physical gold, like GLD
Answer: On a one-year chart, physical gold, after dipping down on a wide-spread financial-market margin financing shock, rebounded and maintained an uptrend while the stock market stayed lower.
Answer: Looking at the correlation table for the past 6 months returns from ETF Screen shows a correlation of 0.18, similar to GLD at 0.16.  That's pretty close to non correlated in my book.
What you may be referring to is what happened during the recent meltdown, it may have felt pretty correlated, but usually during a crisis, all correlation go to 1 (as it did during the 2008 one).


How to setup my box for DVD-RAM media packetwriting?

Question: I can't find any information that's more recent than 2 years on how to setup packetwriting for my DVD-RAM drive. I like DVD-RAMs for reliable backups and hope to set it up correctly. I tried with some outdated how-tos which resulted in messing up a lot because there was no udev back then! How can I achieve this setup in the latest Ubuntu?
Answer: DVD-RAM does not require packet writing.
If you are referring to DVD-RW or CD-RW packet writing, I know that there are HOWTOs all over the Internet.  However, I have yet to find one that actually works with desktop environments/HAL/dbus/whatever it is that ubermodern systems are using instead of plain old fashioned manual configuration.  :-)
I'm sure it is possible.  I just can't figure out how to do it reliably without killing half the things that make my system useful.  Sorry, this isn't much of an answer at all, I know: I have been searching for one for the last couple of years.
There really were some advantages to the way things were done a few or more years ago.
Comment: IIUC, DVD-RAM indeed doesn't need software support for packet writing, but it supposedly speeds up writing significantly. I bought a DVD-RAM disc today (my first one ever) and will do some testing over the weekend. :)
Comment: The [kernel documentation](http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=blob;f=Documentation/cdrom/packet-writing.txt;h=13c251d5add6cce112f94e6050ba8f3bfe63670e;hb=HEAD) also states that packet writing is not necessary for DVD-RAMs, but using the module can increase performance. However, I followed the instructions in that document and writing to the DVD-RAM even got slower than simply copying to it in Nautilus.
Comment: Hi! I did get some packetwriting to work with a very old manual. And messed up my whole system. DVD-RAM is the perfect backup solution, well: WAS the perfect backup solution, cause now you rarely get DVD-RAM media with more than 4.7 GB of RAM. There used to be disks with 17.8 as I remeber ...
Comment: Adding: Now I had to reinstall Maverick and still have no packetwriting DVD-RAM support. Annoying ...
Answer: DVD-RAM is very old so there is no new info. Old and underestimated. DVD-RAM on Ubuntu Linux is easy. I use Ubuntu 16.10 with XFCE4 but that does not matter at all.
Why DVD-RAM? Because it is more reliable and more stable archiving data. See Wikipedia for details on DVD-RAM.
However, DVD-RAM is rather an external drive than a DVD to write on. Not all drives can write and read. However, most modern Laptop and Computer optical drives can.
Careful: DVD-RAM is slow by modern means. Don't force the mount and umount to break.
We have to format it as UDF file system. This is the appropriate FS for the DVD-RAM (I do not quote the details here, use duckduckgo.com)
Know your CD-Writer:
Mount a CD, with "mount" watch out for the name. Like /dev/sr0.
Take the DVD-RAM out of the cartridge if necessary, put it in your drive and reboot.
Prepare:
sudo apt-get install udftools
sudo apt-get install dvd+rw-tools

Make a mount point:
sudo mkdir /mnt/dvdram0

and adapt the user rights etc.
You need to adapt the rights again for the mounted DVD-RAM (different than vfat floppy or external drive).
Adapt the fstab:
sudo vim /etc/fstab

For automatic mount enter a new line like

/dev/sr0  /mnt/dvdram0  auto  user,users,rw,auto,exec,utf8 0  0

The first auto may better be "udf". The second auto depends on you: Try noauto if the boot process hangs.
Format the DVD-RAM:
sudo mkudffs --media-type=dvdram   /dev/sr0

The default options for mkudffs probably match your needs.
Otherwise: man mkudffs !
Mount the DVD-RAM:
mount /dev/sr0

should do it, otherwise use as sudo mount /dev/sr0. With the fstab entry it will be found.
When you ask your CLI now with mount it should answer something like:

/dev/sr0 on /mnt/dvdram0 type udf
  (rw,nosuid,nodev,relatime,utf8,user=myname)

Now again adapt the access rights for the mounted(!) drive:
sudo chown myname /mnt/dvdram0
sudo chmod u+rwx /mnt/dvdram0

Test your access rights:
mkdir /mnt/dvdram0/mydirectory

without sudo it should work. Otherwise check the rights.
Do a reboot now or restart all relevant services.
So now we have

installed the tools
prepared to mount
formatted the DVD-RAM
mounted it in the file system
adapted the user access

It shall be available in the file manager like a normal drive. Watch out for /mnt/dvdram0 (and in Nemo create a bookmark).
Unmounting takes time because of write completion. It is done from CLI or try to find a way in your browser.
What did I forget? What was wromng?
Better way to unmount??


How do I prevent windows from maximizing when "touching" the menu bar in Ventura?

Question: After upgrading to Ventura, everytime I drag a window up towards the menu bar, it maximizes. How do I disable that?
Comment: Sounds like you've installed some third-party window management software, like Magnet, BetterSnapTool, Moom, Rectangle.... etc...
Comment: I don't think so, this started to happen when I upgraded to Ventura. My other two machines, that  still are on Monterey don't show this behaviour, although they are very similar when it comes to their setup. Weird.
Comment: @benwiggy You were absolutely right, when I upgrade Spectacles stopped working and I had to replace it with a fork, Rectangle, and the latter had a default setting that caused this behaviour.
Comment: @benwiggy You should write this as an answer so d-b can mark it resolved
Answer: This appears to be a feature of the BetterTouchTool app. I had the same issue, and it stopped happening when I disabled BetterTouchTool. It does seem to be specific to BTT in MacOS 13 Ventura.
Comment: Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer).
Answer: That's not a built-in behaviour of macOS, so it sounds like you have installed some other window-management utility.


deciding Anonymous or Unknown and citations

Question: I am working on editing and revising a 100 year old text for re-issue and running into several concerns.  The one I will deal with today concerns citations and deciding whether to use anonymous or unknown and how to cite it.  Throughout the work, the author liberally intersperses verses of poetry without referencing anything.  I have been able to track down most of them but am left with about fifteen that I just cannot find.  I do not like the idea of using 'anonymous.'  They have an author.  I just don't know who it is.
Whichever way I decide to go, I still do not know how to cite it.  All the references I can find are for citing an entire work.  These would all be an unknown work by an unknown author on an unknown date, etc.  At the same time, there would be a noticeable gap between Milton and Shakespeare if I didn't put anything.
Suggestions?
Comment: Maybe you could start by editing and revising your 7 hour old question. Put "Anonymous" and "Unknown" in quotations marks, for example, and capitalize them (in the body of your question). And what is the "it" you want to cite? As you write it ("whether to use anonymous or unknown and how to cite it"), you want to cite the unknown, but I believe you want to cite an unknown *source*. I hope that you put more care into editing your text than you did writing your question.
Answer: Since you are editing an existing text, you will probably let your readers know that you did so, for example in a foreword or addendum, and in that explanation you could simply explain that you have added sources where you could find them. Where the source couldn't be identified, you would then simply mark them as
"Source unknown".

I don't know how you are searching for the sources of the poems, but I hope you are aware that many published texts are not available online and cannot be found through a Google search. You will have to locate and browse the original publications of the time. Otherwise your efforts will seem amateurish to those that are familiar with the texts you accidentally do not know.


Peer to Peer transfer on LoL

Question: What is it and should I disable it. Also does it share data from my computer to other users and use my internet (Which is already really slow).
Answer: It means that you are uploading game files to other users who are downloading them from you, very similar to how torrents work. If you don't wish to host game files for other users to download, you should disable it. It will likely slow your upload speed which may also hurt your net bandwidth.
Answer: The LoL installer used Pando Media Booster to distribute files via p2p prior to patch 4.3 (Riot reference), I had asked about it earlier:
How can I identify games that use Pando Media Booster, and is there a workaround to download the installer without it?
The latest version no longer uses PMB but they haven't got around to unbundling it from the installer. Pando 1.3 now has a new owner, and I read rumors about them now doing some borderline shady stuff like changing IE home page etc. - and since its not being used anyway, you should certainly uninstall it.
It used to share data using your internet connection, while LoL doesn't do so any more I am unsure if leaving Pando installed may lead to using up bandwidth.
Comment: Interesting info, but that doesn't really answer the question about what P2P transfer means.
Answer: I just want to add to what has already been said, If you are experiencing lag in your game and you have absolutely nothing working in the background then this (the peer to peer option) is highly likely the cause and you should disable it.

Peer to Peer transfer on LoL


Given pairwise distances between points in space how can the dimension of the space the points lie in be determined if the data is incomplete?

Question: My problem concerns a finite set of points in a space, for example (A,B,C,D,E). The information I have on the points is the distances of separations between the points and it comes in two sets. The distance of A from all of (B,C,D,E) and the distance of B from all of (A,C,D,E). The values of these distances are impossible if the points were to lie in a two dimensional space.  To determine the minimum dimension that these points could lie in it has been suggested to me to try running an algorithm by the name of Multidimensional Scaling, MDS for short, that maps points in high dimensional space to lower dimensions. This algorithm that takes as input the pairwise distances between all of the points has a "stress" function can be evaluated to see how well these distances are maintained when mapped to the lower dimension. Therefore one possible way of solving my problem could be to to run the algorithm and start from the second dimension and increment upwards until the stress function approaches zero closely enough at which point I will have the answer for what dimension the points lie in. However the pairwise distance data I have is not complete and plugging in zeros for the missing data does not make sense because we believe the all of the points in question to be distinct.
Comment: What do you mean by "points in a space"? Do you mean they are in $R^n$ for some unknown $n$?
Comment: Exactly, and the goal is to determine the smallest _n_ in which the given relations could exist.
Answer: It seems that if the following interpretation of you question is right then the answer is trivial. So, suppose that you have five distinct points $A, B, C, D$, and $E$ belonging to $\mathbb R^n$ for some $n\ge 3$ and you know the distances $d(A,B)$, $d(A,C)$, $d(A,D)$, $d(A,E)$, $d(B,C)$, $d(B,D)$, and $d(B,E)$. I claim that there exist points $A', B', C', D'$, and $E'$ belonging to $\mathbb R^3$ such that $d(X,Y)=d(X',Y')$ for each pair $X, Y$ of letters of $\{A, B, C, D, E\}$. Indeed, choose arbitrary points $A', B'\in\mathbb R^3$ such that $d(A',B')=d(A,B)$. Let $X$ be any of the letters from $\{C, D, E\}$. Let $S^{A'}_{X}$ be a sphere with the center $A'$ and radius $d(A,X)$ and $S^{B'}_{X}$ be a sphere with the center $B'$ and radius $d(B,X)$. Triangle inequality implies that $d(A,X)+d(X,B)\ge d(A,B)$. Therefore the intersection $S(X)=S^{A'}_{X}\cap S^{B'}_{X'}$ is nonempty. It rests to show that there exists an injective map $i:\{C, D, E\}\to\mathbb R^3$ such that $i(X)\in S(X)$ for each $x$. We may encounter a problem with the construction of such a map only if there are different $X, Y$ such that both $S(X)$ and $S(Y)$ are singletons (that is one-point sets) and $S(X)=S(Y)$. But this is impossible, because then points $X$ and $Y$ coincide in $\mathbb R^n$, a contradiction.
Comment: Thanks for the answer Alex.


Verify FFT results without equation of waveform

Question: I used python to convert the time-domain signal below into a frequency spectrum so that I can analyze the harmonics. To do this I used Python libraries, specifically numpy and called fft to get the spectrum. I now want to validate my results. I have x, y coordinates in Excel and the plot below. To validate, I know that I could try to compute the Fourier series myself. The problem that I'm having is that I can't actually figure out how to begin. I don't know the equation of the waveform below so I can't use the definition of the Fourier transform. Any ideas on how to do this manual validation (or any other suggestions on how to actually confirm whether my fft is correct) are extremely helpful.
Comment: Is your plot attached the time domain waveform? If so can you attach your frequency domain results as well that you are trying to validate?
Comment: If you don't know the equation for it, how did you get it?  Is it from a measurement, or handed to you by someone?
Comment: @TimWescott, I was given the signal. It's a disturbance signal taken from a recorder.
Comment: @DanBoschen, updated.
Comment: What exactly do you want to verify? Your code, the library, match between theory and praxis? Do you want to verify against the discrete or continuous Fourier Transform?
Comment: @Hilmar, I want to verify that the results from my python fft are correct. If this was some common waveform, I would do the transfer by hand. This would allow me to confirm that the amplitudes are correct, and at the right frequencies. The problem is that because I don't have the equation of the waveform, I'm not sure how to hand calculate it. Any suggestions on how to verify are appreciated.
Answer: You're fitting to measured data.  The only way that I can see to make sure your fit is good is to analyze the FFT output, and reconstruct the waveform with a function, then see how that matches up to your captured data.
You're not capturing an integer number of periods.  That will cause some spectral bleeding, because the bins don't match exactly.  You probably want to window the captured data before you do the FFT -- this will make for slightly more, but cleaner, spectral bleeding.
From the waveform, it's a fundamental with a strong 5th-harmonic impressed on it -- that's consistent with what I see in your FFT.
You can hypothesize that the above is, indeed, what you're seeing.  With that hypothosis, you can then identify the peaks and interpolate the actual frequency of the sine waves from them (alternately, if it's rotating or reciprocating machinery, just take the fundamental as being equal to the rotating or reciprocating frequency).
Then if you're still unsure if you're getting it right, reconstruct the signal from the phase & amplitude relationship.
Answer:
I want to verify that the results from my python fft are correct.

Why? The Python FFT has been used millions of times and it's been unit thoroughly unit tested. What makes you think there is anything wrong with it?

If this was some common waveform, I would do the transfer by hand. This would allow me to confirm that the amplitudes are correct, and at the right frequencies.

Then use some common waveforms to test your code. Just make sure that what you do "by hand" is an actual DFT (Digital Fourier Transform) and not a CFT (Continuous Fourier Transform). Your signals seem to be sparse sum of sine waves. You build some test cases from these. That's exactly what unit testing is about.

The problem is that because I don't have the equation of the waveform, I'm not sure how to hand calculate it. Any suggestions on how to verify are appreciated.

If you can't do it by hand, and if you don't trust the test cases that you can do by hand, you can only verify against a "known good" reference implementation.
Answer: For describing anything other than exact periods of pure sines, FFT is a suboptimal tool of choice, and requires careful interpretation. I advocate for time-frequency methods - see under Modulation Model vs Fourier Transform.
As for FFT, it implements DFT. One way to validate is to assert np.allclose against the naive implementation. As for conceptual validation - well, it's right to suspect DFT is broken, because it is, depending what we expect from it. Relevant article. Lastly, I advise visual studies over hammering out equations, and recommend this clip and DSP Guide.


Alpha over compositor problem

Question: I'm trying to add a fog glow to the blue circles behind Susan using the compositor but so far not being able to make it, the fog glow is applied to all the image but no the blue circles or sometimes the blue circles appear on top of Susan lol
Thanks guys for your help, I'm new to the compositing world of Blender.
Blender file attached*
Comment: You should separate your image like this:
Monkey only - renderlayer #1 (foreground);
Circles only - renderlayer #2 (middleground);
Purple backing only - renderlayer #3 (background).

Don't forget to enable _transparent_ background in render tab.
For composing - plug circles to the _Glow_ node and then use _Alpha Over_ node to put monkey on top. Now put all of this on top of purple background with second _Alpha Over_
Comment: Hi Serge, thanks for your help, I enabled transparent background, setup the render layers the way you told me, plugged the circles to the Fog glow node, used the alpha over to put monkey on top and used an alpha over to put everything on top of the purple background but so far you can see the result in the new image that I re-uploaded here. I re-uploaded the Blend file with the new node setup that your advice, obviously I'm doing something wrong. thanks for your help    :)
Comment: Your mistake that you have a layer ("Main") which combines all in one: monkey, circles and background. In my first post I suggested you to put each of those to their individual layer.
Comment: Thanks Serge!! with your help I was able to make it! people like you make Blender the choice to go, what an awesome community.
Comment: Papasmurf7777, I'm glad you've worked it out!
Comment: Hey Serge, write your comment as answer! I vote it up :)
Answer: Either separate by render layers or use a separate RGB in the compositor to create a mask that only select the blue.

Alpha over compositor problem


what is the right way to delete all features from featureLayer

Question: I have a featureLayer and I don't want to kill it and create another one. I want to delete all features from the current featureLayer. I found that I can use applyEdits method but in order to use it I need to have all features I want to delete. Whilst I don't want to store them separately. Do you know a better way to empty my featureLayer when using the ArcGIS Javascript API?
Answer: Try making a REST delete features call with a where clause "1 = 1" or something similar.
Comment: hi is there any syntax to the REST delete features call? could you provide me an example as I am attempting to do that
Answer: Use featureLayer.selectFeatures() with, as Kirk suggested, a where clause that will return all your features. Once you have all your features, pass them to applyEdits() as the deletes.
Comment: The only problem is I can't specify the right where clause - I tried "1 = 1", "OBJECTID > 0", etc. But every time I have an error "FeatureLayer::selectFeatures - query contains one or more unsupported parameters". The code  var query = new esri.tasks.Query(); query.where = "1 = 1"; featureLayer.selectFeatures(query, ...);
Comment: Won't this return a lot of features to the client?  If this is a large dataset it could really be slow.
Comment: Perhaps, if featurelayer is not connected with any feature service, it doen't support where clauses. What do you think?
Comment: "if featurelayer is not connected with any feature service, it doen't support where clauses" - that's correct, but if so it also wouldn't support editing. From the API reference: "If the underlying layer ... is from a Feature Service, its features can be edited", implying that your featureLayer IS connected to a feature service
Comment: "it also wouldn't support editing" - I support editing even if it is not connected with service. Hovewer, I had to make some workarounds.
Answer: If you have created the feature layer on the client side (no server side url), then you cannot use a query with a where clause. I was able to work around this by searching the extent of the map and then deleting all the items that I found. For example:
function removeAllLayerFeatures(map, layer) {
    require(['esri/tasks/query', 'esri/layers/FeatureLayer'], function (Query, FeatureLayer) {
        var query = new Query();
        query.geometry = map.extent;
        layer.selectFeatures(query, FeatureLayer.SELECTION_NEW, function (results) {
            for (var key in results) {
                layer.remove(results[key]);
            }
        });
    });
}

Answer: Check out the clear() method:

Clears all graphics.

featureLayer.clear();

Answer: Use an Update Cursor, selecting all features ("*").
Use IFeature.Delete(), and store when done.
Comment: This question is asking for a JavaScript solution, not ArcObjects.
Comment: Oops...my mistake! Please ignore.


What does up/down the train mean?

Question: Please give me a general meaning of what up the train or down the train means? does it mean to be in front of it. Would you give me another example of up the * or down the *?
Comment: Please [edit your post](http://ell.stackexchange.com/posts/32758/edit) to include context; at a minimum, please provide a complete sentence containing this phrase. The phrase can mean many different things, not least because the word *train* itself can refer to many different things.
Comment: This is also a duplicate of your previous question: http://ell.stackexchange.com/q/32659/5289
Comment: What's the problem also I've got the answer, although I was asking about something else in the sentence However I did not find a good answer and I asked about another thing I wanted a general meaning though I didn't give a context ..
Answer: Moving up and down something can be tricky because the actual direction changes based on the object. Up tends to mean toward the beginning, or toward the entrance, or toward the source, or toward the parts that are perceived as higher and down is the opposite direction. The phrase is only used when there are two obvious directions, although which direction is "up" and which direction is "down" may not be obvious.
A native speaker wouldn't say "He walked down the room." but would say instead "He walked across the room." I could say "I walked a mile down the road before I saw anyone." or "I ran up the road to see what happened." and either would be correct. Sometimes it isn't obvious whether you should use "up" or "down" and I think in those cases either will work.
Some examples: "She walked up the assembly line to find the source of the jam." Up in this sentence means she walked toward the beginning of the assembly line. "He moved up the corporate ladder." - he was promoted to a position closer to the head of the company. "The girl walked down the aisle to find her seat in the theater." - she moved away from where she entered and also, many theaters have a floor that slopes down toward the stage.
I've never used the expression "up the train", but I imagine it means toward the engine and "down the train" would mean toward the last car.
Comment: Probably: down the drain

What does up/down the train mean?


Was bedeutet "Hauses" in diesem Kontext

Question:
alle Führungskräfte des Hauses mit dem fortgeschrittensten Managementwissen vertraut zu machen, das es zur Zeit gab.
Answer: It is the genitiv of "Haus" (meaning "house" or "company").
EDIT:
The german word "Haus" has another meaning that might be of interest for this question:
When talking about aristocrats from certain tribes or clans you say: "Die Kaiser aus dem Hause Habsburg-Lothringen". In English: "The emperors from the house of Habsburg-Lorraine".
Here the word "Haus" or "house" has the meaning of "tribe" or "clan". And I think that the meaning of "company" comes from this.
Comment: Another meaning: "hotel"
Comment: @Stephie: A hotel is just a special type of a house. A house is a building where people are meant to live or to do their jobs. A bridge is a building but not a house. A hotel and a companies headquarter are houses.
Answer: "Hauses" is somewhat pretentious sounding corporatespeak denoting the company.

Was bedeutet "Hauses" in diesem Kontext


Textures are gray after Blender crash

Question: I spent about three hours painting textures on to a creature I sculpted and decided that I wanted to add some hair to it. I go into edit mode and pick the circle select tool to select the portion of the head that I want to add hair to. I press the F key because that's what I thought was the shortcut for adjusting the radius of the select tool and then suddenly Blender just crashes. Now every time I open up the saved file all of the textures images are just gray. There has got to be a way to retrieve the old textures right?
Answer: Alright never mind I've figured out that Blender doesn't actually save the textures to anywhere in your computer once you make them so I guess I'm just gonna have to bite the bullet and start all over :/
Comment: Hey :). You can recover automatically saved files through *File > Recover > Auto Save*. Files are backed up every 10 minutes, but it can be adjusted in *preferences > system*.

Textures are gray after Blender crash


Association rules vs decision tree vs rule learning

Question: Is  it ok to generate a classifier by collecting all association rules so that the conclusion part refers to the target variable? does it perform better than decision tree or rule learning?
Comment: In order to have a classifier you have to have some input variables and some out variables. Which would be your input/output variables in this case? Which is the question that your classifier needs to answer?
Comment: @AurelianTutuianu There is no specific input/output variables or question for classifier. Just in general is it possible?
Answer: There are several algorithms for creating classifiers out of association rules. The most basic approach will only add a default rule as the last rule, otherwise the resulting classifier may not be able to make prediction for some instances.  More sophisticated algorithms such as CBA (Classification based on Associations) by Bing Liu also perform pruning, which selects only some of the discovered association rules.
Benchmark of CBA against C4.5 can be found in the original paper:
Ma, Bing Liu Wynne Hsu Yiming. "Integrating classification and association rule mining." Proceedings of the fourth international conference on knowledge discovery and data mining. 1998.
According to this evaluation (by CBA author) CBA has slightly better accuracy (1% difference) than C4.5.
A limited evaluation of the simplest approach that essentially just adds a default rule to the end of the rule set, is covered in:
Kliegr, Tomáš, et al. Learning business rules with association rule classifiers. Rules on the Web. From Theory to Applications. Springer International Publishing, 2014. 236-250.
This evaluation shows that using the list of association rules as is drops the accuracy compared to the prune baseline, typically by more than 1%. This indicates that C4.5 would perform better.
Disclaimer: I am co-author of the latter paper.