Can heat pump completely replace natural gas furnace

Question: My current home heating is through a natural gas forced air furnace.
I have tried to get quotes from multiple contractors.. all of them basically keep saying that I need a backup natural gas furnace any way because of the blower assembly in furnaces.
Basically, even if I install a heat pump (ducted) I still need to replace my old furnace with a new one.
Comment: Yes, maybe, no.  Has the old furnace bit the dust and is now a pile of scrape?  Most of today's heat pumps should work down to -20F if sized for the house and can have add on electric heat for colder.  Having a heat source that is non electric can be useful, if just to keep water pipes from freezing.
Comment: There might be a weird local regulation that requires you to have a "furnace", but can only imagine that if the local furnace maker makes the rules.  Research heat pumps for your local cold(record) temperatures.  Most houses only need one heat source to keep warm(if electric stays on).
Comment: what type of heat pump? Air to Air? Air to water? water to water? ie a water loop under the garden to collect ground heat?
Comment: What's the 99% design temperature for your location?
Comment: @SolarMike my current target list of heat pump is air sourced ones
Answer: Depends on how old and cruddy the heat pump design they're offering is.
Technology Connections covers this in their heat pump series.  The old-guard American makers like Trane and Lennox are not happy about the heat pump revolution, and want to stretch a couple more years out of the factories that make That 70's Air Conditioner.
They have heat pump offerings to satisfy the government (sort of like the way Dodge would begrudgingly offer the Dodge Neon but they'd much rather sell a Ram Truck).  But they deliberately make their lines either cruddy or wildly overpriced, so their sales reps can present a "good - better - best" spectrum to customers.  Every contractor I've talked to would really, really rather you get the cheapest 14 SEER non-reversible air conditioner and a gas furnace. In their marketing plan, The real purpose of the "better-best" tiers are to fleece money from the richer folks, and to the rest, convince you to go with the "good" tier.
Meanwhile, makers of Asian style systems like Hitachi or Pioneer sell "best" right out of the chute.  That heat pump series covers the Chicago-ready capability of these units in video 2.
So the information you're hearing is dated, and domestic A/C industry propaganda. It's designed make you lament that since "nobody" makes a cold-weather heat pump, you might as well just go with a gas furnace and That 70's Air Conditioner.
That said... I do think a gas furnace is worthwhile, but I feel strongly it should be an entirely electricity-free, Empire-style gravity (convection) wall or floor furnace.  Why? Blackouts. The worst nightmare with a forced-air furnace is the need to run a generator simply to circulate air so the heat can work. These work just fine.  You set their simple mechanical thermostat below the working range of your regular thermostat, and they kick on when the system fails. They're only in the 70-80% efficient range since they use convection for exhaust air, but you only need them during emergencies.
Answer: "Can heat pump completely replace natural gas furnace" Generally yes but maybe no. If your ambient temperature goes below freezing outside probably no. If the outside never goes below freezing probably yes. I put my system with a backup gas furnace instead of electric heating coils. This has turned out to be a good idea as the cost of electricity has gone up dramatically. I just run it on emergency heat (gas heat) and it saved a lot more on the electric bill then the gas used. Earlier when I installed it the heat pump was the most cost effective.
Comment: No new build in the UK has gas any more. Heat pump all the way, whatever the temperature. They're absolutely fine below freezing. Gas boilers are soon to be outlawed entirely.
Comment: Heat pumps can definitely provide warm air when the outside temperature is below 0 degrees celsius.
Comment: Mine has been able to heat the house quite adequately below freezing. There is some temperature at which the energy efficiency of my gas FHW system becomes higher but I'm not sure what that is. And I do have the latter set a few degrees lower than the heat pump so it automatically kicks in if the heat pump can't keep up.
Comment: Yeah -- modern cold-climate minisplits can provide usable heat down to negative double-digits Fahrenheit, and there is some bleeding-edge equipment that can work down to colder still (ex: Spacepak's Solstice Inverter Extreme is an AWHP that can work down to -22degF)


hide navigation bar in firefox

Question: Title says it all. I'm trying to hide the address and tab bar in firefox such that it only shows up when I press Ctrl+L. Similar to the way it auto hides in full screen mode. I found a whole bunch of discontinued extensions, but no luck with something that still works. Any ideas?
Answer: I found a solution. Go to about:config. Set full-screen-api.ignore-widgets to true. Then you can press f11 to hide all ui elements. You will loose the full screen mode though.
Comment: Oh my godnesses, where did you find that information? Cannot beleave how much time I spent on finding any good infos and ended up writing a userChrome.css and now it turns out, a single config-setting makes about all of the deal for me; Thank you loads of much!
Comment: @Ida I installed auto fullscreen addon with this config. Now everything works perfectly as expected for me.
https://addons.mozilla.org/en-US/firefox/addon/i-auto-fullscreen/
Comment: Still working in 2024.
Comment: The only caveat for me is, that focusing the address-bar, or opening a new tab, will show the top-bar permanently, so you have to hit F11 again. As you don't want to loose fullscreen-mode, maybe running firefox in kiosk-mode. can bring you the wished result? You can run it of the commandline with `firefox --kiosk`
Comment: This needs to be more visible! I was looking for exactly that functionality for ages.
Answer: Another solution without loosing the full screen mode, is the way it is handled in the Mint WebApp.

Create a chrome folder in your firefox profile folder
Place a userChrome.css file within this folder
And add the following content to the file

#nav-bar, #identity-box, #tabbrowser-tabs, #TabsToolbar {
    visibility: collapse !important;
}

You can also only hide the navigation bar or the tabs bar by removing some of the keywords
This way you can make your browser look like an app
Answer: I tried a number of solutions. Nothing worked for my liking. I found this css config does exactly what I want.
This one needs to be added in userChrome.css
https://github.com/MrOtherGuy/firefox-csshacks/blob/master/chrome/autohide_toolbox.css
It autohides address bar, navigation bar and bookmarks bar unit. It shows them when ctrl + l is pressed.
I also hide tabs along this and use only tree style tabs.

hide navigation bar in firefox


Can the Potion of Life be muled to provide a character with a steady stream of +20 to life?

Question: If I have a main character who as completed all 3 difficulty levels and received +60 life from the 3 Golden Bird quests and I have another character who has completed the same quest on normal, can the potion of life the lesser character receives be muled to the main character (for a total of +80 life) or does some game mechanic prevent this?
Answer: This question could also be extended to include other quest items that provide a permanent bonus, such as the Book of Skill. In any case, a single character cannot pick up (or get by trade) a quest item more than once per difficulty, so the answer is that your proposed scheme will not work.
Otherwise, it would be possible to continually create new characters just for these quest items and then buff up a single character for unbounded skill points and HP.
Comment: Ok, an extension to that question: Is there a risk of breaking the game if I use external program to mule the item? I only play single player and use a program to store my items in files instead of creating more characters.
Comment: @TomášZato Dunno. But usually save-game editors and other similar programs allow you to just directly modify your HP anyway.... In any case, you might get a better answer if you ask this as a new, separate, question.


Testing hooks callback

Question: I'm developing a plugin using TDD and one thing that i completely fail to test are... hooks.
I mean OK, i can test hook callback, but how could I test if a hook actually trigger (both custom hooks and WordPress default hooks)? I assume that some mocking will help, but I simply can't figure out what I'm missing.
I installed the test suite with WP-CLI. According to this answer, init hook should trigger, yet... it doesn't; also, the code works inside WordPress.
From my understanding, the bootstrap is loaded last, so it kind of make sense to not trigger init, so the question that remain is: how the heck i should test if hooks are triggered?
Thanks!
The bootstrap file looks like this:
$_tests_dir = getenv('WP_TESTS_DIR');
if ( !$_tests_dir ) $_tests_dir = '/tmp/wordpress-tests-lib';

require_once $_tests_dir . '/includes/functions.php';

function _manually_load_plugin() {
  require dirname( __FILE__ ) . '/../includes/RegisterCustomPostType.php';
}
tests_add_filter( 'muplugins_loaded', '_manually_load_plugin' );

require $_tests_dir . '/includes/bootstrap.php';

tested file looks like this:
class RegisterCustomPostType {
  function __construct()
  {
    add_action( 'init', array( $this, 'register_post_type' ) );
  }

  public function register_post_type()
  {
    register_post_type( 'foo' );
  }
}

And the test itself:
class CustomPostTypes extends WP_UnitTestCase {
  function test_custom_post_type_creation()
  {
    $this->assertTrue( post_type_exists( 'foo' ) );
  }
}

Thanks!
Comment: If you're running `phpunit`, can you see failed or passed tests? Did you install `bin/install-wp-tests.sh`?
Comment: I think that part of the problem is that maybe `RegisterCustomPostType::__construct()` is never  called when the plugin is loaded for the tests. It's also possible you are being affected by [bug #29827](https://core.trac.wordpress.org/ticket/29827#comment:7); maybe try updating your version of WP's unit test suite.
Comment: @Sven: yes, tests are failing; i installed `bin/install-wp-tests.sh` (since i used wp-cli)

@J.D.: RegisterCustomPostType::__construct _is_ called (just added a `die()` statement and phpunit stops there)
Comment: I am not too sure on unit testing side (not my forte), but from literal point of view you can use [`did_action()`](http://queryposts.com/function/did_action/) to check if actions had fired.
Comment: @Rarst: thanks for the suggestion, but it still doesn't work. For some reason, i think that the timing is wrong (tests are ran before `init` hook).
Answer: Test in isolation
When developing a plugin, the best way to test it is without loading the WordPress environment.
If you write code that can be easily tested without WordPress, your code becomes better.
Every component that is unit tested, should be tested in isolation: when you test a class, you only have to test that specific class, assuming all other code is working perfectly.

This is the reason why unit tests are called "unit".
As an additional benefit, without loading core, your test will run much faster.
Avoid hooks in constructor
A tip I can give you is to avoid putting hooks in constructors. That's one of the things that will make your code testable in isolation.
Let's see test code in OP:
class CustomPostTypes extends WP_UnitTestCase {
  function test_custom_post_type_creation() {
    $this->assertTrue( post_type_exists( 'foo' ) );
  }
}

And let's assume this test fails. Who is the culprit?

the hook was not added at all or not properly?
the method that register the post type was not called at all or with wrong arguments?
there is a bug in WordPress?

How it can be improved?
Let's assume your class code is:
class RegisterCustomPostType {

  function init() {
    add_action( 'init', array( $this, 'register_post_type' ) );
  }

  public function register_post_type() {
    register_post_type( 'foo' );
  }
}

(Note: I will refer to this version of the class for the rest of the answer)
The way I wrote this class allows you to create instances of the class without calling add_action.
In the class above there are 2 things to be tested:

the method init actually calls add_action passing to it proper arguments
the method register_post_type actually calls register_post_type function

I didn't say that you have to check if post type exists: if you add the proper action and if you call register_post_type, the custom post type must exist: if it doesn't exists it's a WordPress problem.
Remember: when you test your plugin you have to test your code, not WordPress code. In your tests you have to assume that WordPress (just like any other external library you use) works well. That's the meaning of unit test.
But... in practice?
If WordPress is not loaded, if you try to call class methods above, you get a fatal error, so you need to mock the functions.
The "manual" method
Sure you can write your mocking library or "manually" mock every method. It's possible. I'll tell you how to do that, but then I'll show you an easier method.
If WordPress is not loaded while tests are running, it means you can redefine its functions, e.g. add_action or register_post_type.
Let's assume you have a file, loaded from your bootstrap file, where you have:
function add_action() {
  global $counter;
  if ( ! isset($counter['add_action']) ) {
    $counter['add_action'] = array();
  }
  $counter['add_action'][] = func_get_args();
}

function register_post_type() {
  global $counter;
  if ( ! isset($counter['register_post_type']) ) {
    $counter['register_post_type'] = array();
  }
  $counter['register_post_type'][] = func_get_args();
}

I re-wrote the functions to simply add an element to a global array every time they are called.
Now you should create (if you don't have one already) your own base test case class extending PHPUnit_Framework_TestCase: that allows you to easily configure your tests.
It can be something like:
class Custom_TestCase extends \PHPUnit_Framework_TestCase {

    public function setUp() {
        $GLOBALS['counter'] = array();
    }

}

In this way, before every test, the global counter is reset.
And now your test code (I refer to the rewritten class I posted above):
class CustomPostTypes extends Custom_TestCase {

  function test_init() {
     global $counter;
     $r = new RegisterCustomPostType;
     $r->init();
     $this->assertSame(
       $counter['add_action'][0],
       array( 'init', array( $r, 'register_post_type' ) )
     );
  }

  function test_register_post_type() {
     global $counter;
     $r = new RegisterCustomPostType;
     $r->register_post_type();
     $this->assertSame( $counter['register_post_type'][0], array( 'foo' ) );
  }

}

You should note:

I was able to call the two methods separately and WordPress is not loaded at all. This way if one test fails, I know exactly who the culprit is.
As I said, here I test that the classes call WP functions with expected arguments. There is no need to test if CPT really exists. If you are testing the existence of CPT, then you are testing WordPress behavior, not your plugin behavior...

Nice.. but it's a PITA!
Yes, if you have to manually mock all the WordPress functions, it's really a pain.
Some general advice I can give is to use as few WP functions as possible: you don't have to rewrite WordPress, but abstract WP functions you use in custom classes, so that they can be mocked and easily tested.
E.g. regarding example above, you can write a class that registers post types, calling register_post_type on 'init' with given arguments.
With this abstraction you still need to test that class, but in other places of your code that register post types you can make use of that class, mocking it in tests (so assuming it works).
The awesome thing is, if you write a class that abstracts CPT registration, you can create a separate repository for it, and thanks to modern tools like Composer embed it in all the projects where you need it: test once, use everywhere. And if you ever find a bug in it, you can fix it in one place and with a simple composer update all the projects where it is used are fixed too.
For the second time: to write code that is testable in isolation means to write better code.
But sooner or later I need to use WP functions somewhere...
Of course. You never should act in parallel to core, it makes no sense. You can write classes that wraps WP functions, but those classes need to be tested too. The "manual" method described above may be used for very simple tasks, but when a class contains a lot of WP functions it can be a pain.
Luckily, over there there are good people that write good things. 10up, one of the biggest WP agencies, maintains a very great library for people that want to test plugins the right way. It is WP_Mock.
It allows you to mock WP functions an hooks. Assuming you have loaded in your tests (see repo readme) the same test I wrote above becomes:
class CustomPostTypes extends Custom_TestCase {

  function test_init() {
     $r = new RegisterCustomPostType;
     // tests that the action was added with given arguments
     \WP_Mock::expectActionAdded( 'init', array( $r, 'register_post_type' ) );
     $r->init();
  }

  function test_register_post_type() {
     // tests that the function was called with given arguments and run once
     \WP_Mock::wpFunction( 'register_post_type', array(
        'times' => 1,
        'args' => array( 'foo' ),
     ) );
     $r = new RegisterCustomPostType;
     $r->register_post_type();
  }

}

Simple, isn't it? This answer is not a tutorial for WP_Mock, so read the repo readme for more info, but the example above should be pretty clear, I think.
Moreover, you don't need to write any mocked  add_action or register_post_type by yourself, or maintain any global variables.
And WP classes?
WP has some classes too, and if WordPress is not loaded when you run tests, you need to mock them.
That's much easier than mocking functions, PHPUnit has an embedded system to mock objects, but here I want to suggest Mockery to you. It's a very powerful library and very easy to use. Moreover, it's a dependency of WP_Mock, so if you have it you have Mockery too.
But what about WP_UnitTestCase?
The WordPress test suite was created to test WordPress core, and if you want to contribute to core it is pivotal, but using it for plugins only makes you test not in isolation.
Put your eyes over WP world: there are a lot of modern PHP frameworks and CMS out there and none of them suggests testing plugin/modules/extensions (or whatever they are called) using framework code.
If you miss factories, a useful feature of the suite, you have to know that there are awesome things over there.
Gotchas and downsides
There is a case when the workflow I suggested here lacks: custom database testing.
In fact, if you use standard WordPress tables and functions to write there (at the lowest level $wpdb methods) you never need to actually write data or test if data is actually in database, just be sure that proper methods are called with proper arguments.
However, you can write plugins with custom tables and functions that build queries to write there, and test if those queries work it's your responsibility.
In those cases WordPress test suite can helps you a lot, and loading WordPress may be needed in some cases to run functions like dbDelta.
(There is no need to say to use a different db for tests, isn't it?)
Luckily PHPUnit allows you to organize your tests in "suites" that can be run separately, so you can write a suite for custom database tests where you load WordPress environment (or part of it) leaving all the rest of your tests WordPress-free.
Only be sure to write classes that abstract as many database operations as possible, in a way that all the other plugin classes make use of them, so that using mocks you can properly test the majority of classes without dealing with database.
For third time, writing code easily testable in isolation means writing better code.
Comment: Holy crap, a lot of useful info! Thank you! Somehow I managed to miss the whole point of unit testing (until now, I was practicing PHP testing only inside of Code Dojo). I also found about wp_mock earlier today, but for some reason I manage to ignore it.

What pissed me off is that any test, no matter how small it was, it used to take at least two seconds to run (load WP env first, execute the test second).

Thank you again for opening my eyes!
Comment: Also worth pointing out that the the WP Core unit test framework is an amazing tool for running INTEGRATION tests, which would be automated tests to ensure that it integrates well with WP itself (e.g. there are no accidental function name collisions, etc.).
Comment: Thanks @IonutStaicu I forgot to mentions that not loading WordPress makes your tests **a lot** faster
Comment: Thanks for the "helicopter ride" over the UnitTest forest of WordPress - I'm still laughing at that epic picture ;-)
Comment: @JohnPBloch +1 for good point. Even if using a namespace is enough to avoid any function names collision in WordPress, where everything is global :) But, sure, integrations / functional tests are a thing. I'm playing with Behat + Mink at the moment but I'm still practicing with that.
Comment: Indeed. Because on Dojo I had running time of less than 1-200ms (few tests, 20-30 max); wp test suite? enough to pull me out of flow.
Comment: @gmazzap This answer seems to cover a lot of the issues which were giving me a lot of headaches. However, either I'm missing one point, or it doesn't cover the case where I need to test a class which creates an instance of another class (e.g. WP_Post): I thought factory-muffin could cover this, but this works when the instance of the class is passed as a dependency. In this case, the instance of the class is created inside the class I'm testing.
Comment: @andrea-sciamanna the problem is that good "testable" code should be written avoiding creating instances of objects inside other objects (unless they are PHP object like `ArrayObject` or value objects), for that very reason. If that happen, and you can't / won't change the code, the only way to "unit" test those objects is to create "stubs". E.g. you can write a custom `WP_Post` class, that is loaded only in tests. That's not easy to maintain, and that's why coding with tests in mind, or even write tests _before_ the code (TDD) is a good thing :)
Comment: I think this may deserve a separate question, especially because there is no room enough to keeps writing here :) Question: http://wordpress.stackexchange.com/questions/233132/unit-tests-dealing-with-dependencies
Comment: What a fantastic answer!

Testing hooks callback


Should you compute the greeks on realized or implied volatility?

Question: I am reading Trading Volatility by Collin Bennett and he says that you should compute the Greeks using realized volatility rather than implied volatility? Is this actually true? As far as I know the greeks are usually computed using implied volatility
Comment: Could you elaborate more on the passage you're reading from? Greeks are options sensitivies wrt different factors, e.g. delta is how sensitive the price is wrt changes in underlying, Vega is how sensitive premium is wrt changes in implied vol
Answer: He writes on P. 97 that

Investors should use expected vol, not implied vol, to calculate
Greeks.

Expected VOL is NOT realized vol.
He also writes on P.96 that

(using implied volatility as an estimate of future volatility is
standard market practice for calculating Greeks)

He mention this in an example demonstrating where discrete delta hedging is causing losses (Lehman collapse) and as he puts it

because using implied volatility as an incorrect future volatility
assumption to calculate the delta led to a significant loss

The problem is that in reality, you seldom (if ever) will be able to compute expected vol. It may serve as an example illustrating shortcomings, but computing a delta hedge, as he does, after knowing the volatility (ex-post) is simply infeasible in real world settings. Or putting his example differently, if you would have known Lehman would collapse (or that Bitcoin reached close to 70K), I doubt you would still write in this forum.
Answer: you find implied volatility using root finding methods, and with this value you get the greeks, obviously it's a model, not the truth, but something usefull to control risks
you should know that underling stochastic process should be considered when creating the model (most time it doesn't reflect, like black and sholes and geometric brownian motion for stocks), that's why sometimes traders use others methods to calculate greeks, they use others models that 'make sense' to trade or, in this case, others parameters.
you will see different parameters to trade intraday or 'interdays', it's a trader model, not related to risk controls


contextsensitive RoutedUICommand.CanExecute, Execute

Question: I have a single RoutedUICommand that can be accessed through various places in the UI. Such as global Keyboardshortcut, Menu, ContextMenu or Button. The code that is to be executed in  the RoutedUICommand.CanExecute and  RoutedUICommand.Execute methods depends on what UI element was used. How can I achieve this differentiation. I was thinking that I could use the (Can)ExecutedRoutedEventArgs.Source or OrigianlSource but the source is always the same. It is the main Root window. How is this usually achieved? What could I possibly be doing wrong?
Answer: If you need different code to run depending on the UI that invoked the command you are probably doing something wrong.
If you have something like a just doing something from a keystroke or opening a dialog asking for more information from a menu you should break this apart into two commands (like MS Office "Print" and "Quick Print" commands).
If you truly have to do different things from each UI element you are not getting any advantage from using commands and should think about using old fashioned event handlers, at least then the element specific code is tied to the element and not stored in a central all encompassing "Execute" code .
And if you choose to ignore my advice above, take a look at the CommandParameter property, you can set a different value fro the parameter for each UI element, at least with it you can keep an illusion of the UI/Logic separation commands are designed to provide.
Answer: Normally you could have different CommandBinding implementations for different 'Targets' - having different behavior for each 'Source' is unusual.
Could you give an example of what you are trying to do?
Comment: Exactly to have diffrent source I hat to wire up command bindings for esch source. That way I could differentiate who is the source by examining the sender.


Drupal 7 Ajax Forms

Question: I am using Drupal 7, and I am building a web site, that has a contact form in the footer which should appear in every page. The requirements was to make this form work via Ajax, all examples I found on Internet was form that related to node.
So when I tried to apply the same concept, I faced the problem of rendering the form, so I have passed it to the template as a parameter like this:
$vars['node']->contactForm = drupal_get_form('nilecode_form');

When I render the form by using drupal_render_children($node->contactForm), all the fields were rendered but with no wrapping form tag.
So after frustration, and not very useful IRC chats, I am thinking to do it by using normal Ajax request.
Before doing so is there any solution, before doing it the bad way?
Thanks.
Answer: Take a look at my ajax form examples, the best way of achieving this is using a theme function for the form:
http://monchacos.com/monchacos/code/creating-forms-template-file-ajax-included
Theres an attachment in the post, so you can get the full code example.

Drupal 7 Ajax Forms


No bootable device

Question: I know this isn't exactly a Linux problem but I'm getting no help anywhere else. I'm trying to reinstall ubuntu onto my laptop but I keep getting the error "No bootable device -- insert boot disk and press any key" but I have it on my USB ready to install but for some ready it won't recognize it at all. I've tried everything I could find on the internet and none of them are useful, please help!
Comment: It is not clear how you are trying to reinstall Ubuntu and when you get the error "No bootable devece..." Do you get it when you try to  boot from the internal hard drive? Do you get it when you try to boot from the USB? **Please edit your answer above with the new information.**
Comment: Yes I've got it first in the boot options menu, I've tested it in my computer it comes up saying it's ready to install but when i go onto my laptop to boot from USB to install it on my laptop it will come up with that error saying that there is not bootable device, I've tried if with a DVD/CD as well, comes up with the same error. I know for a fact that it's on the USB ready to install and for some reason it's not recognising the USB at all, I'm not 100% sure why this is happening and not sure how to fix it.
Comment: Are you booting both computers in UEFI or both in BIOS mode? Otherwise it may be flash drive not configured for correct boot mode. You have to select and most systems are now UEFI.
Answer: Assuming your computer supports boot from USB, you may have to enable it to do so in your BIOS settings. Access the BIOS settings by pressing the appropriate key at startup (varies from machine to machine, typically one of the function keys. google your machine to find out what it is), then go to the boot options and ensure boot from USB is enabled.
If this fails, it's possible the USB you created is no good and you should try putting a fresh image on it. unetbootin is popular and has a reputation for not causing as many errors as other similar utilities.
Answer: Sounds like you're using a UEFI system. When you create usb installers they are typically for mbr bios only, it depends what program you use to make it. Install using a DVD and it should work fine.
Answer: I had the same problem installing ubuntu! Here is what to do.

Boot to BIOS
On security, make USB on the top.
Make sure that the USB has a good copy of ubuntu
Click 'try ubuntu'
install efibootmgr
Change so boot order so ubuntu is at the top
Unplug USB
Reboot
It worked with my computer. I'm sorry if it doesn't work with yours.
Answer: What helps me is preparing usb with software "unetbootin", you can install it from command:
<code>wget unetbootin.sourceforge.net/unetbootin-linux-latest
chmod +x ./unetbootin-linux-*
sudo apt-get install p7zip-full
sudo ./unetbootin-linux-*
</code>
It is ofter a file sistem problem. Try with fat, it may help.
NTFS is a file sistem based on windows.

No bootable device


How old should the "recent" published works of a potential supervisor be exactly?

Question: What if "recently" published works of a potential supervisor are 9 or 10 years old but relevant to the research work one wants to pursue? Should one only go by the recent publications or the "Current Research Interests" stated on the potential supervisor's university profile page (also a bit old!) when emailing them?
Comment: Look at their recent papers on arxiv or Google Scholar. If they haven't published in many years, they are likely not a good option.
Comment: It's not so simple; often being a second author simply means their student was first author. Or sometimes it is alphabetical. I would error on the side of counting it as a publication
Comment: "Recently" according to what? If their department web page that may just indicate that the last administrative push to update all pages (with some spiffy new formatting someone chose) was 10 years ago.
Comment: @David Raveh do publications as second author count too?
Comment: @DavidRaveh yes in my discipline that is Engineering I think most of the times the first  author is the student!
Answer: 9-10 years is quite a long time to be inactive on a field. Certainly it suggests that they are no longer interested in that topic. However, it's not conclusive. One possibility is that the topic is not very "hot", so they've set it aside, but they're open to continuing work on it. Another possibility is that they got a grant to work on a different topic, so they've not worked on this one for a while, even though they would like to.
Especially if the topic is adjacent (i.e., within the same general field) as their more recent works, you can certainly ask. Saying you noticed that they have not published in that topic for a while, and asking if they're open to continuing work on it, would indicate you've done due diligence before contacting them, and therefore reflect well on you.


C++ pthreads, main function stops running early

Question: I'm making my first multithreaded program and having some issues.  I based the code on an example I found online, which worked fine until I made my changes.  The main function below makes several threads which run another function. That function runs instances of another c++ program that I wrote which works fine.  The issue is that after the program creates all the threads, it stops running.  The other threads continue to run and work fine, but the main thread stops, not even printing out a cout statement I gave it.  For example, if I run it the output is:
Enter the number of threads:
// I enter '3'
main() : creating thread, 0
this line prints every time
main() : creating thread, 1
this line prints every time
main() : creating thread, 2
this line prints every time

this is followed by all the output from my other program, which is running 3 times.  But the main function never prints out "This line is never printed out".  I'm sure there is some fundamental misunderstanding I have of how threads work.
#include <iostream>
#include <stdlib.h>
#include <cstdlib>
#include <pthread.h>
#include <stdio.h>
#include <string>
#include <sstream>
#include <vector>
#include <fstream>
#include <unistd.h>

using namespace std;

struct thread_data{
   int  thread_id;
};

void *PrintHello(void *threadarg)
{
   struct thread_data *my_data;

   my_data = (struct thread_data *) threadarg;

   stringstream convert;
   convert << "./a.out " << my_data->thread_id << " " << (my_data->thread_id+1) << " " << my_data->thread_id;
   string sout = convert.str();
   system(sout.c_str());

   pthread_exit(NULL);
}

int main ()
{
   int NUM_THREADS;

   cout << "Enter the number of threads:\n";
   cin >> NUM_THREADS;

   pthread_t threads[NUM_THREADS];
   struct thread_data td[NUM_THREADS];
   int i;

   for( i=0; i < NUM_THREADS; i++ ){
      cout <<"main() : creating thread, " << i << endl;
      td[i].thread_id = i;
      pthread_create(&threads[i], NULL, PrintHello, (void *)&td[i]);
      cout << endl << "this line prints every time" << endl;
   }

   cout << endl << "This line is never printed out";

   pthread_exit(NULL);
}

Comment: You're not flushing your buffers.
Comment: So I need to use cout << flush in my other threads?
Comment: Thanks! It works and I understand now what was happening.
Answer: It's because you're not using pthread_join(threads[i],NULL).  pthread_join() prevents the main from ending before the threads finish executing


jQuery lib include conflict with rails3 and twitter-bootstrap-rails

Question: I've an app with rails3 using jQuery by default and twitter-bootstrap-rails and got a problem.
jQuery seems to be included twice, causing links using :remote => true to be called twice too..
If i put the return of javscript_include_tag :application in my app directly and do some tests i got the following:

jquery.js with no application.js => remote links works perfectly
jquery.js with application.js => remote links called twice
no jquery.js but application.js at the top => remote links called twice too

My application.js just contain:
//= require jquery
//= require jquery_ujs
//= require twitter/bootstrap
//= require_tree .

Any ideas how to resolve this problem cleanly ?
Answer: Just found this post that solves the issue. Its a bug with the asset pipeline and was filed here.


Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding

Question:
this is my webpage in which i am collecting daily reports... which is working fine. when i choose monthly reports which contain a lot of data calculation than it gives the following exception (Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding.)
in
DataSet datSet = DatabaseFactory.CreateDatabase().ExecuteDataSet("TollCollectionsReport",
            Web.ShiftID,
            Web.ShiftStatus,
            rdoShiftTimeBase.SelectedValue,
            startDate,
            endDate,
            BoothCodes,
            OperatorCodes,
            CategoryCodes,
            PaymentModesCodes,
            TimeIntervalCodes,
            ddlReportCritera.SelectedItem.Text,
            rdbtnBoothIsSimple.SelectedValue,
            rdbtnOperaotrIsSimple.SelectedValue,
            rdoShiftTypes.SelectedValue,
            rdoCategories.SelectedValue,
            rdoPaymentModes.SelectedValue,
            rdoTimeSequence.SelectedValue,
            groupingSequence,
            Session["TimeInterval"].ToString(),
            isRangeSelected);

this function... this function randomly generates query... here is the line after this function...
string query = datSet.Tables[0].Rows[0][0].ToString();

i increased timeout of db in config file and in program ... but still am getting the same exception at DataSet datSet = DatabaseFactory.CreateDatabase().ExecuteDataSet ..this funtion call works for 30 to 40 seconds after that it crashes and throws an exception... kindly help  me out ... thanks
Answer: This may help you.
Add this to web.config file
<system.web>
<httpRuntime executionTimeout="180" />

Or
Configure Idle Time-out Settings for an Application Pool (IIS 7)


Is there a way to check user permissions in javascript?

Question: Is there a way to check user permissions in javascript? I have a segment of code that I only want visible if the user has the proper permissions, and I think it would be easiest way to check the permissions, and then just set the segment to display: none; if the user doesn't have the right permissions.
Comment: If all you need is to hide block from users with certain roles, you can directly set permission to that block. Go to that specific block management page in _/admin/structure/block_, find "Roles" in "Visibility settings" and select which roles should see that block. Block will not be rendered at all for other users. (This is ok for single user permission, select role that has it, but if you need to hide it by multiple permissions shared by different roles you cant set this that way of couse)
Answer: It is not secure to only rely on Javacript. It is better to separate that .js function which needs permission to execute from other codes then put in a file and load that .js file from your hook_preprocess_page if the user has permission (or some role). I implement this idea with user roles, you may use another strategy for checking the permission.
function THEME_preprocess_page(&$var){
      global $user;
      if(in_array("SOME_ROLE_NAME_WITH_ACCESS_TO_JS_FUNCTION",$user->roles))
            drupal_add_js(drupal_get_path('theme', 'mytheme') .'/js/Your_js.js');

}

in your theme directory, I supposed you placed your .js files in /js directory. So you should create Your_js.js file in that directory and put that function inside it. If the user has appropriate role, that file with that function in it will be loaded and you can use it later, otherwise it won't.


How to add styles to a submenu page?

Question: I'm relatively new to WordPress and, I am creating this plugin, where I need a submenu page. I have successfully created the main page and have added CSS to it without any problems. However, I came to need a submenu page recently. I used add_submenu_page to create that page, and it worked just fine. As far as I know, I can add as much content to that page as I want, and it won't be a problem, too. The trouble started when I tried to add styles to that page. I thought I just had to add classes and IDs to the elements and, then, write their respective style codes in the CSS file used on the main menu page. I enqueue the stylesheet using the following code:
function load_entry_scripts($hook)
{
    if ($hook != 'toplevel_page_edit-dict-entry') {
        return;
    }

    wp_enqueue_style('my-plugin', plugins_url('styles/styles.css', __FILE__));
    wp_enqueue_script('my-plugin', plugins_url('js/entry-edit-plugin.js', __FILE__), array(), '1.0.0', true);
}
add_action('admin_enqueue_scripts', 'load_entry_scripts');

And, again, this code works for the main page. Finally, what do I need to do, so I can add styles to the submenu page?
PS.: I've also tried some alternatives, like creating a stylesheet specifically for the submenu page, but it hasn't worked either.
Answer: One option is to examine the $hook and see, if it matches the parent or any of the child menu page slugs.
function load_entry_scripts($hook)
{
    $hook_parts = explode('_page_', $hook);
    $menu_slug = array_pop($hook_parts);

    if ( ! in_array( $menu_slug, array('my-parent-page-slug', 'my-child-page-slug') ) ) {
        return;
    }

  // add styles && scripts
}

How to add styles to a submenu page?


Is there research on which diphthongs are perceived by English speakers as single sounds?

Question: In English, diphthongs are single phonemes, and monolingual English speakers hear them as a single vowel. However, this does not mean that English speakers will hear all diphthongs in other languages as single sounds. Is there any research on which diphthongs English speakers perceive as single sounds and which ones they don't?
Answer: The only definition of "single sound" that exists in phonology is "single segment", which is different from the phonetic view (whereby "church" has a bisegmental articulation at the beginning t plus ʃ). There is a tie diacritic that can be used in IPA to indicate "functions as one segment". Notorious examples of ambiguous segments are aspirates (th), NC sequences a.k.a prenasalized segments (mb, mp, mf), consonant+glide sequences a.k.a. palatalized and rounded segments, and diphthongs. Fujimura's model of syllables includes pre-spirantized stops (sp, th...), and similar notions turn certain seeming consonant clusters of Georgian into single complex segments.
There is no general test of subject behavior that establishes "single segment behavior" from "cluster behavior". Asking "how many vowels are there in X" or "how many consonants are there in X" is a really poor way of determining the internal representation of sounds in a language. Typically, speakers resort to counting orthographic units, so that θ in English has a count of 2 and expect that speakers of Greek assign a count to 1 to the cluster ks. The first step would therefore be establishing a reliable basis for comparison. This has yet to be done.
Answer: If it's a matter of perception, it would be fairest to say, I think, that a diphthong means precisely a cluster of vowels that speakers perceive and treat as a unit. For example, in elementary school you learn about the "short i" /ɪ/ and the "long i" /aj/ and you treat them both as "first-class citizens" in your inventory of sounds.
It doesn't take too much time to demonstrate to a native speaker that some of these vowels actually have multiple components. I've frequently had high school students just slow down their articulation until they feel that they're saying /a/ and then /j/. The same is true of /aʊ/ and /ɔj/.
However, it's harder to get people to differentiate the sounds in /ej, ij, oʊ, uw/. They don't always perceive the boundary between the phones and if you demonstrate then they tend to feel that you're just saying /e, i, o, u/ even if you stop before the off-glide. I think this is because we don't have separate sounds for /e, i, o, u/, whereas many dialects have /a/ and /ɔ/ or at least align these with other discrete phonemes like /ɑ/.
So my intuitive, anecdotal response to your question would be that the diphthongs that are stubbornly perceived as a unit are those whose components don't align with their own phonemes.
Comment: Yes, this is all true for English.


There are infinitely many powers of $2$ that are at least $10^6$ away from any square and cube

Question: A natural number $x$ is far from squares and cubes if the inequalities $\left|x-k^{2}\right| > 10^{6}$ and $\left|x-k^{3}\right| > 10^{6}$ hold for every natural number $k$. Prove that there exist infinitely many natural numbers $n$ such that $2^{n}$ is far from squares and cubes.
Comment: Honestly, I don't even know where to start, Mr. Clement.
Answer: This is not a full proof, but I would start like this..
A power of 2 that is neither square nor cube must be $2^{6n+1}$ or $2^{6n-1}$, let's take $x=2^{6n+1}$. Now let as find the integers nearest to the square root, which are $\lfloor2^{3n+\frac{1}{2}}\rfloor$ and $\lfloor2^{3n+\frac{1}{2}}\rfloor+1$. First you have to prove that for infinitely many $n$, the squares of these numbers are far enough from $x$. In other words, for infinitely many $n$, $2^{3n}\sqrt{2}$ are far enough from integers -- it is enough to prove that they are contained in $\Bbb Z+[\frac{1}{8}, \frac{7}{8}]$, for example. Here you need to use the irrationality of $\sqrt{2}$: in particular the binary representation of $\sqrt{2}$ contains infinitely many times the string "10". So, for infinitely many $n$, $2^{3n}\sqrt{2}$ looks, in binary, like $\mathrm{something}.*10\ldots$ where $*$ stands for a (possibly empty) string of at most 2 digits.
Further, you need to prove that for infinitely many $n$, both $2^{3n}\sqrt{2}$ and $2^{2n} \sqrt[3]{2}$ are far enough from integers $\ldots$
Comment: I would write that this is a sketch of the full proof at the start, since this is the way to solve the question.


pdf reader with Send By Mail option

Question: Is there any PDF reader which has a 'send by mail' menu option that can attach the PDF to an email (preferably Thunderbird)?
Comment: @DavidFoerster Whatever it sounds like, this question is not an XY problem because it's easy to 'send by mail' a pdf file in Ubuntu without installing anything.
Comment: This sounds like an [XY Problem](//meta.stackexchange.com/q/66377/271411). What are you actually trying to achieve? Why don't you simply use the file manager context menu or the attachment actions of the mail user agent altogether? Why should a PDF reader know anything about e-mails?
Comment: I did not get your comment! If one is reading a Pdf document and want it to send to someone, it will be way easier to just have a menu item "send by email" which directly opens Thunderbird write window with Pdf already attached. Such option is available in libreoffice under File->Send->Document as email.
Answer: I use Evince on my Ubuntu 16.04 which gives me the ability to attach a PDF document to an email using Thunderbird.
You can download Evince from the Ubuntu Software Centre, if you don't have installed it already. It was already installed on my Ubuntu 16.04 LTS.
Official page of Evince
If you installed Evince, open the document you want to send. Then go to File menu and then choose Send To. If Thunderbird is already installed, a Create a new message window will appear with the PDF document attached to it.
Check this screenshot:

Write your message and click on Send to send your message with that file as attachment.
Comment: Great! This works. However `nautilus-sendto` is also required for `Evince` `Send To`. This can be installed as `sudo apt-get install nautilus-sendto` or see https://askubuntu.com/questions/566053/how-to-make-evince-send-to-work-with-thunderbird-in-xubuntu-lts
Comment: I didn't know that! I use Ubuntu with Unity as Desktop Environment. That is installed by default, I guess.
Do you use Xubuntu?
Comment: With Firefox (94) you may open a PDF with Thunderbird using the save button and choosing "open with" and than with "other program", scroll down and take Thunderbird. And the good thing is, that if you have done it once, it is rememberd as your choice.

pdf reader with Send By Mail option


Do I make the sneak check on the patrol marker or confront monsters first?

Question: When I end my turn in the street where there are monsters and a patrol marker, do I encounter the monsters first or perform the sneak check to avoid being arrested. Do I get to choose?
Answer: The FAQ covers this.  You make your evade check first, and then monsters.

Q: At the end of your Movement Phase, do you fight monsters
  before making the Evade check against Martial Law
  to see if you are arrested or after?
A: After the Evade check against Martial Law.
Comment: I don't know anything about "Martial Law" (appears to be an Innsmouth Horror feature) or how the feature differs in magnitude / scope / rules to the patrol markers in Curse of the Dark Pharaoh. This seems the best answer given no other sources unless the Martial Law feature has a much different feel.


OAS And spouse's allowance

Question: I just turned 64 three months ago and am currently receiving spouse's allowance. Can I submit the OAS application now or should I wait?
Answer: You should have received a letter from Service Canada by now. If you didn't then read here:
http://www.esdc.gc.ca/en/cpp/oas/apply.page

The month after you turned 64 years old, you received from Service Canada
A letter informing you that you could be eligible for the Old Age
  Security (OAS) pension

you will need to apply for your OAS pension as soon as possible by completing and mailing the application form enclosed in your letter

A letter informing you that you were selected for automatic enrolment

you will not have to apply for your OAS pension provided that the information in your letter is accurate.

If you wish to defer your OAS pension you may do so by:

Accessing your My Service Canada account and following the directions, or
Signing and returning the automatic enrolment letter by mail.

The month after you turned 64 years old, you did not receive a letter from Service Canada
If you wish to start receiving your Old Age Security (OAS) pension at
  age 65, you should apply for your OAS pension right away.

If you have already reached 65, and you wish to start your OAS
  pension immediately, you should apply as soon as possible so you don't
  lose any payments (we may be able to give you a retroactive payment
  for up to a maximum of 11 months from the date we receive your
  application).
Comment: Thanks. So far I have not received any letter from Service Canada.

OAS And spouse's allowance


Why can't I download apps on my iPhone 6s

Question: I just got an iPhone 6s and I'm having trouble downloading apps. It keeps asking me to set up three security questions and when I do it says that it's downloading but then it asks me to set up security questions again, and if I say cancel then it stops downloading the app. I just keep going in circles which is quiet annoying. What can I do about this?
Comment: Also https://apple.stackexchange.com/questions/244699/cant-download-any-app-from-appstore
Answer: Sounds like this may be an issue with your AppleID. You do have an AppleID already? If not create one, you don't have to use an iCloud.com email address you can use whatever you currently use as your AppleID.
I would log into iCloud.com and check your account settings, security and most importantly, the security questions. Maybe even change your password. Once that is done, sign out of iCloud on your iPhone and sign back in with your new credentials.
Once you have signed in again, try downloading an app. It will likely ask you for a password but should not prompt for anything else.
Answer: I am having the same problem, but I believe my iCloud isn't letting me download free apps such as Spotify and other apps, due to the fact that a charge hasn't went through to my card. Im not exactly understanding why I am not able to download an app that is free although.. I could understand if it was a purchaseable app, but I am very much irritated and confused at the moment.
Comment: Interesting. Basically, you're saying that if you don't have a recent charge, it might be hanging up and you'd need to either get a paid transaction and/or contact Apple support and there is a specific reason why this isn't working?


Is there a way to password protect an individual table in a MySQL database?

Question: I have one database called medtrack and I want to protect each users table, so say user1 has a table, table1, I want it to have a password, say password 1, and user2 has table, with password 2. Is there a way to do this, or should I just create individual databases?
Sorry if this question is stupid, I'm fairly new at this.
Answer: If you have separate table for separate user then you need to use grant command to provide access to "user1" for "table1" and same with "user2" depending upon your application.
And you can also use views if you want to show only subset of table to the user.
Answer: No there isn't any way, however you can encrypt the data in the table before saving.
Passwords are generally saved in encrypted form.
MD5 and SHA (1..512) are frequently used for one way encryption of passwords.
Answer: You can't set password at table level. Password are set at Server level.
However you can protect these tables by giving only READ/Write permission to a specific MySQL user by:
<code>Grant Select, Insert, Update on medtrack.* to 'mysql_user'@'mysql_host';
</code>


Why are batteries measured in ampere-hours but electricity usage measured in kilowatt-hours?

Question: I was reading about energy usage in batteries and don't quite understand why it is measured in different units than home electrical usage.  An ampere-hour does not include a measure of volts.  But my understanding though is that a battery has a constant voltage (1.5V, 9V, ...) just as much as home electrical usage (120V, 220V, ...).  So I don't see why they have different units by which they are measured.
Comment: fyi.  It looks like your question touches the subject of battery gauging.  Here's a recent overview article: http://batteryuniversity.com/learn/article/battery_fuel_gauge_factual_or_fallacy
Answer: \$kW \cdot h\$ are a measure of energy, for which grid customers are billed and usually shows up on your invoice in easily understood numbers (0-1000, not 0-1 or very large numbers; ranges which, unfortunately, confuse many people).
\$A \cdot h\$ are a measure of electrical charge. A battery (or capacitor) can store more or less a certain amount of charge regardless of its operating conditions, whereas its output energy can change. If the voltage curve for a battery in certain operating conditions are known (circuit, temperature, lifetime), then its output energy is also known, but not otherwise, though you can come up with some pretty good estimates.
To convert from \$A \cdot h\$ to \$kW \cdot h\$ for a constant voltage source, multiply by that voltage; for a changing voltage and/or current source, integrate over time: $$ \frac{1 kW\cdot h}{1000 W\cdot h}\int_{t_1}^{t_2} \! I(t)E(t)dt ~;~~E~[V],~I~[A],~{t_{1,2}}~[h]$$
Comment: _for a constant voltage source, multiply by that voltage_ : so why do most constant voltage devices still show mAh and not Wh? (e.g. a USB power bank, which always delivers 5V)
Comment: A battery's output energy and charge does change, @Josh, most notably with respect to changes in temperature and current draw, but the number of coulombs it took to deliver that energy is more constant. I wouldn't mind if you'd explain in [chat](http://chat.stackexchange.com/rooms/15) how one could be billed for power alone.
Comment: @golimar, I would guess that this number is in mAh so that consumers can directly compare them to the amount of charge their mobile devices require, and guess how many times it can be charged. Eg. A 20,000 mAh power bank might be able to charge my 2,000 mAh phone battery 10 times. (Spoiler: it won't.)
Comment: Grid customers are billed for both power and energy.  A battery's "output energy" can't change (neither created nor destroyed). I think you mean "output power". The energy storage capacity of a secondary (i.e. rechargeable) battery can change over the lifetime of the battery due to changes in its structure (because work has been done on it).
Comment: My bad, your usage is correct.  I thought it was important to draw the distinction between power and energy here, but they are directly related.  Energy output will vary with power output because energy is the integral of power.  The whole point of a battery is to store energy and of course its output will diminish as you use it.  Power isn't usually billed alone to residential customers (though part of what we pay does go to the infrastructure), but it is billed to large customers as "Demand Charges".
Answer: A note about battery voltage:  Rated battery voltage is "nominal".  A fully charged 12 volt lead acid battery actually starts out around ~14.4 volts and drops off as you draw energy from it. The actual battery voltage depends on a number of factors not limited to state of charge, battery age, load profile, chemistry, etc,...  For instance, A lithium ion battery of 3.7V (nominal) may start out at 4.15 volts and diminish to ~2.7 volts before requiring recharge.
Watt-Hours (or kW-H) is an indicator of the energy storage capacity of the battery, whereas amp-hours would refer to how many amps minimum you can draw from a battery at full charge for an hour before it was no longer capable of providing that level of flow (perhaps at or above the rated voltage?).  They are closely related, but not equivalent.  Some batteries are designed more for high current draw devices, whereas others are designed to last a long time for lower current draw devices.
Appended:
Now that I look at my cell phone battery, I notice that it has all three ratings printed on it.  It is a Lithium-Ion battery whose nominal voltage rating is 3.7V.  It's energy capacity is marked as 4.81 Watt-Hours.  It's electric charge rating is 1300 milliAmp-Hours.  This seems to indicate that Energy = Voltage * Electric Charge (at least in terms of the battery ratings), though I think that this equation is hiding the fact that there is an integration of P=VI going on and that V is more like an average value than a constant, which probably gives a pretty good approximation.
Comment: This is wrong: "amp-hours would refer to how many amps minimum you can draw from a battery at full charge for an hour". This is not true. You can easily get a 2000mAH battery that will never produce 2 amps, but it could probably produce 500mA for 4 hours.
Comment: The voltage of a fully charged battery (that has been left alone for 24H) is pretty close to 13 V rather than 14.4 V. 14.4 V is the voltage the charger uses under a charging phase.
Answer: A  batteries voltage changes over its lifetime.  The current is set by the circuit it is connected to.
As the current is a constant known value and can be predicted, and the voltage cannot, the units are in the value that can be predicted.
Your electricity supply is a constant voltage and can be predicted.
Comment: I feel that this concise answer is much better than the accepted answer; it gets right to the heart of "why?", which is what the asker actually wanted to know.
Comment: It doesn't entirely get to the heart of why, but if the answer is saying "The number of Coulombs of electrical charge (Ampere-seconds or 1/3.6 mAh) that can be stored in and recovered from a battery is roughly constant over its lifetime whereas the number of Joules of energy (J or 1/3,600,000 kWh) that can be stored in and recovered from the same battery varies considerably over its lifetime" then I would agree
Answer: The way a battery works, the total coulombs it can push around falls out more directly than the total energy it can store.  The voltage is not constant.  It varies by state of charge for one, and the relationship between the two can be quite different between battery chemistries.  All this is to say that A-h is more relevant to battery manufacturers than W-h or Joules.
Joules can of course be relevant to circuit design, so this information is available, just not included in the 2 second sound bite called the Amp-hour rating.  Battery datasheets can get quite complex.  As with most things, there are a host of tradeoffs and thorough information is more than a single number.  If you do have to pick just two numbers to quickly characterize a battery, Volts and Amp-hours are as good as any, and are what the industry has converged on.
Comment: The  problem with Ah is that it is dependent on the load, and it in usually not specified at the short info located on the battery, its not even always available from the manufacturer.
Comment: @Gunnish: All battery datasheets I've seen give you some idea of what the battery can produce over a variety of conditions, with A-h being very common.  Yes, the A-h a battery can deliver varies with the current profile, temperature, and other parameters, but so does the total energy.  Everything is a function of lots of other parameters when it comes to batteries, but the total deliverable charge is probably more constant than others, like the total deliverable energy.
Comment: @Josh: No, it's not that easy.  The total charge a battery can deliver *does* vary with load.  Good battery datasheets will show a curve of the Ah or the derating factor from nominal for discharge current.  Your 25 Ah battery may be rated at that at 25 degC over 10 h discharge (2.5 A).  At 25 A you may get 75% of that, for example.  At lower temperature it will go down additionally.  This all varies differently between battery chemistries, construction details, and various other parameters.  Batteries are complicated.  Go look at a datasheet some time.
Answer: One factor not yet mentioned is that because batteries have a certain amount of internal resistance, drawing more current will cause the voltage to sag.  Suppose, hypothetically, that a particular battery that's been discharged a certain amount will supply 12 volts when supplying 10mA, or 10 volts when supplying 100mA.  Drawing 10mA from the battery for 10 hours will discharge it about as much as drawing 100mA for an hour, but in the former scenario the battery would have supplied 20% more "useful" energy.  Key point: a larger fraction of the energy in a battery will be lost when trying to drain it quickly than when trying to drain it slowly.
Power lines also have a certain level of resistance, and similar factors may apply, but the line voltage reaching a residental customer's meter is generally not appreciably affected by that customer's usage.  A power company could supply one amp at 105 volts using 20% less energy (per unit time) than would be required to supply one amp at 126 volts.  If customers were billed per amp-hour, the power companies would have an incentive to supply their energy at the lowest possible voltage.  Billing per kWh means the customer's billable usage will be proportional to the amount of energy the power company has to generate to supply it.  Incidentally, some devices (e.g. induction motors) will often draw less current at higher voltages (while doing the same amount of work), while other devices like incandescent lamps and heaters will draw more current at higher voltages (while producing substantially more light and heat).
Answer: Simply an "Amp.Hour" is not a scientific unit or SI unit. Amp.hr is a rating that battery manufacturers use but because one ampre = one Coulomb per second, when multiplied by one hour the two time factors cancel out and the result is simply 1 Amp.Hr = 3600 Coulombs of charge, no time factor involved. So a bit of smoke and mirrors from the battery manufacturers. If you want to really know how your battery is going to perform you will have to look a little deeper than taking the word of the sales people ... !
Comment: The amp-hour is scientific in that both the ampere and the hour are scientifically defined. The amp-hour is in very common use in engineering. Note that the question has an accepted answer from seven years ago.
Answer: This is basic Physics we must know, try to understand below:
Power (in watt) = voltage (in volts) * current (in amperes)
      So, P = VI
      And Power is energy per unit time.
      P = E/t
      Now, E/t = VI
      E/V = It
      Divide by 1000 on both sides

Now see the units, mAh (Milli ampere-hours)
It means if the voltage is constant then we can measure the capacity in watt-hours.
At homes, where voltage is constant we measure the capacity in Power
In laptops or mobiles, These devices use a battery's energy according to usage, It drains faster if you are playing PUBG (games) else it drains slower. So the voltage depends on the operation performing on the devices. SO voltage is not constant then we use current as a measurement And it becomes ampere-hour but mobile and laptops take less electricity compared to homes, so they are measured in milliamperes Hour.
A little trick:
Suppose you wanna know how much a ceiling fan cost you for running 1 hour?
See on the back of the fan, a value with unit watt as 55 watt.

It means it takes 55-watt energy for 1 hour and the cost of 1 Kilowatt in India is 8 Rupees.
(you can ask your parents also), then it will cost us 55 * 8/1000 = 0.44 Rupees.

Short answer:-
At homes voltage is constant then we use WattHours
In small devices voltage is not constant (depends on usage) then we use milliAmpereHours.


How does Joomla "force https"?

Question: I've thought it is done by modifying .htaccess file, but it is not. Making changes to the "force https" option doesn't change the .htaccess file. Can someone explain to me what is the mechanism behind Joomla's "force https" setting in the Global Configuration?
Answer: It is handled within the SiteRouter class in Joomla, more specifically in its parse() method where the following condition changes the scheme part of the URI if force_ssl property of the application is set that way and then redirect it:
if ($this->app->get('force_ssl') == 2 && strtolower($uri->getScheme()) !== 'https')
    {
        // Forward to https
        $uri->setScheme('https');
        $this->app->redirect((string) $uri, 301);
    }

More info on SiteRouter class is here:
https://api.joomla.org/cms-3/classes/Joomla.CMS.Router.SiteRouter.html
Comment: Just for completeness this is indeed what forces a redirect when someone ends up on a http url. The route builder also has logic setup to enforce https connections which is used directly in some components: https://github.com/joomla/joomla-cms/blob/staging/libraries/src/Router/Route.php#L24-L43
Comment: Sample code for user activation which uses this flag https://github.com/joomla/joomla-cms/blob/45bd91bbfd4523f6971f0a45bd974b231984db7a/components/com_users/models/registration.php#L113-L126

How does Joomla "force https"?


Can I edit auto-complete dictionary?

Question: Currently my LG G2 Swype-style input with the LG keyboard gives me boneheaded suggestions like tho for to (and actually prefers them). I see elsewhere that user dictionary editing is not available, but some of these entries are five years old already. Any progress on this front?
Answer: You can change the words in the user dictionary by going to Settings > Language and Keyboard > User dictionary. From here you can edit as you wish. There is another way mentioned here that may be easier for you: How to remove misspelled words from your Android Dictionary
"Maybe this is more obvious to everyone else, but the dictionary is accessible from the speech-to-text button. The gear icon actually means something! Long-press the microphone to get to the Touch Input settings menu. From there, click User Dictionary and edit out all your "well, crap, I did it again!!!" entries. You can also add entries (at the top), you can long-press an entry to edit, or click the red X to delete."
This is a good article that I have read before. Hope it helps!
Comment: have you seen word-prediction exist outside of mobile in any word processors or email clients?
Answer: I'm afraid that is not possible for the stock LG keyboard on the LG G2. You can only edit words that you have added yourself using Jimmy's method above (or below?), that is, words in the personal dictionary; but you cannot delete words that came with the standard dictionary. Sadly tho came with Lucky Goldstar's stock dictionary. At any rate, I commend you on your choice of phone, Sir.
(My suggestion would be to switch to Swype, which is free and better anyway. In Swype, you can long-press a suggestion to delete it from the built-in dictionary. I do believe that Swype's dictionary cannot be easily exported to other keyboards in case you want to switch later, but I haven't looked into it.)

Can I edit auto-complete dictionary?


Filter by other fields in Django Rest Framework's SlugRelatedField

Question: I have a model with multiple ForeignKey relationships and am looking to build a POST API that allows me to post their verbose names rather than ids.  This seems like a job for SlugRelatedField, however this does not allow me to provide a queryset that is filtered based on other fields within the JSON post.  The problem is that the fields need to be filtered based on other fields within the JSON request.
class GenericReportSerializer(serializers.ModelSerializer):
    """
    GenericReportSerializer for POST.
    """
    organization = serializers.SlugRelatedField(slug_field='name', queryset=models.Organization.objects.all())
    subdivision = serializers.SlugRelatedField(slug_field='name', queryset=models.Subdivision.objects.all())  # queryset needs to be filtered by organization
    prediction_model = serializers.SlugRelatedField(slug_field='name', queryset=models.PredictionModel.objects.all())  # queryset needs to be filtered by both organization and subdivision

    class Meta:
        model = models.GenericReport
        fields = '__all__'  # use all fields

Organizations are unique by name, so SlugField is fine.  However, subdivisions do not have unique names and need to be filtered by the organization, and the prediction_model needs to be filtered by both the organization AND the subdivision.  I haven't found a convenient way to chain filters together in Django Rest Framework and extending the SlugRelatedField class doesn't give me access to the entire data structure.  Is there a good way to accomplish this?
Answer: You could create a Serializer for each model and then build the relation from GenericReport to organization to subdivision to prediction_model.
I assume they are related with ForeignKey or ManyToMany Relationsships.
class PredictionModelSerializer(serializers.ModelSerializer):
    class Meta:
        model = models.PredictionModel
        fields = '__all__'

class SubdivisionSerializer(serializers.ModelSerializer):
    # TODO: adjust name prediction_model to the name of the related field
    prediction_model = PredictionModelSerializer(read_only=True, many=True)

    class Meta:
        model = models.Subdivision
        fields = '__all__'

class OrganizationSerializer(serializers.ModelSerializer):
    # TODO: adjust name subdivision to the name of the related field
    subdivision = SubdivisionSerializer(read_only=True, many=True)

    class Meta:
        model = models.Organization
        fields = '__all__'

class GenericReportSerializer(serializers.ModelSerializer):
    name = OrganizationSerializer(read_only=True, many=True)

    class Meta:
        model = models.GenericReport
        fields = '__all__'  # use all fields

If you serialize now a GenericReport you will receive a nested json POST response with all related information and your're quite flexible in chaging the behavior fields etc.
Answer: You can customize the slug Related, you just pass request in context and you can access request_data and then you can filter
class SubDivisionSlugRelatedField(serializers.SlugRelatedField):
    def get_queryset(self):
        organisation_name = self.context['request'].data.get('organization')
        return SubDivision.objects.filter(organisation__name=organisation_name)

class PredictionModelSlugRelatedField(serializers.SlugRelatedField):
    def get_queryset(self):
        organisation_name = self.context['request'].data.get('organization')
        subdivision_name = self.context['request'].data.get('subdivision')
        return PredictionModel.objects.filter(organisation__name=organisation_name,
        subdivision__name=subdivision_name)

class ReportSerializer(serializers.ModelSerializer):
    organization = serializers.SlugRelatedField(slug_field='name', queryset=Organisation.objects.all())
    subdivision = SubDivisionSlugRelatedField(slug_field='name', queryset=SubDivision.objects.all())  # queryset needs to be filtered by organization
    prediction_model = PredictionModelSlugRelatedField(slug_field='name', queryset=PredictionModel.objects.all())  # queryset needs to be filtered by both organization and subdivision

    class Meta:
        model = Report
        fields = '__all__'  # use all field


Current generation

Question: No matter the arrangement of resistors in a circuit, a battery will still produce a current as if it were connected to an imaginary combination of the individual resistors within the circuit? Can anyone explain why this is so, can the charged particles know there is a resistance before they leave the power supply?
I know similar questions has been asked, but this has a minor detail which was neither asked nor answered. I am wondering why the total current within a circuit is calculated based on Req, if resistances don't affect the current? I=V/R? Current is charge per unit time, but nobody talks about the time factor affecting the current, I know that the number of particles within a series circuit will be the same, but why is the current same?Do the particles know that there will be resistance before they even reach it?
Answer: No particles do not know this .Let a batterry is connected with a parallel arrangement of resistors with resistors R1 and R2 as and R1>R2 . This means that R1 have greater resistance for current. Now when the battery is connected then due to potential differebce some of the electrons which are weakly attracted by the nucleaus gets  detached from it and started moving towards higher potential.To maintain electrical neutrality battery provides the electrons to those atoms.Now we can understand from here that more resistance means that they have less number of weakly held electrons this implies their will be less movement of charge in direction of potential difference and hence less current.
About time factor we can say that drift velocity of electron =eEt/m
Here we can see that it mainly depends on electric field and average relaxation .
Comment: What about when R1 and R2 are connected in series?

Current generation


What software implements UFF

Question: I am looking for common software packages that implement UFF ideally with an example of how to run it to calculate forces and energies.  I see that Rdkit should be capable of doing this for example, but it is unclear how to do so.
Answer: Many codes implement UFF, including LAMMPS, RDKit, Open Babel.
A few caveats... First off, the original UFF paper is known to have typos and errors. One consistent pain point is that the angle terms have a minimum at 0° so atoms can collapse on each other easily. Most implementations add an harmonic or exponential barrier to avoid this.
Also, there are now a few flavors of UFF, including UFF4MOF .. I don't know of any implementation outside of LAMMPS and friends have indicated that it's still tricky to use.
RDKit Example
Something like this should be what you want. I'm adapting from David Koes's conformer generation script
from rdkit.Chem import AllChem as Chem

mol = Chem.MolFromSmiles("C1CCCCC1")
Chem.SanitizeMol(mol)
mol = Chem.AddHs(mol)
conf_ids = Chem.EmbedMultipleConfs(mol, 50, Chem.ETKDG())

for conf in conf_ids:
    converged = not Chem.UFFOptimizeMolecule(mol,confId=conf)
    energy = Chem.UFFGetMoleculeForceField(mol,confId=conf).CalcEnergy()
    forces = Chem.UFFGetMoleculeForceField(mol,confId=conf).CalcGrad()

Open Babel / Pybel Example
mol = pybel.readstring("smi", "C1CCCCC1")
# or read from a file
pybel._builder.Build(mol.OBMol)
mol.addh()

ff = pybel._forcefields["uff"]
success = ff.Setup(mol.OBMol)
ff.ConjugateGradients(100, 1.0e-3)

energy = ff.Energy()
# I don't remember if this is fully adapted to numpy
gradients = ff.GetGradientPtr()
print(type(gradients))

# This definitely works
for atom in mol.atoms:
    grad = ff.GetGradient(atom.OBAtom)
    print(grad.GetX(), grad.GetY(), grad.GetZ())

Comment: Of course. In RDKit, you'd read in the SDF and then skip the conformer generation and start at the `for loop`. In the Open Babel case, you'd just read in the molecule and skip to the ff setup part.
Comment: I don't use LAMMPS much, but that should be fairly easy too.
Comment: Do you know if its possible to go from 3D coordinates directly to using UFF?  My ideal case was to find an ASE calculator for this, but that seems to not exist.  LAMMPS seems to have a few indirect implementations but nothing straightforward to use without having to learn the details of LAMMPS.
Comment: I know there's an Open Babel calculator for ASE: https://github.com/tkjacobsen/obcalc
Comment: Implementing UFF isn't terribly hard, but I'd start from the RDKit or Open Babel versions to avoid the errors. I haven't implemented the periodic boundary conditions  though .. bonds, angles, etc, seem like they'd be a bit tricky. (Fortunately UFF is not supposed to use partial charges.)
Comment: @TristanMaxson - if you have trouble, send me an e-mail.. not always coming to SE to see notifications here.

What software implements UFF


The fundamental theorem of Galois theory

Question: Who proved the modern form of the fundamental theorem of Galois theory?. Was it in the original Galois' manuscript?
Comment: The question is very close to
http://mathoverflow.net/questions/26811/galois-theory-timeline
Comment: According to http://en.wikipedia.org/wiki/Field_theory_(mathematics), the definition of an abstract field wasn't written down until 1893 (by Weber). So I doubt Galois had the tools to think in such generality.
Comment: Duplicate? See http://mathoverflow.net/questions/26557/what-was-galois-theory-like-before-emil-artin
Comment: @Alain: It is close but not a duplicate. Although the contribution of Artin is significant, the fundamental theorem could be proved before. In fact, as Steven Landsburg answers below, it follows from Galois own results easily.
Comment: Many thanks to everybody for your answers! I think that Steven's answer
is what I was looking for, so I accept it.
Answer: Galois's Proposition I (as translated by Edwards) is:
Let the equation be given whose $m$ roots are $a,b,c,\ldots$.  There will always be a group of permuations of the letters $a,b,c,\ldots$ which will have the following property:  1)  that each function invariant under the substitutions of this group will be known rationally; 2) conversely, that every function of these roots which can be determined rationally will be invariant under these substitutions.
As Edwards observes, it takes a lot of work to decipher the exact meanings of "substitution" and "invariant" here, but once you've done that, this can be translated into modern language as:
If an element of the splitting field of $K(a,b,c,\ldots)$ is left fixed by all the automorphisms of the Galois group then it is in $K$.
The fundamental theorem of Galois theory (i.e. the Galois correspondence) follows easily, though Edwards doesn't say who first stated it.
Comment: For Galois' original text (published in Journal de Liouville), see p. 421 (scroll to the 2/3 of the document):
http://portail.mathdoc.fr/JMPA/PDF/JMPA_1846_1_11_A47_0.pdf
There is an interesting footnote (is it also in Edwards?) where Galois tries to explain what he means by "invariant" and "known rationally". It certainly agree with the comment: "It takes a lot of work to decipher..."
Comment: @Mark: This is why (with due respect) I am not quite satisfied with Steven's answer: someone had to do the deciphering work, and I wonder who it was (being aware that it might not be a single person). A Google search points to contributions by Noether, van der Waerden, and Artin.
Comment: @Alain: Your point is of course valid. The problem is that Galois did not have the modern terminology (also time!), he needed to invent many things from scratch. Similarly, if you read what Euclid actually wrote and compare with what we think he wrote, you will find that Euclid's texts are very hard to decipher also. There are much more modern (the second half of the 20th centry) examples which you certainly know.
Comment: @Alain: As I understand, it took about 100 years after Galois to translate what he did into the modern terminology and many people contributed to it. Qiaochu Yuan mentioned Weber. Also E. Artin, Van der Waerden, and many others. I find this text very interesting: http://www.gap-system.org/~history/Projects/Brunk/Chapters/Ch3.html
Answer: Surely the book
Edwards, Harold M. Galois theory. Graduate Texts in Mathematics, 101. Springer-Verlag, New York, 1984. xiii+152 pp. ISBN: 0-387-90980-X MR0743418 (87i:12002) (link to amazon)
would be useful. This book about Galois theory is made from the historical point of view. In particular, it contains an English translation of Galois' memoir.
Answer: The modern form can be found in Galois Theory, by Emil Artin and Arthur N. Milgram page 46, published in 1944. I'm not expert in math history, but once, I heard Artin was the first person to wrote the modern account of Galois theory.
Comment: -Yes, but there  were many proofs earlier(and modern) for the fundamental theorem of Galois theory before Emil's. Emil's proof is simpler than the proof  the usual ones we find in every mongraph
Answer: I am not particularly interested in mathematical history, but Peter Newmann is: http://www.ems-ph.org/books/book.php?proj_nr=137.


How explicit should a YA novel be?

Question: For a romance YA novel, how explicit can it be? Are there certain descriptions or words that shouldn't be used?
Comment: Just an OT thought: how does any YA story acknowledge and accept that adults, especially YAs, think about sex all the time?
Comment: Yes, quite a few of them do.
Comment: There are no banned things, but just think. I have seen some preteens reading books that classify as YA, so...
Answer: There's a good thread on this over at Absolute Write - http://www.absolutewrite.com/forums/showthread.php?t=184551
The general consensus there seems to be that there is definitely a limit on how explicit YA sex should be.  They suggest going for the more 'poetic' approach rather than an explicit or erotic one, and I think that makes sense.
ETA:I didn't see any sign of a list of 'banned' words, or anything, and I wouldn't think there would be.  Context is probably going to make a lot of difference in something like this.  As long as you're writing to serve the story rather than to titillate, I think you'll be fine.  If editors don't like something specific, they can let you know.  (apparently one writer's editor insisted that in YA sex, there must ALWAYS be mention of a condom.)
Answer: There is no hard set rule, and the boundaries are constantly expanding. Tender Morsels deals with incest, molestation, gang rape, abortions, and many other extremely adult issues. But it does so with implications and metaphors more often than gritty details (don't get me wrong, the book is amazing).
So many of the issues could be glossed over by a reader who does not have a seed of awareness towards them. But one who is "ready" to meet or beginning to grasp the issue will be able read between the lines.
Comment: I remember that 'glossing over' from my own YA-reading years.  I've gone back and read books as an adult and found things that I totally didn't see as a child, because I didn't know enough to pick up on the hints.  It's not a bad system, really!
Answer: I've published quite a few novels for younger readers but my Y/A novel Gobshite, despite being enjoyed and even admired by most of the editors who read it, was declared too near the knuckle for publication -however, it did get me the contact I needed to publish my first series for younger readers, Sebastian Darke.
Comment: Perhaps you could explain what, precisely, the issues with your novel were? That sounds like it'd give a really good sense of possible whereabouts for "the red line" as it currently stands.
Comment: To add to what Standback said, it might be helpful if you told the whole story, or linked to a blog post or something where you went into greater detail. I love behind-the-scenes stories. :)
Answer: A good rule of thumb is that YA books can and do deal with edgy or adult topics and subject matter, but NOT in explicit detail. YA books tend to be bought by teens themselves (in contrast to MG books, which are largely bought by parents and teachers, and therefore are typically squeaky clean) which means that they often deal openly with two perennial teenaged obsessions, sex and violence.
Something explicit, however, could potentially be considered pornographic, and I can't imagine any legitimate publisher wanting the controversy or the reputation that would come with putting out a book like that for an underaged audience (especially considering that the protagonists are likely to be in the same age range).

How explicit should a YA novel be?


How is a moderator chosen in Stack Overflow

Question: What is the criteria for selecting a moderator in Stack Overflow?
Answer: If the community is mature enough (as on stackoverflow.com), moderators are selected through voting, as RSolberg answered. I would estimate the community needs to be 6-9 months old at least for this to work.
If the community is new (as on serverfault.com, and superuser.com), we need moderators to launch with, and so by necessity some moderators have to be hand selected by the "powers that be".
But as these communities grow, they will need more moderators, and voting will be the preferred method.
Comment: Who can be a moderator? Some with at least 10k reputations?
Answer: https://blog.stackoverflow.com/2009/05/stack-overflow-moderator-voting-now-open/
A while back, there was a nomination period followed up by a voting period.  The SO team reviewed the nominations and chose the ones that would be voted on.
It was great that the community got to take on an active role in the decision.
You also gain access to some mod tools once your rep is at 10K...  (not there yet though personally, so not too sure what I could do with that)
Comment: Not too much, mostly editing, seeing deleted answers and watching "most" and "least" questions/answers. (Most upvoted, most downvoted, most viewed, least viewed, most commented, and a few more)
Comment: You can also see posts that have been flagged spam/offensive - but you can't see "moderator attention" flags.


How do I minimize Federal, State, and Municipal tax due from money market funds or bond mutual funds?

Question: I was looking into money market funds and bond mutual funds for some relatively stable investments. Before I make decisions, though, can someone explain under what circumstances would I need to pay federal vs state vs municipal tax, and ways of minimizing those taxes?
Answer: Distributions of interest from bonds are taxable as income by the Federal, state and municipal (if applicable) government. End of year fund distributions are subject to capital gains taxes as well.
You can minimize taxation by:

Buying tax-exempt obligations of the US Government. (Exempt from Federal, but not usually local taxes)
Buying tax-exempt obligations of your state and US territories like Puerto Rico, the US Virgin Islands, and Guam. (Exempt from Federal, State and possible municipal income taxes)
Buying tax-exempt obligations of your city. (I know that New York City bonds are exempt from Federal, New York and New York City income tax, not sure about others)

Note that the only bonds that are guaranteed safe are US Government obligations, as the US government has unlimited taxation powers and the ability to print money. Municipal obligations are generally safe, but there is a risk that municipal governments will default.
You can also avoid taxation by not realizing gains. If you buy individual stocks or tax-efficient mutual funds, you will have minimal tax liability until you sell.
Also, just wanted to point out that bonds do not equal safety and money markets do not pay sufficient interest to offset inflation, you need a diversified portfolio. Five year treasury notes are only paying 1.3% now, and bond prices drop when interest rates go up. Given the level of Federal spending and the wind-down of the war, its likely that rates will rise.
Comment: You can also avoid taxes by investing in a tax sheltered account (401(k), IRA, Roth IRA, HSA, ESA, etc). Of course, some of those will be taxed in retirement (possibly at a better rate) and you can't take money out of them as freely.
Comment: I don't believe there are any tax-exempt obligations of the US government (with respect to federal taxation).  Also, due to the Supremacy Clause of the US Constitution, interest on direct US obligations is exempt from state and local income taxe.


Trying to insert only unique row into new table

Question: I am trying to insert only unique values into a table but it is not working. There is only one value of LastDownload in the Securities table for all 6000 rows.  But in my query I get over 6000 duplications of that value in @Temp. I want only one value.  What am I missing?
DECLARE @Temp TABLE ( Info VARCHAR( 256 ) )

INSERT INTO @Temp
SELECT LastDownLoad
FROM Securities AS S
WHERE NOT EXISTS( SELECT * FROM @Temp AS T WHERE T.Info = S.LastDownLoad )

Answer: Maybe this is overly simplistic... but... it seems to fit...
DECLARE @Temp TABLE ( Info VARCHAR( 256 ) )

    INSERT INTO @Temp
    SELECT Distinct LastDownLoad
    FROM Securities

Answer: Put both answers together, and you get the complete answer:
DECLARE @Temp TABLE ( Info VARCHAR( 256 ) )

INSERT INTO @Temp
SELECT DISTINCT LastDownLoad
FROM Securities AS S
WHERE NOT EXISTS( SELECT * FROM @Temp AS T WHERE T.Info = S.LastDownLoad )

Answer: Did you try using distinct?
DECLARE @Temp TABLE ( Info VARCHAR( 256 ) )

INSERT INTO @Temp
SELECT LastDownLoad
FROM Securities AS S
WHERE NOT EXISTS( SELECT DISTINCT * FROM @Temp AS T WHERE T.Info = S.LastDownLoad )


Goldman Sachs Alumni in Trump Administration

Question: I've read in the press that Donald Trump has a lot of Goldman Sachs' Alumni in his administration.  I know that Steve Bannon worked for Goldman Sachs, but who else in Donald Trump's administration is a Goldman Sachs Alumnus?
Comment: Given that Tyler Durden at Zerohedge.com hates Goldman Sachs with a passion, calls them the Vampire Octopus, you, may want to check there for an answer.
Comment: A more interesting question is comparing Goldman alumni across different administrations. As well as other top level sell side institutions.
Answer: From Wall Street on Parade:

Steve Bannon
Steve Mnuchin, Secretary of the Treasury
Gary Cohn, Director of the National Economic Council
Jay Clayton, Chairman of the Securities and Exchange Commission

Note that Mnuchin and Clayton will require Senate confirmation.  Not sure about Cohn.  Bannon does not and is already part of the administration.
Erin Walsh and Anthony Scaramucci are on the transition team but do not have administration positions at this time.
Comment: Add another one.  James Donovan a managing director at Goldman Sachs is to be nominated as Deputy Treasury Secretary.
Comment: This answer would be better if it noted how long a given person worked there, how much they were paid or compensated, and why they left GS.  It might also be relevant if any of the above *returned* to working for GS after their respective stints in the government.


Solr search with exact match

Question: I am using drupal 8, search api and solr on our site. In views, I am using full text search with direct query option. Search is working for multiple words. What I want is when I search with double quote, I want the result with exact match of query string. But putting double quote doesn't seem to have any effect on it. If I changed parse mode to multiple words, double quotes work but it doesn't return any result for query without double quotes. Can I even achieve it in single view display? Any workaround suggestion so that it works for query without double quotes but also respect double quotes to do exact match depending upon query.
Answer: Take a look at this issue:
keys of fulltext searches must be encoded as phrases for terms parse mode
A quick read indicates that you might be able to just escape the spaces, e.g foo\ bar.
Also see the view settings image in comment #10 of that issue.

Solr search with exact match


Do you guys write the date in year/day/month format?

Question: As I seen 2019/10/10 written in Japan. Does that mean Japanese write it as year/day/month format and why did they write the date like that?
Comment: [Personally, I prefer to use this order in English, too.](https://en.wikipedia.org/wiki/ISO_8601)
Comment: Duplicate/related: [how to tell date?](https://japanese.stackexchange.com/questions/47076/how-to-tell-date)
Comment: Related: https://japanese.stackexchange.com/q/59602/5010
Answer: "2019/10/10" is not a very good example because it contains two "10's", but if you saw that in Japan, the first "10" stands for "October" and the second "10", the day of the month.
Thus, "2019/10/10" means "October 10, 2019".
So, if it were "2019/10/29", the 29 would be the day of month.
The form is "year/month/day" and not "year/day/month".

why did they write the date like that?

Because word order differs from one language to another.  In Japanese, we generally go from bigger to smaller.  That is to say from largest element first, followed by less large and then, least large.
The same goes for writing addresses. For instance:
東京都新宿区百人町{とうきょうとしんじゅくくひゃくにんちょう} 9-26-4
is in the order of "size".
Tokyo > Shinjuku Ward > Hyakunin-cho > 9-46-3
Needless to say, that is the complete opposite of what the same address would be written in English, which will read:
9-46-3 Hyakunin-cho, Shinjuku (Ward), Tokyo
(I will not explain the number part as it is rather complicated, but think of it as a kind of street number for now.)


When is someone a Hindu?

Question: The confusion arised when an answer was given to this post. One would typically associate believing in a religion as believing in the gods of a religion, but, it seems so there are sects of Hinduism who are atheistic. If this is the case, what is the criteria which must be fulfilled for one to call themself Hindu?
Comment: Duplicate question. All modern day 'Hindus' in the religious sense of the word, not the cultural or ethnic sense, are followers of the system expounded by Vyasa, known as Uttara Mimamsa or Vedanta. All Hindus assert that there is a God, that the vedas are the revealed word of God, and in kalpas (cycles) and rebirth. See here the Introdction in the follwing for a general idea - https://www.wisdomlib.org/hinduism/book/brahma-sutras/d/doc62756.html
Answer: Please read my answer here: https://thespiritualhindu.com/who-is-a-hindu/?
Briefly, Shashi Tharoor is incorrect if he said there are 'no binding requirements.' Indeed, Hinduism has a very strict epistemology across all Darshanas. One can call yourself anything you want, but if one is a Hindu in the indigenous sense, one must be a Dharmic creature. Religion is not part of the indigenous belief system; Dharma is.

When is someone a Hindu?


Asking a person's name in different forms

Question: Are these grammatically correct?

Vous êtes Philippe ?
Est-ce que vous êtes  Philippe ?
Il est Philippe ?
C'est Philippe ?
Answer: All but the third one are correct French, but none of them is asking a person's name.
1 and 2 are asking someone if he is Philippe (and not someone else). (Are you Philippe?) Alternatives are C'est vous, Philippe ?
4 is asking someone if someone else is Philippe. (Is he Philippe?)
To ask someone if his name is Philippe, you might say:

(Est-ce que) vous vous appelez Philippe ?

C'est Philippe, votre prénom ?

and to a third person:

(Est-ce qu') il s'appelle Philippe ?

Note that Il est Philippe ? is a typical non native speaker mistake. You can say Il est Français or il est médecin but that doesn't work with a first name.
Answer: The first two are used if you are asking the person directly.
The third is mainly used if you are asking someone else about Philippe, but it is more or less not the best formulation.
The fourth could be used in both cases.
Two more ways could be used if you are talking to Philippe directly.

Etes-vous Philippe?

Or in an  inquisitive tone:

Monsieur Philippe?