I want to show related posts, with the same taxonomy (artists) as the current post. In the related post I don't want the current post to appear.  I am also using a custom post type. (sculptures)  This is the code I am using below, but it is showing the current post in the related post and all post not only those with the taxonomy (artists)  Does anyone have a solution

Related Posts

  <?php  $query = new WP_Query(array('post_type' => 'sculptures', 'artist' => get_the_term_list( $post->taxonomies, 'artist' )));  while ($query->have_posts()) : $query->the_post();  ?>
<a href="<? the_permalink()?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_post_thumbnail('medium'); ?>
   <?php endwhile; wp_reset_query(); ?>

I would like to ask that what code should i add in order to make my related posts by tag to display randomly? I got this code from somewhere else.  <?php $orig_post = $post; global $post; $tags = wp_get_post_tags($post->ID); if ($tags) { $tag_ids = array(); foreach($tags as $individual_tag) $tag_ids[] = $individual_tag->term_id; $args=array( 'tag__in' => $tag_ids, 'post__not_in' => array($post->ID), 'posts_per_page'=>5, // Number of related posts that will be shown. 'caller_get_posts'=>1 ); $my_query = new wp_query( $args ); if( $my_query->have_posts() ) { echo '

Related Posts
'; while( $my_query->have_posts() ) { $my_query->the_post(); ?>

<a href="<? the_permalink()?>" rel="bookmark" title="<?php the_title(); ?>" rel="nofollow"><?php the_title(); ?>
 <?php the_excerpt(); ?>
  <? } echo '
'; } } $post = $orig_post; wp_reset_query(); ?>   Any solution? Thanks!


Evening,  I have two references in my bibliography file that display all the authors instead of (Author et al., year)  I have this at the start of my file:  \documentclass[12pt]{article} \usepackage[round]{natbib} \begin{document}  \citep{Lloyd2009, Mainprice2014a, Mainprice2014}  \bibliographystyle{agsm} \bibliography{transfer}  \end{document}     (Lloyd et al. 2009; Mainprice et al., 2014a, 2014b)  I do not want to force single authors throughout my document as I also have a lot of two author papers that correctly display as (Author1 and Author2, year).  The Mainprice paper displays all authors and from what I can see is no difference to the Lloyd paper that displays as (Lloyd et al., 2009).  @article{Lloyd2009, author = {Lloyd, Geoffrey E. and Butler, Robert W.H. and Casey, Martin and Mainprice, David}, journal = {Earth and Planetary Science Letters}, number = {1-2}, pages = {320--328}, title = {{Mica, deformation fabrics and the seismic properties of the continental crust}}, volume = {288}, year = {2009}}  @article{Mainprice2014, author = {Mainprice, D. and Bachmann, F. and Hielscher, R. and Schaeben, H.}, doi = {10.1144/SP409.8}, journal = {Geological Society, London, Special Publications}, pages = {1--21}, title = {{Descriptive tools for the analysis of texture projects with large datasets using MTEX: strength, symmetry and components}}, volume = {409}, year = {2014}}  @article{Mainprice2014a, author = {Mainprice, D. and Bachmann, F. and Hielscher, R. and Schaeben, H. and Lloyd, G. E.}, journal = {Geological Society, London, Special Publications}, pages = {1--48}, title = {{Calculating anisotropic piezoelectric properties from texture data using the MTEX open source package}}, volume = {409}, year = {2014}}   My question is similar to this unanswered question, but due to being new to StackExchange, I do not have the sufficient reputation to ask if she found a way to fix it.   I also have other references where the first author and year are the same, but they come up as (Author et al., 2016a, 2016b)  Thanks in advance, Amicia

With BibTeX and the harvard/AGSM style, some references (from authors who have multiple papers per year) aren't abbreviated to "et al.", with the addition of a, b, et cetera. For example, with the code attached below, I get:    Only one paper is abbreviated to et al., the others not. Any idea why this is happening? The in-text references should be Basu et al. (2008a) and Basu et al. (2008b), which I believe AGSM should automatically do?  \documentclass[10pt,a4paper]{article} \usepackage{natbib}  \begin{document}  \cite{basu2008a, basu2008b, beare2006}  \bibliographystyle{agsm}  \bibliography{references.bib}  \end{document}   With BibTeX file (references.bib):  @string{jam="J. Appl. Meteor."} @string{ag="Acta Geop."} @string{blm="Bound.-Layer Meteor."}  @article{basu2008a,   author={Basu, S. and Vinuesa, J.-F. and Swift, A.},   title={Dynamic {LES} modeling of a diurnal cycle},   journal=jam,   year={2008},   volume={47},   number={4},   pages={1156-1174} }  @article{basu2008b,   author={Basu, S. and Holtslag, A. A. M. and Wiel, B. J. H. and Moene, A. F. and Steeneveld, G. J.},   title={An inconvenient "truth" about using sensible heat flux as a surface boundary condition in models under stably stratified regimes},   year={2008},   journal=ag,   volume={56},   number={1},   pages={88-99} }  @ARTICLE{beare2006,  author={Beare,R. J. and Macvean,M. K. and Holtslag,A. A. M. and Cuxart,J. and Esau,I. and Golaz,J. -. and Jimenez,M. A. and Khairoutdinov,M. and Kosovic,B. and Lewellen,D. and Lund,T. S. and Lundquist,J. K. and McCabe,A. and Moene,A. F. and Noh,Y. and Raasch,S. and Sullivan,P.},  title={An intercomparison of large-eddy simulations of the stable boundary layer},  journal=blm,  year={2006},  volume={118},  number={2},  pages={247-272} }


If I play the Phantasmal Image as a copy of any other creature (that has no summoning sickness), will it have the summoning sickness or not?  Phantasmal Image     You may have Phantasmal Image enter the battlefield as a copy of any creature on the battlefield, except it's an Illusion in addition to its other types and it gains "When this creature becomes the target of a spell or ability, sacrifice it."   I know that copies does not copy the "summoning sickness" status, but what if it enters the battlefield and is not being copies inside it?

Note: this is intended to be a canonical question about summoning sickness.  "Summoning sickness", broadly, is the rule that stops you from attacking or paying {T} costs with a creature that you just played. But how exactly does it work? How does it interact with other rules and effects?  For example, if I'm trying to figure out how a creature is affected:   Does the status matter (tapped/untapped, face down/face up, etc.)? What if it came into play, but I didn't cast it? What if it's a token? What if it was on the battlefield when my turn started, but it wasn't a creature? What if it stops being a creature? What if it's a creature and also another card type? What if it's a double-faced card that just transformed? What if it changes control? What if it's a copy of another creature? Which of the creature's activated abilities can I use? Are any of its other abilities affected? Can I tap the creature to pay a cost that is not a {T} cost?   (These examples are primarily taken from questions about summoning sickness that have already been asked on the site)


Happens after opening the app through the notification drawer.

When I receive a message on an SE post, I get a notification like this:    If I double tap this notification, the SE application opens, but my feed is empty approximately half the time. It looks like this:    If I refresh the feed (slide from the top), the feed does refresh and shows the new notification.   The notification, above, leads to  comment.  I haven't figured out the pattern yet, but this occurs roughly half the time I open a notification. It's occurred for chat messages, comments and answers - but not consistently. I have received notifications for the same post (for example, the two comments after the one linked above) that do not show an empty feed. But, a chat message barely 10 minutes later will show the empty feed again.  I am utilizing the beta app - version 1.0.72 on Android 5.0.1.


$ sudo apt-get install oracle-java8-installer Reading package lists... Done Building dependency tree        Reading state information... Done Package oracle-java8-installer is not available, but is referred to by another package. This may mean that the package is missing, has been obsoleted, or is only available from another source  E: Package 'oracle-java8-installer' has no installation candidate

I have been trying to install the latest version of java-8. However, I found out that the  due to changes in the java licence.  How should I update my java to 8.0_201 or 8.0_211 now?  Thanks!


I have been given some SVG icons which are all outlined paths. I need to make the strokes thinner to be consistent with the rest of a design I'm working on. Is there a way to do this without reconstructing the icons from scratch?  (What I am asking to do is )

I have downloaded some SVG icons from the web which are all outlined paths. In Illustrator I would like to make those paths thicker. Is there a way to do this? I know when a line is still in stroke-mode you can just adjust the size of the stroke, but once this has been converted to outlines I don't know if this is still possible?


What happens if we throw a dice from same position, with same force, by creating a vacuum environment on earth? Will it be predictable now i.e. will the dice have same results all the time?  If answer to the question is no, I have another question, Why in quantum mechanics we say a particle for example electrons are in two states. We only get a probabilistic value of position, that does not mean, its in two states at a time. The way we see it may be destroying the probabilistic character.

Is it really impossible to calculate in advance the result of throwing dice? After all, the physics of dice throwing is in the world of classical mechanics, rather than quantum mechanics.


I am trying to solve why I am getting on docker / nginx container error 502 with connect() failed (111: Connection refused) when I setup properly the ssl , but I got this issue . I dont see clerly where it comes from . how can I fix this? upstream web_server {     server web:8000; }  server {      listen 80;     server_name demo.io www.demo.io;      access_log /var/log/nginx/demo.io.log;     error_log /var/log/nginx/demo.io.log;      location / {         rewrite ^ https://$host$request_uri? permanent;         proxy_pass http://web_server;         proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;         proxy_set_header Host $host;         proxy_redirect off;     }      location /static/ {         alias /home/app/web/static/;     } } #https://demo.io server {     listen 443 ssl http2;     listen [::]:443 ssl http2;     server_name demo.io;      server_tokens off;      ssl_certificate /etc/letsencrypt/live/demo.io/fullchain.pem;     ssl_certificate_key /etc/letsencrypt/live/demo.io/privkey.pem;      ssl_buffer_size 8k;      ssl_dhparam /etc/ssl/certs/ssl-dhparams.pem;      ssl_protocols TLSv1.2 TLSv1.1 TLSv1;     ssl_prefer_server_ciphers on;      ssl_ciphers ECDH+AESGCM:ECDH+AES256:ECDH+AES128:DH+3DES:!ADH:!AECDH:!MD5;      ssl_ecdh_curve secp384r1;     ssl_session_tickets off;      # OCSP stapling     ssl_stapling on;     ssl_stapling_verify on;     resolver 8.8.8.8;      location / {         proxy_pass https://web;         proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;         proxy_set_header Host $host;         proxy_redirect off;     } }

This is a  about Connection Refused    We see a lot of questions to the effect      When I try to connect to a system I get a message      Connection refused      Why is this ?


I am making a small Morse Code translator, and everything works fine; nonetheless, the output is not shown properly.  CIPHER = {'E': "⦾", "A": '⦿', 'R': '⦾⦿', 'I': '⦿⦾', 'O': '⦿⦿',         'T': '⦾⦾⦿', 'N': '⦾⦿⦾', 'S': '⦾⦿⦿', 'L': '⦿⦾⦾',         'C': '⦿⦾⦿', 'U': '⦿⦿⦾', 'D': '⦿⦿⦿',         'P': '⦾⦾⦾⦿', 'M': '⦾⦾⦿⦾', 'H': '⦾⦾⦿⦿',         'G': '⦾⦿⦾⦾', 'B': '⦾⦿⦾⦿', 'F': '⦾⦿⦿⦾',         'Y': '⦾⦿⦿⦿', 'W': '⦿⦾⦾⦾', 'K': '⦿⦾⦾⦿',         'V': '⦿⦾⦿⦾', 'X': '⦿⦾⦿⦿', 'Z': '⦿⦿⦾⦾',         'J': '⦿⦿⦾⦿', 'Q': '⦿⦿⦿⦾',         '1': '⦾⦾⦾⦾⦿', '2': '⦾⦾⦾⦿⦿', '3': '⦾⦾⦿⦿⦿',         '4': '⦾⦿⦿⦿⦿', '5': '⦿⦿⦿⦿⦿', '6': '⦿⦾⦾⦾⦾',         '7': '⦿⦿⦾⦾⦾', '8': '⦿⦿⦿⦾⦾', '9': '⦿⦿⦿⦿⦾',         '0': '⦿⦿⦿⦿⦿'         } def main():     msg = input("Type your message below:\n\n")     for char in msg:         if char == ' ':             print (' '*7,)         elif char not in 'abcdefghijklmnopqrstuvwxyz1234567890':             print ('')         else:             print (CIPHER[char.upper()])   I would expect the output for "Hello, World!" to be something like this:  ⦾⦿⦾⦾⦿⦾⦾⦿⦿       ⦿⦿⦾⦿⦿⦾⦾⦿⦿⦿  However, the actual output looks much more like this:  ⦾ ⦿⦾⦾ ⦿⦾⦾ ⦿⦿    ⦿⦿ ⦾⦿ ⦿⦾⦾ ⦿⦿⦿   I tried removing and placing commas randomly. Then, I tried removing the '\n' statements on the input, but nothing changed with respect to the output. I tried to use the .splitlines as shown here (), but it stopped printing completely! Then, I googled it and did not found anything close to this problem, so I started to read more material on Python strings. I found a website () that has a good amount of material about Python strings, but I could not find anything that could solve my problem there.  I would greatly appreciate your help!

I'd like to do it in Python. What I'd like to do in this example in C: #include <stdio.h>  int main() {     int i;     for (i=0; i<10; i++) printf(".");     return 0; }  Output: ..........  In Python: >>> for i in range(10): print('.') . . . . . . . . . . >>> print('.', '.', '.', '.', '.', '.', '.', '.', '.', '.') . . . . . . . . . .  In Python print will add a \n or space, how can I avoid that? Now, it's just an example, don't tell me I can first build a string then print it. I'd like to know how to "append" strings to stdout.


Is this defined by the language? Is there a defined maximum? Is it different in different browsers?


I'm running Ubuntu 20.04, and noticed that I'm running Gnome 3.36.2 - when the latest stable release is 3.36.3. How can I upgrade? Is it safe to do so?

Why are packages in the official Ubuntu repositories older than the latest (upstream) versions from Debian Sid, PPAs, the authors, etc.?


I hope that this question won't be too ambiguous.  I would like to achieve following thing.  [user@host]# ./my_program SET THIS AS NEXT COMMAND THAT YOU CAN EDIT [user@host]# SET THIS AS NEXT COMMAND THAT YOU CAN EDIT   Is there any way of achieving it without writing explicitly to a file descriptor?  I have a working shell, let's say with PID 10150. My current solution is following:  Console 1:  [user@host]# echo $$ 10150 [user@host]#   Console 2:  [user@host]# echo -n "SET THIS AS NEXT COMMAND THAT YOU CAN EDIT" > /proc/10150/fd/0 [user@host]#   Console 1:  [user@host]# echo $$ 10150 [user@host]# SET THIS AS NEXT COMMAND THAT YOU CAN EDIT

Is it possible in an interactive bash shell to enter a command that outputs some text so that it appears at the next command prompt, as if the user had typed in that text at that prompt ?  I want to be able to source a script that will generate a command-line and output it so that it appears when the prompt returns after the script ends so that the user can optionally edit it before pressing enter to execute it.  This can be achieved with xdotool but that only works when the terminal is in an X window and only if it's installed.   [me@mybox] 100 $ xdotool type "ls -l" [me@mybox] 101 $ ls -l  <--- cursor appears here!   Can this be done using bash only?


I used this piece of code to find my IP address using python: import socket ip = socket.gethostbyname(socket.gethostname()) print(ip)  But when it prints "127.0.1.1" instead of something like this "192.168.x.x" Why does the python-3 module socket return the IP address of my machine as "127.0.1.1" instead of the local IP address even if it is connected to the internet?

How can I find local IP addresses (i.e. 192.168.x.x or 10.0.x.x) in Python platform independently and using only the standard library?


Suppose $a_i$ are dinstinct positive integers $\forall1\le i\le n$. Prove that $$\frac{a_1}{1^2}+\frac{a_2}{2^2}+...+\frac{a_n}{n^2}\ge\frac{1}{1}+\frac{1}{2}+...+\frac{1}{n}$$  My approach: I will procede by proof by contradiction. If $a_1,a_2,...,a_n$ is not a permutation of $1,2,...,n$, then one can reduce $a_k (\exists a_k>n)$ to a value $<n$ and $>1$ So that $a_1,a_2,...,a_n$ is a permutation of $1,2,...,n$. From now on assume $a_1,a_2,...,a_n$ is a permutation of $1,2,...,n$. Now, by the rearrangement inequality, $$\frac{a_1}{1^2}+\frac{a_2}{2^2}+...+\frac{a_n}{n^2}\ge\frac{1}{1^2}+\frac{2}{2^2}+...+\frac{n}{n^2}=\text{LHS}$$ with the rearrangement sequence being $\{a_1,a_2,...,a_n\} \text{and} \{\frac{1}{1^2},\frac{1}{2^2},...,\frac{1}{n^2}\}$.  Is this proof correct? Is there a better way of doing it?

Let $a_1, \ldots, a_n$ be distinct positive integers. I want to prove that  $$\frac{a_1}{1^2} + \frac{a_2}{2^2} + \cdots + \frac{a_n}{n^2} \geq \frac{1}{1} + \frac{1}{2} + \cdots + \frac{1}{n}.$$  I've been considering using Rearrangement and Cauchy Schwarz, but cannot make any progress


I added a PPA and every time I run apt-get update the Bash reminds me of my failure:  W: Failed to fetch http://ppa.launchpad.net/whatever/ etcetera/.../.../Packages  404  Not Found   I want to know if there is a way to stop seeing it.

PPA seems to be constantly offline. Whenever I use sudo apt-get update, this error is shown:  W: Failed to fetch http://ppa.launchpad.net/ 404  Not Found   How do I fix these errors?


I have a Custom Object Rule__c, And I have added another Custom object Rule_Set__c as Related list in page layout for Rule__c and when I try to query like below:  @AuraEnabled(cacheable=true)     public static List<Rule__c> getRules(String objId) {         String query;         query = 'SELECT Id, Name, Formula__c';         query += ' ,(SELECT Name' + ' FROM Rule_Sets__r)';         query += ' From Rule__c WHERE Active__c = true AND Parent_Obj__c = :objId';         return Database.query(String.escapeSingleQuotes(query));     }  I am getting Exception like: Error: Didn't understand relationship 'Rule_Sets __r' in FROM part of query call. If you are attempting to use a custom relationship, be sure to append the '__r' after the custom relationship name. Please reference your WSDL or the describe call for the appropriate names. Note: When I query for fields for another Custom object which is related to the Rule__c Object the above query is returning results properly, I am getting the Query Exception only when I query for fields in object Rule_Set__c

I'm getting an error - didnt understand relationship when running this query in dev console. I have set the child relationship the lookup field to IncEvents. The lookup field is on the MyRule object -   select Id, Name, (select Id from IncEvents_r) from Namespace_MyRule__c  I noticed that the editor is displaying a single underscore between the namespace and the object name but I did enter a double underscore.


I want to invest 10% of my portfolio into bonds.  The other 90% will go into stock.  I took a look at Government Bonds which TD Ameritrade offers at a $5000.00 minimum.  This is a little over my budget.  I am also considering low cost bond funds such as VUSTX/VBISX.  The returns on these bond funds are historically beating the market.  However, the return appears to be based on interest rates which the government has announced should be going up in the short term.  I could hold onto cash, buy short term, buy long term...I am having difficulty deciding.  With the belief that interest rates are rising in the short term should I just hold onto cash until April 2015 (I think rates will be up by then)?

The first thing I learned about bonds is that when interest rates rise, the price of existing bonds tends to fall. Unfortunately, I didn't learn much else about bonds. So I have a couple questions about them.   If interest rates rise I'm sure it will affect some kinds of bonds more than others. What are the different kinds of bonds and how do they fare in time of changing interest rates? My financial planner suggested 20% of my 401(k) should be in bonds. (I am decades away from retirement.) What do they add to my portfolio in terms of risk and diversification? (I guess I'm asking why wouldn't I drop most of the bonds from my portfolio since they've been outperformed by my mutual funds over the last couple years when interest rates have been stable?)


I have noticed that in Meta, for example Biology Meta, I have the same reputation as in Biology, but the badges are different. The badges, however, seem pretty random as I own more badges in Meta than I deserved there (as far as I can track anyway). How does the badging system work in meta sites?

Badges earned on per-site meta sites are separate from the main site, but reputation is carried over from the main site (because you don't earn any on Meta).   I perfectly understand keeping the rep the way it is (meta votes are too subjective to integrate them with rep) but the badge split seems odd to me.  Multiple badges are in fact impossible on Meta; Mortarboard, Bounty related badges. In addition badges in general are much harder to earn due to the lower amount of users and content; badges like Great Answer are nearly impossible.   As a result of this, most users on Meta end up with the easy 5-10 bronze badges for basic participation on Meta and not much else; stuff like Supporter and Critic that are hard not to get.   I understand the want to drive more people to meta, so perhaps badges are separate to institute a reward system; however this doesn't seem to work well since Meta badges (mostly) don't appear on the main site. This in combination of the 0 rep gain makes Meta feel almost not real. It also makes part of your progress (badges) on the main site invisible on Meta, and vise versa.  IMO the badges should be the same on both Meta and main site, but more Meta-oriented badges should be added to encourage use of Meta. This way Meta badges feel "real" instead of "Meta".  Is there an official reason for per site metas having separate badges?


When is $\sum_{n=0}^{4}{x^n}$  ($x$ a natural number greater $0$) square ? Any help would be appreciated.

Are there any positive $n$ for which $ n^4+n^3+n^2+n+1$ is a perfect square?  I tried to simplify   \begin{align*} n^4+n^3+n^2+n+1 &= n^2(n^2+1)+n(n^2+1)+1\\  &= (n^2+n)(n^2+1)+1 \\   &= n(n+1)(n^2+1)+1 \end{align*} Then I assumed that the above expression is a square; then  $$ n(n+1)(n^2+1)+1 = k^2$$  $$  \begin{align*} n(n+1)(n^2+1) &= (k^2-1) \\    &= (k+1)(k-1) \end{align*} $$   Then trying to reason with prime factors, but cannot find a concrete proof yet.


I've been trying to use C++ metaprogramming to build constructs such as  f(g<0>(args...), g<1>(args...), ... g<n-1>(args...))   given callables f and g, integer n and variadic arguments args...  However I turn the problem, at some point, I need a nested variadic expansion : one for args... and one for 0 ... n-1, and given the compilation errors I'm getting, I'm wondering if/when it's possible in C++11/14/17, and if not, if there is a clever work-around ?  Below, and example of what I'd like to achieve:  struct add {     template<int n, class A, class B> static inline auto     f(const A & a, const B & b) -> decltype(std::get<n>(a)+b)         { return std::get<n>(a) + b; } };  template<class... Args> void do_stuff(const Args & ... args)     { /* do stuff with args */ }  std::tuple<char,short,int,float,double> data = {1,3,5};  map_call<3, add>(do_stuff, data, 1); //< what I'm trying to do // calls do_stuff(add::f<0>(data,2), add::f<1>(data,1),  add::f<2>(data,1) ) // i.e.  do_stuff(2,4,5)   Where one of the (failed try) implementations of map_call is given below:  // what I tried: template<class Mapped, class Indicies> struct map_call_help; template<class Mapped, int... indices> struct map_call_help<Mapped, std::integer_sequence<int, indices...>> {     template<class Callable, class... Args>     static inline void f(Callable && call, Args && ... args)     {         call( Mapped::f<indices>(std::forward<Args>(args)...) ...);         //                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^      1         //    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2         // nested expansion fails with parse error / expected ')'         // inner expansion is: std::forward<Args>(args)...         // outer expansion is: Mapped::f<indices>(_forwarded_args_)...     } }; template<int n, class Mapped, class Callable, class... Args> inline void map_call(Callable && call, Args && ... args) {     map_call_help<Mapped, std::make_integer_sequence<int, n>>::f(           std::forward<Callable>(call), std::forward<Args>(args)... ); }   integer_sequence related stuff needs #include <utility> and C++14, or it can be implemented in C++11 -- see e.g. answers to  if interested.

In templates, where and why do I have to put typename and template on dependent names? What exactly are dependent names anyway?    I have the following code:  template <typename T, typename Tail> // Tail will be a UnionNode too. struct UnionNode : public Tail {     // ...     template<typename U> struct inUnion {         // Q: where to add typename/template here?         typedef Tail::inUnion<U> dummy;      };     template< > struct inUnion<T> {     }; }; template <typename T> // For the last node Tn. struct UnionNode<T, void> {     // ...     template<typename U> struct inUnion {         char fail[ -2 + (sizeof(U)%2) ]; // Cannot be instantiated for any U     };     template< > struct inUnion<T> {     }; };   The problem I have is in the typedef Tail::inUnion<U> dummy line. I'm fairly certain that inUnion is a dependent name, and VC++ is quite right in choking on it. I also know that I should be able to add template somewhere to tell the compiler that inUnion is a template-id. But where exactly? And should it then assume that inUnion is a class template, i.e. inUnion<U> names a type and not a function?


I am a beginner at Blender and very enthusiastic about the enormous possibilities. It is a flood of options. I started with the creation of a sparkling diamond as a part of a logo for my daughters business. I found a perfect youtube tutorial and succeeded making the diamond. After making the diamond I let turn the animated diamond. It looks very realistic! I am proud at myself! But... When I start rendering the diamond animation or rendering the image I got a very strange result. See my image from the result. I tried in my opinion everything but no result. I run Blender on my iMac Pro. Who can help me?  The image shows the diamond animation in layout. It was constructed using a youtube video (Making Awesome Diamond Shader in Eevee - Blender Tutorial by VFX Mastro). It looks for me as a perfect diamond! Render animation shows on the left the red diamond output using the Evee engine and the output setting on the right side.

I made a character, and its one of my first times texturing, and I saved my character into a new folder, and when I came back to the model ALL the textures were pink, I used to know what to do, but I stopped texturing, how do I bring my textures back?


On his first Christmas at Hogwarts, Harry received his invisibility cloak with a note which said:  Your father left this in my possession before he died. It is time it was returned to you. Use it well.  But there is no name/initial at the end of this note, so who sent it to Harry?

In the Harry Potter film #2 ( The Chamber of Secrets ), there is a moment where Harry says :     " I think it's time to use my dad's old cloak again. "   ( Sorry if I misquoted by a word or two )  We only see in film #1 ( The Philosopher's Stone ) that Harry gets the cloak as a Christmas gift, but it is not explained who gave it to him or whose it was before. So I wonder, where did Harry learn that this cloak belonged to his father and who presented it to him ?


so I got the new update, and when I went into the game, professor willow came up like when I started playing. I tried to login with google but it didn't work, and now when I try to log in, the choice to log in with google won't even come up anymore!

I downloaded the July 30th update for Pokemon Go and when I open the app I'm prompted to login, But once I login, it redirects me to this page on Cookies::     If I click "Done" in the top left, it prompts me to login again! I've tried reinstalling the game, restarting my phone, etc. I can't much enable Cookies on the inline Safari browser. It doesn't make sense, and cookies are on in Safari (because I don't use Safari and they're enabled by default).  How can I fix this?


int main() {     return 0; }   Who receives the value 0 after executing the main function? and what is this value used for after that?

What is the correct (most efficient) way to define the main() function in C and C++ — int main() or void main() — and why? And how about the arguments? If int main() then return 1 or return 0?  There are numerous duplicates of this question, including:       — For C++, with a very good answer indeed.     Related:


Hi guys I today started up my pc today(like any other day) and suddenly on desktop my pc freezes completely ctrl+alt+del doesn't work.  So I restarted my pc and suddenly it gave me the bootmgr is missing error, I then unplugged my ext hdd(not that it normally gave me issues) to then get the next issue which is "Reboot and select proper boot device or insert boot media in selected boot device and press a key".  I have no idea where this issue came from, it's all so sudden.   What I did so far is:  Restart it a few times. Check my bios for the boot priority(My SSD is all of a sudden missing) only my disk drive is detectable. Noticed my Bios build is 1107, My motherboard is the Asus P8H67M-Pro, went to the site and saw the latest build 1502 so it's quite outdated although it doesn't reach windows since my ssd is missing so I can't safe start to update my bios.  My SSD is by the way not new, I didn't add anything to my pc external nor internal and my SSD brand is OCZ Vertex 4 120gb. Also I opened up my pc because I read my ssd should be on the sata 0 but I don't see any numbers on the cables for I'm also uncertain which it needs plugged in.  Please help me, thanks in advance.

My computer no longer boots Windows or the installed operating system. Instead, I may get this error:  PXE-E61: Media test failure, check cable -or- Check cable connection!  PXE-M0F: Exiting PXE ROM.   and/or one of the following messages or similar:  Operating System not found  No boot device available- No bootable devices--strike F1 to retry boot, F2 for setup utility  No bootable device -- insert boot disk and press any key  No Boot Device Found. Press any key to reboot the machine  Default Boot Device Missing or Boot Failed  Reboot and Select proper Boot device or Insert Boot Media in selected Boot device   What does this mean and what can I do?     This question comes up often and the answers are usually the same. This post is meant to provide a definitive, canonical answer for this problem. Feel free to edit the answer to add additional details.


When running all test classes from the Setup menu in a Sandbox org at the same time, I am receiving the error "System.DmlException: Insert failed. First exception on row 0; first error: UNABLE_TO_LOCK_ROW, unable to obtain exclusive access to this record:" on occasion which causes the test class to fail.   If I rerun one of these failed tests by itself, the error does not occur. However, I am concerned with what will happen when I go to move these tests to the Production org. Will this locking issue be an issue there as well? Or should I be making a code update to prevent this from happening?

In spring13, I am getting UNABLE_TO_LOCK_ROW error in my few test classes while running all test classes in new view provided in spring13 release. But in winter12 I don't get any error like this. Do I have to do anything to make it work? Any Thoughts?


I finished my Master one year ago and now I am writing a paper from my master thesis. But now i am a PhD student in another university (another country). Which affiliation i should write in the paper?. Is it ok to write both university names on paper?  Thanks

I began working on a paper during my undergraduate degree in the summer of 2014. I continued to work on the same paper into summer 2015, at which time I graduated and moved to a different university to pursue a graduate degree. However, all experiments failed and my collaborators and I were unable to produce any meaningful results. In fall 2015, while enrolled in graduate studies at the second university, I realized that the question at the centre of this paper could be answered using a completely different method. I contacted my collaborators and we have been able to produce some great results.   Now I am writing the paper and wondering what I should list as my affiliation, since the project was begun at one university but overhauled and completed at another. I see four options:    The old university The new university Both the old and new universities The old university, with a “present address” note    What is standard practice in a situation like this, where work is begun in one lab but completed in another? Does the re-design of the project from the second university complicate the issue?


I have a question about external JavaScript and SEO. Assume I have a site called example.com with and index page of:  <html> <body>   <div class='main-container'>     <script src='http://www.other.com/page.js'></script>   </div> </body> </html>   and   // at http://www.other.com/page.js document.write('blue fish and green grass');   Will Google crawl what is outputted by www.other.com/page.js? Are there any techniques or strategies to make that content crawlable so that the text 'blue fish and green grass' was indexed?   Edit:  This  seems to suggest that it is not but is also somewhat dated.

Does the Google spider knows how to render JavaScript, or only HTML?


In my bash script I want to check that date values provided via command line arguments by the user, have yyyy-mm-dd format. So for example, the date August 10th 2020 has to be written as 2020-08-10. Here is the test that I've written for pattern matching via a regular expression: #!/usr/bin/bash  dateval="2020-08-10" regexp="^[0-9]{4}-[0-9]{2}-[0-9]{2}$"  if [[ ! "${dateval}" =~ "${regexp}" ]] then     echo "Date format is not valid" else     echo "Date format is valid" fi  This prints "Date format is not valid" and I don't understand why as the date value being tested is indeed in good format. Could you kindly make some clarification and indicated what I misunderstand?

The following code  number=1 if [[ $number =~ [0-9] ]] then   echo matched fi   works. If I try to use quotes in the regex, however, it stops:  number=1 if [[ $number =~ "[0-9]" ]] then   echo matched fi   I tried "\[0-9\]", too. What am I missing?  Funnily enough,  suggests this should work.  Bash version 3.2.39.


In Data Studio I can connect to a sever/database, go down to Users And Groups, right-click on Users and add a new one. But the program never asks me for a password. How can I specify it? Also, no matter how many times I tried to "Save changes" they are never saved. I even tried to "generate change" and run it, but it always fails. I am connecting as the only user that exists on the server: db2admin. If db2admin has no authority to manage users, then who has?

I'm struggling here on how to do this I couldn't find anywhere or won't be able understand the documentation.  So I'm connected as a DBA user on a DB2 client (TOAD for example) and I want to create a new user to the database from this client, I went to the User tab, right click on it and chose the Add User option.   There is no place to add the user password. Even confirming the create command the user appears on the users list.   So I went to the command line tool and try to create a new using the GRANT command as:  GRANT DBADM WITH DATAACCESS WITH ACCESSCTRL ON DATABASE TO USER TEST;   The user gets created (I see it on the user tab on TOAD) but I'm unable to connect with it because I didn't define the password.  So, how can I define a password for newly created user on DB2 that it is not an OS user?


When a moderator edits someone else's chat message and submits the edit, the reply button on the message's hover menu disappears.  Some chat conversations revealed this was initially by-design: the system used to be that the reply ping went to the last editor. Having tested this out in chat, that's no longer the case: the reply ping pings the message's author, regardless of edits.  However, it appears the client-side disabling behavior hasn't been changed, and still removes the reply option. This is fixed by a reload, but the button should in theory remain there.

Here's this message from Sathya:    It usually shows like this in the rooms when you're in another chat room:    I edited the post to change a word repetition that sounded weird (Can you tell I'm bored and we don't have any flags in our queue?), and suddenly it changed the author to me:    What happened here?


I managed to set up selective sync in Dropbox once before but now I can't work out how I did it. I want to set Dropbox to "selective sync" so that I don't end up with all my personal files on my work computer.  I've got it running on Ubuntu, Windows 7, and Mac OSX 10.5.

I have a desktop machine with plenty of space with Dropbox set up.  I also have a netbook with limited space.  Is there any way to set up my netbook to sync only with certain folders in my Dropbox (i.e., sync my 10 MB of documents not my 100 GB of pictures). I also have some Ubuntu machines and some Windows machines so advice for both would be welcome.


I've just got my new Ubuntu Touch, how do I import my contacts if I have them saved in my Google account?

I have flashed a phone with Ubuntu for Phones and would like to get my contacts from Google onto the device. How do I do that?


I'm trying to find $\displaystyle\int\frac{1}{(x^2-1)^2}dx$. Partial fractions just gives me the same fraction. When I try trig substitution, I end up with $\dfrac{\cos^2(x)}{\sin^3(x)}$. What am I doing wrong? What can I do?

I was having a bit of trouble with an integral  $$\int {1 \over (x^2-1)^2}dx$$  It was given as a partial fractions problem, and I tried a substitution of  $x=sec(\theta);dx=sec(\theta)tan(\theta)d\theta$  to get $$\int{{\sec(\theta) \tan(\theta)}\over{\tan^4(\theta)}}d\theta=\int{\cos^2(\theta)\over \sin^3(\theta)}d\theta$$  but I can't seem to move past this. Any suggestions would be greatly appreciated.


$string = trim($_POST['string']) $sql = "INSERT INTO table (string) VALUES(:string)"; $query = $db->prepare($sql); $query->execute(array(     ":string" => $string ));   Can this block of code prevent SQL injection?  EDIT: This is the connection that I am making to the database. Does the charset of this code allows the above block of code to be executed and prevent the SQL injection?  //database credentials define('DBHOST','localhost'); define('DBUSER','root'); define('DBPASS',''); define('DBNAME','table');  //application address define('DIR','http://localhost/'); define('SITEEMAIL','noreply@example.com');  try {  //create PDO connection  $db = new PDO("mysql:host=".DBHOST.";port=3306;dbname=".DBNAME, DBUSER, DBPASS); $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);     $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);  } catch(PDOException $e) { //show error echo 'Looks like server is down please check back later'; exit; }

Let's say I have code like this:  $dbh = new PDO("blahblah");  $stmt = $dbh->prepare('SELECT * FROM users where username = :username'); $stmt->execute( array(':username' => $_REQUEST['username']) );   The PDO documentation says:     The parameters to prepared statements don't need to be quoted; the driver handles it for you.   Is that truly all I need to do to avoid SQL injections?  Is it really that easy?  You can assume MySQL if it makes a difference.  Also, I'm really only curious about the use of prepared statements against SQL injection.  In this context, I don't care about XSS or other possible vulnerabilities.


Let $\Omega \subset \mathbb C$ be an open and connected set, such that $\overline{D_1} \subset \Omega$. Let $f:\Omega \to \mathbb C$ be a holomorphic function with $f(z) \in \mathbb R$ for all $z$ such that $|z|=1$. Show that $f$ is constant.  I couldn't do much of the problem. I've defined the function $e^{if(z)}$. So, for $z : |z|=1$, $e^{if(z)} \in \partial D_1$. I don't know if this is of any help. I would appreciate suggestions, maybe defining this function is not useful.  Addition from editing:  From what I've seen here , using the maximum modulus principle, if $e^{if(z)}$ is non-constant on $D_1=\{|z|<1\}$, then $e^{if(z)}$ attains its maximum and minimum on $\partial D_1$. If we consider $e^{if}$ and $e^{-if}$, then $|e^{if(z)}|=1=|e^{-if(z)}|$ for all $z : |z|=1$. But then $$(1) \space |e^{if(z)}|\leq 1, |z|<1,$$ and $$(2) \space |e^{-if(z)}|\leq 1, |z|<1$$.  From (1) and (2) it follows $|e^{if(z)}|=1$ for all $z :\{|z|\leq 1\}$, which means $e^if$ is constant on $D_1 \implies f$ is constant on $D_1$.  I don't see how can I deduce from here that $f$ is constant on $\Omega$ just by the fact that $f$ is constant on $D_1$.

Let $f(z)$ be entire function. Consider the functions $e^{if(z)}$ and $e^{−if(z)}$ and applying the Maximum Modulus Theorem, show that if $f(z)$ is real when $|z| = 1$, then $f(z)$ must be a constant function.  (We take $f(z)=u(z)+iv(z)$)  I am confused as so far I have $|g(z)|=|e^{if(z)}|=|e^{-v(z)}|$ and then since $f(z)$ is real, $f(z)=u(z)$ and $v(z)=0$ so I assumed it would follow that $|g(z)|=|e^{v(z)}|=1$.  Similarly, $|g(z)|=|e^{-if(z)}|=|e^{v(z)}|=1$.  Using Liouville I assumed one could say that both $g(z)$ and $h(z)$ are bounded entire functions, they are constant and so it follows that $v(z)$ is constant, meaning that both its partial derivatives are equal to 0 and, due to Cauchy Riemann, both of the partial derivatives of $u(z)$ are equal to zero.  It would then follow that $f(z)$ is constant.  I don't know how to go about the question using the Maximum Modulus Theorem, also I feel I am overlooking the importance of $|z|=1$ perhaps?  Any help would be much appreciated!!


I am investigating some odd behaviour on a sub-net, where host registration doesn’t list some of the IPs that some users report having. Now that I’ve seen evince, i want to passively scan for the presence of a rouge DHCP server, not listed in my domain. How might I do that?    Or rather, are there any Linux tools to list the DCHP servers within a domain? (I might write a script to search randomly, as I suspect the rouge DHCP server is not on all the time, or perhaps not acting as a DHCP server all the time.)

What's the best approach towards determining if I have a rogue DHCP server inside my network?  I'm wondering how most admins approach these kinds of problems.  I found  through searching, and thought about trying it out.  Has anyone had experience with it? (I would like to know before taking the time to compile it and install).  Do you know any useful tools or best-practices towards finding rogue DHCP servers?


I am trying to achieve an on-click event on multiple buttons with the help of jQuery.  These buttons are coming from php file.   php code:  <?php        require_once './common/db_connect.php';         $db_connection = db_connect();         $select_query = "SELECT term_id, term, status, active FROM term WHERE active = 1";         $statement = $db_connection -> query($select_query);         $result = $statement -> fetchALL(PDO::FETCH_OBJ);         foreach($result as $row) {             echo '
';                 echo ''.$row->term.'	';                 echo '<button value="'.$row->status.'">'.$row->status.'</button>	';                 echo ''.(($row->active == 1) ? 'Yes' : 'No').'	';                 echo '<button class = "delete" data-id='.$row->term_id.'>Delete</button>	';             echo '
';         }     ?>   In the above code, I have a button with class="delete" and on this, I like to have an on-click event but it is not working.  jQuery code:

I have a bit of code where I am looping through all the select boxes on a page and binding a .hover event to them to do a bit of twiddling with their width on mouse on/off.  This happens on page ready and works just fine.  The problem I have is that any select boxes I add via Ajax or DOM after the initial loop won't have the event bound.  I have found this plugin (), but before I add another 5k to my pages with a plugin, I want to see if anyone knows a way to do this, either with jQuery directly or by another option.


I am working with two curves $C$ and $D$ defined over the same finite field, with $C \cong D$. I know that the genus of $C$ is $g_C=2$. Can I say that the genus of $D$ is $g_D=2$?

I would like to know how to prove (or even better to see a full proof) of the following "fact".          Let $C_1$ and $C_2$ be two smooth curves and let $\phi : C_1 \rightarrow C_2$ be an isomorphism. Then     $$ \text{genus}(C_1) = \text{genus}(C_2) $$      I am not completely sure this is true since I haven't seen this result explicitly stated, but I Imagine it has to be true.   The motivation for this comes from an exercise from Silverman's book The Arithmetic of Elliptic Curves. I was doing the following exercise and I found that I needed the above mentioned fact in order for my argument for $(i) \implies (ii)$ to work.          2.5 Let $C$ be a smooth curve. Prove that the following are equivalent (over $\bar{K}$):          (i) $C$ is isomorphic to $\mathbb{P}^1$.          (ii) $C$ has genus $0$.          (iii) There exist distinct points $P, Q \in C$ satisfying $(P) \sim (Q)$      I've thought about it but unfortunately I don't really see how to easily relate the dimensions of the Riemann Roch spaces associated to each curve.   I would really appreciate some help with this.   Thank you.


I am moving from https://www.exampleA.com/ to https://www.exampleB.com/directory/. This is because the old site is now a part of a larger company so we are moving it into its directory. For this reason I am not redirecting to the root.   The problem is now I cannot use GSC change of address tool.   All my redirects are in place and those are fine. Is there a workaround I can do with redirects so I can use the change of address tool? If not, what are the downsides to not using it? I'm guessing Google will not transfer authority, seo value, etc. to the new domain?

Is it possible to tell Google's Webmaster Tools that our site hosted on www. has moved to a sub folder, sub domain or a new domain with sub folder?


In my  on command prompts, the examples all seems to show the computer name and username as the only thing at the "prompt", ie MacBookPro:Documents user$ However when I open terminal, the prompt reads: codybugstein@TL-WA855RE ~ %  Where does this come from? How is it generated? What is the @ sign? And why is my router model in there? Thanks!

When I wake my Mac mini from sleep, it occasionally comes up with a dialog saying "The name of your computer "whatever" is already in use on this network. The name has been changed to "whatever (1)"" (or (2), I'm up to (4) at the moment).  The Mac is plugged in to the network via an ethernet cable and gets a DHCP assigned IP address from my router which runs pfSense. I have DHCP set to give the same IP address to the Mac's Mac.  Why does this happen, and more usefully, how can I make the machine stop renaming itself?  In System Preferences - Sharing I have 'File sharing' and 'Remote Login' enabled.


I have a Rexex Problem I cannot solve: I would like to analyze lines like the following five examples and put them into groups:  [0xA100] Test Name #1: TestValue #1 [0xB163] Test Name #20: TestValue #2 [0xC162] Test Name #330: TestValue #3 [0xD111] Test Name #400: TestValue #4 [0xE113] Test Name #5000: TestValue #5: xyz   The first group shall contain everything between [0x and ]  The second group shall contain everything until the first appearance of a :   The third group shall contain everything after the first appearance of a :  I solved this with the following Regex:  (\[0x.*\])(.*):(.*)   Unfortunately this does only work, if I have only double dot in my string. With two or more double dots, the Regex always finds the last occurence.  How can I force to always take the first appearance of the double dot?

I have this gigantic ugly string: J0000000: Transaction A0001401 started on 8/22/2008 9:49:29 AM J0000010: Project name: E:\foo.pf J0000011: Job name: MBiek Direct Mail Test J0000020: Document 1 - Completed successfully  I'm trying to extract pieces from it using regex. In this case, I want to grab everything after Project Name up to the part where it says J0000011: (the 11 is going to be a different number every time). Here's the regex I've been playing with: Project name:\s+(.*)\s+J[0-9]{7}:  The problem is that it doesn't stop until it hits the J0000020: at the end. How do I make the regex stop at the first occurrence of J[0-9]{7}?


Does there exist a number which contains in its digits all of the prime numbers listed in order: $$2.3\,5\,7\,11\,13\ldots\ldots$$  if so, will it be rational or irrational &/or transcendental?

Is the following number transcendental? $$0.23571113171923293137\dots$$(Obtained by writing prime numbers consecutively from left to right, in the decimal expansion)


First of all, I know that there have been discussed a few threads on similar topic, but the threads didn't cover all my questions. How do you choose whether to use these, or those, or the + noun when posting replies to the thread? For instance, there are some random sentences, which I've just made: 1) The first post Don't do it! If you do it, I'll be angry with you.  Did you hear it?  What? I didn't. What is the first answer supposed to be for the first post?  a) These sentences are wrong. — This would be my personal preference   b) Those sentences are wrong.  c) The sentences above are wrong.  (Note: These/those/the sentences above are intended to be  Don't do it! If you do it, I'll be angry with you. Did you hear it? What? I didn't.) 2) The first post  Don't do it! If you do it, I'll be angry with you.  Did you hear it? What? I didn't. a) The first answer *These/those/the sentences are wrong. — I would choose these in this case.  I don't know. Bad things happen.  *(Note: These/those/the sentences above intended to be Don't do it! If you do it, I'll be angry with you. Did you hear it? What? I didn't.) b) The second answer *These/those. — This time, I would choose either those or 'The sentences in the first post are wrong'. Okay. I'll keep it in mind.  Good bye.  *(Note: These/those/'the sentences in the first post' are intended to be Don't do it! If you do it, I'll be angry with you. Did you hear it? What? I didn't.)

First of all, I'm not a native English speaker, but in school I learned that these is used if referring to something near, and those is used when referring to something far away (temporally or locally). But now I'm sometimes watching English movies and notice sentences like "Have you seen those boots?" while the boots were only centimeters away. Is this just not correct, or have I learned the wrong rules?  Another question is, what if I'm referring to something abstract such as ideas or thoughts so that I can't say if they are far away or not. Should I use those or these?  Edit  So it can't be really wrong in any case if I use these respectively those?


I have a class like this one:  class Tickets{     Data data;     class Data{         String departure;     }     public String getDeparture(){         return data.departure;     }  }   When I try something like this:  Tickets tickets=new Tickets(); if (tickets.getDeparture!=null)   I get nullpointerexception on this check. Why is that so? How can I avoid it? What to do instead? Thanks for help.

What are Null Pointer Exceptions (java.lang.NullPointerException) and what causes them?  What methods/tools can be used to determine the cause so that you stop the exception from causing the program to terminate prematurely?


I have a column in my dataset that contains a dummy-variable educ_pers if the educational level of the respondant is the same as his/her parents'. Each row in this dataset is one respondant. The data looks somewhat like this: set.seed(1) Data <- data.frame(   idno = sample(1:10),    educ_pers = sample(c("1", "0"), 10, replace = TRUE) )  where idno is the id number of the respondant and educ_pers indicates whether the indivdual has the same educational level compared to his/her parents educ_pers==1 and educ_pers==0 if educational levels differ. To obtain the educational persistance, I would like to calculate the probability of a randomly chosen individual from the cohort to have educ_pers == 1. If possible, a 95% confidence interval around the probability would be ideal! Thanks a lot in advance!

I have a random sample of Bernoulli random variables $X_1 ... X_N$, where $X_i$ are i.i.d. r.v. and $P(X_i = 1) = p$, and $p$ is an unknown parameter.  Obviously, one can find an estimate for $p$: $\hat{p}:=(X_1+\dots+X_N)/N$.  My question is how can I build a confidence interval for $p$?


I am a math student and I am taking my first physics course of Mechanics. But I don't know the difference between the $w=mg$ force and $F=G\cfrac{m_1 m_2}{r^2}$ (why we don't use the first one when talking about the interaction between our planet and me).   For me, the two forces are related since $g$ is the gravitational acceleration. I know that $F=G\cfrac{m_1 m_2}{r^2}$  is the force with which the earth attracts us (because we have mass).

Newton's Law of Universal Gravitation tells us that the potential energy of object in a gravitational field is $$U ~=~ -\frac{GMm}{r}.\tag{1}$$  The experimentally verified near-Earth gravitational potential is  $$U ~=~ mgh.\tag{2}$$  The near-Earth potential should be an approximation for the general potential energy when $r\approx r_{\text{Earth}}$, but the problem I'm having is that they scale differently with distance.  $(1)$ scales as $\frac 1r$.  So the greater the distance from the Earth, the less potential energy an object should have.  But $(2)$ scales proportionally to distance.  So the greater the distance from the Earth, the more potential energy an object should have.  How is this reconcilable?


I have been looking in to alternating current and I am confused. If the voltage reverses doesn't the flow of electrons also reverse? I am aware of another fair answer on this site . That answer, however, confused me just a bit. I gathered that the electrons do not per se "flow." Is this true? How is the electrical current moving?

If electrons in an alternating current periodically reverse their direction, do they really flow? Won't they always come back to the same position?


I have FinancialForce installed in my SF instance, I want to deploy 3 new components from my sandbox environment 100% covered, but always I'm receiving the same deployment error related to Financial-force Triggers.    Is there any possible way to deploy my code or to cover those components?

I have several AppExchange apps installed that are failing tests. What is the recommended approach to resolving this? Are tests run when a new package is installed? Is there a way to determine what is actually failing besides the name of the method and something like "expected true, actually false"? The test results rarely show enough information to be useful.   What I'm doing atm, is checking for updates for the packages, and then writing the company with the failing test results.   Any feedback would be appreciated.


The universe started at the big bang around 15 billion years ago. The universe is now at least 92 billion light-years in diameter.   Together, don't these mean that the universe, at some time in the past or present, was expanding at a rate of faster than 1 ly/y in every direction? Why is that possible?

The observable universe is approximately 13.7 billion years old. But yet it is 80 billion light years across. Isn't this a contradiction?


Okay so I am using this GPS location from  and I keep getting Null Object reference and not sure why.Here is my code:   boolean permissionGranted = ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED;      if(permissionGranted)     {         if (GPS.sharedInstance(AppDashboard.this).canGetLocation() && GPS.sharedInstance(this).isPermissionEnabled()) {             double lat = GPS.sharedInstance(AppDashboard.this).getLatitude();             double lon = GPS.sharedInstance(AppDashboard.this).getLongitude();             Log.e(TAG, "Location: " + lat + "/"+ lon);         }         else         {             Log.e(TAG, "Can't get GPS locations");         }     } else {         ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.ACCESS_FINE_LOCATION}, 200);     }   My Manifest:  <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> <uses-feature android:name="android.hardware.location.gps" />   My Logcat:  Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'double android.location.Location.getLatitude()' on a null object reference at com.gpsApp.utility.GPS.getLatitude(GPS.java:113)   And GPS Class 113  public double getLatitude() {     if (_locationManager != null) {         _latitude = _location.getLatitude();     }      return _latitude; }


I totally get what division means in the real world.  "dollars / hour", well, that's the number of dollars you will make in one hour.  "kilometers / gallon" is the distance you can go with a gallon of gas.  Division means that given a certain amount of one thing, you'll get a certain amount of another thing.  I'm so good with division that you could give me a ratio I've never seen before and I can tell you what it means.  "Burgers / McDonalds"?  It's the average number of burgers a McDonalds will produce.  "Dolphin / Miles"?  Every mile you drive, you get this amount of dolphins.  Multiplication on the other hand makes no sense at all.  What the heck is a foot-pound?  And I don't really mean the definition.  I mean, what does multiplication actually do for these two values?  What does multiplying two values say about their relationship?  What if I were to say kilometer-hours? Or dollar-kilograms? Or dolphin-miles?  What would those things mean?    Bonus points go to explaining this in a very simple, clear manner.

I can easily understand what divisive units imply, but not what multiplicative units imply.    What I mean is, when I read "$12 \:\mathrm{eggs/carton}$", I mentally convert it to, "There are 12 eggs for each carton". I get that.  But, when I see units like joules * seconds, $\:\mathrm{J \cdot s}$, it really bothers me for some reason. I'm not sure what it's saying. It's not saying the amount of joules expended over a certain time-frame, otherwise it would be joules/second, wouldn't it? So, when I read units like joules * second, I try to relate it to my egg-carton analogy, and it comes out like this:  "There are 12 eggs for each reciprocal of a carton."    It just doesn't make any sense for me. Is this a problem for anybody else? Should this be on math SE? Is this even a valid question or am I just asking why $2 + 2 = 4$?


My rails site posts to a secure host (e.g. '') when the user logs into the site.  Session data is stored in the database, with the cookie containing only the session ID.  The problem is that when the user returns to a non-https page, such as the home page (e.g. '') the user appears to have logged out.  I believe the reason for this is that a separate cookie is stored for each host (www vs. secure).  Is this correct?  What is the best secure way to persist the session between both the http and https sections of the site?  Does anyone know of any plugins that address this problem?  The site runs on Heroku.

I have a 2.2.3 app which I upgraded to 2.3.2  It's a multi-site (using subdomain) that creates one top level session for all sites.  This is how I change the domain in production.rb:  ActionController::Base.session_options[:domain] = "example.com"  # in rails 2.2.2, this is what i used to do: # ActionController::Base.session_options[:session_domain] = "example.com"    Strange things started to happen after I upgraded I can no longer log in using restful authentication; it does authenticate me, but as soon as I'm redirected, it would ask me to log in again.  As I said, I use restful_authentication and I also use passenger 2.1.2. Can anyone help?


If you are in a moving train or in a bus, what you observe is that the trees which are nearer to you move opposite to the direction of your motion. But the trees which are very far away from you, appear to be moving along with the direction of motion. Why it happens?

When you run or ride bike at night if you observe the moon you feel like he moves along with you as the same speed you are going. Why?


I've been working on a small personal project and mainly polishing the IO aspect of the program.   I'm mainly having trouble with one method, which is responsible of calling two methods that read one line of text document and dissect it to find a certain string.  public boolean noSavedGame(){     boolean noGameFound = false;     read();  //method reads the text document that can have multiple lines     String temp = find();  //method finds the property and returns it in a string      if(temp == "none"){          System.out.println("Saved game not found");         noGameFound = true; //a saved game WAS NOT FOUND      }     else{         System.out.println("saved game found");         noGameFound = false; //a saved game WAS FOUND         propertyDetail = temp;     }      return noGameFound; }   So, the first line of the text document looks like this:  <pastSavedGame> - none   read() correctly takes that line and find() correctly returns "none" as its supposed to return the property.   But the conditional is not working right. Even though temp equals "none", the if-statement is executed, not the else statement. At first, I thought whitespace was an issue, but does not seem to be a factor.  I apologize for what may be a very simple question, but I am new to Java. Thank you for the help.

I've been using the == operator in my program to compare all my strings so far. However, I ran into a bug, changed one of them into .equals() instead, and it fixed the bug.  Is == bad? When should it and should it not be used? What's the difference?


I am running Windows 8.1 and downloaded Windows 10 for installation on another machine. I have a 128 B SanDisk Cruzer Blade USB drive that had other backed-up files on it.  After the files had been loaded by the Media Creation Tool all of my other data on the USB drive was gone and now it is only the 3.13 GB of data for Windows 10 and 28.8 GB free space.  Where did my data and the other 90GB go?

What steps can I take to try to recover lost or inaccessible data from any storage device?  Answers:   This applies to any computer storage device, e.g. internal/external hard drives, USB sticks, flash memory. The most important thing is to STOP using it, any type of I/O can ruin your chances of a recovery.     We have separate questions covering common problems with USB flash drives in greater detail:


While writing a small library to automate some path-drawing functions, I noticed that using defined arguments to replace hard-coded TikZ path options returns an error. Since I'm using the \def command to share common, user-given arguments between functions, this is hindering me quite a bit.  Here is a small MWE:  \documentclass[tikz]{standalone} \begin{document} \begin{tikzpicture}         \node[circle,draw] (example1) at (0,0) {1};         \node[circle,draw] (example2) at (1,0) {2};          % this works as expected         \draw (example1) to [out=20,in=160] (example2);         % this doesn't work         \def\pathArguments{out=340,in=200}         \typeout{\pathArguments} % returns 'out=340,in=200', as expected         \draw (example1) to [\pathArguments] (example2); \end{tikzpicture} \end{document}   Expected output:    Actual output:    Error: line 12: Package pgfkeys Error: I do not know the key '/tikz/out=340,in=200' and I am going to ignore it. Perhaps you misspelled it. ... (example1) to [\pathArguments] (example2)  I've even added a typeout to check if maybe the \pathArguments get modified in any way, but if one were to simply copy the result of the typeout in the square brackets instead of \pathArguments, the output is as expected.

I've made a matrix in a beamer presentation and I'm trying to style the nodes.  \newcommand\foo{row 1/.style={inuse}} \begin{frame}{Chunks}   \tikzset{     inuse/.style={text=red},     free/.style={text=green},     addr/.style={minimum width=3em},     data/.style={nodes=draw,minimum width=6em},   }   \scalebox{0.6}{   \begin{tikzpicture}[node distance=2mm]     \matrix(magic) [matrix of nodes,ampersand replacement=\&,row sep=-\pgflinewidth,                     column 1/.style={addr},                     column 2/.style={data, column sep=1em},                     %row 1 column 2/.style={inuse},                     %\foo ,                     %\foreach \r in { 1,2,3 } {row \r column 2/.style={inuse}, }                     column 3/.style={addr},                     column 4/.style={free, data, column sep=1em},                   ]     {       100: \& 00000010 \& 110: \& 12345678 \& 120: \& 12345678 \& 130: \& 12345678    \\       101: \& 00000001 \& 111: \& 12345678 \& 121: \& 12345678 \& 131: \& 12345678    \\       102: \& 00000002 \& 112: \& 12345678 \& 122: \& 12345678 \& 132: \& 12345678    \\       103: \& 00000003 \& 113: \& 12345678 \& 123: \& 12345678 \& 133: \& 12345678    \\     };   \end{tikzpicture} } \end{frame}   Of the three commented out lines, the first works and the other two fail. For the \foo macro I get:  Package pgfkeys Error: I do not know the key '/tikz/row 1/.style={inuse}' and I am going to ignore it. Perhaps you misspelled it.   But if I stick the macro body where I tried to use it, no problem. Clearly I'm missing something fundamental about macros, but what?  Invoking \foo in the tikzset gave the same result.  The foreach gives me something totally cryptic:  ! Undefined control sequence. \foreach ...reach \let \pgffor@assign@before@code                                                    =\pgfutil@empty \let \pgff...   Any help much appreciated.


I am trying to hunt down this story for my boss (one of two stories he has me hunting). He can remember the plot but has no idea re: author or title.   Apparently in the story aliens take over humans by having them perform music or artistic works. One human then shoots all the aliens in his quest to be a hero (even though the aliens were having the humans produce beauty and art instead of destroying them).  Any help or suggestions greatly appreciated thanks.

The collection included 'The Newt' and 'The Hero Equation'.  I am looking for the authors of these stories and the title of the anthology.  The Newt is about newts living inside people and the only way to remove them is for somebody else to declare "I don't believe you have a newt inside you".  The Hero Equation is about aliens who take over humans by having them perform music or artistic works. One human then shoots all the aliens in his quest to be a hero (even though the aliens were having the human produce beauty and art instead of destroying them).


I'm about to finish up a BA in linguistics and am looking at some interdisciplinary options for grad school (specifically in cognitive science).   I have a competitive GPA in my last two academic years, though my first year was a bit of a wash to say the least.   I was thinking that it would be a good idea to go back for a second degree for the following reasons:   to boost my cumulative gpa (my academic performance in first year was a pretty big blow to my cgpa) to gain a better understanding of my research interests. (There are certain science courses that I haven't taken that make me feel downright incompetent without, such as first year physics and math.)   However, I'm acutely aware that I know nothing when it comes to grad school admissions, especially when it comes to interdisciplinary programs such as cognitive science. Is a second degree worth it?

I have finish my BSc in physics. I want to work in a interdiscipline like biophysics or econophysics. Because these are mainly physics, one can study higher with spending little effort to understand biology or economy concept. However, I think that having a stable knowledge in other discipline would also help you better in researching. Since I have studied physics, mathematics isn't a problem, therefore I can skip it to shorten the study time, which means the amount of time I spend will approximate to the master degree duration (I hope so). Another point is I can be more flexible than one who only know his/her specialization.  The biggest disadvantage is I don't have a master degree, of course.


I have vf page:    <apex:page standardController="case" extensions="Gss_CsHelathCheckExtension"  recordsetVar="lstAllUserData" sidebar="false" showHeader="false"> <apex:includeScript value="/lightning/lightning.out.js" /> <apex:includeLightning /> <div id="lightning" /> <script> var myList = {!lstSelUserDataIds};  $Lightning.use("c:GSS_CsHealthCheck", function(){     $Lightning.createComponent(         "c:Gss_CaseHealthCheck",         {caselist :myList},         "lightning",         function(cmp){             $A.eventService.addHandler({                 event: 'force:navigateToObjectHome',                 handler: function(event) {                     if (sforce && sforce.one) {                         // VF page in S1 or Lightning Exp                         sforce.one.navigateToObjectHome(event.$params$.scope);                     } else {                         // VF page in Classic                         // Ugg! We need an if branch for each possible object type.                         // Is there a better way of doing this?                         if (event.$params$.scope === 'Case') {                             window.location = '{!URLFOR($Action.Case.Tab, $ObjectType.Case)}';                         }                     }                 }             });          }); }); </script>     GSS_CsHealthCheck  <aura:application access="GLOBAL" extends="ltng:outApp" > <aura:dependency resource="c:GSS_CaseHealthCheck"/>   <aura:dependency resource="markup://force:*" type="EVENT"/>  </aura:application>   GSS_CaseHealthCheck.CMP  <lightning:button variant="brand" label="Cancel" onclick="{!c.CancelPage}" />   Js:  CancelPage:function(component,event,helper){      //window.history.back();     var event = $A.get('e.force:navigateToObjectHome');     event.setParams({         scope:'Case'     });     event.fire(); }   ERROR:     This page has an error. You might just need to refresh it. Action failed: c:GSS_CaseHealthCheck$controller$CancelPage [Cannot read property 'scope' of undefined] Failing descriptor: {c:GSS_CaseHealthCheck$controller$CancelPage}   I have refereed below post:

This is a simple component, not sure what I am missing, this is exactly referred in the docs:   Component:  <aura:component >     <aura:handler name="init" action="{!c.navigate}" value="this"/> </aura:component>   JSController:  ({     navigate : function(component, event, helper) {         var urlEvent = $A.get("e.force:navigateToURL");         urlEvent.setParams({             "url": 'https://www.google.com/maps/place/'         });         urlEvent.fire();     } })   Error:  This page has an error. You might just need to refresh it. Action failed: c:navigatetoURlcmp$controller$navigate [Cannot read property 'setParams' of undefined] Failing descriptor: {c:navigatetoURlcmp$controller$navigate}


I have an image that I have created which is basically paired image with two bands:  band 1 is NDVI image from Sentinel 2 band 2 is SAR image from Sentinel 1  I have tried to export this image to my drive and I get the next error:     bands must have compatible data types; found inconsistent types:   Float32 and Float64.   I have seen here few posts about the same error, but couldn't fix it:  I have tried to change it to int16, and it worked, but i'm afraid I'm losing data. I have tried to use the same code but instead of 16 to put 32 but i'm afraid I'm losing data from the 64 and to be honest I couldn't understand really the different between the different numbers. Also, I couldn't use toUint64(). When I upload the int32 image to QGIS, I got black square with values of 0. I don't really need the visualization but I'm worried that I have gotten values 0 and I don't have any value.   pairedImage = pairedImage.toUint32();  Export.image.toDrive({   image: pairedImage,   description: 'imageToDriveExample',   scale: 20,   region: geometry }); print('Paired Image',pairedImage);    My end goal is to understand what are the consequence of this, which data I might lose and how I can keep my data.

I'm trying to export a tiff map and gave the following error:     Error: Exported bands must have compatible data types; found   inconsistent types: Float64 and Float32.   How can I solve this?  Code:    //Choose country using GEE Feature Collection  var region = ee.FeatureCollection('ft:1tdSwUL7MVpOauSgRzqVTOwdfy17KDbw-1d9omPw').filterMetadata('Country', 'equals', 'Portugal');  //Add region outline to layer ‐ for selected countries  Map.addLayer(region,{}, 'Portugal');  // image collection pre 11/10/2017  var lt8_pre = ee.ImageCollection('LANDSAT/LC08/C01/T1_SR')   .filterBounds(region)    .filterDate(ee.Date("2017-08-01"),ee.Date("2017-10-11"));    Map.addLayer(lt8_pre, {bands: ['B4', 'B3', 'B2'],min: 1000, max: 1500}, 'image L8 pre');  var lt8_ndvi_pre = lt8_pre   .map(function(img){     return img.addBands(img.normalizedDifference(['B5', 'B4'])).updateMask(img.select(['pixel_qa']).neq(5).neq(3).neq(2));   });  // Create an NBR image using bands the nir and red bands (6 and 4) var lt8_nbr_pre = lt8_pre   .map(function(img){     return img.addBands(img.normalizedDifference(['B7', 'B4'])).updateMask(img.select(['pixel_qa']).neq(5).neq(3).neq(2));   });  print(lt8_ndvi_pre); print(lt8_nbr_pre);  // image collection pos 11/10/2017  var lt8_pos = ee.ImageCollection('LANDSAT/LC08/C01/T1_SR')   .filterBounds(region)    .filterDate(ee.Date("2017-10-18"),ee.Date("2018-02-10"));   Map.addLayer(lt8_pos, {bands: ['B4', 'B3', 'B2'], max: 1000}, 'image L8 pos');  var lt8_ndvi_pos = lt8_pos   .map(function(img){     return img.addBands(img.normalizedDifference(['B5', 'B4'])).updateMask(img.select(['pixel_qa']).neq(5).neq(3).neq(2));   });  // Create an NBR image using bands the nir and red bands (6 and 4)   var lt8_nbr_pos = lt8_pos   .map(function(img){     return img.addBands(img.normalizedDifference(['B7', 'B4'])).updateMask(img.select(['pixel_qa']).neq(5).neq(3).neq(2));   });   print(lt8_ndvi_pos); print(lt8_nbr_pos);  //Clip to Specified Region var NDVI_pre = lt8_ndvi_pre.mean().clip(region); var NDVI_pos = lt8_ndvi_pos.mean().clip(region); var NBR_pre = lt8_nbr_pre.mean().clip(region); var NBR_pos = lt8_nbr_pos.mean().clip(region);  Map.centerObject(region, 10); var ndvi_viz = {min:-0.8, max:1, palette:'000000,00FF00'}; Map.addLayer(NDVI_pre.select('nd'), ndvi_viz, "LT8 NDVI mean pre 11/10"); Map.addLayer(NDVI_pos.select('nd'), ndvi_viz, "LT8 NDVI mean pos 11/10");  // Display the NBRpost var nbr_viz = {min: -1, max:1, palette: ['FFFFFF','CC9966','CC9900','996600', '33CC00', '009900','006600','000000']}; Map.addLayer(NBR_pre.select('nd'), nbr_viz, "LT8 NBR mean pre 11/10"); Map.addLayer(NBR_pos.select('nd'), nbr_viz, "LT8 NBR mean pos 11/10");  //Calcule dNBR and dNDVI var dNBR = NBR_pre.subtract(NBR_pos); var dNDVI = NDVI_pre.subtract(NDVI_pos);   //Map.addLayer(dNBR,nbr_viz, "dNBR"); Map.addLayer(dNDVI.select('nd'), ndvi_viz, "LT8 dNDVI"); Map.addLayer(dNBR.select('nd'), nbr_viz, "LT8 dNBR");  Export.image.toDrive({       image: NBR_pos,       description: 'NBR_pos',       scale: 30,       region: Pt,       maxPixels: 278466375,     });


This problem is the Exercise from . The problem says      Find the a closed form of $$S_n = \sum_{1 \leq k \leq n}\frac{1}{k(k + 1)}$$   I tried these ways with no luck  Re-index and plus themself   Replace k with k + 1  From $$S_n = \sum_{1 \leq k \leq n}\frac{1}{k(k + 1)}$$ Replace k with k + 1 $$S_n = \sum_{1 \leq k + 1 \leq n}\frac{1}{(k + 1)(k + 2)}$$ Add -1 all through the inequation $$S_n = \sum_{0 \leq k \leq n - 1}\frac{1}{(k + 1)(k + 2)}$$ The range is not matched with original. So, I think I cannot go further. Replace k with k - 2  From $$S_n = \sum_{1 \leq k \leq n}\frac{1}{k(k + 1)}$$ Replace k with k - 2 $$S_n = \sum_{1 \leq k - 2 \leq n}\frac{1}{(k - 2)(k - 1)}$$ Add +2 all through the inequation $$S_n = \sum_{3 \leq k \leq n + 2}\frac{1}{(k - 2)(k - 1)}$$ The range is not matched with original. So, I think I cannot go further. Replace k with n - k + 1  From $$S_n = \sum_{1 \leq k \leq n}\frac{1}{k(k + 1)}$$ Replace k with n - k + 1 $$S_n = \sum_{1 \leq n - k + 1 \leq n}\frac{1}{(n - k + 1)(n - k + 2)}$$ Tune the inequation $$S_n = \sum_{0 \leq n - k \leq n - 1}\frac{1}{(n - k + 1)(n - k + 2)}$$ $$S_n = \sum_{-n \leq -k \leq -1}\frac{1}{(n - k + 1)(n - k + 2)}$$ $$S_n = \sum_{1 \leq k \leq n}\frac{1}{(n - k + 1)(n - k + 2)}$$ Try adding them together $$2S_n = \sum_{1 \leq k \leq n}(\frac{1}{k(k + 1)} + \frac{1}{(n - k + 1)(n - k + 2)})$$ $$2S_n = \sum_{1 \leq k \leq n} \frac{(n - k + 1)(n - k + 2) + k(k + 1)} {k(k + 1)(n - k + 1)(n - k + 2)}$$ I decide not to go further. Is this the dead end?   Plus with extra boundary  From  $$S_n = \sum_{1 \leq k \leq n}\frac{1}{k(k + 1)}$$ Add $$\frac{1}{(n + 1)(n + 2)}$$ to both side $$S_n + \frac{1}{(n + 1)(n + 2)} = \sum_{1 \leq k \leq n}\frac{1}{k(k + 1)} + \frac{1}{(n + 1)(n + 2)}$$ $$S_n + \frac{1}{(n + 1)(n + 2)} = \sum_{1 \leq k \leq n + 1}\frac{1}{k(k + 1)}$$ Adjust the inequation $$S_n + \frac{1}{(n + 1)(n + 2)} = \frac{1}{2} \sum_{1 \leq k - 1 \leq n}\frac{1}{k(k + 1)}$$ Replace k with k + 1 $$S_n + \frac{1}{(n + 1)(n + 2)} = \frac{1}{2} \sum_{1 \leq k \leq n}\frac{1}{(k + 1)(k + 2)}$$ From this point, I have no idea to go next.  Can anyone give me a clue? Every suggestion will be appreciated.

I have just started learning sums. I need to evaluate the following sum:  $$S_{n} = \sum_{k=1}^{n} \frac{1}{k(k+1)}$$  $$a_{1} = \frac{1}{2}, a_{2} = \frac{1}{6}, a_{3} = \frac{1}{12}, a_{4} = \frac{1}{20}, a_{5} = \frac{1}{30}, a_{6} = \frac{1}{42}, ...$$ I tried splitting it to partial fractions:  $$\frac{1}{k(k+1)} = \frac{A}{k} + \frac{B}{k+1}$$  $$1 = A(k+1) + Bk$$  $$1 = Ak + A + Bk$$  $$\begin{cases} A = 1 \\ 0 = A + B \quad \Rightarrow B = -1\end{cases}$$  $$\Longrightarrow S_{n} = \sum_{k=1}^{n} \Big( \frac{1}{k} - \frac{1}{k+1} \Big)$$  $$S_{n} = \sum_{k=1}^{n} \frac{1}{k} - \sum_{k=1}^{n} \frac{1}{k+1}$$  Wolframalpha gives answer $S_{n} = \frac{n}{n+1}$  Help's appreciated. P.S: Are the tags okay?


I have a select list that contains strings fetched from my database, multiple strings contain spaces and are causing error, at first PHP was not reading the space. I fixed that using quotations but the error is still there.  This is my php code in one file:  $AllDepartements = $db->getAllDepartements(); echo "<select name='Major' style='width: 270px'><option value=''>Select       Major</option>"; While ($row = mysql_fetch_array($AllDepartements)) { $Major = $row['DName']; print "<option value='".$Major."'>$Major</option>";  } print "</select><br>";   and this is the add function call:  else if($tag =='add'){ $SSN =  $_POST['SSN']; $Class =  $_POST['Class']; $Major =  $_POST['Major']; $Minor =  $_POST['Minor'];  if($db->addStudent($SSN,$Class,$Major,$Minor)) header('Location:' . $form . '.php?tag=list'); else echo mysql_error(); //echo "ERROR!"; }   and finally the function itself:   public function addStudent($SSN,$Class,$Major,$Minor) {         if($result = mysql_query(" INSERT INTO student (SSN,Class,Major,Minor)    VALUES ('$SSN','$Class',$Major,$Minor ")) {         return true ;     }     else          return false; }   The error I receive is:     You have an error in your SQL syntax; check the manual that corresponds to your MySQL   server version for the right syntax to use near '' at line 1

If user input is inserted without modification into an SQL query, then the application becomes vulnerable to , like in the following example:  $unsafe_variable = $_POST['user_input'];   mysql_query("INSERT INTO `table` (`column`) VALUES ('$unsafe_variable')");   That's because the user can input something like value'); DROP TABLE table;--, and the query becomes:  INSERT INTO `table` (`column`) VALUES('value'); DROP TABLE table;--')   What can be done to prevent this from happening?


I have just tried to use notify-send on my 13.10 machine and can't get it to work without using sudo with it.   I don't know what details can I provide with this issue.   My notify-osd version :   $ ii  notify-osd      0.9.35+13.10.20130917.1-0ubuntu1-leolik~ppa0  amd64        daemon that displays passive pop-up notifications   On regular version for 13.10 there was the same issue.  EDIT   $ ll /usr/bin/notify-send -rwxr-xr-x 1 root root 14720 wrz 10 16:12 /usr/bin/notify-send

Problem  sudo notify-send Test "Hello World"   Displays a notification as expected.  notify-send Test "Hello World"   Does not display a notification.  Further information  Ubuntu version 16.04.  The notifications appear to use notify-osd instead of notification-daemon. Running notify-send appears to launch a notify-osd process under the user that ran notify-send. I'm not sure what dbus is.   No error messages  There are no errors in the syslog. When I run the following code no error messages occur.   #include <libnotify/notify.h> #include <stdio.h> int main() {     gboolean x = notify_init ("Hello world!");     printf( "notify_init: %d\n", x );     NotifyNotification * Hello = notify_notification_new ("Hello world", "This is an example notification.", "dialog-information");     GError *err = NULL;     x = notify_notification_show (Hello, &err);     printf( "notify_notification_show: %d\n", x );     if(err != NULL) {         printf("Error detected!\n");         printf("Error message:%s\n", err->message);     }     else {         printf("No error detected.\n");     }     g_object_unref(G_OBJECT(Hello));     notify_uninit();     return 0; }   I do not know what I'm doing. Thanks for the help.  Python Notify  In the past, I've used a python program that has working notifications. I tested a hello world notification and it works without sudo!   #!/usr/bin/env python # -*- coding: utf-8 -*- import gi gi.require_version('Notify', '0.7') from gi.repository import Notify  Notify.init("test") n = Notify.Notification.new('test', 'test2') n.set_urgency(Notify.Urgency.CRITICAL)     n.show()   Code from   I am not sure why this works. The python Notify is just wrapping the library used in the C example. I'd prefer not to use python but will if I must.  Edit  The problem occurred again. Resolved by adding urgency critical.


On my photo, the ICC version is 2.0, however the ICC datetime is 2009.   Does this mean the device can not predate 2009, and that the photo must have been taken after 2009?

I am trying to determine when a photo was taken with a smart phone. It was sent to me, not taken from facebook. I've viewed the exif data but the only field that even references a date is the ICC profile date. What is this date? is this the date it was taken? if not, how can I view the date it was taken?


How does the father of my step-father relate to my daughter from her point of view?  I'm leaning toward great-grand-step-father, but I'm not sure.

Here at the Genealogy and Family History Stack Exchange we see many questions about relationship mapping which is also known as:   relationship calculation kinship terminology etc   If you are just trying to understand how to calculate "cousins and removes" then  provides an excellent guide.  However, if you are seeking an English term for a more complicated relationship between two members of an extended family, rather than asking a question like:          site users are encouraged to first review the answers below.    Note: This Q&A arises from  and is set to  to help make it canonical.


I have multiple text boxes in my windows form whose text I want to become selected when they are clicked on by the user. I am trying to find a way to make only the first click in a box select text when the user makes consecutive clicks in the box. I would like to have subsequent clicks in the same box position a text cursor box rather than endlessly select the text, which is what is happening now.   I have tried calling focused.Select() inside an if statement that only runs if no text is already selected like shown below. The problem with that is that right after a user clicks on selected text briefly "un-selects" then Highlight_OnClick runs and the text is again selected.       private void HighlightWhenFocused(object sender, EventArgs e)     {          if (sender is TextBox)         {             TextBox focused = sender as TextBox;             focused.Select(0, focused.Text.Length);             //if (focused.SelectionLength == 0 { focused.Select(0, focused.Text.Length); }                 // does not work either         }     }   My code above always selects the text but the problem is that even once the user has clicked on a text box that is already selected, subsequent clicks only re-select the text.

When a C# WinForms textbox receives focus, I want it to behave like your browser's address bar.  To see what I mean, click in your web browser's address bar. You'll notice the following behavior:    Clicking in the textbox should select all the text if the textbox wasn't previously focused. Mouse down and drag in the textbox should select only the text I've highlighted with the mouse. If the textbox is already focused, clicking does not select all text. Focusing the textbox programmatically or via keyboard tabbing should select all text.   I want to do exactly this in WinForms.  FASTEST GUN ALERT: please read the following before answering! Thanks guys. :-)     Calling .SelectAll() during   the .Enter or .GotFocus events won't   work because if the user clicked the   textbox, the caret will be placed   where he clicked, thus deselecting all   text.      Calling .SelectAll() during the .Click event won't work because the user won't be able to select any text with the mouse; the .SelectAll() call will keep overwriting the user's text selection.      Calling BeginInvoke((Action)textbox.SelectAll) on focus/enter event enter doesn't work because it breaks rule #2 above, it will keep overriding the user's selection on focus.


Is there a desktop version of Ubuntu that runs on a Raspberry Pi 2?  Not just the 'core' functionality like Windows 10.

I was thinking about buying a , and running Ubuntu on it. I have looked around the web, and a lot of stuff says that it's difficult for it to work on ARM processors. Has anyone figured out how to get a Raspberry pi to run Ubuntu?


My Mysql table contains one column Let's discuss together!! when when i get it into php page ? is displaying in place of ' means Let�s discuss together!!   . So how to to get data from mysql in php page in proper way

I'm setting up a new server and want to support UTF-8 fully in my web application. I have tried this in the past on existing servers and always seem to end up having to fall back to ISO-8859-1.  Where exactly do I need to set the encoding/charsets? I'm aware that I need to configure Apache, MySQL, and PHP to do this — is there some standard checklist I can follow, or perhaps troubleshoot where the mismatches occur?  This is for a new Linux server, running MySQL 5, PHP, 5 and Apache 2.


I currently only have 1 user account on my ubuntu server. I would like to change the user name without creating another account. Is there a way to do this? Any help would be greatly appreciated.

Some time ago, when I installed Ubuntu, I chose a rather stupid username for my account that I do not want to use anymore. How do I change this (including the name of my home directory, and the name in the terminal) without losing settings for applications? How do I keep permissions and my keys for various authentification (e.g. email, SSH, GPG and more)? What settings could possibly get lost if I changed my username?


I am of Syrian nationality.  I got a visa to Singapore through the Singapore consulate in Lebanon. I travelled there 28-6-2017. When I reached Singapore, the immigration officer asked me about my return ticket. I showed it to him, but unfortunately I didn't notice that the return date was more than 1 month.  Also he asked for a hotel booking, but I didn't have one. For those reasons, he refused my entry. I was returned back on the same airline.   Is the visa still valid? If I prepare the requested documents and travel again, will I be banned? They didn't stamp my passport. They took a thumb print.

My friend who is an Indonesian citizen tried to enter Singapore this week and was refused entry at the Singapore Harbour Front Ferry Terminal by immigration.  This was his first trip overseas and is not used to international travel, so due to his inexperience and that he was excited to go to Singapore, he possibly made some mistakes on trying to be granted access into Singapore.   He was told he was to enter a Singapore address for his stay or a friend or relative he will stay with. He was only staying for one day and was going to catch the ferry back at night, so he had no plan to stay in Singapore and as such had no address to put. They then asked why he was traveling alone and that he should travel with somebody for his first trip. He told them he always travels alone in Indonesia and finds it easier to see and do things alone. He was then asked why he was entering Singapore and the reason he gave was to purchase some electronics which he cannot buy in Indonesia. They asked for how much money he had and they then advised that he did not have enough money to purchase the items he was after. They refused his entry and he was then escorted to a ferry and returned to Indonesia. His passport was not stamped and he was not fingerprinted.   He was given a Notice of Refusal of Entry which had the reason as "Being ineligible for the issue of a pass under current immigration policies" form on his departure. Also included on this form is his passport number etc. He was not advised of him being banned or a time frame that he cannot enter Singapore.  My questions are: Has he been banned or restricted to enter Singapore for a period of time? When entering countries including Singapore, does he need to tick the box stating he has been refused entry into another country? I am hoping to get my friend to Australia at the end of the year for a 10 day holiday and will this hinder his chance of getting a visa and entering Australia?


I am creating a button using javascipt like below:   "
<button id='rkeys'>Related<button>

"    $('#search_results').append(html_result)   And below that I have the functions which is waiting for a click event on '#rkeys' id, but nothing happens when I press that button.   related_keys = ->    console.log('click')  $('#rkeys').on 'click', related_keys   What can I do to make this work.

I have a bit of code where I am looping through all the select boxes on a page and binding a .hover event to them to do a bit of twiddling with their width on mouse on/off.  This happens on page ready and works just fine.  The problem I have is that any select boxes I add via Ajax or DOM after the initial loop won't have the event bound.  I have found this plugin (), but before I add another 5k to my pages with a plugin, I want to see if anyone knows a way to do this, either with jQuery directly or by another option.


I've been looking into creating a barcode scanner program, and in my research I came across something I've never seen before, and I'm not sure exactly what it is doing...  Here's a snippet of my program, including the line I don't understand:  import javax.comm.*;      public class InvScan implements SerialPortEventListener {   static CommPortIdentifier portId1; SerialPort serialPort1;   public InvScan(){     serialPort1 = (SerialPort) portId1.open("InvScan", 2000); //what does this mean?  }   See the line where I commented "what does this mean?". SerialPort is an abstract class... I know abstract classes can be instantiated using an anonymous class, but I've never seen this before. This line of code came from a tutorial for a program designed to do something related to what I want to do, but the author didn't explain what is going on here very well (or maybe I just didn't understand?). His notes say:     we are instantiating the SerialPort object by executing portId1’s open() method. Recall portId1 is a ComPortIdentifier object and the open() method comes from ComPortIdentifier.   I've done some research, and I can't even find another example of whatever is going on here (probably because I don't even know what to call it, really).   This isn't even really essential to my program, as I can just redesign it (and not be a script kiddie, haha), but it's really bugging me that I don't know what is going on in that line.

I have seen this mentioned a few times and I am not clear on what it means. When and why would you do this?   I know what interfaces do, but the fact I am not clear on this makes me think I am missing out on using them correctly.   Is it just so if you were to do:  IInterface classRef = new ObjectWhatever()   You could use any class that implements IInterface? When would you need to do that? The only thing I can think of is if you have a method and you are unsure of what object will be passed except for it implementing IInterface. I cannot think how often you would need to do that.   Also, how could you write a method that takes in an object that implements an interface? Is that possible?


I've got a problem using Microsoft Word - surely there's a Stack Exchange site for that, isn't there?

I would like to ask a question about Microsoft Word. It is the software itself based not coding related. The question is about table shapes. Which one is most proper ?


Let $R_1$ and $R_2$ are two rings such that $R_1$ $\subseteq$ $R_2$ and $R_2$ is a finitely generated ring over $R_1$. We know that, if $R_1$ is Noetherian and $S$ is a ring such that $R_1$ $\subseteq$ $S$ $\subseteq$ $R_2$ and $R_2$ is a finitely generated module over $S$, then $S$ is a finitely generated ring over $R_1$.   I found out in the June edition of The American Mathematical monthly that if we remove the condition that "$R_2$ is a finitely generated module over $S$", then there exists examples where $S$ might not be a finitely generated ring over $R_1$ and they construct an example using heavy machineries, I was thinking whether a 'simpler' example could be constructed.  And Also if one could provide a general algorithm on constructing such rings, it will be very much appreciable.

Consider the subalgebra $R=k[x,xy,xy^2,xy^3, \ldots] \subset k[x,y]$. How do I prove that $R$ is not finitely generated (over $k$)?    What is the general strategy for proving that an algebra is not finitely generated?


I've done a lot of Googling and can't seem to figure out what's going on. I'm teaching myself C++ (I'm more familiar with Java).  I have Item Class objects that are being stored in an Inventory Class map, not as pointers. I want to retrieve one of the items from the Inventory in a function, assign it to a temp variable while I delete it from the Inventory map, and then return the object itself so something else can use it. When I originally tried using the code within my function it was returning the error (followed by the stack trace of c++ library stuff):  no matching constructor for initialization of 'Item'             ::new ((void*)__p) _Tp();   I tried creating a copy constructor, but to no avail. Eventually, it worked by including an empty constructor ( Item(); ) in my header file and defining it in my cpp file ( Item::Item() {} ).  I would just like to understand why this was necessary so I can recognize it in the future to know what I'm doing.  EDIT: Upon further inspection of the error stack trace, it turned out the actual problem with with the Inventory::addItem function. When assigning an object to a map using operator[], the map first instantiates the value type to the key using the default constructor before making the assignment. No default constructor was available, so the error was returned.  It was fixed by changing the line to map.insert({key, value})  Here are the important parts of the two class files:  //item.h #include <string> using namespace std;  class Item { private:     string name;     int type;     int levelReq; public:     Item(string name, int type, int levelReq);     Item();     string getName() {return name;}     int getType() {return type;}     friend ostream &operator<<(ostream &out, const Item &item); }; --------------------------------------------------------------- //item.cpp #include <string> #include "item.h"  using namespace std; Item::Item(string n, int t, int l) : name(n), type(t), levelReq(l) {} Item::Item() {} ostream &operator<<(ostream &out, const Item &item) {     return out << item.name; } --------------------------------------------------------------- //inventory.h #include <map> #include "item.h"  class Inventory { private:     map <int, Item> inventory;     int size;     bool full;     int nextFree;     void findNextFree();  public:     Inventory();     bool isFull() {return full;}     void addItem(Item item);     Item getItem(int slot);     void showInv(); }; --------------------------------------------------------------- //inventory.cpp #include <iostream> #include <string> #include "inventory.h" #include "item.h"  using namespace std;  Inventory::Inventory() {     full = false;     nextFree = 1;     size = 28; }  void Inventory::addItem(Item item) {     if (!full) {         inventory[nextFree] = item;         findNextFree();     }     else {         cout << "Your inventory is full (Inv::addItem)";     } }  Item Inventory::getItem(int slot) {     Item item = inventory.at(slot);     inventory.erase(slot);     full = false;      if (nextFree > slot) {         nextFree = slot;     }      return item; }      void Inventory::findNextFree() {     nextFree++;      if (nextFree == size + 1) {         full = true;     }     else if (inventory.count(nextFree)) {         findNextFree();     } }

See also      Not a major issue, just annoying as I don't want my class to ever be instantiated without the particular arguments.  #include <map>  struct MyClass {     MyClass(int t); };  int main() {     std::map<int, MyClass> myMap;     myMap[14] = MyClass(42); }   This gives me the following g++ error:     /usr/include/c++/4.3/bits/stl_map.h:419: error: no matching function for call to ‘MyClass()’   This compiles fine if I add a default constructor; I am certain it's not caused by incorrect syntax.