I'm practicing Java by making a program that can play some online puzzle games such as minesweeper, chess, etc.  Since the games are all played on an orthogonal grid, I found the methods common to each game and tossed them in a class that has a 2-d array of elements I named Orthogonals.  My first intuition was to let the squares of the board be generically typed:  public abstract class GridBoard <E extends Orthogonal>{     private final E[][] board;     public final int width;     public final int height;      public GridBoard(int width, int height){         this.width=width;         this.height=height;         board= new E[][]();     }      /*...*/ }   Unfortunately, new E[][]() isn't possible for some important reasons.  I would be happy using a constructor like public GridBoard(E[][] board), but I want Orthogonal to have methods like orthogonal.getNeighbor(NORTH), which require them to know which (final) board they're a part of.  From what I can tell, there are a few different ways of getting around this limitation, but none of them feel like they simplify the design.  My goal is to let MinesweeperBoards work with a MineSquare[][], but ChessBoards have ChessSquare[][], for example.   shows how an array can be created, but the class of a generic can't be obtained dynamically.  A class would have to be passed into the constructor, which adds needless complexity for the implementer.   Some answers to questions about similar patterns suggest letting the subclass of GameBoard fill the array with their own type of squares, and then casting each time the board is read from.  Is this an acceptable practice?  When are casting and instanceof considered acceptable design?  board doesn't need to be defined in the abstract class, and all of the methods in Orthogonal can rely on the concrete implementations.  But that sounds like a great way to put repetitive code into every different game.  I could remove the Orthogonal class entirely and put the logic for navigating the board into GridBoard.  But if I do that, there won't be as clean a way to write something like return square.neighbors().filter(MineSquare::isBomb).count().    I could change the class definition to GridBoard <E> and make Orthogonals a class that get created as needed and read Es from the board.  This seems like the most reasonable solution, but I'm very curious about the best way to solve the array of subclasses problem if that wasn't an option.  Is there a perk or drawback that I've overlooked?

Due to the implementation of Java generics, you can't have code like this:   public class GenSet<E> {     private E a[];      public GenSet() {         a = new E[INITIAL_ARRAY_LENGTH]; // error: generic array creation     } }   How can I implement this while maintaining type safety?  I saw a solution on the Java forums that goes like this:  import java.lang.reflect.Array;  class Stack<T> {     public Stack(Class<T> clazz, int capacity) {         array = (T[])Array.newInstance(clazz, capacity);     }      private final T[] array; }   But I really don't get what's going on.


Hold up! before you click that button to report this question as a duplicate of , consider that not only is that question 10 years old, but is also fairly non-specific, and doesn't make good use of the  blog post in the following year.  To fix a 10 year old question and expect new answers is to paint a 10 year old car and expect to sell it for MSRP.   This question is about questions that begin with "how do" or "how does", meaning questions about methodology and application. It's been a meme in most outside communities that on stack exchange the answer to the question "How do I do A" is objectively "No, don't do A, do B instead". While this may be helpful in some instances, it's at the least, very condescending.  This means this question is actually two wrapped up in eachother, and very intertwined. The first is, as above, "Is the answer "Don't do that" an acceptable response to a "how do I" question?". The second is then, following the first, "When can we assume that the person doesn't actually want to know what their question asks?" The very two are asking two parts of the same scale.  I want to throw one more subject into the ring just to make answers more concise, and cut-throat. Stack exchange isn't know for being particularly "nice". Despite the "Be nice" policy employed site wide, many users feel that they are rejected for asking questions that may be trivial to others, even if a bit ignorant. The epitome of this, in my opinion, is EE.SE, who usually refuse most (even slightly) ignorant, questions based on . This has caused a huge riff in the community over the years. Going back to good subjective bad subjective,  the riff appears in the professional elites, which, in a sense are the 'top 1%ers' of the site, controlling a majority of the reputation and the subjective commoners. There have been multiple people who straight up leave because the users there won't abide to said arbitrary standards, and as such the "don't so that" is said a lot there. Thus the question I want to throw in is: Does your answer support the "Be nice" policy, and will your answer have a positive effect on users if what your answer was the rule?  So let me repeat my questions: Is the answer "Don't do that" an acceptable response to a "how do I" question? When can we assume that the person doesn't actually want to know what their question asks? Does your answer support the "Be nice" policy, and will your answer have a positive effect on users if what your answer was the rule?  I encourage all to use examples of "Don't do it" answers in your answer.

I read with interest  and the comment . I also read  and  the infamous FAQ answer   With rare exceptions, such as , the MSO attitude seems to be that people responding to questions have a "right" to choose not to directly answer the question in favor of an answer which basically tells the OP they "shouldn't be doing it that way". The advice all focuses on the information the OP should provide to avoid this kind of response rather than suggesting that those providing answers should be respectful of questions and not make assumptions that there is some underlying problem that the OP is trying to solve that should be addressed instead.  In rationalizing the approach of not answering the question, two "carpenter" analogies were used, one involving a question about how to cut balsa wood and the other involving a question which of two non-tool household items is better to pound a nail. In both cases, they ask the rhetorical question of whether it's better to answer the question or challenge the question.  My MSO question here is: Why do so many seem to think they have to choose between these two ways of responding? Why don't folks consider answering the question and supplementing their answer as they wish with questions, challenges, additional information, editorial opinion, etc. Not only is that more respectful to the OP, it's more respectful to future readers who arrived at the answer based on the question asked. If I do a search about how to cut balsa wood, I don't want to land on an answer that just tells me what a bad idea it is to use balsa wood in house construction.  Update: While I don't want to focus on specific examples, in response to some of the answers/comments, here's a recent one where I was the one asking the question:      Although it would take me a while to uncover examples, the more common occurrences I run into are where someone shares some code and an error they are getting and ask why they are getting that error. Instead of explaining the error, the answers typically propose some other approach. Admittedly, the OP is often times satisfied with that answer and not knowing why the error occurred, but I would contend the community is the poorer for it and, as a rule, this practice unnecessarily runs the risk of offending.


I want to describe parts of equation underneath them similar to this:    How do I go about doing this? I have the following code so far:  \begin{algin} A = \frac{B}{C} + \frac{D}{E} + \frac{G}{H} \end{align}

Given an equation, say Bayes' rule,  $P(X \mid O) \propto P(X)P(O \mid X)$   how do I label the different parts of the equation using curly braces?


I have linked a new USB drive with my system and i am not able to copy any file to it. I tried to change the permission by using below command:  /media$ sudo chmod 777 0000-7D6C   "0000-7D6C" is the drive name. But it gives below message:  chmod: changing permissions of `0000-7D6C': Read-only file system   Can anybody help me please.

I'm using Ubuntu 10.10 and using a usb drive but I'm finding that I can't chmod any programs on the drive to +x. It is being auto-mounted by Gnome (using udev, I think?) so I imagine the problem is a mount option but I can't seem to find a way to modify the default mount options any where. There are no entries in fstab. Anybody encounter this problem?


What is the difference between these two properties: public int Foo = 6; public int Bar {get;} = 6  Here is a link to a working program that shows the output is the same:  using System;  class Program {     static void Main(string[] args) {              var someClass = new SomeClass();              Console.WriteLine(someClass.PropertyWithEquals);       Console.WriteLine(someClass.PropertyWithGetter);            } }  public class SomeClass {     public int PropertyWithEquals = 6;     public int PropertyWithGetter {get;} = 6; }  The output of this is 6 and 6. If the output is the same, are there any other reasons to prefer one over the other?

In C#, what makes a field different from a property, and when should a field be used instead of a property?


To the best of my understanding, there are three roles on Stack Exchange family websites who are able to delete a question:  Moderators Voting users with reputation > 10000 Question owners  Are there ways for non-owner users to find which question is deleted by which role(s)?

What circumstances can cause a question or answer to be deleted, and what does that actually mean?    How can a post be deleted? When can't I delete my own post? Can I still see my post even after it's deleted? Can I see a list of my deleted posts? How can I undelete one of my posts? What does deletion mean for a post? How do votes to delete work? What are the criteria for deletion? What else should I know about deleted posts? If I flag my question with a request to delete it, what will happen?       For more information, see the articles about  and  in the .


Sorry for making duplicate Topic but it is very important to me because i don't understand this topic by looking other related topics. Actually i am in process to build a WordPress theme and i am working on it, when i look into other themes source codes usually i find this code.    etc etc.  and i understand its something related to do_action();  So my question is that why we use this function in wordpress? and what is the job of this function and can we have a benefit of using this code on every starting and ending html tags in theme?  Thanks in Advance, Regards aran

This question might be wrong, I am not sure about it. Because I am not clear on this.  I know add_action it is used to to hook our function to the specified function. For example add_action('wp_head'.'myfunc'); now what ever code in myfunc will be executed in the wp_head(). This is clear but i am having doubt in do_action what it does?  I think it is used to create our own hook like already available hooks(wp_head,wp_footer,..etc) If i am correct can anyone show me a simple understandable answer with simple example.  I have tried the difference in internet but all are pointing to difference between add_action and add_filter. I don't want to go there because first i want to clarify this and then I’ll move there.  Can anybody help me?  EDIT after Question POST  function custom_register() {     echo '<script>jQuery(document).ready(function(){alert("Learning Hooks");});</script>';  } do_action('custom');  add_action('custom','custom_register');   I tried this in plugin but i didn't get the alert message.  But when i hook the same function with wp_head then it is working fine  /******************working****************/ add_action('wp_head','custom_register');


I have several launch files in my directory (e.g. "my_script.launch.py") and their content is pretty similar to this file:  import launch import launch.actions import launch.substitutions import launch_ros.actions   def generate_launch_description():     return launch.LaunchDescription([         launch.actions.DeclareLaunchArgument(             'node_prefix',             default_value=[launch.substitutions.EnvironmentVariable('USER'), '_'],             description='Prefix for node names'),         launch_ros.actions.Node(             package='demo_nodes_py', node_executable='talker', output='screen',             node_name=[launch.substitutions.LaunchConfiguration('node_prefix'), 'talker']),     ])   All of them have some imports at the top and a generate_launch_description() function, that returns an object which I want to inspect.  I want to implement this function  def get_generate_launch_description_per_path(path):    pass   that executes the convenient function of the python file on that path and thus returns the LaunchDescription object so I can manipulate it afterwards. Any idea? Probably will need some kind of reflection or dynamic load.

How can I load a Python module given its full path? Note that the file can be anywhere in the filesystem, as it is a configuration option.


I want to add a photo on the top right-hand corner of my resume. I have made my resume on the online LaTeX editor overleaf. Here is the link to my code-  Can someone please help me?

I am new to LaTeX. I am writing a CV using the moderncv package with style banking. I want to add a photo. After I run the compile command it exits normally but the photo doesn't appear on the page.   My code is following:   \documentclass[11pt,a4paper,sans]{moderncv} \moderncvstyle{banking}  \moderncvcolor{blue}  \usepackage[utf8]{inputenc} \usepackage[scale=0.8]{geometry} \usepackage{import} \usepackage{booktabs} \usepackage{xcolor} \usepackage{tabularx}  \name{Name}{Last Name} % My name is quite long, can it be the problem? \title{Resume} \address{Address}    \phone[mobile]{my_number}     \email{my_e-mail}   \photo[64pt][0pt]{name_of_the_phot}    \setlength\tabcolsep{10pt} \begin{document}  \makecvtitle     \end{document}   Any help how to add photo and change its position afterwards? I want it to appear on the right or left side.  Thanks in advance.


I have two content type A and B in which B content type node is reference in A content type node. In B content type node there is status field. I want to fetch the A content type node in which the status of B content type node is something.  Can you please guide me how can I use this?  Thanks

I'd like to run a query using the EntityFieldQuery object. I need value from both the node and node_access table therefore I'd need to use INNER JOIN. From the d.o documentation I can't figure out how this is possible.  Here's what I have --  $query = new EntityFieldQuery(); $result = $query->entityCondition('entity_type', 'node') ->entityCondition('bundle', 'node_access') ->propertyCondition('type', 'external_link') ->propertyCondition('status', 1) ->fieldCondition('gid', '3', '=') ->fieldCondition('realm', 'domain_id', '=') ->fieldCondition('grant_view', '1', '>=') ->range(0,1) ->execute();


I made the download from Ubuntu Software-Center, but when I try to start PlayonLinux I get the answer above. What should I do next?  I'm using Linux the first time in my life.., please don't answer in a "complicated" way^^  Thanks anyway!  p.s. english is not my native language, but i guess it will work out      answers are also welcome in german & portuguese^^

I'm downloading PlayOnLinux to run Paint Tool SAI, but I cannot open PlayOnLinux. When I click on it to open it, a dialog box comes up that says: "PlayOnLinux cannot find curl (from cURL) You need to install it to continue". How do I install this?   I'm referring to this article:


I added   deb-src http://security.ubuntu.com/ubuntu bionic-security main   into my sources.list, did apt update  Here's what I'm getting:  vm@vm-Standard-PC-i440FX-PIIX-1996:~$ apt-get source linux-image-4.15.0-23-generic  Reading package lists... Done Picking 'linux-signed' as source package instead of 'linux-image-4.15.0-23-generic' Need to get 17,8 kB of source archives. Get:1 http://security.ubuntu.com/ubuntu bionic-security/main linux-signed 4.15.0-23.25 (dsc) [2.050 B] Get:2 http://security.ubuntu.com/ubuntu bionic-security/main linux-signed 4.15.0-23.25 (tar) [15,8 kB] Fetched 17,8 kB in 1s (11,9 kB/s)        dpkg-source: info: extracting linux-signed in linux-signed-4.15.0 dpkg-source: info: unpacking linux-signed_4.15.0-23.25.tar.xz   it keeps downloading linux-signed  UPDATE:  If I do   apt-get source linux   it works but then I still need to do  sudo apt-get build-dep linux-image-$(uname -r)   in order to install the dependencies. However, it will install the dependencies of linux-signed. If I try sudo apt-get build-dep linux it installs a lot of things that are not necessary to build a kernel

I am following the instructions here:   I ran  apt-get source linux-image-$(uname -r) cd linux-signed-4.15.0 chmod a+x debian/rules chmod a+x debian/scripts/* chmod a+x debian/scripts/misc/* fakeroot debian/rules clean fakeroot debian/rules editconfigs   The output of the last command is  dh editconfigs dh: Unknown sequence editconfigs (choose from: binary binary-arch binary-indep build build-arch build-indep clean install install-arch install-indep) debian/rules:35: recipe for target 'editconfigs' failed make: *** [editconfigs] Error 2   My uname -r is 4.15.0-34-generic.  A possible duplicate is , but the answer there does not address the "Unknown sequence editconfigs" message. Do the  instructions need to be updated?


It's the 13th day since I applied. Four days ago, I received an email that said my application reached Sheffield and ECO would make a decision. How long does that usually take?  The tracking site doesn't say anything: it was 'green' until  reached the UKVI; after that, the status is 'red' and hasn't been updated.   My husband and children have German passports, but I don't, so I need a visa so that we can attend a party.

On May 9, I applied from Rome using the UK visa center. Two months have passed, and I have not been given any decision on my application. I submitted my visa request on the basis of my husband's Italian passport. It's been 70 days without any response. Is there any way to know when I will receive my visa?  Here's what the status screen shows:


I want to draw in a cartesian plan using pgfplots an arrow and corresponding perpendicular directed lines.   I've tried the following code:  \documentclass{standalone} \usepackage{tikz} \usepackage{pgfplots}  \begin{document} \begin{tikzpicture}   \begin{axis}   [       axis x line  = bottom,       axis y line  = left,       width        = .63\textwidth,       height       = .63\textwidth,       ymax         = 10,       ymin         = 0,       xmax         = 10,       xmin         = 0,     ]     \node (source)      at (axis cs:0,0){};     \node (destination) at (axis cs:6,5){};     \node (y0)          at (axis cs:0,5){};     \node (x0)          at (axis cs:6,0){};      \draw[dashed] (y0)--(destination);     \draw[dashed] (x0)--(destination);     \draw[->]     (source)--(destination);   \end{axis} \end{tikzpicture} \end{document}   But result is not good, because lines and arrow head does not stay on the same position:    How can I draw the arrow and directed lines correctly?

I have the following piece of tikz code:  \documentclass{standalone} \usepackage{tikz} \begin{document} \begin{tikzpicture}[>=latex] \draw (2,2) circle [radius=2pt]; \draw (3,3) circle [radius=2pt]; \path[inner sep=0pt] (2,2) ++(45:2pt) node (A) {}; \path[inner sep=0pt] (3,3) ++(225:2pt) node (B) {}; \draw[-] (A) -- (B); \end{tikzpicture} \end{document}   where I want to connect two connect the circles with a line. Points A and B should be on the circles, but unfortunately they are slighty off. How can I fix the existing code?


I own a bicycle trailer and the stock parts are terrible at best.    (Aosom Elite II.)  Where can I find high quality bearings, axles shafts, axle sleeves? Can I source them or will they have to be custom made?   I would also like to know how can I change to a nutted axle instead of one held on by a C-clamp.  Here are some pics, supposedly, these are actually parts to a wheel chair axle.  In other words how can I swap out the wheel chair parts for high quality bicycle parts.  Here are some pics.

I purchased an Aosom trailer a while back, and the wheels and tires are truly horrible.    So much so I only run light loads now.  I'm looking for 20" wheels that are either double wall alloy or vintage steel wheels.  I'm leaning towards used vintage wheels because they are cheaper.  My main problem is finding wheels that will fit on the trailer. All wheels that I see already contain a real axle. How do I remove the rear axle from the wheel?  Here are some images of the wheel and axle


I am looking for a book in quantum computers for self-learning.The kind of book that teaches quantum-mechanics + quantum-computation. I have basic understanding in calculus , linear-algebra (like matrix addition,multiplication) and classical mechanics that is taught in the Advanced level.Just basic , like I don't understand (but know) the logic behind Maxwells equation or laplace operators etc.  But , as I am a CS student, my basic goal is understanding quantum computers as you should realize.  So what book is best for this purpose?

I was hoping you guys could recommend reading material on quantum information. I have a good background in quantum mechanics, including in foundational issues, as covered in Ballentine's Quantum Mechanics.  I am interested in the intersection of quantum information and quantum foundations, such as in the works of C. Fuchs and in the research of the Perimeter Institute. While I prefer a more rigorous text, I'm trying to be as open as possible and would enjoy any suggestions or recommended reads.  Currently, I am reading the book by Busch, Lahti and Grebowski, notes on ArXiv by Keyl and also the notes by Preskill.


I get the exception whenever I run the program without passing in  the usDollarAmount or cancel the program... I'm using swing components to accept user input. The program works fine otherwise.  Please show me how to handle this... Thanks  THE Currency CALCULATOR Exception in thread "main" java.lang.NullPointerException at sun.misc.FloatingDecimal.readJavaFormatString(Unknown Source) at sun.misc.FloatingDecimal.parseDouble(Unknown Source) at java.lang.Double.parseDouble(Unknown Source) at Currency.main(Currency.java:28)  import java.text.DecimalFormat;  import javax.swing.JOptionPane;   public class Currency{  public static void main(String[] args) {     // declare and construct variables       double usDollarAmount, poundsAmount,eurosAmount,rublesAmount;      DecimalFormat twoDigits = new DecimalFormat("####.00");      //print prompts and get input     System.out.println("\tTHE Currency CALCULATOR");      //print prompts and get input     usDollarAmount = Double.parseDouble(JOptionPane.showInputDialog(null, "Enter your dollar amount:"));        // calculations      poundsAmount = 0.64 * usDollarAmount;     eurosAmount = 0.91 * usDollarAmount ;     rublesAmount = 61.73 * usDollarAmount ;       // output   JOptionPane.showMessageDialog(null, "YOUR DOLLAR AMOUNT OF  " + twoDigits.format(usDollarAmount) + " is equal to  " + twoDigits.format(eurosAmount)  + " euros"  + " ," + twoDigits.format(poundsAmount)  + " pounds"  + " " + " and " + twoDigits.format(rublesAmount) + " rubles"  );   System.exit(0);  }   }

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?


We can get the Einstein field equations of GR from the  via two distinct methods:   First, by taking the metric as the only degree of freedom, and imposing right away that the connection is the Levi-Civita connection. In that case the Lagrangian will be a functional of the metric only since the Levi-Civita connection is expressible in terms of derivatives of the metric.   Second, we can follow the : Take the metric and the connection as independent degrees of freedom and vary with respect to both. It happens curiously that the Euler-Lagrange equations for the connection will just be the condition that it must be the Levi-Civita connection.   It seems to be a wonderful coincidence that we get exactly the condition that the connection must be Levi-Civita one, thus recovering the Einstein field equations. So my question is: Why does this work? Is there any deeper mathematical reason why we get the right answer?

There are two ways to do the variation of .  First one is Einstein formalism which takes only metric independent. After variation of action, we get the Einstein field equation. Second one is  which takes metric and connection are independent. After variation, we get two equations, first is field equation and second is that connection is Levi-Civita connection.  So my question is why it is so coincident that Palatini variation of Einstein-Hilbert action will obtain an equation that connection is Levi-Civita connection and Palatini formalism coincides with Einstein formalism? While for $f(R)$ action they are generally different. Are there some deeper mathematical or physical structures of Einstein-Hilbert action which can account for it.


Here's what I have done:   I set up an apache server on Ubuntu in VMware. I used the NAT config. I set up port forwarding.     Now on the host machine, I can access the server using localhost. It works. But from the web, if I use the Host's IP address in another computer, I cannot access the web server.  Is there anything more I need to do?

I've got a development webserver on an Ubuntu box inside of VMWare Workstation 7.1.3. I'd like to run a web browser on a Windows machine (the host OS) for actually testing a web page I'm working on -- hard to run IE tests in Ubuntu :)  However, if I simply try to ping the IP given to the ubuntu VM (192.168.83.137) (or open it in my browser for that matter), it seems the host cannot communicate with the guest.  How do I allow the guest OS to communicate with the host when the guest is running in NAT mode?


I cannot access  my computer using Ubuntu after upgrading to 15.10.If I attempt to access my files from recovery mode, it needs me to login and just shows #boot. How can I fix my installation?

I am trying to boot Ubuntu on my computer.  When I boot Ubuntu, it boots to a black screen.  How can I fix this? Table of Contents:


What is the difference between a ConcurrentHashMap and a Hashtable in Java?  Which is more efficient for threaded applications?

I have a Map which is to be modified by several threads concurrently.   There seem to be three different synchronized Map implementations in the Java API:   Hashtable Collections.synchronizedMap(Map) ConcurrentHashMap   From what I understand, Hashtable is an old implementation (extending the obsolete Dictionary class), which has been adapted later to fit the Map interface. While it is synchronized, it seems to have serious  and is discouraged for new projects.  But what about the other two? What are the differences between Maps returned by Collections.synchronizedMap(Map) and ConcurrentHashMaps? Which one fits which situation?


We have a requirement to troubleshoot an existing system running Busybox, we have Telnet access. It would be helpful to log the system's console output (ideally the last n lines of it) to a file for debugging.  There's plenty of examples on redirecting the stdout/stderr of a command to a file at the point of invocation, but I can't find anything conclusive on capturing output from a running process or processes.  It seems like we should perhaps be able to capture/redirect from /proc/<PID>/fd/1 but searching suggests this is not possible, and I haven't managed to find an incantation to make it work.  Being a small embedded system we can't install more packages, so if it can't be done with basic command-line kung-fu we'll have to go back to the drawing board.  Any suggestions?

I know how to redirect output and how to  in bash. Now, suppose I accidentally forgot to append the output redirection part to the command (e.g. 2>&1 or > /tmp/mystdout) and my background process is already running for a while, can I still change to where stdout and stderr are being written to? I really would like not to kill and restart the application.  To be more specific as asked by  in his comment, I would like to fiddle with it in these scenarios in specific:   wrong output file forgot to redirect stderr to stdout   or a combination of both  E.g. I have Apache running and I can see the file descriptors:  /proc/8019/fd/0 -> /dev/null /proc/8019/fd/1 -> /dev/null /proc/8019/fd/2 -> /var/log/apache2/error.log


I tried to coax google into finding results for "am not preceded by I", but failed.  Now my question is: Is saying "Am" instead of "I am" valid slang?  Examples:   Am a God. Obey. Am driving. Can't talk now. Am a cat. Food plz.   By "grammatically correct slang", I mean if it's okay to use such sentences when talking, writing signs, registering domains, et al, when the intention is to not be serious, i.e. will native speakers understand?

I want to know firstly if it's grammatically correct to start a declarative sentence with "Am". For example:     Am excited about the game today.   Secondly, if it is grammatically incorrect, then I wanted to ask how much "head room" there is for the above usage. I can't think of an example now, nor find one here at english.stackexchange. However I imagine there are usages of the english language that grammatically are illegal, yet have somehow become accepted as colloquial or idiomatic perhaps.


var a; typeof(a); //undefined  typeof(c); //undefined  if(c) {} //throw error   How can I know that c doesn't exist without try catch.    Update after marked duplicate: typeof initializedVariable and typeof notInitializedVariable both will show 'undefined'. My question is to know whether the variable exists(initialized) or not.

What's the best way of checking if an object property in JavaScript is undefined?


I'm using following Javascript code in one of my calculations:   var bx1 = parseFloat(tx9) * ( 70 / 100 );  The output of bx1 is showing in decimals. However, I want it to be no decimals. Looking for some help!      Eg. bx1 = 700*70/100 = 489.999. I want it either 489 or 490, anything is fine.

Consider the following code:   0.1 + 0.2 == 0.3  ->  false   0.1 + 0.2         ->  0.30000000000000004   Why do these inaccuracies happen?


Environment: SharePoint 2013  How to migrate documents with Metadata and Content types to another site collection?

I'm in the process of upgrading/cleaning up a large Web Application with a lot of Site Collections. On a SharePoint Foundation 2013 env.  I have found some questions about moving document libraries and lists but nothing really covers it good. At least not what from what I have found.  Is there a way to move Libraries and/or Lists from one site collection to another on the same web application without effecting any metadata on the files and keeping all versions of document/ListItems.  I would preferably like to do this using PowerShell.  Have any tips/links?    that this question might be a duplicate of, but i don't believe the answer covers if there is a way to to this with PowerShell.  UPDATE  I have now investigated this more and tested some different ways to move Lists and Libraries.   Granular Backup and Restore ()   This worked but some metadata was lost. I found that user fields like custom user fields, Created By, Modified by and Create Date and so on, was not kept. Sadly, other ways this was easy to do.  How to: In Central Admin go to Back Up and Restore -> Granular Back up -> Export a site or list. Use PowerShell to Import it. (Import-SPWeb http://site -Path export.cmp -UpdateVersions Overwrite)  Save List as Template, Include Content.   Sometimes Include Content is "greyed-out".  Using code.   Looses Metadata if I move SPFolder. (Time consuming if I recreate the list on a different site collection and move all items and tag the metadata per document.)


A common example showing that a subring of a Noetherian ring is not necessarily Noetherian is to take a polynomial ring over a field $k$ in infinitely many indeterminates, $k[x_1,x_2,\dots]$. The quotient field is then obviously Noetherian, but the subring $k[x_1,x_2,\dots]$ is not since there is an infinite ascending chain of ideals which never stabilizes.     Is there an instance of a finitely generated Noetherian ring over some ground ring $R$, that has an intermediate ring which is not finitely generated over $R$, and hence not Noetherian either?

It's well known that if $K$ is a finitely generated extension of some field $E$, then any intermediate field $F$, $E\subseteq F\subseteq K$, is also finitely generated over $E$.  I'm curious, does the same hold for rings?      Say $S$ is a ring, and $R\supset S$ is a finitely generated extension of $S$. If $T$ is any intermediate ring, is it necessarily true that $T$ is finitely generated over $S$ as a ring?   Is it as simple as saying that for any $t\in T$, $T$ can be generated by the generators of $R$ over $S$? I feel unsure about this statement, since it's not clear to me that the generators of $R$ over $S$ need be in $T$.  If not, what is an example what shows otherwise? Thanks.


I'm developing a app, which works pretty well on the Android Studio Emulator, but when I built a APK and installed on my phone, it closes and crashes. So I decided to run it on my phone, debugging with ADB.  Looks like the problem is in line 67 of that Java code ()  for (int i = 0; i < itemlist.size();i++){         Points item = itemlist.get(i);         googleMap.addMarker(new MarkerOptions()                 .position(new LatLng(Double.valueOf(item.getPosx()), Double.valueOf(item.getPosy())))                 .snippet(item.getDescription())                 .icon(BitmapDescriptorFactory.fromResource(MarkerChange(item.getType())))                 .title(item.getName()));      }   .. But I wasn't able to fix that, someone can give me some help with this issue?  Thanks... and sorry for any posting mistake: I am a newbie here in StackOverflow and English isn't my native language.

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 not very old HP DeskJet 2622 printer connected with a USB connection. I have not been able to print anything with 20.04 ubuntu.  I had no problem printing with 18.04.  Is my printer incompatible with 20.04.  If yes then what HP printers will work with 20.04.  I setup my printer with hp-setup but error messages say no communication (error 5012) with the printer. Another message was about HP and no system tray

Let's assume that one has some HP printer and/or scanner and checked its support status on the corresponding page of HPLIP site - .  So one have the following information: the device Model name, Min. HPLIP Version and Driver Plug-in need.   What should one install to make Ubuntu fully support the HP printer and/or scanner?


I would like to be able to do this  mv /long/path/to/file/old.txt /long/path/to/file/new.txt  without typing the directory twice. I imagine something like  rename /long/path/to/file/old.txt new.txt  Is this possible?

Is there a convenient way to rename a file (or dir) without redundantly repeating the path or directory-changing to it?  For example …  mv -some_flag db/migrations/abc_201911201243.php abc_20191101090000.php   … to rename the file without moving it out of that directory.  I looked into the man pages for mv, rename and rsync but didn't find anything, so I'm wondering if there is by chance a non-obvious trick to do this.


While I was answering some grammar tests, I came across this :     (Blank) the patient's condition, the doctor decided to operate .   Our teacher says 'regarding' is the correct choice but I can find no reason as to why 'according to' might be incorrect. Please explain the difference between 'regarding' and 'according to' ? Is it always possible to use these two interchangeably ?

I wrote this sentence     However, if the user defines each rule (regarding/according to/in) a specific context, the algorithm will take the context into account before deciding to remove such elements.   Which are applicable and what would be the implication of each?  I myself think "regarding" means "about" and is not proper here, but I doubt between "according to" and "in", because "in" is a collocation for "context".


I've created a custom keyboard layout, but I want to use it on multiple computers. How can I package up my custom layout in such a way that I can easily install it on other computers?  I've begun following the steps outlined , but there are two problems with the accepted answer.   The answer appears to be obsolete, since Bugzilla now gives me the error . The answer is not detailed enough for me. I've made what I think are the correct modifications to the git repository, but now what? The answer just says to use "standard dpkg build tools", but I don't really know what that means.

I've managed to create a custom keyboard layout for .  Now that the keyboard is in a state that I can share it. I don't know how to make it a redistributable package.


I have 3 Corine land cover rasters, which each contains types of land use, for simple example - 1 - arable land, 2 forest, 3 - urban areas etc. How do I get not only the variety (which is easily obtained by cell stats) but also which type of land use changed to which, for all 3 of the cases. So for example between years 2006 - 2012 from 1 to 2 and between 2012 - 2018 from 2 to 3. The desired output could be a .dbf. I was thinking of using the "diff" tool, however I didn't come up with a reasonable and good looking output. Any suggestions?

I'm currently analyzing the change detection for urban expansion over a decade starting from 2006-2016. How can I use raster calculator in order to know the changes? For example, from agriculture to urban area and etc. I already classified the images into 4 classes, urban area,vegetation,water bodies and barren land.


Let $A \in M_{4 \times 4} (\Bbb R)$ be an orthogonal matrix with $\det(A)=-1$. Prove that $-1$ is an eigenvalue of $A$.   I'm a bit lost. I know about all the basic orthogonal matrices' properties (including the ones about scalar product). I also know that orthogonal matrices' eigenvalues are $\pm 1$. Any tips, please?

If $P$ is real orthogonal matrix with $\det P = -1$, prove that $-1$ is an eigenvalue of $P$.    can anyone help me please how can I solve this problem?


In a washing machine you wash clothes in heavy mode then it moves a bit. Then it is doing work with internal force. Then does it violate that any work can not be done with internal force?

My Mechanics textbook claims that the sum of the work by internal forces is not generally zero.  translated to English the paragraph reads:     Notice about the work by internal forces: the work by the internal forces is in general not equal to zero although the sum of the internal forces is always equal to zero. Since the work also depends on the relative displacement of the two pointmasses in the material system, the work provided by these 2 internal forces will generally not be equal to zero.   Other sources claim that the work done by internal forces is always zero.  (answer by Mark Eichenlaub)     Then I didn't do any work on the system at all since, by definition, only external forces can do work.        the net work done by internal forces is zero since they do not cause motion of the object.   To me it would seem that these sources contradict eachother. Do they? If so, which one is correct? If not, please explain why they don't contradict eachother.


I have a PhD in applied mathematics from a top university. I didn't realise it at the time because I was so focussed on my research, but it seems my research area (numerical analysis of PDEs) is actually very niche in terms of real-world problems in industry.  All the job listings I see are looking for people with a probability/statistics/machine learning background. There are literally hundreds of listings for these types of jobs for every one job in my area. I am currently a postdoc but I plan to leave academia for industry (probably finance) in the near future.  As the need for people with statistical skills is so clear, I have started considering the possibility of doing a second PhD, this time in a statistical area.  It would have to be part-time as I will be working full-time in industry. However, I currently work 7 days a week and very long hours on research as a postdoc, it is my hobby as much as my job. So when I begin working in industry, which is a standard 40 hour Mon-Fri working week, from my perspective I will have a huge amount of free time, i.e. eveninings and weekends, that I could dedicate to statistical research.  So I have several motivating factors for considering doing a second PhD:   Statistical skills are very much in demand and are of far more use in real-world applications than my own niche skillset. I would like to work on important real-world problems and it would be ideal to have a qualification for this. I absolutely love research and having a goal to work towards to motivate me to get really deep into a topic. I will have alot of free time when I move to industry soon, and I would like to dedicate that time to something constructive. I am interested in probability and statistics from a theoretical perspective and I would like to make a contribution to this field. Originally I applied for PhDs in this area, along with applied math PhDs; I went with the math PhD as I was also very interested in that area and it was a great opportunity to work with an excellent supervisor and university.   So a second PhD in a statistical area seems to make alot of sense to me.  Questions:   Would any professor even be interested in working with me considering that I already a PhD and that I plan to work on the second PhD during evenings and weekends? If you think there are professors that might be interested, how should I go about approaching them? I would not like to appear unprofessional. I don't need any funding as I will be working full-time. Will this help me in finding a professor for a second PhD or is it largely irrelevant?

I am studying a combined bachelor of engineering (electrical) and bachelor of mathematics; I just started this year and will graduate in 2018. The reason why I am doing double degrees and not a single degree is because I love both electrical engineering and mathematics and I could not ignore any of them. So with this in mind, I am thinking of doing two PhDs when I graduate (one in electrical engineering and one in mathematics). Is this a good path or I should concentrate on only one of them?


Scanner scanner= new Scanner(System.in);     System.out.println("Answer the following quiestions:");       System.out.println("1-Which of these letters is not a vowel?");     {         String a = "a-A";         String b = "b-I";         String c = "c-W";//true         String d = "d-O";         System.out.println(a);         System.out.println(b);         System.out.println(c);         System.out.println(d);         String answer1 = scanner.next();         System.out.println(answer1);         System.out.println(c.equals(answer1));        }  When i compare two strings in java It keeps giving me a "False in the output even though it should be "true"

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 have upgraded to from Ubuntu 14.04 to Ubuntu 16.04. How to get the Unity desktop?

I am trying to boot Ubuntu on my computer.  When I boot Ubuntu, it boots to a black screen.  How can I fix this? Table of Contents:


I saw the following statistic on TV a few years back:      53% of voters are going to vote for Mitt Romney over Barack Obama (Error: 3%, sample size: 300, survey conducted via phone)   After seeing this, I wrote the following in my notes:     Let's say that a politician is polling at a 53% rating, and the "error" (Standard Error) is 3%. Does this mean that the politician is actually polling between 50% and 56%? No. It actually means that 95% of the votes are between 47% and 59% (because a +- 2 standard deviation span contains 95% of incidents), and actually only 67% of the votes are between 50% and 56% (because a +- 1 standard deviation span contains 67% of incidents)   Questions:   Did I interpret it correctly? If not then what is the correct (or a better) interpretation? I understand how Standard Error is calculated in a Linear Regression. But how is the Error calculated in a situation like this where one is simply asking 300 people whether they're going to vote for A or B?   (please feel free to improve my tags.)

Recently the media reported on a political poll that stated that "46% of Republican voters in Mississippi think that interracial marriage should be illegal".  One example story (of many around the 'net) is this one from the NY Daily News: .  From that article:     A survey conducted last month shows 46% of GOP voters in the state   believe interracial marriage should be illegal - a plurality of the   people questioned   Given that I know many people in interracial marriages (including in my own family) I was motivated to track down the full story rather than fall to the obvious hysteria.  I located the press release on the poll from Public Policy Polling  (PDF)  which has:     46% of these hardcore Republican voters believe interracial marriage   should be illegal, while 40% think it should be legal. With Barbour   included, Huckabee gets more support (22%) from the former than the   latter (15%), as does Palin (13-6). The support for Bachmann (10-2),   Gingrich (13-8), and Pawlenty (4-1) works the opposite way.   And at the end of the first page they state:     PPP surveyed 400 usual Mississippi Republican primary voters from   March 24th to 27th. The survey’s margin of error is +/-4.9%.   Now what I don't understand is how to interpret the results especially the margin of error value.    From the raw numbers, 46% (~50%) of 400 voters is 200 voters who responded who think that interracial marriages should be illegal.  But from stats of Mississippi in the 2008 Federal election, McCain polled about 725,000 Republican votes (to Obamas 556,000). My gut feeling is that you can't extrapolate that 46% number to the other 724,600 Republican voters and still retain a 5% margin of error.  So is the media misrepresenting the numbers (really? the media would do that?!?!?!) Or are there statistics at work that I don't understand?  Thanks for your help!


I know about the PIVOT feature in SQL Server and I've read a few other questions and answers on here but I just can't seem to grasp it in order to do what I need. I'm trying to run some calculations and I have the following:  TABLE office_settings column office_id (bigint not null) column setting_value (NVARCHAR(500) NOT NULL)  office_id    setting_value -------------------------------------------- 4             0.2 4             0.2 4             2 4             3 5             0.2 5             0.2 5             2 5             3   I'd like to convert this using PIVOT (assuming that's the right tool for the job) to this, basically "grouping by" the office_id column, so:  office_id    value_1    value_2    value_3   value_4 ------------------------------------------------------     4         0.2         0.2         2         3     5         0.2         0.2         2         3   I should also mention that I need to CAST the setting_value column values to DECIMAL(4,2) in the process of this - in case that has any bearing on the T-SQL required to accomplish it.  Any ideas?


Let n be a positive integer. Prove that $1^2 +2^2 +3^2 + ... +(n-1)^2\equiv 0 \pmod n$ if and only if $n\equiv \pm 1 \pmod 6$  So I figured out that $1^2 +2^2 +3^2 + ... +(n-1)^2$ is equivalent to $\frac{(n-1)(n)(2n-1)}{6}$, but I don't see why the only restriction has to be on the $(n-1)$ factor. Why is the $(2n-1)$ factor also not included in the initial restriction?

The problem is as follows: Prove that $$1^2 + 2^2 + 3^2 + \cdots + (n-1)^2 \equiv 0 \, \text{mod n} \ \text{if and only if } n \equiv \pm 1 \, \text{mod} 6.$$  My idea is to of course rewrite the summation. We have $$1^2 + 2^2 + 3^2 + \cdots + (n-1)^2 = \frac{(n-1)n(2n-1)}{6}.$$  Now, in order for this to be an integer, must we have in particular that $6 \mid n-1 \Rightarrow n \equiv 1 \, \text{mod} 6$?  We also know that the sum $$1^2 + 2^2 + 3^2 + \ldots + (n-1)^2 + n^2 = \frac{n(n+1)(2n+1)}{6}.$$ Must we have in particular that then $6 \mid n+1 \Rightarrow n \equiv -1 \, \text{mod} 6$?  I think the statement holds if and only if the whole way so we are done with both ways?


When you create a field in Salesforce you can make it Required at the object level:  These required fields then cannot have FLS set via the profile. If you try and set FLS for them via the metadata API you get an error. So it would be useful to be able to work out which fields are marked as 'Required'. So how do you do that? There isn't any obvious field for it in the API or the Metadata API. The  has a 'nillable' property fields but that is also set for all checkboxes, so that can't be it.

I want to know how I tell whether a field is required or not in an Apex controller.   In my controller I get the record id and then get the object of that record by a describe call, then I get all the fields of that object, but I am not able to tell which field is required and which is not.


I'm at the stage where even a light cycle to/from work raises an appreciable sweat.   I shower when I get into work,  but I'm sweaty when I get home too. How do I avoid showering twice a day?

I'm planning on commuting by bicycle to work in hot Montreal, though this question is probably relevant to anyone who bikes to work in a city with temperatures above 20 degrees Celsius (68 degrees Fahrenheit). I have to wear business casual to formal clothes (no jacket, usually).  How do I not sweat?  I'm particularly looking for   Helmet features that prevent sweating Tips on rhythm, speed, pace, etc. that prevent sweating Bags that will make me sweat less (I'm leaning toward nice, office-friendly panniers at the moment but I'm open to other suggestions)   Any other tips would be greatly appreciated.


I'm pretty sure that, with the axiom of choice, there always exists a surjection from $\Bbb R$ to $\omega_1$ (well-order $\Bbb R$, send the first $\omega_1$ elements to the corresponding ordinals, if there are any reals left over send them to whatever). What happens in the absence of choice?

I'm quite sure I'm missing something obvious, but I can't seem to work out the following problem (web search indicates that it has a solution, but I didn't manage to locate one -- hence the formulation):     Prove that there exists a surjection $2^{\aleph_0} \to \aleph_1$ without using the Axiom of Choice.   Of course, this surjection is very trivial using AC (well-order $2^{\aleph_0}$). I have been looking around a bit, but an obvious inroad like injecting $\aleph_1$ into $\Bbb R$ in an order-preserving way is impossible.  Hints and suggestions are appreciated.


I would like to get rid of some packages that I have seldom used or not used in a very long time. I am particularly interested in how to list such packages via command-line tools like dpkg, apt-get or apt-cache, but it would be good if someone could also list ways of doing it via GUI programs such as Synaptic. Is it possible to query packages based on usage statistics or date of last use?

I'd like to find a tool that could tell me which Debian packages on my system have been rarely or never used, perhaps by looking at file lists and access times.  This is to find candidates for deletion from my nearly full hard drive.  I'm not very well informed about the rich ecosystem of desktop GUI tools (I use aptitude); does anyone know if one of those tools, or any other tool, can identify how recently a package has been used?


Does Google AdSense penalise websites that say "please disable ad blocking software… it helps pay our bills… blah blah…"?  Example of "please disable adblock":    It’s kind of asking to see (or click) my ads which is against Google AdSense policies.

Description:  I found a nice practice on websites to deal with users who take advantage of AdBlock's software -  is an article on it (have a look at the image of the cat).  I think this should be obvious now...  Problem to solve:  I have an ad container on my site and I will place in this container a short note about "whitelist my site", with the following options:   Use normal, formatted/plain text.  Use an image in the background.   If user has AdBlock, the ad won't appear and my hidden text will appear for them.  According to  AdSense support document:     Encouraging clicks      Publishers may not ask others to click their ads or use deceptive   implementation methods to obtain clicks. This includes, but is not   limited to, offering compensation to users for viewing ads or   performing searches, promising to raise money for third parties for   such behaviour or placing images next to individual ads.   In theory what I'm planning is some kind of encouragement for clicking ads.  Question:  Will I be violating Google AdSense's terms if I implement a text only and/or image only "whitelist us" message? Might I have problems with this type of violation?


I'm trying to understand the ending of DoFP.      Wolverine wakes up in the future at the Xavier school, obviously not knowing anything that has transpired since he was flung into the Potomac river in the battle with Magento.  He approaches the Professor and Xavier says something like "I've been waiting for you to return."  How is it that this Wolverine remembers what happened?

At the end of X-Men: Days of Future Past, Professor X asks Wolverine what he remembers, and he replies "Everything".  However, the Trask incident happened in 1973 and the events of X-Men Origins: Wolverine happened after 1975.  It was shown in Origins that Stryker put adamantium inside his body and wiped his memory. Therefore, how could Wolverine say that he remembers everything that happened in 1973?  Kitty says only someone who time-travels remembers everything. Does this mean that Wolverine came from 1973 to 2023 directly, or did he live through those years again?


I have a button to keep adding new rows. But its not adding. I want to add a new row in the end. I found the issue from class="portfolioimgdivnext" Please check the below code and help me to fix.  Demo     $('.addmore_img').click(function() {   $('.portfolioimgdivnext:last').after('

<input type="text" class="form-control" name="portfolioimgtitle[]" required maxlength="150" placeholder="Image Title" />This field is required.
<input class="fileUpload" accept="image/jpeg, image/jpg, image/png, image/gif" name="portfolioimg[]" type="file" value="Choose a file" data-msg-accept="Please upload only jpg, jpeg, png and gif file">
<input class="form-control" placeholder="Portfolio Image" readonly><button class="btn btn-fab btn-fab-mini" type="button">attach_file</button>
This field is required.

<button type="button" class="btn btn-warning btn-sm remove_field"></button>

'); });

     <input type="text" class="form-control" required name="portfolioimgtitle[]" maxlength="150" value="Title" placeholder="Image Title" />
       <input class="fileUpload" accept="image/jpeg, image/jpg, image/png, image/gif" required name="portfolioimg[]" type="file" data-msg-accept="Please upload only jpg, jpeg, png and gif file" value="Choose a file">
         <input class="form-control" id="uploadre" placeholder="Portfolio Image" readonly>         <button class="btn btn-fab btn-fab-mini" type="button">attach_file</button>
       This field is required.

     <button type="button" class="btn btn-default btn-sm bckbtn addmore_img">     </button>

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 want to upload a csv file with co-ordinates. The locations belong to USA. So I Upload a csv file to ArcMap and add XY data. The Projected Coordinate System is WGS_1984_World_Mercator. As soon as I add a base map, the locations are shown below continent of Africa. I tried changing the co-ordinate system. But not lucky ever. I am a beginner.   Anything I am overlooking?

I put 4 different layers into my ArcMap document, but only one of them will show up on the map! I should be seeing the other 3 layers as well. When I do a Zoom to layer, I can see one layer, but I cannot figure out how to make the other 3 show up at once on top of each other.  Before I opened ArcMap, I used ArcCatalog where I right-clicked 3/4 of the shapefiles and  clicked Properties → Coordinate system → Import and then clicked on my Trees layer, which has the coordinate system I want the other 3 to have. But when I opened ArcMap the 4 layers did not overlap, nor could I move them above or below each other.


I got the above named error after changing an eqnarray envrmt to align envrmt. I was wondering if align does not work with doc class scrartcl, but the mwe of other users also seem to work like that. Also the error can't be in the formula, as in a sample formula like below the same problem occurs.  Any ideas?  \documentclass[a4paper,12pt]{scrartcl}  \usepackage[ngerman]{babel} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage{amsmath, amssymb, graphicx} \usepackage{color}  \newcommand{\eq}{\begin{equation}} %Shortcuts für num. Einzelformel \newcommand{\eeq}{\end{equation}} \newcommand{\eqs}{\begin{align}} %Shortcuts für ausgerichtete num. Formelsysteme \newcommand{\eeqs}{\end{align}}  \begin{document}      \eqs a&=b+c\\ de&=fg+hi \eeqs  \end{document}

I know from the  that it is not possible to introduce direct abbreviations like \newcommand{\bal}{\begin{align}} % doesn't work \newcommand{\eal}{\end{align}}   % doesn't work  or \newcommand{\bal}{\align}    % doesn't work \newcommand{\eal}{\endalign} % doesn't work  What is puzzling me is that \newenvironment{foo}{\align}{\endalign}  does work, at least if one is well-behaved enough to diligently type \begin{foo}...\end{foo}, since \foo...\endfoo won't work either. I'd really appreciate some help to shed some light on what is going on behind the scenes :-)


In my program I have objects with different textures, that are in the same vbo. I cant have an array of samplers in my shaderprogram, so i have to use a texture atlas. I have seen some ways to make a texture atlas out of PNGs, but that would mean that I'll have to load those textures twice. Is there a way to put two textures together in one atlas? For example i have:  id = 1; width = 32; height = 32;   and   id = 2; width = 32 height = 32   I want something like this  int atlas = createTexture(t1.width + t2.width, t1.height + t2.height); glBindTexture(GL_TEXTURE_2D, atlas) //add(offset x, y, id) glAdd(0,0,t1.id); glAdd(t1.width, t1.height, t2.id);   I am not ooking for a texture packing algorithm! I need a way to create an atlas out of textures loaded to the GPU (OpenGL)

What is a good texture packing algorithm?  Technically,  is , so a heuristic is what I'm really after.


I kinda get a chance to extract gamefiles from the game fortnite(assets, sounds, etc), and then I want to use them for my animation, would that be illegal.  If it is illegal, what if I alter the assets, like modifying it to a voxel, and use it commercially, is it still illegal?

I need to incorporate other people's work into my game project. I must admit (with a little embarassment) that I am almost completely ignorant about copyright. I only have a vague idea of what it is, what it protects, or what it means when I see Ⓡ or © or ™. Since English is not my native language, reading all those Wikipedia pages full of legal jargon only gave me an headache.  I'm looking for images (sprites, backgrounds, UI elements mostly) and sound. I intend to publish the game (Google Play and Flash/HTML5 game websites, maybe the iPhone App Store). I don't plan to "sell" it directly, but I do intend to insert ads and/or in-app purchases.  I will most likely need to edit the content before including it in my game. Probably just scaling/rotating, but the greater degree of freedom I have, the better.  So, what should I look for, to be sure I have the rights to use the media I find the way I need to (like "royalty free" or "copyright free")? In which cases do I have to ask for "permission" to use that media, and how? Like, send the owner of the site an e-mail?


This question sounds noob to me but I am confused after being away from computing for some time (maybe I have had serious concussions or a brain tumor).  I bought a laptop some while ago and thought it was cool to let the salesmen dual boot it with some Ubuntu LTS. Now I am stuck with Ubuntu 17.10 and I do not have a clue how to fix this. Some features I need (e.g. RStudio) are problematic on this Ubuntu version and I just like feeling comfort with a LTS.   I think the easiest way is to just add 16.04 to a new partition but I can not even find out how to add partitions in linux and nothing comes up when writing grub in the dashboard.   I have often set up dual-boot with Windows and various distros but for some reason I am stuck now.

How do I completely reinstall Ubuntu without affecting the Windows partition? The way I setup my laptop is like this:   Completely wiped everything using GParted from Ubuntu CD Partitioned the HDD to 3 partitions (one for Windows, one for Ubuntu, one for Storage) Installed Windows 7 Pro 64-bit Installed Ubuntu 10.04 LTS 64-bit   The reason why I want to reinstall is NOTHING works in Ubuntu. No internet at all both Ethernet, and Wireless and when I figured out how to fix the wireless, there is no way to download drivers for the display so everything is just ugly and big. To make things more complicated, upgrading to 10.10 via update manager just gives me an error.  The way I see it right now is I have to try to wipe 10.04 and just install 11.04 from scratch but I'm not sure how to do that? Does anyone know?


when I click and blur div, an other div is create in last, but when I blur div what just is add, javascript not working, please tell me, why? and how fix.  Thanks for advance. Sample is:   js:  var contents = $('.changeable1').html(); $('.changeable1').blur(function() {         $('#addItem').before('<div class=\"changeable1\" contenteditable=\"true\"> Click this div to edit it </div>'); });


It seems like Hibernate function is not working properly on Ubuntu 18.04. I have tried with several commands like sudo pm-hibernate, and sudo systemctl hibernate etc. Nothing works.  Is hibernate also related to Hardware? My laptop RAM is 16GB and I have created the swap partition with the size of 24GB.  Any suggestion?

Hibernate worked correctly when I had been using Ubuntu 17.04. After upgrade to 17.10 I couldn't resume because of black screen after resume ().   After upgrade to 18.04 if I try to start my computer after hibernation it boots as if there was no hibernation done.


I define a varible, name 'Decisoin_name' and set -1 at first  and I try to change it in a def of a class  because I’d like  to add 1 everytime when I call the def  but the system send me a message      "local variable 'Decision_name' referenced before assignment"   what can I do?  Would you give me a solution to fix it ? thank you  The following is my code  Decision_name = -1  class Decision_Dialog(QDialog):      def sendback(self):          Decision_name+=1          print(Decision_name)          self.close()

How can I create or use a global variable in a function?  If I create a global variable in one function, how can I use that global variable in another function? Do I need to store the global variable in a local variable of the function which needs its access?


i just started python after php and javascript but i am confused in this easy concept....i already search a lot about this on tutorialpoints or w3school but i find nothing  here is the example code   var1 = 'Hello-World!' print("var1[:6]: ", var1[:6])   This code will print the output as  Hello- but here where is the W word because a string always start from 0 value so w will also be printed .....  anyways now i decided to print every word seperately  print("var1[0]: ", var1[0]) print("var1[1]: ", var1[1]) print("var1[2]: ", var1[2]) print("var1[3]: ", var1[3]) print("var1[4]: ", var1[4]) print("var1[5]: ", var1[5]) print("var1[6]: ", var1[6])   and the output is   var1[0]:  H var1[0]:  e var1[0]:  l var1[0]:  l var1[0]:  o var1[0]:  - var1[0]:  W   now i am really confused that why W is not printed in my first example code ?

I need a good explanation (references are a plus) on Python's slice notation.   To me, this notation needs a bit of picking up.   It looks extremely powerful, but I haven't quite got my head around it.


my team is starting to work on creating functional and technical requirements for big software. As a part of this assignment we are asked to provide well grounded hardware requirements.  I have no idea where to start and how to do it, have you ever seen methodology or any practice that can provide such requirements? how should we decide and state that we need this or that processor? actually the system will work on any modern hardware. please tell me about your experience

This is a  about  Related:      I have a question regarding capacity planning. Can the Server Fault community please help with the following:   What kind of server do I need to handle some number of users? How many users can a server with some specifications handle? Will some server configuration be fast enough for my use case? I'm building a social networking site: what kind of hardware do I need? How much bandwidth do I need for some project? How much bandwidth will some number of users use in some application?


An example for Python:   At this point, the only way I know is to ./configure and wait for it to stop at errors, try to understand the error, and google the error message to find out which development package to download.  That's inefficient.  Which part of the documentation or code should I look? Is there some standard location?

When installing something from source (say, Ruby 1.9.2), what command can I run to get a complete list of all the dependencies needed to install that application? Is this possible?


I have seen many times that the gradient of $x^TA\,x$ with respect to $x$ is $2A\,x$. But how do you find its gradient with respect to $A$?

How can I find the gradient of the term $a^TXb$ where $X$ is a $n \times m$ matrix, and $a$ and $b$ are column vectors.  Since the gradient is with respect to a matrix, it should be a matrix.  But I do not have a clue on how to derive this gradient.   Any help ?


Do counters added to a god with  disappear when the god stops being a creature?  Scenario:  is a creature (due to devotion reaching the required amount) and Gleam of Battle is also on the battlefield. Then Purphoros attacks and gets a +1/+1 counter for attacking. If my devotion to red then drops below 5 and Purphoros is no longer a creature, would the +1/+1 counters stay on him or will he reset to his original power/toughness level?  My thinking is when he becomes an enchantment he loses it due to the fact that he is no longer a creature and that his power and toughness are technically not there and so he gets remade into being a creature only when devotion is high enough.

Say I have a  and  out. I tap the Steel Overseer for his ability to put +1/+1 counters while my Blinkmoth is a creature, and it gains a counter. After my Blinkmoth goes back into a land, does it keep the counter, or does it lose it?


Let $C_{0}=\{(x_{n}):x_{n}\in\mathbb{R},x_{n}\rightarrow 0\}$ and $M=\{(x_{n})\in C_{0}:x_{1}+x_{2}+\cdot\cdot\cdot+x_{10}=0\}.$ I have to find dimension of the space $\frac{C_{0}}{M}.$ According to me its dimension is infinite. But i am not correct. Please tell me what is the exact dimension of the quotient space and how to find it? Thanks in advance.


My terminal emulator shows the following error while trying to install Dropbox. I need help and I am a beginner in Ubuntu.  Reading package lists... Done Building dependency tree        Reading state information... Done Some packages could not be installed. This may mean that you have requested an impossible situation or if you are using the unstable distribution that some required packages have not yet been created or been moved out of Incoming. The following information may help to resolve the situation:  The following packages have unmet dependencies:  nautilus-dropbox : Depends: dropbox but it is not going to be installed E: Unable to correct problems, you have held broken packages.

Occasionally, when I'm installing stuff, I get an error like the following:  Some packages could not be installed. This may mean that you have requested an impossible situation or if you are using the unstable distribution that some required packages have not yet been created or been moved out of Incoming. The following information may help to resolve the situation:  The following packages have unmet dependencies:  package1 : Depends: package2 (>= 1.8) but 1.7.5-1ubuntu1 is to be installed E: Unable to correct problems, you have held broken packages.   How can I resolve this?


Did anyone else noticed that it's almost impossible to search anything on developer docs through google recently.  Previously search like this: "salesforce schema get describe" would return  withing first few results, now however it's nowhere to be seen.

For years now I'm working frequently with some Salesforce developer documentations, e.g.:       The best and easiest way in my workflow to find stuff (in general) was to use some reasonable keywords on Google, like "apex map" oder "apex list" or "visualforce repeat" and so on. This worked very well!  I was used to get high quality deep links (at least within TOP 3) as results for searches like:   searching with Google for apex map class ==> TOP 1 was  searching with Google for visualfore apex repeat ==> TOP 1 was    Why I did this?  I did intentionally NOT use the buildin-search (inside the documentation provided by Salesforce), because the results were usually way worse than Google, it takes more keystrokes and clicks to use it and the way the resultset is displayed is simply very inconvenient (tiny listview, severe need of scrolling, painful handling) and before you can search you have to open the documentation itself (way slower than goolge showing results)  Issue:  Now a short time ago (can't say exactly when it started) searching on Google is not bringing the expected hits as stated above within the TOP 10 results. It looks to me, as if the documentation not longer indexed correctly or not index at all by the Google bot.  This situation is bad for learners and beginners. They should find the official documentation using the search engine the will most likely use.  Questions:   Any tips and tricks on tweaking my search terms in order to get back the expected results? I've tried already a lot of combinations (e.g. "salesforce visualforce apex:repeat" which really should bring  close to top 1) but the official documentation is pretty resistant against being found via Google.  Are there others with the same experience? Does someone know to whom at Salesforce and over which channels we could reach out and address this issue? (I have no premier support, and my questions to anything close to development will be shut down when I open a case)   What I checked so far  The URLs of the deep-content have not been changed (as it happened some time ago ). I could check this, because I've lots of deep-link-bookmarks collected - all of them working correctly with no redirect noticed. If the URLs had changed, it could be just a question of time the google bot needs to re-index the documentation again, but since the links are the same I'm expecting no improvement just by further waiting.  Workaround  As @JamesSullivan stated in his comment the search engine  is doing better than Google. I can confirm that searching for apex map class salesforce brings up the right match on TOP 1. But it feels slightly less powerful as Google felt before and I need to feed one or two keywords more to get such precise matches as I was used to.  Extra note  Google for apex map class salesforce (like duckduckgo above) brings at TOP 1 a poor match to the root  (not to the deep content) and it shows up in Japanese or Chinese for me by default. I think this might have been the link I'm after, but got crippled somehow... (but not sure)  Conclusion  I think only Salesforce can help.  It seems to me, that maybe the google bot is just no longer crawling the documentation - maybe because of a bad robots.txt or something similar, which might be easy for Salesforce to change back as it was a short while ago...


I have Googled and also checked Stack Overflow answers for this. But I am not able to understand clearly on this. Can anyone help explain simply the following example please?  function myObject(){     this.iAm = 'an object';     myObject.prototype.values = "value";     this.whatAmI = function(){         alert('I am ' + this.iAm);     } } var myObject1 = new myObject(); myObject1.values = "value2"; myObject1.iAm = "New";  alert(myObject1.values);   var myObject2 = new myObject(); alert(myObject1.values);   In the above code if I use this.iAm, it behaves in the same way prototype behaves.   I am new to Javascript Object Oriented Programming.   I expect many down votes. But I'm not concerned with that, because I just want to receive an explanation in a clear and simple way, that I have been able to find yet.

I'm not that into dynamic programming languages but I've written my fair share of JavaScript code. I never really got my head around this prototype-based programming, does any one know how this works? var obj = new Object(); obj.prototype.test = function() { alert('Hello?'); }; var obj2 = new obj(); obj2.test();  I remember a lot discussion I had with people a while back (I'm not exactly sure what I'm doing) but as I understand it, there's no concept of a class. It's just an object, and instances of those objects are clones of the original, right? But what is the exact purpose of this ".prototype" property in JavaScript? How does it relate to instantiating objects? Update: correct way var obj = new Object(); // not a functional object obj.prototype.test = function() { alert('Hello?'); }; // this is wrong!  function MyObject() {} // a first class functional object MyObject.prototype.test = function() { alert('OK'); } // OK  Also these  really helped a lot.


How to express my surprise at the moment?  I am wondering how easy the task is!  or  I wonder how easy the task is!

I often find myself writing sentences such as: "I am wondering if the landlord replied to you yet?"  And I always end up removing the question mark and rephrasing the sentence. In speech it is easy to inflect such a sentence so as to infer that it is a question, but in reality "I am wondering" is a statement and I feel it should not have a question mark when written down.  So is it acceptable to use "I am wondering" as a question?


Apart from that electric and magnetic field variation thing, is there any other explanation? Can photons simply pass through vacuum?

As I understand it, electromagnetic waves have two components which are the result of each other, i.e., when a moving electric charge creates a changing magnetic field at point X then a changing electric field is created at point Y and this repeating process is what creates EM waves, so therefore, it requires no medium. Is my understanding correct?  One thing that I'm surprised to know is that light is also called an electromagnetic wave.  Does this include light of any kind, for example: light from a bulb, a tube, and also from the Sun? How do they contain electric and magnetic fields?


I dual boot xubuntu alongside windows separated by two partitions. Every time I make a shortcut to a folder from the windows partition, it stops working/disappears from the side pane after restart. Is there any fix to this?

I'm using ubuntu 14.04 LTS. When I start my pc and click on any bookmark from the file manager it shows this error:   Unable to find the requested file. Please check the spelling and try again. Unhandled error message: Error when getting information for file '/media/angel/DOC/edu': No such file or directory   But when I open DOC drive and again clink on the same bookmark it works properly. Can anybody tell me why is this happening and how to solve this issue?   Edit: Output of lsblk is following: (ubuntu is installed in sda5)  NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT sda      8:0    0 119.2G  0 disk  ├─sda1   8:1    0  91.3G  0 part  ├─sda2   8:2    0     1K  0 part  ├─sda5   8:5    0  24.1G  0 part / └─sda6   8:6    0   3.8G  0 part [SWAP] sdb      8:16   0 465.8G  0 disk  ├─sdb1   8:17   0  93.2G  0 part  ├─sdb2   8:18   0     1K  0 part  ├─sdb5   8:21   0  93.2G  0 part  ├─sdb6   8:22   0  89.3G  0 part  ├─sdb7   8:23   0  93.2G  0 part  ├─sdb8   8:24   0  93.2G  0 part  └─sdb9   8:25   0   3.8G  0 part  sr0     11:0    1  1024M  0 rom     After opening the disk drive the output of lsblk is bellow:   NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT sda      8:0    0 119.2G  0 disk  ├─sda1   8:1    0  91.3G  0 part  ├─sda2   8:2    0     1K  0 part  ├─sda5   8:5    0  24.1G  0 part / └─sda6   8:6    0   3.8G  0 part [SWAP] sdb      8:16   0 465.8G  0 disk  ├─sdb1   8:17   0  93.2G  0 part  ├─sdb2   8:18   0     1K  0 part  ├─sdb5   8:21   0  93.2G  0 part  ├─sdb6   8:22   0  89.3G  0 part /media/angel/DOC ├─sdb7   8:23   0  93.2G  0 part  ├─sdb8   8:24   0  93.2G  0 part  └─sdb9   8:25   0   3.8G  0 part  sr0     11:0    1  1024M  0 rom   The output of sudo blkid gives the following information about sdb6:  /dev/sdb6: LABEL="DOC" UUID="04280A22280A12FA" TYPE="ntfs"


A mixed distribution where cumulative probability distribution function (CDF) is given by G(x)= (1-p)H(x)+pF(x)  where, p=0.2 (assumed in this case as it ranges from 0-1),  H(x)= 0 when x=0 else 1, and  F(x) is a two-parameter gamma distribution.  How can I get quantiles for y =c(0.2,0.5,1) for a given gamma parameters say shape=3.5 and scale=1.5 ? Note: I triedqgamma(y, shape, rate=scale, lower.tail = TRUE,log.p = FALSE) for gamma distributions only but I am not able to incorporate for the first term in the given CDF.

My PDF:     M was estimated and found to be 5.   I need to work out the quartiles for the PDF above. In addition, I need to use different methods of estimation to estimate the parameters. So far I've successfully used the method of moments. I'm finding it difficult to form the likelihood function.  This is the approach I took to work out the quartiles, which I believe is not correct; quartile 1 below:    And this is what I have so far for the likelihood function:    Any help would be truly appreciated! Thank you.


I was just curious for the proof/theorem for a very close decimal (so when you keep adding a decimal) to equal the next integer such as .999999999999....=1. Thank you.

I'm told by smart people that $$0.999999999\ldots=1$$ and I believe them, but is there a proof that explains why this is?


As you can see I have a Y G W R/2 C/3 D/1 terminals on my HVAC. I am planning to change my thermostat to one that requires a c line. There are 2 spare lines available, however I am not sure which is the C terminal. This is a forced air heating (gas) cooling(electric) system. I am guessing that its the C/3 terminal. Any help would be appreciated.

So, the spiffy new wi-fi thermostats want power on the C wire from thermostat, but the old thermostat doesn't have a C wire at it.  What's the easiest way to add the C wire/24 volt to the thermostat location?


I am using ArcGIS Desktop 10.x.  I am trying to automate the Buffer Wizard since I have several large sets of the data that I need to buffer at multiple distances. Doing it by hand will take a long time and be quite tedious, but I've already compared buffer times: even arcpy scripting with the buffer tool takes longer than using the Buffer Wizard by hand.   I do not have experience working in the Shell, so I am wondering whether this is feasible?

I've got a script that takes a single input polygon feature, throws 10 buffers around it at tenths of a specified input distance, and then symbolises the output based on an existing layer file.  Pretty simple.  However, the arcpy.MultipleRingBuffer_analysis operation is amazingly slow.  It takes upwards of two minutes to generate the buffers, even for very basic polygon inputs - the same result can be had in about two seconds by using the buffer wizard tool.  Problem is, the buffer wizard can't be accessed through arcpy.    So obviously it's possible to quickly generate multiple ring buffers - does anyone have any insight as to how the buffer wizard tool is doing it, and how that might be replicated in Python?


I want to draw the following figure using TikZ in LaTeX with the following requirements:   Numbers are evenly distributed around the circle. I can control the size of the circle. The size of the numbers can also be modified.   Edit: after following the comments, I get something that works.  \documentclass{beamer} \usepackage{tikz}  \begin{document} \begin{tikzpicture} \tikzstyle{every node}=[font=\large] \def\numofpoints{9} \def\labelpatt{{2,3,1,8,7,9,0,6,4,5}}  \node[circle,draw,minimum width=2cm] (bigc) {}; \foreach \x in {0,...,\numexpr\numofpoints-1\relax} { \node (l-\x) at (360/\numofpoints*\x+90:1.2cm)     {\pgfmathparse{\labelpatt[\x]}$\pgfmathresult$}; } \end{tikzpicture}  \end{document}

I would like to place n points over a circumference like Figure 3 of this . I'd choose the label to be assigned to each vertex and color and I'd like to have the code in TikZ-pgf.


A question closed as a duplicate normally displays a message stating that it already has an answer elsewhere.   Despite this, the message presented to the poster when someone suggests a duplicate does not reflect the possibility that the question could be a duplicate even if the original has no answer. You are presented with two choices:     That solved my problem!   Or:     No, my question is different. I will edit to explain how.      In cases where the same question has been asked but has no answer, neither choice is accurate. The question is not different, but the problem has not been solved.   Can this message be modified to allow us a choice where it is a duplicate even though the problem has not been solved?

Can we get an alternative to the "That solved my problem!" button that doesn't make the presumption that it solved my problem? I.e. "Yes, that's the problem I have."  In some cases, SE (et. al.) answer something, but the answer really doesn't solve it, it was a "cop-out" -- a "we know there's a problem, but there's currently no fix or workaround". Can we get a button that indicates that "Yes, I acknowledge I have that same problem, and I may have even tried those solutions, but it's not solved by any means." button or something?  I get the purpose of it - make it more friendly and easier to remove duplicates, but I refuse to say "That solved my problem!" if I still have a problem (mostly on principle). I'd rather have a "Ah yes, that's my issue! But, it seems like there's no actual solution there."  As an example:


I am trying to insert a product name and description with single quotes (Men's Shirt) and backslashes (shirt size M \ 38 ) into my table. Here is my code <?php  require 'connection.php';  // Usually I populate these values from POST  $s_no=1; $prod_name = "Men's Shirt"; $prod_desc = "High quality Men's shirt size M \ 38";  $safe_prod_name = mysqli_real_escape_string($connect,$prod_name); $safe_prod_desc = mysqli_real_escape_string($connect,$prod_desc);  $insert = "INSERT INTO `test`(`s_no`, `product_name`, `product_desc`) VALUES (?,?,?);"; $query = mysqli_stmt_init($connect); if (!mysqli_stmt_prepare($query, $insert)) {     header("Location: test.php?error=DBINSERTError");     exit(); } else {     mysqli_stmt_bind_param($query, "iss",$s_no , $safe_prod_name, $safe_prod_desc);     mysqli_stmt_execute($query); }  ?>  After inserting, data in the table looks like this +------+--------------+----------------------------------------+ | s_no | product_name |              product_desc              | +------+--------------+----------------------------------------+ |    1 | Men\'s Shirt | High quality Men\'s shirt size M \\ 38 | +------+--------------+----------------------------------------+  I saw many SO posts, and many suggest using stripslashes() and checking whether magicquotes are turned off. I have also added php_flag magic_quotes_gpc Off in .htaccess file to ensure that. But still this backslash is getting inserted into the table. I cannot use stripslashes while retrieving because "High quality Men's shirt size M \ 38" will become "High quality Men's shirt size M 38 ". kindly suggest to overcome this issue.

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 problem with this message when i want use snap I TRIED: sudo snap install snap-store but i recive this message: Unable to contact snap store

I wanted to install snap-store, but got this error message: error:unable to contact snap store  I decided to reinstall snapd, so I ran these commands: sudo apt-get purge snapd sudo apt-get autoremove   After that I lost my software center. Is there a way to bring it back? I tried: sudo apt install software-center  but I got this error message: E: Package 'software-center' has no installation candidate


I know there are lots of same type of questions posted on stackoverflow but I have something in custom and dont know how to solve this problem.  If any number is prefixed with ‘+’ or 0 (sequence of zero like 00) or ‘91-‘, then it should be removed automatically before group creation.  prefixed needs to be removed -    0 or sequence of 0 (00, 000, 0000 etc) + 91- +91-   Valid mobile numbers entered by users should be as below:    If mobile number is 10 digit, it should start with 9,8,7 or 6  If mobile number is 12 digit, first 2 digits should be 91 and 3rd digit should be 9,8,7 or 6  All other numbers should be considered invalid for domestic group creation.   What will be the php code for above as will be?  phone no ex-    +918877665544 or 0918877665544 or 0000918877665544 will give 918877665544 (length 12) +91-8877665544 or 91-8877665544 or 00008877665544 will give 8877665544 (length 10) +91-88776655440 (length 11) or 91-88-77665544 (- in between) will give gets skip or should giv blank   only digits are allowed after removing the allowed prefixes.  if any other it should skip (should give blank).  Note:- for all the cases it should have only one regex as this regex will be inserted from config settings.

I'm trying to put together a comprehensive regex to validate phone numbers. Ideally it would handle international formats, but it must handle US formats, including the following:   1-234-567-8901 1-234-567-8901 x1234 1-234-567-8901 ext1234 1 (234) 567-8901 1.234.567.8901 1/234/567/8901 12345678901   I'll answer with my current attempt, but I'm hoping somebody has something better and/or more elegant.


There are things that I do not understand. When you use gpu only uses 1 core. Solution or explanation? Blender 2.78 release 1475052116   Amd fx 8120 ram 16gb 1600 ssd 120 kingstone + hdd sata3 500 gb gtx 970 sc evga  linux mint 18

I am using Blender 2.77 and an R7 250 GPU on Windows.  Compute Device >> OpenCL (Oland).  OpenSubdiv >> (Tested with all).  Device >> GPU Compute.


I'n not that good in math and physics sadly but I want to understand one problem I'm facing right now. I am in a situation with a projectile shoot from a random height on direction of a target with position $(x_2,y_2,z_2)$ there $y_2$ could be offset in height. I know the initial angle of shooting and the distance. Now if the situation is in 2D I did menage to understand how to solve it following this nice video.  so using the formula  $$Y=Y_0 + V_{0y} t -\frac{1}{2}gt^2$$ $$X=X_0 + V_{0x} t -\frac{1}{2}at^2$$ where $a=0$ on $x$  I did solve it change $t=x/V_{0x}$ and substitute it on $y$ and managed to find the initial velocity $V_0$ that I used on the motion part of my script. The problem is that my target could be set as well as my projectile on a $X,Z$ horizontal position, so how I could get the velocity component on $X$ and $Z$ to reach my target and of course I guess will change even my $V_0$ formula.  Thank you for everyone who will help me.

I need to calculate the initial velocity required to launch a projectile at a given angle from point A to point B. The only force acting on the projectile after launch will be gravity – zero air resistance. The projectile is launched within a simulated, virtual environment; however, I am asking for help with the physics rather than the simulation itself.  I have had success (with a different equation) when point A and point B are at the same height; however, once point B is at a different height, my calculations become less precise – well, wrong in fact.  I researched the following formula for finding the range of a projectile on uneven ground. The parameters are all available to me, except the initial velocity that I need to solve for.     $d$ : range or distance   $v_i$ : initial velocity   $g$ : gravity   $\theta$ : launch angle   $y_0$ : launch height   $$d = \frac{v_i \cos\theta}{g}(v{_i} \sin \theta + \sqrt{(v_i \sin\theta)^2 + 2gy_0})$$  I attempted to solve for initial velocity (eq: A):  $$v_i = \sqrt{\frac{d^2g}{2\cos\theta^2(y_0+d \tan\theta)}}$$    Using this equation in my simulation I apply the velocity to a normalised displacement vector and launch the projectile. It gets close to its target but:   $x_{final}$ is always correct $z_{final}$ is always incorrect - it is close to the desired $z$ but always offset by a seemingly proportional amount.    I have spent many hours trying to review the equation but I have been unsuccessful. Any advice would be most appreciated:   is this the correct equation? have I solved for $v_i$ correctly? I have looked for an example equation online but I have not found one structured how I need it, i.e. solving for $v_i$ I have spent hours researching online - perhaps I have missed some good (but entry-level) resources. Do you know of any reference material that may help me?   Update - I have now named the equation above for referencing below  Following on from the answer by @Pygmalion, which I am still gratefully working to understand:  I agree that your derived equation is equivalent to mine (A). Using yours (@Pygmalion's) in my simulation, I therefore observe the same failures: the projectile always lands short of the target.  I have simplified the simulation keeping the launch height and target height the same. I still encounter the same problem with equation A; however, when passing the same parameters to the following equation the projectile always hits the target precisely (eq: B):  $$v_i = \sqrt{\frac{dg}{\sin2\theta}}$$  Given the success of equation B when the launch and target heights are the same and the failure of equation A given the same conditions, I question whether equation A is the correct one to solve the problem since I would expect it to work for any combination of launch|target height.  I think the help I need is around why equation B works. Does it cater for conditions that  equation A overlooks? If equation A is unsuitable, are you able to recommend an alternative?  In short, the $v_i$ calculated by equation A (in my simulations) is always less than $v_i$ from equation B given the same inputs - the projectile therefore always falls short of its target.


I am curious, plot-wise, what the chronological order of the James Bond films are?  I seem to recall that Casino Royal and Quantum of Solace are set in the beginning of James' career as a 00-agent and that Dr. No is set before he became aware of SPECTRE's existence. But that's about it.

There was a foolish (in my opinion) question asked on Scifi.SE       James bond keeps returning with a different face, albeit usually a similar one, and often operates with high-tech gadgetry that seem to be on par with the Doctor's sonic screw driver.   In my opinion each new actor represents a reboot of the franchise using the new face, not a continuation of the story.   Is there any continuity between versions of James Bond which change actors? I'm not talking about characters like M or Q, I'm talking about events or past advisories being referenced in a different Bond movie where the main actor was someone else.


Is $hh^T$ positive semi-definite? It seems to be positive semi-definite, but I cannot prove it. Please help:)

The positive semidefinite cone is generated by all rank-$1$ matrices $xx^T$, which form the extreme rays of the cone. Positive definite matrices lie in the interior of the cone. Positive semidefinite matrices with at least one zero eigenvalue are on the boundary.  I am unable to justify why the statements above are true. Please give some hints.


Is there a word or idiom for coming to a solution through unnecessarily convoluted means? I think similar to the question  but where the circuitous route isn't forced but a result of error or ignorance. I have a particular illustration that frequently comes to mind when describing unnecessary transformations (y = x - 2; y += 2). While reviewing counterproductive strategies that all arrived at the correct answer, a lecturer said "you can solve the problem like this, just like you can eat like this". He put his arm over his head and bent it around to the other side of his face and touched his upside down hand to his mouth. "Eating with an upside down hand" isn't yet ubiquitous enough for anyone to know what I'm talking about Edit: Oops! I think this is a duplicate

For an example, I'll quote C.S. Lewis' The Voyage of the Dawn Treader:     One day the cat got into the dairy and twenty of them were at work moving all the milk out; no one thought of moving the cat.   Is there an idiom for this type of situation?


I use my Ubuntu 14.04 laptop in 2 networks.  One of the network requires a network proxy. So suppose initially my laptop doesn't has any network proxy added to it. I switch it on and add the network proxy I need to add (or remove in other case). The problem is that the terminal remembers the original conditions (those before switching on the computer). So when I want to set proxy to the terminal as well, I use  export http_proxy='http://host:port'   export https_proxy='http://host:port'   and I check the proxy conditions using env | grep proxy. I get:  http_proxy='http://host:port' https_proxy='http://host:port'   But when I close the terminal screen, open it once again and again type  env | grep pro   I get no response, i. e. the proxy conditions get unset. How can i get out of this situation?

I tried to reset proxy of the terminal by some commands but it doesn't happen and automatically switches back to this proxy 172.16.0.16 (which apparently was my college proxy).   I checked in my system settings.I don't understand why this is recurring. Please be comprehensive.Also I further would like to know how to bypass proxy server since I couldn't access any of the ubuntu repositories as they were blocked in my college's proxy settings as is Ubuntu's homepage.  Thanks for your time.    For sudo ls /etc/apt/apt.conf.d/        It displays a different set of options where proxy is not listed.I am on 12.10,if this should help any.I put a snap of the terminal after the above command has been entered.


I have a tabular inside an itemize environment:  \documentclass{article} \begin{document}     \begin{itemize}         \item[(b)]         \begin{tabular}{|c|c|}             ...         \end{tabular}     \end{itemize} \end{document}   It looks like this:    But I want it to look like this:    I.e. I want to align the top of the table to the present item baseline. How?

Consider this example:  \begin{enumerate}     \item Blablabla bla bla bla.         \begin{tabular}{l}             Lorem ipsum dolor sit amet.\\             Consectetur adipiscing elit.\\             Donec eu ante non mi sagittis molestie.\\         \end{tabular}     \item Next question \end{enumerate}   LaTeX will vertically center the table, which looks pretty weird. It basically looks like this:                            Lorem ipsum dolor sit amet. 1. Blablabla bla bla bla. Consectetur adipiscing elit.                           Donec eu ante non mi sagittis molestie.   How can I manage for the consecutive lignes to line up under the first one (with the same margin)? Something which would look like this:  1. Blablabla bla bla bla. Lorem ipsum dolor sit amet.                           Consectetur adipiscing elit.                           Donec eu ante non mi sagittis molestie.   Any ideas?  Thanks!