How do I get the value of a persistent variable with `variable_get()`?

Question: How do I get the value of a persistent variable with variable_get()? Does the function save the value on a database table or somewhere else?
Answer: To get the value use:
$valueVar = variable_get('myvar');

It is saved on a generic database table called [prefix]_variable, if you are not using prefix, the name of the table is variable. Look at: https://www.drupal.org/forum/support/module-development-and-code-questions/2009-05-14/help-which-table-is-the-variable
Answer: You can use variable_set() to set the value and that will store it in the database. e.g.
variable_set('myvar',123);

Then to retreive it:
$myvar = variable_get('myvar');

You could create a page with a form to allow CMS users to change the values of your variables. See this for examples: https://api.drupal.org/api/drupal/modules%21system%21system.module/function/system_settings_form/7.x
Answer: variable_get() only retrieves the value of a persistent variable; it doesn't save its value as that is the task for variable_set().
Actually, variable_get() gets the persistent variable value from the global $conf which is initialized from the following code in _drupal_bootstrap_variables().
  global $conf;

  // Initialize the lock system.
  require_once DRUPAL_ROOT . '/' . variable_get('lock_inc', 'includes/lock.inc');
  lock_initialize();

  // Load variables from the database, but do not overwrite variables set in settings.php.
  $conf = variable_initialize(isset($conf) ? $conf : array());

The code in variable_initialize() first tries to load the persistent variable values from the cache, and then load the values from the database (the variable database table).
  if ($cached = cache_get('variables', 'cache_bootstrap')) {
    $variables = $cached->data;
  }
  else {
    // Cache miss. Avoid a stampede.
    $name = 'variable_init';
    if (!lock_acquire($name, 1)) {

      // Another request is building the variable cache.
      // Wait, then re-run this function.
      lock_wait($name);
      return variable_initialize($conf);
    }
    else {
      // Proceed with variable rebuild.
      $variables = array_map('unserialize', db_query('SELECT name, value FROM {variable}')
        ->fetchAllKeyed());
      cache_set('variables', $variables, 'cache_bootstrap');
      lock_release($name);
    }
  }
  foreach ($conf as $name => $value) {
    $variables[$name] = $value;
  }
  return $variables;

To answer the values of persistent variables can be stored:

In the global $conf initialized in the settings.php file (which means in memory)
In the cache, which isn't necessarily stored in the database, especially if there are third-party modules that change the cache functions
In the variable database table, when saved using variable_set()


How to write a scene about a main character who is crying?

Question: I am writing a scene in which I want to show how my MC is still weak and vulnerable. My character is emotionally strong, but I am not able to describe a scene where she is crying in a room alone, so she doesn't seem as strong as she thinks she is. How do you write about vulnerability without explicitly stating that?
Comment: Welcome to Writing.SE! Currently, your question is at risk of being closed, as it's unclear what exactly you're having difficulty with. What sort of advice are you looking for regarding this?
Comment: Hi Valerie. Can you be more specific about your problem. Why can't you write a scene showing your character crying in a room alone?
Answer: Crying? Who, Me? (sniff):
I think you want something like this:
MC is reflecting on the person (tough characters are usually too busy saving the world to cry in the moment that something bad happens, it's a crisis-management thing), thinking about the great features of the dead person, how they'll miss them, endearing personal details, etc. They find tears welling up, and deny it (Damn allergies). Then they do the go-to tough thing, and get angry at themselves for showing feeling, and angry at the dead person (they aren't That great! {sob}).
Finally they insist they aren't going to cry, at which point they begin sobbing so uncontrollably they can't breathe and the air comes in through ragged gasps. They need to sit down and roll up in a ball because they can't move and start shaking uncontrollably. Drool or snot is a little over the top, but makes for good color.
The crying at this point is about lots of other things than the dead person: their parents, lost relationships, their childhood dog, and so on, but they never mourned any of those things, and they all keep slamming into the MC until they have nothing left.
If they have a companion (you said no, but stories change), they snuggle into them like a child until the crying passes, possibly until they fall asleep, or otherwise until they calm enough (still crying) to again get angry at themselves over their display (potentially setting off another round of bawling).
Answer: A word of advice, always avoid the word "I" when writing a question. They tend to close it.
As for your question:
People tend to act very differently after they have witnessed the loss of a loved one. If you are writing a book, then I would suggest that you build your character strong by showing off their traits at different moments. A simple search on google could be enough to know what are the traits of an emotionally strong person.

People tend to act very differently after they have witnessed the loss of a loved one

More importantly, you should show why are they being strong: is it because they are having trouble moving on? Or they are being strong for someone else like a younger sibling, another parent, or anything else. And by "show", I mean as in "Show; don't tell."
Now going to the first part again:
Your character is human and has emotions like a normal human being, so when the MC doesn't deal with their grief, they tend to go out of their character. They are mostly angry, they flip out on anyone, at any time for trivial reasons; they talk less and avoid interaction, and... don't make the right decisions. And this, until now, what we have discussed is all build-up to the breakdown scene.
The breakdown
As build-up can be for various reason, a breakdown can be caused by numerous reasons too. When they are confronted point-blank about "it", they will flip out and try to hurt the confronting person (with words ofc) too. And if you keep this long enough, the MC will definitely break. Or when they are alone, a special thing or some situation (like falling off an album or playing of a recorded message) can bring back some memories. Or the classic, breaking down when no one is around. Of course, these all are examples; you can be creative all you want.
What about short stories?
In short stories, you began the story after the build-up phase -- assuming your story is not tragic, or your plot is based on the MC's breakdown -- this also helps the story start on action. To explain the build-up, you can put a small paragraph or a dialogue explaining the backstory briefly.
Example
I recently completed a story on this same topic. The MC in the story is still dealing with her father's death. Due to this, in the first part of the story, she appears timid and a loner. And when a boy tries to help her, she flips out on him, stating that he will leave her too. Thus, exploring her insecurities. But once she starts to deal with these emotions, her character becomes more assertive as the story progress.

"I want your diary," he repeated calmly.
"No way!" I glowered.
"You have mine, don't you?"
"You gave it to me, on your own WILLINGNESS. You can have the damn thing back," I
said, punching the diary on his chest.
"I don't want it back, Zea…"
"Then what do you want, Davis? Why did you ask me? What is it? You wanna hang out
with me, or––or want to have some kind of relation… or you just waltz in here, being
charming and smiling, then leave me — alone and broken," tears heaped up in my eyes,
as I took rapid breaths.
"Zea, none of it is true, and people just don't come and go in life."
"DON'T THEY? One morning you wake up, and they are gone, just gone, leaving you all
alone. And they are so arrogant, they think they don't own an explanation to you, or
even have the courtesy to say goodbye. They all go, Davis. They all go."

Before this scene, the story showed how nervous and uncertain she is, and as we look into her thoughts, we know that she has no interest in the present moment. Since it was a short story, you can see how close the build-up and the breakdown is: first, she flips out for a simple reason, and then as her anger gushes out, she breaks down. Three paragraphs later, you know why she broke down.
Comment: When people die, their loved ones cry. That's natural. So your question: how to make her cry? Is improper. It's like asking why peter parker cried over the death of his uncle? Your main question should be how do make her seem vulnerable? Based on how your character is, the way they deal with this is different. But everyone cries!
Answer: Make it less obvious that she cried. Say something like, she was so sad that her cheeks turned salty and dry or that her face and/or clothes turned wet. Write it in a way that, at first, she ignored the whole act of crying and tried to supress it, and later realised that it's ok.


Can't see tables while importing database

Question: Why can't I see tables while I am importing database in phpmyadmin. It shows me success but then still I am not able to see any tables. Though if I run any query it does show me the result. What is the problem? I have tried finding answers online but couldn't find anything.
Answer: Try clicking on another database to see if it refreshes. Also check the file config.inc.php to see if you tables are being hidden. Search for a line similar to
$cfg['Servers'][$i]['hide_db'] = 'your-db-name';
Comment: No, it not not refresing. Neither there is this line in the config.ini.php file.
Answer: The question is unanswered. Sorry had to write.
Answer: Are you in the correct database? You can use
show databases

to find out all databases in your MySQL.
And you can use
SELECT DATABASE()

to find out your current database.
I am thinking you might have the database tables created in one database that is not your default database.
Hope this helps.


How to help others when you don't have a complete solution?

Question: I've recently joined StackExchange after using it as a resource for many years.  Therefore I don't have a high reputation (26), and so cannot use the comments field.  Is there any way to PM a user with a partial solution?  I got told off for posting a short outline in the Answer section earlier today, so I don't want to put anything there.
Answer: Welcome to U&L as a contributor! I (barely) remember the day I joined the sites and I definitely remember the learning curve involved. Your concern is very valid; there are lots of similar questions here on U&L Meta as well as on the Main Meta.
As to your specific question:

Is there any way to PM a user with a partial solution?

That's easy: no.  Stack Exchange intends to be a public collection of Questions and Answers.
When you have a partial answer of the form "use awk; I'll post a full answer later", I'd recommend staying pat. Write up your thoughts locally; test it later when you have a chance, and then take the time to answer.  You may find that there are some eager answerers here and questions that are clear enough to answer often garner several answers pretty quickly.
If, however, you find a thorny question with no answers after several days, and you think you can solve part of the problem, then feel free to post an answer that demonstrates the partial solution and clearly outlines the shortcomings. It may inspire someone else to finish the job, or you may find inspiration later.
You've done exactly the right thing in trying to understand what happened, both in the comments on your answer and by posting here on Meta. Thank you for trying to learn more about how Stack Exchange works, and I hope you find the rest of the learning curve to be smooth! Feel free to reach out here on Meta or in our chat room if you have more questions!
Comment: I didn't mean to mischaracterize your answer; rather, that a comment like "I'll flesh this out later" is a strong indication that you should wait before answering. I know I've been bitten a couple times when I posted the answer before doing enough testing! Looking back at that question you tried to answer, I noticed that three more answers arrived within 20 minutes of yours. They all seem to use the external `sort` command, so your idea of sorting internally within awk could still be a unique answer.
Comment: Regarding comments, I'll be the first to admit that the Stack Exchange codebase has lots of twisty little passages and I'm constantly referring to the [Help Center](https://unix.stackexchange.com/help) and the various [FAQs on Meta](https://meta.stackexchange.com/questions/tagged/faq). The [comment anywhere privilege](https://unix.stackexchange.com/help/privileges/comment) is awarded at 50 reputation points here at U&L. The unique part here is that *"you can always comment on your own posts, and any part of your questions"*.
Comment: Thanks for the response Jeff.  "use awk; I'll post a full answer later" is a little unfair, I outlined a way to do it: read in a parametised number of lines and print them out, read in the other lines into an array and then sort the array and print them out.  Anyhow moving on: the two questions that I was trying to respond to were Maallaard's, but I wasn't sure that an explanation was an answer, and user936802's where I see the same thing with Alma/KDE.  I have a work around for it, but not a complete answer, hence why I tried to comment but aren't allowed to! (Why do comments work here?)
Comment: Sure! I just know that a lot of people struggle with the learning curve here, so if I can make it easier for one earnest person, I'll feel good!


Why did my sponge cake go moldy so quickly?

Question: I made a no-oil sponge cake for a swiss roll. I filled it with fresh whipped cream and then stored the cake in the fridge. It has gone moldy within 4 days of filling it.  Since filling it, it has been stored in the fridge. Why did it go moldy so quickly?
Comment: Did you cover the swiss-roll? The air in the fridge may contain spores. What temperature is your fridge at?
Comment: I agree that some local spore source can make a huge amount of difference with this -- I've lived places where all kinds of things got blue mold very quickly, and places where bread, etc. left in the fridge *for months* ended up very stale, but mold free.  How to get rid of it is another question, I don't think simply covering things will save you since they are inevitably uncovered at some point.  Dropping the fridge temp a few degrees would probably help.
Answer: Not sure exact fridge temp and it was stored in a plastic rubbermaid covered container. but I think oil does have something to do with it since other cakes with butter such as pound cake does not grow moldy so quickly.
Answer: Oil acts as a preservative which slows down the growth of mould in the cake. Because you've removed a preservative, the bacteria grows at it's normal pace. Chilling it slows it down, but not as much as the oil would.
When I make bread I tend to put honey in it as this is a natural preservative and this works for me, gets another day out of the bread.
Comment: Sorry, but this answer has quite a few misconceptions. 1) Just because oil can preserve plant matter from aerobic organisms when it's submerged, it does not mean it acts as a preservative when used in a batter. 2) We don't have much bacterial growth in this case, the OP observed mold. 3) Oil wouldn't have slowed down bacterial growth in the cake at all (which is very low in a cake anyway) 4) you may get a day more of a honeyed bread softness wise, but not food safety wise. Most honeys are not bactericidal at the concentration used in bread.


Can a NAT router run out of ports?

Question: The highest TCP port number is 65535. If a router doing NAT uses an ephemeral port for each connection made to the internet on behalf of the hosts on the internal network, does this mean that it is possible for the router to run out of ports? What is going to happen when the router runs out of ports?
Comment: When a connection is closed, the ephemeral port is released for reuse. If your question is "Can I have more than 65,535 connections open simultaneously?", the answer is NO.
Answer:
If a router doing NAT uses an ephemeral port for each connection made to the internet on behalf of the hosts on the internal network, does this mean that it is possible for the router to run out of ports?

Theoretically, but unlikely.
NAT (usually) works on a mapping of the tuple { source IP, destination IP, source port, destination port }. For your router, one of the IP addresses is itself and the other three components of the tuple are typically going to vary per connection. Let's assume we're applying NAT to an outgoing packet (rather than its reply). The source IP, destination IP, and destination port will be known and fixed. The source port can vary. That gives you approximately 65000 concurrent connections to the same service on the same host. Typically you'll be accessing multiple servers on multiple services, so the numbers shoot way up very quickly indeed.
You are far more likely to run out of space in the connections state table, which can probably handle only a few hundred concurrent connections. Even if it can handle a few thousand concurrent connections it's still far fewer than the numbers we've just considered.
Once you run out of space, what happens next is implementation dependent. The router software might refuse to allow additional connections, or it might kick out the one least recently used. Regardless, it might or might not return error information for the corresponding connection attempt.
There's a good article on CloudFlare that describes a little about the Linux implementation of connection tracking.
Answer: Yes, it is possible for a NAT router to run out of ports.
What happens at that point is decided by the specific NAT router implementation, but generally I would expect that a common strategy might be throwing out the least recently used active connection (i.e. the connection that has been idling without traffic the longest time) and reusing its port.
However, the relevant RFCs say that a TCP connection is identified by the combination of 4 identifiers:

source IP address
destination IP address
source port
destination port

A difference in just one of these is (and must be) enough to differentiate between two connections.
While a host typically uses one port for every outgoing connection (as a source port), a NAT router can reuse port numbers as long as all the other three identifiers are not the same.
So, a NAT router with an external IP address of N.N.N.N could map one outgoing connection as N.N.N.N:60000 -> 220.127.116.11:80 and another simultaneous connection as N.N.N.N:60000 -> 126.96.36.199:80 just fine, as the different destination IP address will be enough to identify the packets as belonging to two separate connections.
As a result, running out of port numbers is fairly unlikely to happen in practice if the NAT implementation is properly designed to handle large numbers of connections.
Answer: Yes, in the same way your computer can run out of ports if it opens too many network connections.
The difference is that the NAT router does not have a good way of reporting the error back, so it will probably just silently discard the packets for the new connection.
Comment: It *might* send back an ICMP packet of some description though I've never seen it happen to know what behaviour to expect.
Answer: Yes, the router can (theoretically) run out of ports.
I have no idea if the standard(s) say what the router should do in that situation. But as most (TCP) connections are relatively short-lived, I guess a reasonable first step would be to hold the packet and try again in a (very) short while. If ports don't become available I see two options:

Silently drop the packet - with the result that the connection isn't established, but the client has to deal with it without knowing what is wrong or where the problem occured.
Return an error packet - same result, but at least the client has an idea where the prblem occured.

I said "theoretically", because in the real world NAT is typically only used in situations where you have more than enough (IP's+)ports.

Can a NAT router run out of ports?


How do single GA pilots prevent boredom during long flights?

Question: My question somehow relates to this question asking about how pilots cope with boredom, but now the scenario is not the typical airliner configuaration with two pilots, but with only one. I'm thinking of single pilot operated business jets with flights over, say, 4 hours. What does the single pilot do to prevent boredom and associated problems such as vigilance loss and fatigue? They've got no one to chat with as stated in the first answer to above cited question... of course, they will continue to check and monitor systems, occasionally report and talk to ATC, but there is plenty of scientific evidence (i.e. see this book) a simple monitoring task can easily lead to fatigue - so are there any methods pilots use to prevent boredom and vigilance decrement?
Comment: When I flew light singles and light twins commercially, we often had to have help unloading so we took turns with another pilot being PIC. We spent most the time betting on bazaar or the latest regulations - we kept score. The looser had to buy a couple rounds of beer at the end of the day. This was very beneficial - it kept us abreast of the latest regs. When I was alone, I played guessing games with myself; trying to see how close I could get to the correct time over the next fix, fuel calculations, testing the range of nav sites, how long I could go without touching the controls, etc.
Comment: While some business jets are certified single pilot, almost no business jet is operated with a single pilot (at least as a business-use jet, ferrying employees, etc), mostly for insurance purposes.
Answer: Not long ago, I had my longest flight as a PPL: about 4 hours from Dallas, TX to Kansas City, MO, in a 172, facing a steady headwind the whole way, so making a ground speed of less than 90kts.
I ran checklists about twice as often as normal, and re-did my fuel calculations very regularly (in part because of the extremely slow progress).
I listened to the ATC frequency, and tried to build a good mental picture of all the planes around me.
I went through every single setting and option on my MFD glass cockpit and iPad.
I watched the scenery, both for visual navigation (despite my GPS), and just to admire the view.
Even after all this, the flight was pretty boring near the end, and I'm glad I don't do flights that long very often.
Comment: You have posted this answer on both this question and dupe question, don't you think it should only be on one?
Comment: This question got closed.   I posted my answer on the question that remains open.


glog always create two files, which has nearly the same content

Question: My test code as blow:
std::string strLogPath = "d:/logtest/";
google::InitGoogleLogging("test1");
FLAGS_log_dir = strLogPath;
FLAGS_stderrthreshold = google::GLOG_INFO;
FLAGS_minloglevel = google::GLOG_INFO;
//FLAGS_colorlogtostderr = true;

std::string strLogPath1 = "d:/logtest/L";
google::SetLogDestination(google::GLOG_INFO, strLogPath1.c_str());
google::SetLogDestination(google::GLOG_ERROR, strLogPath1.c_str());
google::SetLogDestination(google::GLOG_WARNING, strLogPath1.c_str());
google::SetLogDestination(google::GLOG_FATAL, strLogPath1.c_str());

LOG(INFO) << "infoinfo";
Sleep(1000);
LOG(WARNING) << "wwwww";
LOG(WARNING) << "wwwww";
LOG(ERROR) << "eeeeee";
Sleep(2000);
//LOG(FATAL) << "ffffff";
LOG(WARNING) << "wwwww";
LOG(WARNING) << "wwwww";
LOG(WARNING) << "wwwww";
google::ShutdownGoogleLogging();

I got two log files, one file contain all messages(INFO, WARNING and ERROR), and the other contain all WARNING and ERROR messages, but without INFO. This is quiet different from my expectation. I want all messages in one file, and don't like the WARNING and ERROR messages appear twice in different files.
It would be highly appreciated if someone can tell me the solution.
Thanks a lot in advance.
Answer: You probably already have a solution for your problem but I will post this anyway for other users.

glog is not designed for logging in one file as far as I know. Therefore you can't do what you want using only glog.
However there are other solutions for your problem.
First: Write your own little logging library. This isn't very complicated and is a great Programming training ;)
Second: For *nix only. Activate logging to stderr in glog using the logtostderr-Flag and redirect the output from stderr to the desired log file.
FLAGS_logtostderr=1;
LOG(INFO) << "Info";
LOG(WARNING) << "Warning";
LOG(ERROR) << "Error";

and on the shell: ./MyProg 2>logFile
Last: Keep everything as it is and delete the logfiles you don't need. Either within your program using c/c++ or with a call to system()


Android OS Updates On Nexus

Question: I was considering buying Nexus 6P however there would be new Nexus by next September so i was wondering if any one would clarify this rumor. A friend said that he heard from a Nexus user that a Nexus gets every Android OS Update so basically if the Nexus 6P which has Android Marshmallow right now would be immediately be  updated to Android Nougat when the update arrives and so on and so forth. Is this true or is my friend just messing with me.
Comment: This link will help you (look for Nexus devices)---  https://support.google.com/nexus/answer/4457705?hl=en&ref_topic=3415518
Comment: @MANI You should post the relevant portion of that link as an answer.
Answer: Nexus devices generally get system updates in a timely manner, but only for a certain amount of time (as is generally the case for all devices). The Nexus 6P is guaranteed to be updated until September 2017, so it will definitely receive the Android Nougat update.

Android OS Updates On Nexus


Will I be able to keep everything in my Season Bank?

Question: In the winter event when you attack people some of the loot goes into the season bank which can be collected at the end of the event. The amount I will be getting is way more than my storage can hold right now. Will I lose all of the resources that I can't store or will I be able to collect them all?
Comment: According to the [fandom wiki](https://clashofclans.fandom.com/wiki/Loot_Cart): "Like all resource collectors and the Treasury, if collecting the Loot Cart will make some type of your resources overflow, the excess part will remain in the Loot Cart and won't be lost." I cant say its safe to assume thats the case with the season bank, but this might be the best info to go off of. That being said, I think if you purchase resources, it allows your collection to overflow i.e. if you have 5m/7m elixir and you buy 5m elixir, it will hold the full 10m.
Answer: At the end of the season all of your resources from your season bank go to your storage. You get all of the resources no matter how small your storage is.


Google App Script Spreadsheet Form error

Question: Separate issue raised with Google by st...@ditoweb.com here (issue 2391)
We have an iframe-based spreadsheet form on a website (http://www.monarch-equestrian.co.uk/brochurerequest.html) which is set to generate emails with attached PDF's to respondents.
Over the past few days, this has been generating an error notification - "You do not have permission to call getActiveSpreadsheet". The script, triggered on submission, has been working perfectly - however the spreadsheet had grown to 1387 rows so we archived it and deleted most of the records in the original (in case we had reached the limit allowed and so we wouldn't have to create a new spreadsheet etc).
The question is, even though the spreadsheet is presumably now within data limits and all the settings are unchanged, why are we still getting the error?
Answer: According to the reported issue noted in the question, this was fixed Feb 25, 2013.


Shortcut for Snapping options in QGIS

Question: Is there any shortcut option for using snapping in QGIS, similar to pressing F3 in AutoCAD?
Answer: When you hover over any button in QGIS toolbars, its name pops up, as well as eventual shortcuts in brackets.
The default shortcut for toggling snapping seems to be s. If this doesn't work, have a look in the settings-menu, there you may change shortcuts.
You need to have the toolbar added to your GUI in order for this to work properly.
Comment: Have you added the snapping toolbar to your GUI @Peter?
Comment: @Peter According to the policy of this site, consider accepting this answer if it was useful: just click the checkmark next to the answer.
Comment: Aha I see, now that I've added the snapping toolbar to my GUI, pressing "S" does turn snapping on and off. Still though it doesn't really work perfectly with regards to snapping on active layer vs all layers (you have to switch it manually), and some other snapping settings as well. But yes this is what I've been looking for. Many thanks Erik
Comment: But does pressing "S" really work? I mean, for pressing "S" to turn on and off you need to have the 'Project snapping options' mini window active, which kind of defeats the purpose. I was asking for a shortcut that could work *while* I'm editing a shapefile's geometry. Having to stop editing, go to //Project/Snapping options, click into the mini window and then press "S", only to return to editing ... isn't really helpful. Moreover I often have to regularly switch between snap-on and snap-off, so a shortcut would be incredibly helpful and time-saving.

Shortcut for Snapping options in QGIS


Are custom inner theme folders in any way overridable by child themes?

Question: Basically, I'm trying to override some files of the Uncode theme. But this is not a theme-specific question: it can be applied to any theme. The Uncode theme has a custom dir 'partials' (/uncode/partials/) that contains some layout elements. On my child theme I created a 'partials' folder as well (my-child-theme/partials), but the inner files seem not to be overridden. Is it normal? WP docs say that any file of the same name should be overridable, but is seems that's not true. Am I doing something wrong?
Answer: It depends entirely on the parent theme. While WordPress will check the child theme for templates in the Template Hierarchy and use those if they are present, it's up to theme authors to decide how much overwriting by child themes they want to support for any other files outside this hierarchy.
For example, when including template parts the theme author could use:
require 'partials/partial.php';

And this would work fine, but if the theme author wanted to support child theming they would use:
get_template_part( 'partials/partial' );

This is because get_template_part() will check the child theme for partials/partial.php and use that if it exists, otherwise it will fall back to the parent theme's copy of partials/partial.php.
Since 4.7.0, WordPress has added several functions that allow theme authors to support child theming for other files.
get_theme_file_uri() will return a URL for a file in the child theme if it exists, otherwise it will use the parent themes'. This allows themes to support replacing CSS and JS files in child themes.
For example, if the parent theme enqueues a stylesheet like this:
wp_enqueue_style( 'custom-style', get_theme_file_uri( 'assets/custom.css' ) );

Then a child theme author can replace that stylesheet by just placing assets/custom.css in their child theme.
get_theme_file_path() will return the path for a file in the child theme if it exists, otherwise it will use the parent themes'. This can be used by parent themes to allow child themes to replace entire included PHP files.
For example, if the parent theme included a PHP file like this:
include get_theme_file_path( 'inc/template-tags.php' );

Then a child theme author could replace template-tags.php by just placing inc/template-tags.php in their child theme.
So the takeaway here is that WordPress does support child themes replacing arbitrary files from their parent theme, but the parent theme author needs to explicitly support it by using the correct functions.
Uncode is a paid theme, so I can't see the code, but I suspect it's not using get_template_part(), which is why you can't replace the files in your child theme. Paid themes are often not good 'WordPress citizens' and have pretty spotty support for functionality like this.
Comment: So If my theme author has used `require get_template_directory() . '/inc/template-tags.php';` I'm pretty much hooped?
Comment: Right, you won't be able to replace `inc/template-tags.php` in your child theme. But frankly, replacing entire PHP files is a pretty ham-fisted approach. You would be better served by creating your own template tags file with your own template tags, and then replace the _templates_ that use the theme's with templates that use yours.
Answer: That is a very good question, the theme directory can be quite confusing sometimes.
The answer is No, WordPress only looks at core theme files. Since a sub directory isn't part of this it will not look for sub folders in your child theme. What you can do is include the file that includes the partials folder, and that will include your custom partials folder in your child theme.
Comment: I'm pretty sure it's not true...


Why do individual helium atoms rise?

Question: Balloons full of helium rise because the buoyant force is great than the gravitational force and the buoyant force is due to a pressure difference between the top and bottom of a ballon but why exactly does a individual helium atom rise?
Comment: Basically the same reason, albeit more at a granular/stochastic level. Mix a small piece of styrofoam in some sand and start shaking it to mimick air molecules flying around. The styrofoam will end up on top. Or conversely you could put some gold chunks in some sand and pan it out the other way
Comment: @R.Rankin I think the examples you give of the Brazil nut effect are more about the difference in size of the particles, rather than the density. Helium gas in a gaseous mixture is different.
Answer: The probability that an energy level, $E$, is occupied is given by the Boltzmann factor:
$$ P\propto e^{-\frac E {kT}} = e^{-\frac{mgh}{kT}}$$
where $m$ is the species mass. The scale height is then:
$$\bar h = \frac{kT}{mg}$$
For ${\rm N}_2$ you around 8,000 meters, while helium is 7x higher. Oxygen ($m\approx\,$32) is even lower at 7200 meters, so in the death zone (above 8000m) alpinist have less the $1/e$ the oxygen available at sea level.
Comment: Why is single emphasized? A single helium atom is going to be at a random height. It moves randomly with a higher average height than other heavier molecules. Have you ever seen a Markov process away from its mean?
Comment: @josephh buoyancy is a statistical effect due to the interactions of an ensemble of atoms . If one has just a helium atom in vacuum  and gravity, it would fall. So the OP is asking about the effective forces on an individual atom in the ensemble, i.e. at the quantum level.
Comment: @JEB  could you give a link for the expressions?
Comment: @JEB Yes, that is where I misunderstood what the OP was asking. Thanks
Comment: @annav https://en.wikipedia.org/wiki/Boltzmann_distribution https://pubchem.ncbi.nlm.nih.gov/compound/Nitrogen https://en.wikipedia.org/wiki/Standard_gravity https://pubchem.ncbi.nlm.nih.gov/compound/Helium https://en.wikipedia.org/wiki/Death_zone
Comment: Thanks, the first is enough. So it is not a quantum effect  of individual atom to bulk, but a classical statistics gravitational due to the mass differences between atoms.
Answer: Are you asking about an individual helium atom within the balloon?
If so, then the reason for this is rather simple. As you point out, there is an uneven distribution of pressure on the surface of the balloon. When integrated, that means unbalanced forces. So the "first" thing to rise is the balloon - the rubbery thing - itself. The moment this happens, the helium atoms inside are still just flying around as they usually would, in various random directions. But they are confined by the balloon material, and now from their point of view, the bottom of the enclosure has started to move up.
Hence, the bottom of the balloon will - quite soon - collide with some helium atoms. That sends them reeling back upward, where they then strike others, also sending them on an upward course. As the balloon continues to accelerate up, it strikes more and more atoms and this likewise impedes the ones further up to move even faster upward. As a result, the momentum gained by the balloon enclosure transfers to the gas atoms within, and the gas is impelled to move along with it in the upward direction.
Answer: The_Sympathizer gives a great answer to why the atoms in a balloon rise.  The lift doesn't come from the helium inside but from the atmosphere outside. If the balloon's surface were rigid so it occupied the same volume regardless of its contents, one would find that an empty balloon would have a net upward force on it greater than one filled with helium. They have the same upward buoyant force by the atmosphere but the empty balloon's weight is less.
JEB gives a great answer to why helium atoms in a gaseous mixture are disproportionally at the top. All the gas particles have the same KE on average because all the components of the mixture are at the same temperature. Less massive gas particles have greater speeds on average and achieve greater altitudes.
Answer: One thing to remember is the speed that the gas molecules travel is inversely related to the molecular mass. For example the average molecular speed is
v = (8kT/(pi*m))^0.5
[I don't know how to do math text]
Therefore the very light helium atom will have a higher average speed than nitrogen or oxygen.  In a gravity field, this tends to make it rise higher. In fact, hydrogen and helium are so light that this average speed is higher than the escape velocity of the Earth.   So the upper fringes of the atmosphere have huge concentrations of these gases, and the atmosphere is constantly losing a small trickle of its total H2 and He to space.

Why do individual helium atoms rise?


factor analysis with missing values

Question: I have data on about 25 subjects and 30 variables with about 20 missing values. The data is missing at random. What will be the best approach to perform factor analysis. How is factor analysis versus principal component analysis in such cases where some data is missing? Thanks in advance.
Comment: You may not do FA on such a small sample, even without missing data. Especially that you have less subjects than variables (just cannot). To factor-analyze 30 variables you should have about 150 subjects if you expect results to be non-garbage.
Comment: Thanks for this advice. So it may be better to simply do non-parameteric tests. Is any multivariate evaluation possible at all? The variables are mostly numeric (continuous).
Comment: I don't think you can know that the data are missing at random. To know that, you have to know the values of the missing data, and if you know that, you don't have missing data. Perhaps they're assumed to be missing at random?
Comment: Yes, of course I am assuming that the data is missing due to random lack of its recording in original documents.
Answer: In general, I agree with @ttnphns' comment in that you have to have a certain minimal number of cases per variable, with other metrics include loadings and number of variables per factor. This is addressed in the literature (i.e., MacCallum, Widaman, Zhang & Hong, 1999).
Having said that, this heuristic is not set in stone - people have different opinions on the topic and I ran across research that discusses conditions, when it is possible to obtain good results from factor analysis (FA) of small sample data sets ($N < 50$) and/or sample data sets with other questionable characteristics. In particular, aspects of applying FA to small sample data sets are discussed by Costello and Osborne (2005), de Winter, Dodou and Wieringa (2009) as well as Zhao (2009).
References
Costello, A. B., & Osborne, J. W. (2005). Best practices in exploratory factor analysis: Four recommendations for getting the most from your analysis. Practical Assessment, Research & Evaluation, 10(7). Retrieved from http://pareonline.net/pdf/v10n7.pdf
de Winter, J. C. F., Dodou, D., & Wieringa, P. A. (2009). Exploratory factor analysis with small sample sizes. Multivariate Behavioral Research, 44, 147–181. doi:10.1080/00273170902794206 Retrieved from http://www.3me.tudelft.nl/fileadmin/Faculteit/3mE/Over_de_faculteit/Afdelingen/BioMechanical_Engineering/Organisatie/Medewerkers/Winter/doc/exploratory_factor_analysis_with_small_sample_sizes.pdf
MacCallum, R. C., Widaman, K. F., Zhang, S., & Hong, S. (1999). Sample size in factor analysis. Psychological Methods, 4(1), 84-99. Retrieved from http://people.musc.edu/~elg26/teaching/psstats1.2006/maccallumetal.pdf
Zhao, N. (2009). The minimum sample size in factor analysis. [Website] Retrieved from https://www.encorewiki.org/display/~nzhao/The+Minimum+Sample+Size+in+Factor+Analysis
Comment: Thanks for your answer and references. I am reading them now.
Comment: @rnso: You are welcome. Hope they will be helpful.

factor analysis with missing values


GNU/Hurd vs. GNU/Linux

Question: I was quite surprised to learn that the GNU project has an independent kernel of their own called Hurd. And there are mainstream distributions like Arch Hurd and Debian GNU/Hurd which uses it. Is there any significant advantage for Hurd over Linux?
Comment: The distribution of Debian which runs the FreeBSD kernel is a more significant player. People are actually using that for production work, unlike the Hurd.
Comment: I agree. GNU/HURD today is no less effective than GNU/Linux.
Comment: Here are some further thoughts on the OS differences that arise from different kernel architectures (monolithic kernel vs microkernel).
Answer: At this point in time, considering there is no "stable" distribution of GNU/Hurd, the major advantages seem to lie with Linux.
A good place to start understanding the differences between a Mach microkernel, and a traditional monolithic unix kernel is the Wikipedia page on Mach (Kernel).
As an interesting note, Mac OS X, uses a Mach Kernel, called XNU.  Though based on Mach 3.0, it's not a microkernel, like Hurd is.  It makes sense, since Jobs brought the Mach kernel from NeXT to Apple when Apple bought NeXT.
Happy Reading.

Status Update 2018
In the first 6 months of 2018, the git repo for HURD received only 40 commits, so rumors of stability may be exaggerated.  And the number of active code contributors is down to something like 5.  So, GNU/Hurd is still at a major disadvantage to GNU/Linux.  Check back in 2025 after another 7 years, for another update.
See this article from Phoronix for detail.
Comment: @NlightNFotis Suggest you post your own answer.
Comment: A low number of commits may mean stability. A high number of commits may mean unstable. Or it may be the opposite. It kinda depends on what's committed.
Comment: You might want to update your answer now. As of 2013 the hurd is a remarkable piece of software that is moving forward nicely, and is now in the position to stay online for quite some time before needing to be taken down (there are still some memory leaks). You can find more information [here](http://www.phoronix.com/scan.php?page=news_item&px=OTY2Nw) and [here](http://www.phoronix.com/scan.php?page=news_item&px=MTI3OTE)
Comment: @NlightNFotis how about as of 2016? any updates?
Comment: As of March 2017, it is finally getting to be stable. But, it is still not ready for production. It still has serious unresolved bugs and missing features.
Answer: Hurd was the original 'anticipated' kernel BEFORE Linux existed. It has been under development, seemingly for years. During that time, Linus Torvalds along with volunteers worldwide, developed and implemented a kernel that is large, but worked. It was enhanced with programmers from many software firms including Redhat, HP and IBM. It is reliable and works. Mach adhere to the Minix philosophy of having a simple microkernel. I would suggest you take a look at the work of Minix if you would like to see the differences in philosophy. Though the microkernel may have some theoretical advantages, all of the literature I have read, seems to favor the kernel strategy taken by Linux.
Comment: There are cases where the separation a microkernel offers is worth the costs  - usually systems that have to be highly reliable and able to cope with as many errors as possible. Typically anything running on an aircraft (apart from on-board entertainment systems) or in automotive industry. Generally places where less is more, since lives are at risk.
Comment: "seemingly" for years?
Comment: @Kusalananda decades. When Linus was writing his own code, Stallman was being publicly laughed at on the forums (well... on USENET), because Linus managed to complete 'his' non-proprietary kernel code for the x386 architecture, while GNU Hurd, well, was still in the drawing board... not really, but nothing serious could be done with it.
Answer: According to the Wikipedia article on GNU Hurd:

In 2010, after twenty years under development, Stallman said that he
  was "not very optimistic about the GNU Hurd. It makes some progress,
  but to be really superior it would require solving a lot of deep
  problems", but added that "finishing it is not crucial" for the GNU
  system because a free kernel already existed (Linux), and completing
  Hurd would not address the main remaining problem for a free operating
  system: device support.

It seems that it would take a large amount of work to complete the project and resolve the issues that it is facing. On top of this, it is quite unclear what (if any) benefits the Hurd kernel would bring to most normal users over the current Linux kernel, which has had a large amount of resources poured into it over many years and works very well on a wide range of architectures.
Because of this, it seems that Hurd is little more than an academic exercise at this point. With no real driving need behind it, it seems unlikely that it will reach full usability any time soon, let alone catch up with or exceed the impressive capabilities of Linux. I don't mean to knock the Hurd developers, but I wouldn't hold your breath ...
Comment: Having been around since 1990 waiting for Stallman to 'finish' Hurd, I have long ago stopped holding my breath. GNU/Linux was already 'a thing' before even Hurd was _a name_.

GNU/Hurd vs. GNU/Linux


Absorption cross section for direct dissociation and predissociation - Photoelectric absorption

Question: Why the absorption cross section in direct dissociation process is wide and structureless while the absorption cross section in the predissociation process is structured and containing lines which are normally Lorentzian in shape?
Answer: In direct dissociation the system is excited from a bound state to an unbound state. Because the translational energy of the unbound state is not quantised all energies above the dissociation energy are absorbed, so there is a continuous absorption spectrum with no sharp lines.
In pre-dissociation there is usually some selection rule that blocks direct dissociation, so there is a transition from the ground state to a an excited but bound state. This transition gives sharp lines like any other transition between bound states so you get a spectrum with sharp lines.
However the excited state may very quickly decay to the unbound state, and if this happens lifetime broadening will blur the lines in the spectrum. Typically you find that the probability for decay of the excited to unbound states depends on energy, so as you increase the energy you find the lines start sharp, then blur out, and finally get sharp again.
Comment: @ John Rennie: I have a confusion (may be silly). In case of direct dissociation, the electrons are excited or not? Is it adiabatic or non adiabatic? If electrons are excited and cause dissociation, there is an electro-vibronic coupling and the Born Oppenheimer approximation is not valid! right?
Comment: In a molecule an electronic excitation usually (always?) involves a vibrational transition as well. It's a long time since I did any work in this area, but IIRC we assume the transition is fast compared to the vibrational period so the Born Oppenheimer approximation still applies.


Yodlee API PKI, trying to encrypt data rsa/ecb/pkcs1padding using rails/ruby

Question: I'm creating an app using yodlee api, so far everything good, but right now, I'm having this block related to the PKI feature of yodlee. I'm not able to encrypt the data using "RSA/ECB/PKCS1Padding" as they request, all  I found so far are java examples, anyone with a snippet of code, or a reference to make this possible on ruby?
Answer: I guess you are referring to this manual to integrate Yodlee API with PKI feature.
Have a look into the ruby's OpenSSL classes. Encryption using RSA is possible with the OpenSSL::PKey::RSA class, see also this intro doc. Basically you have to load the public key returned from the API, and use the public_encrypt method to encrypt the data and hex-encode it in the end. The encryption uses the PKCS1_PADDING by default which is just what you want.
A complete example is available in this SO answer.
Comment: Thanks! Do you know if I can find any yodlee code sample? I'm already using the encryption but I'm still getting the decryption error.
Comment: I don't, sorry. If you have a concrete failing code, update the question or perhaps place a new one. In general, it should be an equivalent code to the Java code posted in the official manual.
Comment: Sorry if I mislead you, the output should be hex-encoded, not base64-encoded. I corrected the answer.


old bare copper ground wire to pool pump

Question: I am reinstalling an existing 220 V pool pump and have found that the equipment ground is a bare copper wire, not insulated as per current code requirements . A new home run to the panel is about
100 ' and not practical . Will introducing a gfi
breaker in either a spa panel downstream from the main panel or a gfi breaker in the main panel bring the circuit up to standard ?
Comment: What wiring method was used for the current branch circuit run to the pool pump?
Answer: No, it wouldn't bring it up to standard
Pool pumps need to be grounded (using an insulated ground wire when the wiring run is in a corrosive environment) and GFCI protected, so adding the GFCI won't make up for a lack of grounding, unlike the situation with ungrounded receptacles, where GFCI protection can be used to bring an ungrounded receptacle up to Code.


Cloud Solver Options

Question: For personal work, I am investigating options for commercial solvers.  Prefer a cloud solution so I don't need to invest in higher-compute machines.  I have received pricing for Gurobi Instant Cloud, but would like recommendations from others.
Comment: If you are not aware Neos-server.org allows you to run (but not abuse) free compute resources and has access to a variety of solvers. If your problem is small enough that might be worthwhile. Depending on your problem it might also be worth it to look into cheap hosting companies which also rent dedicated machines or deploy solvers without hardware license checks in cloud machines as Azure and AWS can be expensive. This means more sys admin duties for you though.
Comment: Perhaps you can tell us the range if problem types you want the solver to address. For instance, if you neef to solve non-convex quadratically-constrained problems, CPLEX (which is available as a could solution) would not handle that.
Comment: Range of problems @MarkL.Stone : I am starting independent consulting in supply chain OR.  So mostly LP/MIP/MILP with the occasional QP.  Probably nothing else.
Comment: I am familiar with NEOS , but the size of problems I am scoping with clients, I would not want to send to NEOS.  Thanks for the tip on servers @worldsmithhelper
Comment: If those clients are commercial, using NEOS might be against the [terms of use](https://neos-server.org/neos/termofuse.html) anyway, depending on the individual solver - several of the big names are licensed only for academic non-commercial use.
Comment: Yes @GeoffreyBrent commercial clients.  I'll keep looking into cloud options.  www.datadrivensupplychain.com is my business URL BTW.
Answer: You can run OptaPlanner (open source) in the cloud, on OpenShift/AWS/Azure etc.
All of the quickstarts contain a docker file. All quickstarts can run in with the JDK docker image, but all the Quarkus quickstarts also support native compilation into a normal linux executable, which is ideal for serverless setups.

Cloud Solver Options


What is the correct way of asking a question?

Question: Are there guidelines for what constitutes a good question?  What should be included in a question and what shouldn't be?
Comment: A few tips that are commom to the whole StackExchange network are at:
 [How to Ask?](http://islam.stackexchange.com/questions/how-to-ask)
Answer: Make it as easy as possible for the answerer to answer.
This is probably the most important thing.

Stick to one question and make it stand out.  The answerer should have no doubt as to what the question is.

Make the question the title.  See Advice for writing question titles on Islam.SE.

In addition, answerers are more likely to answer questions which have the properties:

Unlikely to change (which would waste the answerers' time),
Unlikely to result in discussion, i.e., there's a clear endpoint to the answerer's commitment,
Likely to yield upvotes and maybe even acceptance if the answerer takes the time to answer, i.e., appreciation,
Properly formatted,
Self contained, i.e., the answerer does not need to go off-site to work out what the question is.

When I answer questions at math.SE, I inspect a question for maybe 2 seconds before deciding (a) if I'm capable of answer it, and (b) if it's worth my time answering it.  I mention my math.SE "volunteer work" on my CV, so there's a real-world benefit to this reputation.  If I feel answering a question will not yield reputation, I won't bother answering and just move onto the next question.

What else to include (Or: Where's the rest of the question?)

Why do you ask?  Explain the motivation behind the question.  This is helpful for phrasing answers to match.
However, experience indicates providing details of questions motivated by personal reasons distracts more than it helps.  (Pro-tip:  Use Google to find a webpage of someone else with the same personal problem, and ask about their problem.)

What do you know?  This indicates your current level of understanding; it also indicates where there may be misunderstandings.  E.g.:

I Googled [blah blah blah], but there were no relevant results,
I found this fatwa which says [blah blah blah], but that doesn't answer the question because [blah blah blah].
My friend told me [blah blah blah].
I found [this question], but that differs from this question because [blah blah blah].

What do you think the answer is?  This indicates you've put some thought into the question.  E.g.:

I think the answer is [blah blah blah] because of [blah blah blah], but I'm not too confident.
[This fatwa] says [blah blah blah] which suggests the answer is [blah blah blah].
I'm fairly sure the answer is [blah blah blah] because of [blah blah blah], but I want to check.
[Unreliable reference] says the answer is [blah blah blah], but this source is unreliable.

Conditions

Search for your question first.  This is not a foolproof solution, but it's better than risking posting a duplicate.

Be on-topic.  If it's completely off-topic, don't bother.  For Islam.SE, the boundaries of on-topic and off-topic are not clearly defined.  I have no qualms about asking borderline questions, because at worst they'll be closed.

Avoid single-use questions.  They're really boring and often go ignored.  These are questions which are so specific to the user's circumstances, that the answer would only be valuable to the user themselves.

These are on the How to Ask page.

Other tips

Google the title of your question.  If it doesn't contain the appropriate Google keywords, the title needs rephrasing to include those keywords.

Reference and link to specific Qur'an, Hadith, fatwa, etc.  There's different versions of each of these and it's helpful to pinpoint exactly which one the author is referring to.

Link to Wikipedia for non-obvious Arabic terms, specific scholars, important texts, etc.
Comment: I'm not really comfortable with the "What do you think the answer is?" part; it's too easy to take as an excuse to post leading questions (which has often been done to promote ideological points of view) rather than honest "I'm asking because I actually don't know the answer" ones. As written, your examples seem less about knowing what the answer is, rather they're noting that you are aware of the easy/obvious answer (showing research effort) and explaining what they're missing that you need (clarifying what *you* are expecting in an answer above and beyond what's out there).


What's the difference between combining Rules conditions with AND and just have them follow one after the other?

Question: Is there a difference between using AND in Rules Conditions and simply adding Rules Conditions one after the other?
Answer: No difference, except if you want to do something more complex like this:
____ AND _____ OR _____ AND _____
You can only do that with conditional rules. (If I recall correctly)
Comment: Sorry to say, but part of this answer is not correct (= wrong). Lucky you ... I rarely downvote answers (and for sure not anonymously). Do you mind if I allowed to correct this with an additional answer? ... So that maybe next time you want to recall it you have something to go search for?
Comment: @Pierre.Vriens please feel free to do so :)
Comment: merci for the approval (hm, hm) .. but don't blame me afterwards if your answer would get un-accepted hé ...! Stay tuned ...
Comment: @Pierre.Vriens I will be happy to delete it, if I am completely off.
Comment: No no, no need for delete, it's only partially wrong! Hang on (I'm working on it ... go have a coffee if you're in a hurry/too curious). Or go checkout the newest "promo ad"-proposal on meta.drupal.SE
Comment: Curious for your feedback about my correction ... Ps: I told you upfront to not blame me hé ...
Comment: Curious for your feedback about my correction ... (I told you upfront to not blame me hé ...). Nevertheless "merci" for the inspiration I got from it to add my own answer.
Answer: Preface: I'm assuming this question is about D7 ...
Correction to the prior answer
I'm sorry, but the prior answer is only partially correct (which is the same as saying partially wrong, n'est-çe pas). Please allow me to briefly correct that (before anybody believes it):

The question is about (contains) "... using AND in rules conditions ...", while the Conditional Rules module cannot be used in Rules Conditions (only in Rules Actions). Actually Rules Actions are the reason-to-exist for this (interesting) module.
If you want to do something more complex, then you can ALSO use Rules Components as an alternative. So "You can only do that with conditional rules" is not true.

To AND and/or to OR?
Moving on now to the actual question, this is my answer to it:

This question is a typical Rules newbie question. Since it isn't obvious that within the Rules Conditions there are 3 ways to combine conditions:

add an explicit "OR", so that either condition must be true (for the Rules Actions to be executed).
add an explicit "AND", so that both conditions must be true (for the Rules Actions to be executed).
do not add an "OR" or an "AND": that's equivalent to an explicit "AND".

One might ask then So when do I ever really need to add an "AND"? The answer to that is if you need to more complex logic like in this sample:
Condition 1 OR (Condition 2 AND Condition 3)
In plain English: the Rules Actions will be triggered if either (or both) of these conditions are true:

Condition 1.
Condition 2 AND Condition 3.

Rules Conditions inside Rules Actions
But, the real Rules fun starts when this (typical) question arises: "I need to add something like a Rules Condition inside the Rules Actions, how can I do that?" ( * ).
To resolve this typical question, there are basically 2 approaches (that I am aware of):

Use the Conditional Rules module. For an example using the Conditional Rules module (for which there is not a lot of docu available), refer to my answer to the question "How to prevent a node being saved when using the Rules module?".
Rework the relevant part of your Rules Action(s) into performing a Rules Component. Because in a Rules Component, it is possible to also add Rules Conditions.
Typical scenario: "Use Rules to perform a redirect for users with at least X user points, after some Rules Event Y happened". To get this to work:

Create a Rules Component, with number of userpoints as a parameter. Within this Rules Component, add a Rules Condition (there you are!) to check if the parameter is at least X and add a Rules Action to perform the redirect.
Create a rule, triggered when Rules Event Y happened. Retrieve the nr of user points for the current user (How to???). And add a Rules Action to invoke the previous Rules Component.

Sweet, no?
( * ): There are dozens of samples that are variations of this question, my favorite one is when some Rules Action needs to happen based on the number of User Points the current user has (and you do not like to use PHP as a Rules Condition, like I do). If you don't see why that's a variation of it, then first try to find out what the Rules Condition for that would be ... hint: it's a Rules Action, not a Rules Condition.
Comment: Really extensive and exhaustive answer, thanks a lot! I finally had to combine AND and OR, so I complete understood the using case!
Comment: @PonzioPilato : merci! ... and sorry I could not let the prior answer just go. Thought I'd try to explain this typical question for "once and forever". FYI: when I first started with Rules, I struggled with the same thing over and over (now I know by heart).
Comment: Oooooooooh yes.
Comment: I'm completely agree! Quite often we, as Drupal newbies, need some clear and simple answers to simple questions that are missing of documentation and waste so much our time. Thanks again :)
Comment: Some people understand things with only a few words (or just reading the source code) ... other people prefer a tutorial to get it.


How to identify which account a given S3 bucket lives in?

Question: I come across many S3 buckets... is there a way to tell which AWS account a given S3 bucket was created in?  I can only think of iterating through each account I have access to, but I don't have keys for many accounts in our portfolio.
Comment: I suspect making that information available publicly would be a small security risk, so I doubt there's a way to do it. You probably have to log into your account via the console or API.
Answer: As Tim said this doesnt look possible due to security reasons. None of the CLI APIs look useful for this.
Ideally you should have a parent account and use My-Organization feature to keep track of all accounts (consolidated billing is a good excuse to get all of them under a single umbrella) and also ask account owners to create a cross-account-role with read privileges. Once you have this, you can easily iterate all accounts programmatically and find the relevant info.
Comment: I thought that returning an account ID number would not be anything sensitive, but then someone may be able to target login hacks against a particular bucket owner.


If $X$ and $Y$ are zero mean independent Gaussian random variables with different variances, what is the density of $\sqrt{X^2+Y^2}$

Question: Let $X\sim\mathcal{N}(0,\sigma_X^2)$ and $Y\sim\mathcal{N}(0,\sigma_Y^2)$ be independent Gaussian random variables. What will be PDF of $Z=\sqrt{X^2+Y^2}$ and $W=\arctan{\left(\frac{Y}{X}\right)}$. Will they still be Rayleigh and uniform distributions respectively?
Comment: No. And also note that the joint distribution, in this case Gaussian *and* independent, is called Multivariate normal distribution https://en.wikipedia.org/wiki/Multivariate_normal_distribution
Answer: According to your description, $x = Z \cdot \cos(W),\ y = Z \cdot \sin(W)$. Follow this answer for the derivation of joint PDF of $(Z, W)$ : Complex Gaussian Magnitude and Phase Joint PDF Derivation
You will reach the following expression after Methid of transformation:
$$f_{Z,W}(z,w) = |\mathbf J|.f_{X,Y}(z \cdot \cos(w), z \cdot \sin(w)), \ where \ \mathbf J \ is \ Jacobian$$
Since the computation of $\mathbf J$ will not change hence:
$$\mathbf J= z$$
Now, when you put the joint PDF of 2 independent Gaussian random varaibles $X, Y$ in the above expression you get the following :
$$f_{Z,W}(z,w) = |\mathbf J|\cdot f_{X,Y}(z\cdot \cos(w), z\cdot \sin(w)) $$ $$= z \cdot \frac{1}{\sqrt{2\pi \sigma_x^2}}\exp(-\frac{1}{2\sigma_x^2}(z\cdot \cos(w))^2)\cdot \frac{1}{\sqrt{2\pi \sigma_y^2}}\exp(-\frac{1}{2\sigma_y^2}(z\cdot \sin(w))^2)$$
Combine this and find the marginal PDFs of $Z$ and $W$ from the above expression. You will find that integrating from $-\pi$ to $\pi$ w.r.t. $w$ will not give you Rayleigh Distribution anymore. And, similarly, integrating from $0$ to $\infty$ w.r.t. $z$ will not give you $\frac{1}{2\pi}$, and hence not Uniform Distribution anymore.
Answer: By definition, $X$ and $Y$ must have a same variance $\sigma^2$ to make $Z$ being Rayleigh.
Answer: Z follows a Hoyt distribution. The shape parameter is $q=max(\sigma_x,\sigma_y)/min(\sigma_x,\sigma_y)$, and the spread parameter is $w=\sigma_x^2+\sigma_y^2$.
The PDF of W is given in On the envelope and phase distributions for correlated gaussian quadratures. But to my knowledge, there are not closed-form expressions for the mean and the variance.


Copying files from local machine to remote HDFS cluster directly

Question: I want to copy a file directly from my local Linux machine to a remote HDFS cluster i.e., I don't want to copy the file to the remote machine and then move it to HDFS using copyfromlocal command.
For this, I have executed the following command which I found it in an online blog.
<code>cat sample.txt | ssh -tt root@MY_HDFS_CLUSTER "sudo -u hdfs hdfs dfs -put - /user/myuser/data/sample/sample.txt"
</code>
The issue I am facing while executing the command is that file is copied completely from my local machine to remote HDFS cluster but a file sample.txt.COPYING is created in remote HDFS cluster instead of sample.text file. The copy process runs indeterminately, in other words, it is not terminating and I have to kill the process using Ctrl+C.
It is much appreciated if someone help me resolve this issue.
Answer: How big is your sample.txt file? I think it is probably big and the process is not terminating because it hasn't actually finished copying the file yet.


Dodge Neon SRT-4

Question: My SRT-4 is putting out the proper boost and pulling vacuum, but it's not pulling the right amount. When I bought the car in 2008 it was pulling about 20hg, but it sat for three years and now it is only pulling 10hg. I have looked at every hose and line and didn't see anything wrong. Any suggestions?
Answer: If you say all the hoses and clamps are in good order, then the only other things that come to mind are the wastegate and exhaust manifold. Either the wastegate is opening too soon, or the exhaust manifold is leaking from the gasket or a crack. This would mean that either you lose boost too early, or you never get enough boost in the first place.
Or, if you're lucky, it's simply a case of having a blocked intercooler (bits of debris, a colony of mice, SPIDERS!) or a dirty air filter.
If you're really unlucky, it could be that your turbo decided that it's the perfect time to retire.

Dodge Neon SRT-4


Split the values by a comma and pass it to a collection variable

Question: I have a screen element where I input the opportunity Ids split by comma. I am wondering if there is a way to split the values by comma and add it to a collection variable so that I can loop through the records.
Answer: The Flow engine can't do this natively, so you'll need an apex action to help with this.
You can create one yourself, or you'll find UnofficialSF already have an action that will do this for you.
https://unofficialsf.com/new-flow-actions-to-convert-csv-strings-to-string-collections-and-vice-versa/
You can use the 'Convert To String Collection' to get a collection of strings from your input.
If you don't want to install the managed package for this, the source code is also available.
Answer: There is a way to do this using flows. Please follow the below steps: -

Resources

2 Collection variables

recordIdDisplay_collection: This will contain the final collection output.

Data Type: Text
Allow multiple values (collection): checked

Occurrences_of_comma_collection: Looping collection

Data Type: Number
Allow multiple values (collection): checked

4 Formulas

i_plus_plus: Incrementing i

Data Type: Number
Decimal Places: 0
Formula: {!i} + 1

recordIdDisplay_split: Splitting and getting 1st value in recordIdDisplay

Data Type: Text
Formula: LEFT({!recordIdDisplay_original}, FIND(',', {!recordIdDisplay_original})-1)

recordIdDisplay_substitute: Replacing already stored values (in collection) from recordIdDisplay blank (essentially removing)

Data Type: Text
Formula: SUBSTITUTE({!recordIdDisplay_original}, {!recordIdDisplay_split} & ',', '')

Occurrences_of_comma_max: Maximum commas in recordIdDisplay

Data Type: Number
Decimal Places: 0
Formula: (LEN({!$Record.recordIdDisplay}) - LEN(SUBSTITUTE(LOWER({!$Record.recordIdDisplay}),",","")))

3 Variables

i: Iterator

Data Type: Number
Decimal Places: 0
Default Value: 0

recordIdDisplay_original: Stores updated value of recordIdDisplay after substitution

Data Type: Text
Default Value: {!$Record.recordIdDisplay}

Elements and their order

Assignment (Occurrences_assignment)

Variable: {!Occurrences_of_comma_collection}
Operator: Add
Valu: 0

Loop (For each occurrences of comma)

Collection Variable: {!Occurrences_of_comma_collection}

Decision (End Loop?)

OUTCOME DETAILS

Label: If all comma occurrences finished
Condition Requirements to Execute Outcome: All Conditions are Met (AND)

Resource: {!Occurrences_of_comma_collection}
Operator: Contains
Value: {!Occurrences_of_comma_max}

[Path] If all comma occurrences finished

Assignment (Assign last value)

Variable: {!recordIdDisplay_collection}
Operator: Add
Value: {!recordIdDisplay_original}

End

[Path] Default Outcome

Assignment (Assign n-1 values to collection)

Variable: {!recordIdDisplay_collection}
Operator: Add
Value: {!recordIdDisplay_split}

Variable: {!i}
Operator: Equals
Value: {!i_plus_plus}

Variable: {!Occurrences_of_comma_collection}
Operator: Add
Value: {!i}

Variable: {!recordIdDisplay_original}
Operator: Equals
Value: {!recordIdDisplay_substitute}

Hope this helps!
Answer: I found a nice(r) way of achieving the requested: First I check whether the separator (should be a constant) is contained in the string, if so, the left part is cut into a separate variable and added to the collection (if not empty), then the remaining part is put into the original variable and we start over.
To extract first entry: trim(LEFT({!remainingText}, FIND({!SEPARATOR}, {!remainingText})-1))
To update remaining text: Trim(right({!remainingText}, len({!remainingText})-FIND({!SEPARATOR}, {!remainingText})))


Is Apache serving over HTTP vulnerable to Heartbleed?

Question: I run a server whose only public open port is 80, serving non-encrypted data over HTTP, not HTTPS. Is it affected by Heartbleed?
Answer: Teun Vink is right, it's not vulnerable if you are certain that https is turned off, for example by turning mod_ssl off.
Even if you don't actively use https, it may still be enabled. Many servers have https enabled by default with some automatically generated certificate. This will not be valid and throw an error or warning in browsers, but it will still be exploitable.
If you can modify the apache configuration, disable mod_ssl with a2dismod ssl. On Windows I'm not sure this works; for example in a xampp installation you should edit the httpd.conf file in the xampp/apache/conf folder. Put a pound sign (#) in front of the line that says
LoadModule <something_with_ssl> so it becomes #LoadModule <something_with_ssl>
If disabling mod_ssl causes problems in other parts of the configuration, you can also simply make sure that the only Listen option is for port 80. You should search in all configuration files for those Listen options, for example with grep or on Windows you could use Notepad++' search in files feature.
In any case, it's advisable to update OpenSSL if possible. Other stuff may be using it, or someone may turn https on in the future without realizing that it's vulnerable.
TL;DR: Update OpenSSL if at all possible, even if you are not vulnerable. If not possible, make absolutely certain you're not using https.
Comment: @David, Actually, I think your comment is flawed :P. What you're saying is: "even with this bug, an attacker needs to be savvy enough to exploit it, whereas http can always be read in plaintext". There is a huge distinction here: with this bug you can read *anyone's* data from the RAM if you get a bit lucky, even the server's (i.e. its private key). With http you can only read the data from whomever's network traffic you can see. If http was equal to the heartbleed bug, we'd have banned plain http a long, long time ago (though, for different reasons, we should, and are in http v2.0).
Comment: I think it's worth a bit more detail about why the question itself is flawed. The whole purpose of OpenSSL is to encrypt traffic. The heartbleed bug defeats that encryption. So, if you are knowingly running traffic unencrypted to port 80, you have already made the choice that the security of that data isn't important. Even with this bug, OpenSSL requires an attacker to be savvy enough to craft malicious heartbeat packets, and make sense of the memory dump that comes back. With plain HTTP, all you need is wireshark or some other traffic sniffer.
Comment: Hah, agreed. That second part was poorly worded. Although, conceivably if you are sniffing plain text creds, you can access the app with those, and then it becomes much easier to find other exploits within the app that may lead to root access. Taking those few extra steps in my contrived example, then I'm back to arguing that you're worse off using http than if you're running https with the heartbleed bug. In truth, either scenario is awful if you're a sysadmin / app owner / business owner :P
Comment: @David Hmm, I'm not sure heartbleed+ssl/tls is better than no ssl/tls at all... I have first hand experience exploiting both and you're right that they're both awful, but the impact of http is usually much lower. Of course in different situations things might be different, but generally I think you're much better off disabling https altogether if the alternative is to leave it vulnerable.
Comment: Agreed. I admit defeat :)
Answer: No it's not. Heartbleed is an OpenSSL vulnerability, no OpenSSL is used for HTTP.


Are Spider-Man & Deadpool the only characters who have met alternate versions of themselves?

Question: As I understand it, Spider-Man has met alternative versions of himself on several different instances, such as the Noir, 2099, & Ultimate alternates, at one point teaming up with them and other alternates as Web- Warriors. Deadpool also has encountered several alternate versions of himself, going so far as to create an entire team of alternate Deadpools known as the Deadpool Corps. I was just curious: have any of the other Marvel characters experienced similar encounters, or has it only been Spidey and the lovable Merc with the Mouth?
Comment: Is there any character who **hasn't** met an evil version of him/herself from an alternate universe?
Comment: It gets tricky distinguishing between "alternate versions" and time travel, especially when the timeline changes.  Thor went on adventure with his younger and older selves, for example.  Would that qualify?
Comment: I haven't read much of Secret War but wouldn't lots of these characters be meeting once -616 and -1610 start fighting?
Comment: The numerous and varied answers here are exactly why I hate "do any exist" questions.
Comment: I think it all started when the Silver Age Flash encountered the Golden Age version of himself.
Comment: From your comments on people's answers I can tell that you have some specific criteria in mind for what "alternate versions of themselves" means, and I *think* I see what you're trying to get at. Could you edit your question to clarify those criteria?
Comment: @phantom42 so more annoying stuff over there to hate over, let these ones slip...
Comment: Funny how a simple "yes/no" question turned out as "too broad". Q: `have any of the other Marvel characters experienced similar encounters, or has it only been Spidey and the lovable Merc with the Mouth?` A: `yes.`
Comment: @Mindwin Yes, that's historically the problem with such questions. Simply saying "yes" without providing examples is a valid, but poor answer - exactly the type of answer we typically try to discourage. It becomes problematic here because as all of these examples are "correct", meaning no answer is really more correct than another, so no one answer can be objectively declared as "correct". These *are* often good/interesting questions, but poor fits for the main site.
Answer: Characters meeting alternate versions of themselves is a common trope in Marvel comics. There are too many instances of this to list, but here are a few:

The Hulk most famously fought a future version of himself (Maestro) in the The Incredible Hulk: Future Imperfect series. The Maestro character would later appear several other times as well, always posing a dangerous threat to the younger Hulk.
If you count the psychic plane, the various incarnations of The Hulk had to face a new incarnation - Guilt Hulk - within Bruce Banner's mind in Incredible Hulk #377. The Guilt Hulk, an evil persona based on Bruce's abusive father, would show up again later as well.
The original five X-Men were brought forward into the future in the All-New X-Men series, resulting in all but Jean Grey meeting themselves. This proved particularly traumatic for Scott Summers, who ended up fighting his older self on several occasions.
An offshoot of the Exiles, the Wolverine Squad is a team made up entirely of Wolverines from different universes. The team was created specifically to kill a gestalt being - Brother Mutant - which included yet ANOTHER version of Wolverine in its makeup.
The current "Secret Wars" arc witnessed multiple characters meeting alternate versions of themselves
In the new reality ruled over by Doom, his will is enforced by The Thor Corps - a police force comprised entirely of Thors from different universes.
The X-Termination event saw X-Men from three different continuities interact.

These are just a few - there are numerous examples available. And if you count cases where the doppelganger is an android, clone, shape-shifter, or something else assuming the form of a character, the list becomes even larger.
Comment: ...and also Bizzaro.
Comment: @Daft: yes, LOL, the expanded list would indeed include characters like Bizarro.
Answer: The Ultimate Fantastic Four had the unfortunate luck to meet their Zombie-Universe counterparts in Ultimate Fantastic Four Vol. 1, issue 21.

This was the beginning of the Marvel Zombies storylines. I'm certain there are other instances of Marvel characters meeting other-universe counterparts, but this one sticks out in my mind.
Comment: Only answer so far that seems to apply.
Answer: Here are three panels from Alan Moore's run on Captain Britain in which the hero meets numerous alternative versions of himself.

There was later an entire superhero team formed of alternative versions of Captain Britain, the Captain Britain Corps.
Comment: I like this answer, but are these actually different versions of Brian Braddock? I thought they were different people filling the "Captain Britain" role.
Comment: It depends what the original question meant by "alternative versions of himself". They're alternative versions of Captain Britain, but not of Brian Braddock.
Answer: Not if you include Beta Ray Bill/Beta Ray Thor as an alternate version of Thor:

Thor has also met this alternate version of himself:

And he once turned into a Hulked-Out version of himself:

And as cde pointed out, in Thor Corps, Thor teamed up with Beta Ray Bill, Thunderstrike, and Thor 2099.
Comment: Op included Spiderman 2099. Thor has also met Thor 2099.
Comment: Thor corps. Thor, Thorse, Thunder Strike and Dargo Ktor Thor 2099 team up.
Comment: This is just different characters in the same role, though. If we count Thor & Beta Ray Bill, we'd also have to include Green Hulk/Red Hulk or different team rosters (Old Avengers vs. New Avengers).
Comment: Your middle example is a good one, btw.
Comment: @cde - I didn't know that.  I can't find any pictures of it, or I'd add them.
Comment: @cde - Many thanks.  Added.
Answer: Xmen travel through alternative time lines like squirrels cross branches of a tree.
Cable has met Nate Grey the X Man, and Strife.
Beast was kidnapped and tortured by Dark Beast.
Gambit fought Sun, a physical god version of himself.
Storm and Wolverine have met their days of future past punk counterparts.
Wolverine has met I think, his gay and in love with Hercules alternative self.
SheHulk has met and interrogated her "Slept with Juggernaut" copy.
Comment: There's a gay version of Wolverine? That's the most evil thing I can think of. It's like picturing Clint Eastwood in drag.
Comment: _a physical god version of himself_... imagine pitching that idea.
Comment: @omega And he has a Freddy mercury mustache to boot
Comment: Wasn't Stryfe Cable's son?
Comment: @mindwin Cables clone, and the real father to cables son.
Comment: @cde Funny family and their clones, always siring the next generation in lieu of the real person.
Answer: The X-man met the X-babies, alternate versions of themselves created by Mojo.
Jean Grey and Madeline Pryor.
Magneto and Joseph


" multiple active partitions " ERROR

Question: I am trying to install ubuntu 11.10 from a bootable usb but when i boot from usb the " multiple active partitions " error show up and automatically boots in windows 7. PLEASE HELP! Thank you.
Answer: write image with last version of ultraiso. i had this problem with every ubuntu release. unetbootin didn't help, only the latest versions of ultraiso at the moment.

" multiple active partitions " ERROR


Analogy for arising/increasing difficulties

Question: I'm looking for a metaphor or analogy for experiencing more and more difficulties (after getting more familiar with a certain teaching or art). I think I have seen a few in the past but I can't think of them right now.
Answer:
For every head you cut off, another two will grow back (Referencing the Hydra myth)

Related to the above, less violent:

For each question you answer/problem you solve, two more come/pop up.
Answer: A well-known saying refers to the situation where beginners think something is easy, but those at an intermediate stage are overwhelmed. It's often said as:

The more you learn, the less you know.

or

The more you know, the more you know you don't know.

Both versions allude to the discovery of an insurmountable amount left to learn.
Comment: Well said, I can relate.
Comment: +1 I particularly like the second version. I think it's really a more explicit restatement of what the Delphic Oracle meant by saying Socrates was the wisest man alive. Socrates himself having said *"I know nothing"*, which made him wiser than anyone else because at least he knew enough to recognise the extent of his own ignorance.
Answer: One relevant expression is

One step forward, two steps back

although it implies that any small progress made is counterproductive, and you are moving backwards.
As suggested in the comment on this answer by Rikon, a more accurate expressiong might be

Two steps forward, one step back.
Comment: +1 To add to this, "Two steps forward, one step back" would imply some progress is being made, just not without difficulty at every step.
Answer: There's "snowballing".  Once the snowball gets rolling it gets larger and larger.
Answer: It sounds like you have opened a can of worms.


Windows 7 Recycle Bin sort by Date Modified

Question: In the Recycle Bin, I sorted by 'Date Modified', but the result is not in the proper order. It was neither ascending nor descending.
Other sorts (by Date deleted, size, item type) all work well.
Does anybody have the same problem?
Comment: Wow, just added that column and I see that you're absolutely correct - it doesn't sort properly by Date Modified at all! If some columns are not allowed for the Recycle Bin, why does Windows allow users to add them in the first place?
Comment: I couldn't make out for sure. It *seems* that Date Modified is being used as a secondary sort order, but what the primary sort is wasn't all that clear. I'll have to check further. It would also help if someone else can confirm this.
Comment: Did you find what order the files are sorted when you try sorting by 'date modified'?
Comment: `If some columns are not allowed for the Recycle Bin, why does Windows allow users to add them in the first place?`   @Karan, why wouldn't it be allowed? It was not only allowed, but enabled by default in XP and it worked just fine. This is simply a defect, a bug in Windows 7 (maybe the reason they hid the column by default). Moreover, there is no reason for it to exist, so it is a big oversight. You would think that they would have caught and fixed it in SP1, but nope. Let's hope that SP2 (if they make one) will fix it.
Comment: It also happens in Windows 10, as you can see [here](https://snag.gy/9F5ir0.jpg).
Answer: This is because Windows creates sub groups for the deleted items: "Today", "Last Week", "Earlier this Year" and then sorts upon these groupings as the dates apply.  These groups can be changed by opening the Recycle Bin > right click the open white space > Hover over Group by > and choosing your preferred sorting method.  To allow proper sorting for date modified you can choose the None option.  This should allow you to sort "Date Modified" correctly.  Keep in mind that some of these group sorting methods do not readily show that they are in groups, such as the group named "Original Location".
Comment: Group by None doesn't solve the issue.
Answer: OK, got it.  Choose "Date last saved" from the More dialog in the column chooser. Choose Group by None and the date sort now works. Not perfect but good enough!


Are refactorings expected to change unit tests that cover the functionality that is being refactored?

Question: Imagine that you are using a tool that automatically applies a set of refactorings of your choice. If the refactorings breaks the existing API for whatever reason (e.g. change method name, parameterise method or a refactoring that makes some structural changes) do you expect the tool to also automatically change your unit tests so that they all still pass? Or is this something unreasonable to expect?
Answer: A good quality refactoring tool with a well organised setup should handle for example renaming. When internals of a method are changed, unit tests shouldn't be affected.
If you have to change the callers of a method manually, I'd expect you have to change your unit tests as well.
Answer: No, I would not expect an automatic refactoring to change test code.
One of the key points behind a refactoring is that it should not ever change the expected behavior of a class*, and as such should never cause a failure of a test covering that behavior.
As a matter of fact, the way that you know a refactoring is ok to do is because the tests that passed before the refactoring continue to pass after the refactoring, without changing the tests.
If a refactoring that you expect to be painless results instead in a broken test, then I would use that as an opportunity to re-evaluate the value of the refactoring, or re-evaluate the test itself, which may be too concerned with the private internal workings of a class.
* based on a standard definition of the term

Code refactoring is the process of restructuring existing computer code—changing the factoring—without changing its external behavior.
Comment: Would you then agree that renaming a public member is not a refactoring action?
Comment: @BartvanIngenSchenau I would say renaming a public member is _not_ refactoring, in the sense of the term I provided in my answer nor as part of the common "red/green/refactor" process. But not everybody agrees with that definition, including [some IDE's that consider it a common refactoring](https://docs.microsoft.com/en-us/visualstudio/ide/reference/rename?view=vs-2019).


GUI Programming. Database and Tables syncronization

Question: I've worked on several desktop applications that used tables to group information from a database table. But keeping this information updated has made me hack different solutions like a working thread that updates a table executing a query every X seconds, or simply a button to refresh the view. I have even seen an app that would refresh a table using mouse movement events. So my question is, which is your preferred method. Is there a "perfect" way of achieving this that I sleep over at college?
Thanks for the responses people.
Answer: What are you trying to accomplish?
Is it some sort of real time monitoring application like stock trading, plant monitoring software or do you have grid in some CRUD application that you want automatically update?
If this is a crud application, then first thing I would do is to check requirements:

Is it really necessary for your user to have updated information automatically all the time,
Does your user looks at monitor all the time?
Why? Maybe you can implement some sort of alert system that can be checked less often?

If you really really need approach you described, then you did fine - you can use either timer or some other event(button, mouse move, ...) to refresh data. Of course, constant requerying will become performance problem as number of users raise.
If it is real time monitoring software with lots of data than you should not put database in center of system. You should have central service that your clients connect to over TCP (or some similar protocol). Central service should keep latest state of system (plus maybe some history). Clients can attach to service and service should notify clients when there is new data, so that you avoid constant polling. Database should be used as log that application uses for analysis of past events, but not for real time display.
Edit :
Regarding Andrej's answer: I am not sure if this resolves your problem. Observer pattern is usually implemented with subscribe/notify mechanism, so that data source can notify all observers when data changes.
Problem is that RDBMS's usually do not have mechanism that can notify you about data change. Even if they have, it is not practical because there can be large number of changes in short period of time.  Think of tens or hundreds of updates in second - how often RDBMS should notify clients about change? What if there are hundreds of clients with slow network? When you have more than one user, things become complicated.
Databinding works in process - you cannot bind your grid directly to table in database. You first need to get data to your application into some object that can be bound to GUI (datasets, lists, ...)
Answer: Some programming languages/frameworks have build in support for databinding. Databinding will synchronize the view (table component) and the data (database tables).
Flex, for example, has binding build in, javafx also, for regular java you can use jgoodies bindings, or oracle's adf data controls and data binding.
If your language doesn't have a standard binding solution, it might be useful to have a look at how an existing one is implemented, for example jgoodies bindings (it's opensource).
Btw, most of the bindings frameworks are based on some default design patterns like the observer pattern: The view component needs to subscribe itself to be informed of updates on the data.
Edit:
Good point about database changes. That's a bit harder. Technically it should be possible to use triggers to inform the client. In Oracle for example, a trigger could possible post a data change event message on a message queue using advanced queuing, which interested client could listen for. I haven't seen this in practice though. You usually don't want to put knowledge about gui clients into your database.
Better would be to have a data collection which is regularly updated using polling. This data collection would be bound to a view component using bindings.
Answer: Perfect is specific to your needs, but many web sites simply update the table whenever you've done an update to a cell.  This generates a lot of traffic.  Maybe you could queue the updates by using, e.g., a transaction, and then commit when the user closes the given table, presses save or a timeout expires ?
I think it all depends on your particular application.
Answer: The easiest way would be to have some configurable timer thread that updates the query (provided that the timeouts don't occure every second). You could also show the timestamp of the latest data gathering and provide Refresh button for users who want current data.
Answer: Very helpful Andrej. Databindings seem like the easy way to go when you've got the chance of using them.
Oh yeah, the observer pattern:

software design pattern in which an
  object maintains a list of its
  dependents and notifies them
  automatically of any state changes,
  usually by calling one of their
  methods. It is mainly used to
  implement distributed event handling
  systems.

I find it very handy the way C# declares new events using delegates.
Thanks for your very good answers.
Comment: I am not sure if this resolves your problem. Observer pattern is usually implemented with subscribe/notify mechanism, so that data source can notify all observers when data changes. Problem is that RDBMS's usually do not have mechanism that can notify you about data change, so you are back on start.
Answer: That's cool for a web app. But we're talking about a desktop application that even when idle, should keep updating it's information from a database.
This is more a design question, than a programming one.


Can a hacker determine what version of WordPress and PHP a site is using?

Question: Can a hacker determine what version of WordPress and PHP a site is using?
Assume this info is not available by View Source.
Answer: Most PHP-enabled web servers will display the PHP version in the Server response header.  For example, my development machine currently shows this with all of its requests:
<code>Server: Apache/2.4.38 (Win64) PHP/7.3.2
</code>
There are configuration settings to turn off displaying the PHP version, and it really is quite trivial to lie about anything and everything in HTTP response headers.
Additionally, there are several ways to get the version of Wordpress installed, the easiest way being to to go to /readme.html on the site.
The RSS/ATOM feeds will also often include the Wordpress version number.
Though you said we should assume that the information isn't available by viewing the page's source, it is often available in a meta tag, depending on the theme.
Links to some resources will have cache busting parameters attached to them, with the cache busting string sometimes being the version of Wordpress that is installed.
And, if you have the time and determination, you can fingerprint the common files that are found in most Wordpress distributions. If a file changes in a specific version, you can look for those changes.
A clever developer can cause each of these to lie, of course, and can mutate the static files in a way that makes fingerprinting them a futile endeavor, but most people follow the default behavior of their PHP version and Wordpress software, making it trivial to identify versions.
All of this underscores the importance of keeping your software up to date to prevent known vulnerabilities from being exploited.
As far as whether or not a hacker can identify the version of PHP and Wordpress...  Well, anyone can, so I suppose a hacker can, as well.
Comment: "If a file changes in a specific version, you can look for those changes."  Ahh... that's a good one. Great answer. Thank you.
Answer: There are different tools available on the web you can use freely to identify information about your website like pentest-tools.com
As hackers equipped with more strong tools or scripts, they can identify it easily. But yes you can make your website more secure by just testing your website on these freely available tools and then

modify your header setting
close unnecessary ports
don't allow ssh access
you can patch against the shown vulnerabilities in scans

etc
Comment: closing ports, blocking ssh, and patching will not do a thing to affect whether someone can determine the PHP version used