I'm learning Go and I wrote this for a programming challenge. It is working (building and running) but I feel the code is not what Go code should be:  The code implements the steps a podracer takes to race over a 2D map. I input a target and a speed, and the code calculate where the pod will be at the end of the turn : rotating to point toward the target & moving (counting in previous speed).      In the playTurn() method below, I call each step. I reassign results (else they are not taken into account) because of scope I think.    It feels wrong for OOP code to have to reassign each step answer to the pod's attribute. What am i missing ?   Code :   package main  import (     "fmt"     "math"     "os"     "strconv" ) // Dot is king type Dot struct {     x, y int } // Pod is life type Pod struct {     position                Dot     vx, vy, angle, nextCpID int     hasShieldOn             bool }  func squaredDist(a, b Dot) int {     return (a.x-b.x)*(a.x-b.x) + (a.y-b.y)*(a.y-b.y) } func distance(a, b Dot) float64 {     return math.Sqrt(float64(squaredDist(a, b))) }  func (pod Pod) getAngle(p Dot) float64 {     d := distance(p, pod.position)     dx := float64(p.x-pod.position.x) / d     dy := float64(p.y-pod.position.y) / d     a := math.Acos(dx) * 180.0 / math.Pi      // If the point I want is below me, I have to shift the angle for it to be correct     if dy < 0 {         a = 360.0 - a     }     return a }  func (pod Pod) diffAngle(p Dot) float64 {     a := pod.getAngle(p)     pangle := float64(pod.angle)      right := 0.0     if pangle <= a {         right = a - pangle     } else {         right = 360.0 - pangle + a     }      left := 0.0     if pangle >= a {         left = pangle - a     } else {         left = pangle + 360.0 - a     }      if right < left {         return right     }     return -left }  func (pod Pod) rotate(p Dot) int {     a := pod.diffAngle(p)      // Can't turn more than 18° in one turn !     if a > 18.0 {         a = 18.0     } else if a < -18.0 {         a = -18.0     }      pod.angle += int(math.Round(a))      if pod.angle >= 360.0 {         pod.angle = pod.angle - 360.0     } else if pod.angle < 0.0 {         pod.angle += 360.0     }     return pod.angle }  func (pod Pod) boost(t int) (int, int) {     if pod.hasShieldOn {         return pod.vx, pod.vy     }     pangle := float64(pod.angle)     pod.vx += int(math.Round(math.Cos(pangle) * float64(t)))     pod.vy += int(math.Round(math.Sin(pangle) * float64(t)))     return pod.vx, pod.vy }  // t shoud become a float later on func (pod Pod) move(t int) (int, int) {     pod.position.x += pod.vx * t     pod.position.y += pod.vy * t     return pod.position.x, pod.position.y }  func (pod Pod) endTurn() (int, int) {     // todo rounding position if needed     pod.vx = int(float64(pod.vx) * 0.85)     pod.vy = int(float64(pod.vy) * 0.85)     return pod.vx, pod.vy }  func (pod Pod) playTurn(p Dot, t int) {     pod.angle = pod.rotate(p)     pod.vx, pod.vy = pod.boost(t)     pod.position.x, pod.position.y = pod.move(1)     pod.vx, pod.vy = pod.endTurn()     fmt.Fprintf(os.Stderr, "\nPredicted Pod position : ")     fmt.Fprintf(os.Stderr, "\n(%d, %d) speed (%d,%d)", pod.position.x, pod.position.y, pod.vx, pod.vy) }

I'm learning Go and I wrote this for a programming challenge. It is working (building and running) but I feel the code is not what Go code should be.  I used an OOP design. Is it correctly implemented in GO ?   In my main, I will call the method pod.playTurn(target, speed)  package main  import (     "fmt"     "math"     "os"     "strconv" ) // Dot is king type Dot struct {     x, y int } // Pod is life type Pod struct {     position                Dot     vx, vy, angle, nextCpID int     hasShieldOn             bool }  func squaredDist(a, b Dot) int {     return (a.x-b.x)*(a.x-b.x) + (a.y-b.y)*(a.y-b.y) } func distance(a, b Dot) float64 {     return math.Sqrt(float64(squaredDist(a, b))) }  func (pod Pod) getAngle(p Dot) float64 {     d := distance(p, pod.position)     dx := float64(p.x-pod.position.x) / d     dy := float64(p.y-pod.position.y) / d     a := math.Acos(dx) * 180.0 / math.Pi      // If the point I want is below me, I have to shift the angle for it to be correct     if dy < 0 {         a = 360.0 - a     }     return a }  func (pod Pod) diffAngle(p Dot) float64 {     a := pod.getAngle(p)     pangle := float64(pod.angle)      right := 0.0     if pangle <= a {         right = a - pangle     } else {         right = 360.0 - pangle + a     }      left := 0.0     if pangle >= a {         left = pangle - a     } else {         left = pangle + 360.0 - a     }      if right < left {         return right     }     return -left }  func (pod Pod) rotate(p Dot) int {     a := pod.diffAngle(p)      // Can't turn more than 18° in one turn !     if a > 18.0 {         a = 18.0     } else if a < -18.0 {         a = -18.0     }      pod.angle += int(math.Round(a))      if pod.angle >= 360.0 {         pod.angle = pod.angle - 360.0     } else if pod.angle < 0.0 {         pod.angle += 360.0     }     return pod.angle }  func (pod Pod) boost(t int) (int, int) {     if pod.hasShieldOn {         return pod.vx, pod.vy     }     pangle := float64(pod.angle)     pod.vx += int(math.Round(math.Cos(pangle) * float64(t)))     pod.vy += int(math.Round(math.Sin(pangle) * float64(t)))     return pod.vx, pod.vy }  // t shoud become a float later on func (pod Pod) move(t int) (int, int) {     pod.position.x += pod.vx * t     pod.position.y += pod.vy * t     return pod.position.x, pod.position.y }  func (pod Pod) endTurn() (int, int) {     // todo rounding position if needed     pod.vx = int(float64(pod.vx) * 0.85)     pod.vy = int(float64(pod.vy) * 0.85)     return pod.vx, pod.vy }  func (pod Pod) playTurn(p Dot, t int) {     pod.angle = pod.rotate(p)     pod.vx, pod.vy = pod.boost(t)     pod.position.x, pod.position.y = pod.move(1)     pod.vx, pod.vy = pod.endTurn()     fmt.Fprintf(os.Stderr, "\nPredicted Pod position : ")     fmt.Fprintf(os.Stderr, "\n(%d, %d) speed (%d,%d)", pod.position.x, pod.position.y, pod.vx, pod.vy) }   Am I using struct correctly ? Is it acceptable object oriented code ?


I thought of creating a path from a matrix $A$ to a matrix $B$ using their traces, but got nowhere.

The question asks "Is the set of all $3\times3$ real invertible matrices connected?"  My intuitive idea is that we can establish a separation consisting of matrices with positive and negative determinant respectively, whose union will be the whole set but with no intersections. However I am not sure how to show intersection of one set with the closure of the other set is empty, according to the definition of being disconnected. (My guess is that the closure for real matrices with negative determinant is just itself union matrices with 0 determinant)  So what will be a rigorous proof of this, using only tools in point-set topology and knowledge in linear algebra?   I know that $3\times3$ matrices can be viewed as homeomorphic to $\mathbb{R}^9$, but how do we define the topology on this subspace (i.e. set of all $3\times3$ matrices)? What will an open set look like in this topology?


Just wandering, how to reduce the file size of the image but keeping the quality in C# .net?  I have the following code use to save the image taken from ipad:  Bitmap srcBmp = new Bitmap(file.InputStream);  int w = srcBmp.Width; int h = srcBmp.Height; if (srcBmp.Width > 2732 && srcBmp.Height > 2048) {     w = 2732;     h = 2048; }  SizeF newSize = new SizeF(w, h); Bitmap target = new Bitmap(w, h); var destRect = new Rectangle(0, 0, w, h);  HttpContext.Response.Clear(); HttpContext.Response.ContentType = "image/jpeg"; using (var graphics = Graphics.FromImage(target)) {     graphics.CompositingMode = CompositingMode.SourceCopy;     graphics.CompositingQuality = CompositingQuality.HighQuality;     graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;     graphics.SmoothingMode = SmoothingMode.HighQuality;     graphics.PixelOffsetMode = PixelOffsetMode.HighQuality;      using (var wrapMode = new ImageAttributes())     {         wrapMode.SetWrapMode(WrapMode.TileFlipXY);         graphics.DrawImage(srcBmp, destRect, 0, 0, w, h, GraphicsUnit.Pixel, wrapMode);         using (FileStream fileStream = new FileStream(fname, FileMode.Create))         {             target.Save(fileStream, System.Drawing.Imaging.ImageFormat.Jpeg);         }     } }   The Image been saved is always over 14MB. Anyway I can keep the image quality and reduce the file size below 2MB?

How can I resize an image, with the image quality unaffected?


Error was occoured like below in python.   [1,2,3]*1e-6  TypeError: can't multiply sequence by non-int of type 'float'   How can I fix this?

I am typing to get a sale amount (by input) to be multiplied by a defined sales tax (0.08) and then have it print the total amount (sales tax times sale amount).  I run into this error. Anyone know what could be wrong or have any suggestions?   salesAmount = raw_input (["Insert sale amount here \n"]) ['Insert sale amount here \n']20.99 >>> salesTax = 0.08 >>> totalAmount = salesAmount * salesTax  Traceback (most recent call last):   File "<pyshell#57>", line 1, in <module>     totalAmount = salesAmount * salesTax TypeError: can't multiply sequence by non-int of type 'float'


I am writing code that is supposed to initialize a deck of cards, shuffle them, and then deal them to a specific number of players. I have written all the necessary methods, however when I try and implement them it compiles but when I run it I get a NullPointerException that's originating from my shuffle method.   What I'm thinking is that something is going wrong in my initialization of the deck of cards and thus when I try and access the deck in subsequent methods I'm getting the exception.  I'm just not sure what's going wrong and would be very grateful for some help! Here is the code:  (The exception appears when I attempt to switch the cards in the Shuffle method)  import java.util.Random; import java.util.Arrays;  public class Deck {      private Card [] arrCards;     public Deck()    {      Card [] arrCards = new Card[52];       String [] suits = {"Hearts", "Spades", "Diamonds", "Clubs"};       int count = 0;       for(int i = 0; i < suits.length; i++)      {        for(int j = 1; j <= 13; j++)        {           Card deckCards = new Card(suits[i], j);           deckCards.print();           arrCards[count] = deckCards;           count++;         }        }      }    public void shuffle()   {     int seed = 123;     //create arbitrary new temp card     Card temp = new Card("Hearts", 1);     Random randNum = new Random(seed);      for(int i = 0; i < 1000; i++)    {       int firstRand = randNum.nextInt(52);       int secondRand = randNum.nextInt(52);        temp = arrCards[firstRand];      arrCards[firstRand] = arrCards[secondRand];      arrCards[secondRand] = temp;     }    }   public Card [] dealHand(int n, int playerNum)  {      Card [] playerCards = new Card[n];       int counter = 0;      int start = (n  * (playerNum - 1));      int end = start + 12;      for(int i = 0; i < n; i++)     {       for(int j = start; j < end; j++)       {        playerCards[i] = arrCards[j];         }       }     return playerCards;  }   }  Thank you so much I really appreciate it! (Especially since this is probably a really basic mistake somewhere)  :)

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?


Is it possible to run a task or script started from terminal at the background?

How do I run a program in the background of a shell, with the ability to close the shell while leaving the program running? Lets say my UI is having problems or for some reason, I need to boot up a program from the terminal window, say, nm-applet:  nm-applet   When it's started, it occupies the foreground of the terminal window.  Is there any simple way to run the program in the background without needing to leave the terminal open or have it occupy the whole terminal?  On that note, I did find a way to run programs from the terminal and have it allow for other inputs, by appending an ampersand (&) to the command as such:  nm-applet &   But this isn't much use as any processes started in the terminal are killed once the terminal is closed.


Downloaded Adobe Flah player, went to downloads to run setup, opened the downloaded file but there was no (exe, setup or install). And when I searched on this issue, I had to read a long procedure of copying things here and there. It is just a hassel to install an outsider software.  Is there a rule on this matter?

Even though I have the latest Adobe Flash player 11.2 for Linux in Firefox -   - a particular online flash game still requests that I update to the latest flash player.  I've tried this online game on my laptop (Windows 8 with Flash Player 11.8) and it has no problems.  Is there a way to trick Ubuntu or this game into thinking Flash Player 11.8 is "installed"?


I have used some answers from Stack Exchange sites, with desire to republish it. I have prepared some work (something similar to blogpost) from answers of different 3-4 users. How can I properly apply SE license (cc) , how I will attribute all those users, from whom answers the post was created? Do I have to make list of all those users, and also list of links to the answers?

I just found http://programmingfaq.w3ec.com/faq/4761/whats-the-hi-lo-algorithm which has an exact copy of this Stack Overflow question, , with all its answers and no difference in a single character. There is no reference to Stack Overflow.  Is this legal, or at least tolerated? Is this impertinent theft of information? I just can't see any sense in copying whole pages, particularly when not referencing the source.


I have two website. first one is in wordpress and second one is in corephp. My Question is that i am connection database by $wpdb.  /* Core php database */  $newwpdb = new wpdb( 'username', 'password', 'database', 'localhost' );  Database connection is done. Now i am fetching some data using second database. After fetching i want to close the connection of core php database.  I have checked but not found any solution of it.    So anybody knows than please help me for solution.  Thanking in advance

Is there any method to close connection similar to  for  in WordPress?  Is it not necessary to close connection for global $wpdb?


In Marketing Cloud, we would like to remove multiple rows based on the EmailAddress column, which is the primary key in our permission data extension.  Now, we tried using the code snippet for Server-Side JavaScript (SSJS) from the SF official developer's site, but that only removes a single contact at a time. I don't know how to add additional email addresses for removal in the SSJS code snippet below. Please help.      <script runat=server>  Platform.Load("core", "1");          var permissionDE= DataExtension.Init("Preference_Management");          permissionDE.Rows.Remove(["EmailAddress"], ["customer@customer-emailDomain.com"]);       </script>

Is it possible to perform a Delete from a Data Extension using Query or something?  Like we have Insert/Update option in a query, I would like to delete.   I know this can done using API but is that the only way to perform automatic deletions from a data extension?


I want to prove this by saying if 3 divides n and  divides then then $8\times 3$ must divide $n$ which is 24, but that doesn't seem like a proof. Or maybe a proof by contradiction that if 3 divides n and 8 divides n then 24 does not divide $n$, but that creates a contradiction because 3 and 8 divides $n$ so $3\times8$ must.    I'm hoping there's a theorem that says if $x$ and $y$ divide $n$ then $xy|n$

If $\gcd(a,b) = 1$ and $a,b\mid x$ then $ab\mid x$.  My attempt at answering the question:  \begin{align*} x &\equiv 0 \pmod{a}\\\ &\Longrightarrow x\text{ is divisible by $a$}\\\ &\Longrightarrow x = ma\text{ for some integer $m$}\\\ \ \\\ x &\equiv 0 \pmod{b}\\\ &\Longrightarrow  x\text{ is divisible by $b$}\\\ &\Longrightarrow x = mb\text{ for some integer $m$}\\\ \ \\\ x^2 &= (ma)(mb)\\\ x^2 &= (m^2)(ab)\\\ x &= \sqrt{m^2ab}\\\ x &= m\sqrt{a}\sqrt{b} \end{align*} Let $m$ be $k\sqrt{a}\sqrt{b}$. Then \begin{align*} x &= kab\\\ &\Longrightarrow x \equiv 0 \pmod{ab} \end{align*}  Is this correct, if not can someone point me in the right direction?


Sorry for asking I believe a repeated question, but I can't figure out the problem here, maybe my understanding of this is not correct. Setup     class Job {     public:         virtual bool createJob() {             return false;         }     };      class Limit {     public:         virtual bool updateLimit() {             return false;         }     };      class Base : public Job, public Limit {     private:         std::string cx;     public:         virtual ~Base() {          }     };      class DerivedJob : public Base {     protected:         std::string ax;         std::string bx;         std::vector<std::string> vx;     public:         bool createJob() override {             return true;         }     };      class DerivedLimit : public Base {     protected:         std::string ax;         std::string bx;         std::vector<std::string> vx;     public:         bool updateLimit() override {             return true;         }     };  Should work?     Base parent;      auto stat = static_cast<DerivedJob&>(base);     std::cout << "JOB: " << std::to_string(stat.createJob());     std::cout << "LIMIT: " << std::to_string(stat.updateLimit());      auto dyn = dynamic_cast<DerivedJob&>(base);     std::cout << "JOB: " << std::to_string(dyn.createJob());     std::cout << "LIMIT: " << std::to_string(dyn.updateLimit());      auto stat1 = static_cast<DerivedLimit&>(base);     std::cout << "JOB: " << std::to_string(stat1.createJob());     std::cout << "LIMIT: " << std::to_string(stat1.updateLimit());      auto dyn1 = dynamic_cast<DerivedLimit&>(base);     std::cout << "JOB: " << std::to_string(dyn1.createJob());     std::cout << "LIMIT: " << std::to_string(dyn1.updateLimit());  I Tried many examples and read many posts, but when I add string and other garbage to my derived classes, it stops working, maybe my fundamental understanding of this is incorrect? Don't be to harsh, I am only a junior in c++ :D Thank you for your time explaining these things to me. Additional question How does dynamic casting work? Example class Device { private:   Base _base; public:   Device(int x) {     if (x == 5) {        DerivedJob object;        object.test = 5;        object.test2 = 1;        _base = object;     } else if (x == 7) {        DerivedLimit object;        object.test = 5;        object.test2 = 1;        _base = object;     } ...   } }

Someone mentioned it in the IRC as the slicing problem.


My 2015 MacBook Pro uses wifi from a 4G dongle. Some process or application is regularly making large download requests, which are very expensive over 4G - it recently used $60 of data in a single day, for an unknown purpose.  How can I detect (and disable) these processes?  To demonstrate, I rebooted and immediately opened Activity Monitor (so I'd have an accurate measure of the network activity), then used the laptop for an hour or so (but without constantly monitoring the activity).  The total Data Received is 428Mb (confirmed on the wifi dongle), but the cumulative network traffic of the processes listed is far less than this:    I assume that one or more processes is running, requesting data, then closing, and that after this they're no longer individually listed in the Activity Monitor, so it's not possible to determine which processes are implicated.  How can I debug which application or process is causing this? Activity Monitor doesn't seem to be precise enough, so is there a better option?  PS I have disabled:   App Store "check for updates" and "automatically download" DropBox Google Drive iCloud Drive and I haven't opened iTunes.

I'm being forced to use my Macbook more and more with my metered 4G connection. I really need to keep data usage limited. Windows has an  mode which really helps with this.   What's the best way to handle this issue in the OSX world? Perhaps some use of the firewall? Is there any sort of logging happening as to what is using the network?  Thanks for your help :-)


We have a custom object called 'support' - we have process builder configured for this  object. in one of the process builder action it will invoke Apex (Invocable Method). This will trigger a callout to External System. In Apex Test Class we have mocked the response for HTTP callout by using Test.setMock & HttpCalloutMock interface. code coverage for that apex class is 96%.  We have different apex test classes where we are need test records for Support Object - we are creating test data using testDataFactory Class. While running the test we are seeing below error - "Methods defined as TestMethod do not support Web service callouts".  Please provide your suggestion to resolve this issue.  Sample Code:  public class AnimalsCallouts {    @InvocableMethod(label='Call External System')   public static void callEx(List<ID> ids) {       makeGetCallout();   }       @Future(callout=true)     public static void makeGetCallout() {         Http http = new Http();         HttpRequest request = new HttpRequest();         request.setEndpoint('https://th-apex-http-callout.herokuapp.com/animals');         request.setMethod('GET');         HttpResponse response = http.send(request);         // If the request is successful, parse the JSON response.         if (response.getStatusCode() == 200) {             // Deserializes the JSON string into collections of primitive data types.             Map<String, Object> results = (Map<String, Object>) JSON.deserializeUntyped(response.getBody());             // Cast the values in the 'animals' key as a list             List<Object> animals = (List<Object>) results.get('animals');             System.debug('Received the following animals:');             for (Object animal: animals) {                 System.debug(animal);             }         }         return;     } }  @isTest global class AnimalsHttpCalloutMock implements HttpCalloutMock {     // Implement this interface method     global HTTPResponse respond(HTTPRequest request) {         // Create a fake response         HttpResponse response = new HttpResponse();         response.setHeader('Content-Type', 'application/json');         response.setBody('{"animals": ["majestic badger", "fluffy bunny", "scary bear", "chicken", "mighty moose"]}');         response.setStatusCode(200);         return response;      } }   @isTest private class AnimalsCalloutsTest {     @isTest static void testPostCallout() {         // Set mock callout class          Test.setMock(HttpCalloutMock.class, new AnimalsHttpCalloutMock());          // This causes a fake response to be sent         // from the class that implements HttpCalloutMock.          AnimalsCallouts.callEx(null);     } }  @isTest public class TestFactory {   public static Support__c getSupport(String name, Boolean doInsert){     Support__c a = new Support__c(name = name);     if(doInsert){       insert a;     }     return a;   } }  @IsTest private class NewTestClass {     @TestSetup     static void dataCreation(){       Support__C a = TestFactory.getSupport('Muddy Water', true);     }     @isTest static void testMethod111() {         // do Nothing     } }

I am trying to write a test for a trigger that is firing a future apex callout :  The trigger calls the callBillingService method from this class:  public class BillingCalloutService {     //Implement business and callout logic methods here     @Future(callout=true)     public static void callBillingService(List<Id> recordIds) {         List<Project__c> projects = [Select Id, ProjectRef__c,Billable_Amount__c from Project__c Where Id = :recordIds];          List<Project__c> projectsToUpdate = new List<Project__c>();          String username = ServiceCredentials__c.getValues('BillingServiceCredential').Username__c;         String password = ServiceCredentials__c.getValues('BillingServiceCredential').Password__c;          String auth = username + ':' + password;         String encodedAuth = EncodingUtil.base64Encode(Blob.valueOf(auth));          for(Project__c p : projects) {              BillingServiceProxy.InvoicesPortSoap11 service = new BillingServiceProxy.InvoicesPortSoap11();             service.inputHttpHeaders_x = new Map<String, String>();             service.inputHttpHeaders_x.put('Authorization', 'Basic ' + encodedAuth);              BillingServiceProxy.project project = new BillingServiceProxy.project();             project.username = username;             project.password = password;             project.projectRef = p.ProjectRef__c;             project.billAmount = p.Billable_Amount__c;              if(service.billProject(project).equals('ok')){                 projectsToUpdate.add(new Project__c(ProjectRef__c = p.ProjectRef__c, Status__c = 'Billed'));             }         }         shouldIRun.stopTrigger();         upsert projectsToUpdate ProjectRef__c;     } }   Error     Methods defined as TestMethod do not support Web service callouts   Test Class  @IsTest private class BillingCalloutServiceTest {      @IsTest     private static void testBillingCalloutService() {     Account a = new Account(Name = 'Acme');     insert a;     Opportunity o = new Opportunity(Name='Test', StageName='Submitted Project', AccountId=a.Id, Amount=1000, CloseDate=Date.Today());     insert o;     Project__c p = new Project__c(Status__c='Running',Start_Date__c=Date.Today(),End_Date__c=Date.Today(),Billable_Amount__c=10000,ProjectRef__c='projectX',Opportunity__c=o.Id);     insert p;      insert new ServiceCredentials__c(Name='BillingServiceCredential',Username__c='toto', Password__c='azerty');      Test.startTest();     Test.setMock(HttpCalloutMock.class, new BillingCalloutServiceMock());       p.Status__c = 'Billable';       update p;     Test.stopTest();     // runs callout and check results     p = [select Status__c from Project__c where id =: p.id];     System.assertEquals('Billed', p.Status__c);     }  }


I've got a citation where the authors name includes Š. LaTeX gives an "! Package inputenc Error: Invalid UTF-8 byte sequence." on this, fine, I'm used to that, so I replace it with \v{S}. That just gives me a v in the output. But \v{z} works just fine.   MWE:  \documentclass[]{article} \usepackage[utf8]{inputenc} %Allows UTF8 input.   \begin{filecontents}{UTF8.bib} @Article{UTF8,     author ="Chen, Teng-Hao and Lee, Semin and Flood, Amar H. and Miljanić, Ognjen Š.",     title  ="How to print a crystal structure model in 3D",     journal  ="CrystEngComm",     year  ="2014", } @Article{LaTeX,     author ="Chen, Teng-Hao and Lee, Semin and Flood, Amar H. and Miljanić, Ognjen \v{S}.",     title  ="How to print a crystal structure model in 3D",     journal  ="CrystEngComm",     year  ="2014", } @article{TeachingReview,     author = "Gra{\v{z}}ulis, Saulius and Sarjeant, Amy Alexis  and Kantardjieff, Katherine A and et al..",     title = "{Crystallographic education in the 21st century}",     journal = "Journal of Applied Crystallography",     year = "2015", } \end{filecontents} \usepackage[utf8]{inputenc} \usepackage[super,sort&compress,comma]{natbib}  \usepackage[T1]{fontenc} \usepackage{natmove}  \begin{document}  Oddly Miljanić, Ognjen Š. works fine in the body of the text.\cite{UTF8}  If I encode the name in LaTeX it works in body text: Miljanić, Ognjen \v{S}.\cite{LaTeX} But REALLY oddly Gra{\v{z}}ulis, Saulius works everywhere.\cite{TeachingReview}  \bibliography{UTF8} \bibliographystyle{abbrvnat} %the RSC's .bst file \end{document}

How to write in bibliography (package natbib) letter "a" with two dots above? Specially, I mean the word Birkhäuser.  Is there a general rule or way how to write such umlauts or other accented letters in bibliographies?


i am getting this error and have been trying to debug the cause for quite sometime now. I have scan through almost all the topics that google returned to me, but none help so far.   So, now i am trying to deploy only the problematics field/obj () and i am getting the same issue.  'Reason_fo_Loss__C' 's picklist was updated and am trying to deploy to another org.   i have disabled the history in the target org, as well as - set     <trackFeedHistory>false</trackFeedHistory>   <trackHistory>false</trackHistory>   There is no inactive fields with the same name too.  Any thoughts to resolve this will be appreciated.. thank you

I've just spent several hours trying to fix a deployment that was failing with the following extremely helpful error message:  Error: objects/Opportunity.object(2098,13):duplicate value found: <unknown> duplicates value on record with id: <unknown>   After a lot of Googling (which didn't help) and even more trial and error (which finally did), I've discovered that the question I really needed an answer to is...     If Salesforce gives me a "duplicate value found: <unknown> duplicates value found on record with id <unknown>", how can I figure out what's actually gone wrong?   There are several possible answers online, and a couple here on StackExchange, but without knowing how to narrow the focus after getting such a horrible, useless error message, it's too easy to fall for red herrings.


Suppose $B$ is a Borel set and $f$ mapping  from $B$ to $R$ is a non decreasing function.Prove that $f(B)$ is a Borel set. f is a Borel measurable function because the inverse image of $(a, \infty)$ will be of the form $(t, \infty)$ or $[t,\infty)\cap B$ which is a Borel set. I cannot define inverse function because it may not be strictly increasing. How do I proceed?

I'm studying measure theory and two question came to my mind:        If $f:\mathbb{R}\to\mathbb{R}$ is monotone and $B\subseteq\mathbb{R}$ is borel, is the image $f(B)$ borel?   If $f:\mathbb{R}\to\mathbb{R}$ is a monotone function (say, non-decreasing), does there exist a sequence of continuous functions $f_n:\mathbb{R}\to\mathbb{R}$ converging pointwise to $f$?      Here's the motivation for those questions: Let $(X,M)$ and $(Y,N)$ be measure spaces.   It's known that if $\mu$ is a measure on $(X,M)$ and $f:X\to Y$ is measure, then we have the pushforward measure $f_*\mu(A)=\mu(f^{-1}(A))$ on $(Y,N)$. What if we were to define a "pullback measure"? Given a function $f:X\to Y$ such that $f(M)\subseteq N$ (i.e. $f$ maps measurable sets to measurable sets) and a measure $\nu$ on $N$, the natural formula would be $f^*\nu(A)=\nu(f(A))$. So we ask if is there a good amount of functions which map measurable sets to measurable sets in $\mathbb{R}$, and monotone functions seem like good candidates (for strictly monotone, continuous functions, the result is valid and there are several answers on the web). If this were true, maybe we could use some convergence argument to solve the problem above.


I can not understand the usage of super term here? Is it a class or function or something else ?  From the code below:  class Child(SomeBaseClass):     def __init__(self):         super(Child, self).__init__()   Can someone please explain this line of code below ?  super(Child, self).__init__()

I'm trying to understand the use of super(). From the looks of it, both child classes can be created, just fine.   I'm curious to know about the actual difference between the following 2 child classes.  class Base(object):     def __init__(self):         print "Base created"  class ChildA(Base):     def __init__(self):         Base.__init__(self)  class ChildB(Base):     def __init__(self):         super(ChildB, self).__init__()  ChildA()  ChildB()


I am reading a book on doing Bayesian Data Analysis.  I have just learned what the Metropolis Hastings (MH) Algo does, at least in relation to Bayesian Data Analysis.  My understanding of the MH Algo is that it allows us to approximate the posterior distribution for which analytically it may be tough for us to determine.  The biggest issue seems to be evaluating the denominator in Bayes' theorem as for continuous priors, we need to evaluate an integral to normalize the likelihood function.  In the book I'm reading, I just got to a section on Gibbs Sampling.  I am having a hard time understanding how it works and what the point of it is.  In the book, it says that "Gibbs Sampling is a special version of the Metropolis-Hastings Algorithm". Here are the things I don't understand.   When running the algo for Gibbs Sampling, the next point we travel to is determined via a conditional distribution.  The book defines this distribution (I am assuming it is the proposal distribution) as p(θ1|{θj-1},D), where D is the data or real world sample you have observed.  The above distribution looks just like the posterior distribution as it's basically a parameter value given the Data.  If the goal of MH MCMC was to generate the posterior distribution because analytically it is too hard, how do we already have the posterior distribution to use for Gibbs Sampling?  And what's the point of sampling from the posterior distribution anyways if we already know what is.  We should be able to extract the density at any point just by using the formula for the posterior distribution. My second question is that, in Gibbs Sampling, the book states we move from one point to another with 100% probability.  I don't understand this as isn't the mechanic that makes MH MCMC work is the probability of moving to one point or another depends on the relative likelihood.  The ratio of likelihoods between two points -> probability of moving to that point -> allows us to approximate the posterior distribution.   Thanks!

I am self-studying Gibbs sampling from a book. The book introduces metropolis hastings algortihm to generate representative values from a posterior distribution. So we know $p(D | \theta) p(\theta)$ but not in the normalized form. So we generate those values.   Now when it introduces Gibbs sampling it quotes,      Gibbs sampling is especially useful when the   complete joint posterior, $p(θ_i |D)$, cannot be analytically determined   and cannot be directly sampled, but all the conditional distributions,   $ p(θ_i |\{θ_{j \ne i}\}, D)$, can be determined and directly sampled.   Suppose we have two parameters $\theta_1$ and $\theta_2$ so for determining $p(θ_1|θ_2, D)$, we need $\frac{p(θ_1, θ_2|D)}{p(θ_2|D)}$, and now I am all the more confused. First it says      when we can't analytically determine the posterior   and then uses  $\frac{p(θ_1, θ_2|D)}{p(θ_2|D)}$ , where we don't know yet the posterior distribution, because that is not "analytically determined". Can anyone explain, what am I understanding wrong.


I'm thinking to reinstall Ubuntu on my machine and would love to have Unity back.  I can't get used to Gnome.  What is the best way to get Unity back on the recent releases of Ubuntu?  Or is there an alternative to Unity?  The feature I miss the most is the Alt search for a menu item.

I recently installed Ubuntu 18.04 and I'm not keen on the desktop environment. I want the desktop env. I used to have in Ubuntu 14.04. How can I get it?  I've attempted to use , but when I try to install the Unity's 7.2.5 version using the command:  apt install unity=7.2.5   it gives me   E: Version '7.2.5' for 'unity' was not found   For sure I need to add a PPA for this, but which one!?


I read conflicting information about the megapixel - subpixel relationship when it comes to sensors in digital cameras. I read that megapixel is number of sub pixels and I also read megapixel is number of pixels where each pixel is made out of 3 or 4 sub pixels, which one is true?  Considering the square patern of pixels in modern sensors, each pixel is made from 2 green sub pixels and 1 blue & green sub pixel. If the megapixel number means the number of sub pixels, then true pixel number is 1/4 of the megapixel number. On other hand if the megapixel is the number of true pixels, then the sub pixel number is 4x higher than megapixel number.

that camera makers consider the individual R/G/B sensors when they talk about megapixels. So the image below would be a 6x6 pixel camera, not 3x3 as you would imagine.    If that's true, a RAW file would contain only one color information per pixel (be it R, G or B) as a 10, 12 or 14 bit number.  My confusion comes as I read in some places stuff like:   RAW files store an avarage of the two green sensors per pixel. RAW files use 12 bits per pixel, but there are 3 colors so that's actually 36 bits per pixel.   Which would obviously be false, if Ken's claiming is correct.  So what's the truth?


From a real world perspective each dimension in the 3-D Cartesian System can be represented by an axis that is perpendicular to 2 other axes. I read somewhere else that the effect of ${i}$ is to reorient data 90 degrees on the "imaginary" axis. I guess my question is this: What role ( if any)   does $i$ serve in everyday or even quantum physics?  ${Edit}$  To clarify, I am more concerned with the dimensional aspects of $i$. If for instance you were to consider a 3-D location to be a "point" with length width and height in a complex graph representation with three additional mutually perpendicular axes?   PS. I know this thread is getting a bit hair brained. But in my defense, I did look for a "specualation" tag before I posted this thread here.  $EDIT$  I changed $\sqrt{-1}$ back to $i$, because I am concerned with the hypothetical real world effect of the entity. Not the mathematical representation.

The use of imaginary and complex values comes up in many physics and engineering derivations. I have a question about that: Is the use of complex numbers simply to make the process of derivation easier, or is it an essential ingredient, without which it would be impossible to derive some results?   I can identify two different settings where the answer may be different:   It doesn't look like it is mandatory for results in Newtonian mechanics, General Relativity and classical electrodynamics. Can we say the same thing about quantum mechanics either way for sure?   Could this be a difference in quantum mechanics over the classical picture?


In versions of macOS before macOS Mojave (10.14), one could press the Alt/Option key when viewing an image in Quick Look to zoom in to the "actual size" of the photo.  When the macOS Mojave beta came out, it seemed as though that feature was removed. I asked a question about it , and it turned out that the shortcut key was changed to Control.  In the last few beta versions of macOS Mojave as well as the public release, unfortunately, this does not seem to be working anymore. I tried all combinations of modifier keys that I could think up of, but nothing seems to work.  Is there any other new shortcut for zooming an image in Quick Look on macOS Mojave?

One invaluable Quick Look feature which I used to use pre-Mojave was pressing the "alt/option" button when using Quick Look to view a photo, which zoom in on the photo to its actual size. However, it seems like on Mojave this changes the orientation of the rotate button on the Quick Look toolbar, a feature I do not expect to use.  Is there an easy shortcut in Quick Look on Mojave, like the alt/option shortcut which existed pre-Mojave, which I can use to get back the old behavior, or has this useful feature been completely removed?


I understand what the code below does:  var x = myFunction(3, 4)  function myFunction (a, b) {     return a * b; }  console.log(x);   It will create a function called myFunction, call it with 3 and 4 and return 12.  But I don't understand what the difference between the above code and the code below.  var myFunction = function (a, b) {     return a * b; };  var x = myFunction(3, 4) console.log(x);   If we can write code like the first one, why do we need to write code like the second one?  Thanks.

I've recently started maintaining someone else's JavaScript code. I'm fixing bugs, adding features and also trying to tidy up the code and make it more consistent.  The previous developer used two ways of declaring functions and I can't work out if there is a reason behind it or not.  The two ways are:  var functionOne = function() {     // Some code };     function functionTwo() {     // Some code }   What are the reasons for using these two different methods and what are the pros and cons of each? Is there anything that can be done with one method that can't be done with the other?


I have a form, that form has a gridview that display data, that data comes from a list of any class that a I have in the entities, my question is how to add a list of any entity as property, i try the following:     public List<T> objectList { get; set; } //List as entity     public help() //Constructor     {         InitializeComponent();         gridControlHelp.DataSource = objectList; //Binding the grid with the list     }

You should be able to create a generic form:  public partial class MyGenericForm<T> :     Form where T : class {     /* form code */     public List<T> TypedList { get; set; } }   Is valid C#, and compiles.  However the designer won't work and the form will throw a runtime exception if you have any images stating that it cannot find the resource.  I think this is because the windows forms designer assumes that the resources will be stored under the simple type's name.


I want to be able to run all of my Steam games on my laptop.  But 2/3 of them are .exe files.  Is there a way to run or convert them as/to .deb files?  Or is there a program that will help me run them?

Can .exe and .msi files (Windows software) be installed in Ubuntu?


If $$D_{2n} = \{r^i s^j, \quad 0 ≤ i ≤ n − 1, \quad 0 ≤ j ≤ 1 \}$$ is the dihedral group of order $2n$, show that the center of $D_{2n}$, $n > 2$ is the trivial subgroup if $n$ is odd, and is the subgroup $\{e, r^{n/2} \}$ if $n$ is even.  I don't know how to proceed with this one. Kindly help. Thanks in advance.

The center of $D_6$ is isomorphic to $\mathbb{Z}_2$.   I have that $$D_6=\left< a,b \mid a^6=b^2=e,\, ba=a^{-1}b\right>$$ $$\Rightarrow D_6=\{e,a,a^2,a^3,a^4,a^5,b,ab,a^2b,a^3b,a^4b,a^5b\}.$$ My method for trying to do this has been just checking elements that could be candidates. I've widdled it down to that the only elements that commute with all of $D_6$ must be $\{e,a^3\}$ but I got there by finding a pair of elements that didn't commute for all other elements and I still haven't even shown that $a^3$ commutes with everything. For example, I have been trying to show now that $$a^3b=ba^3$$ and haven't gotten too far yet but if I had to answer a question like this on the exam, I feel it would be difficult, is there any kind of trick or hints other than brute force using the relations to get that $a^3$ commutes with everything?  For the solution once I have that the center of $D_6$ is what I think then as there is only one group of order $2$ up to isomorphism, it must be isomorphic to $\mathbb{Z}_2$.  Ideally a way that doesn't appeal to $D_6$ as symmetries of the hexagon if that seems possible.


I was wondering if reputation is meant more as a "resource to be used" or as something that should steadily increase as your experience grows? I ask this as recently on Stack Overflow my reputation has been dropping because I have been posting a lot of bounties.   Is this how I'm meant to use my reputation, or should I really be trying to get to those higher amounts of reputation?

On Stack Exchange, users may gain a certain level of reputation.  What does reputation do? How can a user gain or lose reputation?   See also   in the Help Center  - Maximum amount of votes a user can use in a day and reputation requirements to vote.  - How to get an exact overview of the actions that got you your reputation.  - A full list of all privileges granted at each reputation level on all sites.


I am an Indian citizen and applied for my MSc in UK for the first time. However my visa got rejected on the basis of not being a genuine student, though all my documents are genuine. The rejection was based on the visa interview. I am planning to apply again for the same country and the same university for the January intake.    Will my rejection will haunt me and I what are the chances of getting the visa this time?

I am 21, Vietnamese and have been accepted for the 26-week-long General English course in St Giles International, Brighton, UK. I have applied to the UK Visas and Immigration office in Vietnam. I have asked for short term student visitor visa and got refused. Now I am reapplying.  Exact wording of the refusal letter quoted here:     I have refused your application for a  visit visa because I am not satisfied that you meet the requirements of paragraph A57 of Appendix V: Immigration rules for Visitor because:         You have said that you will travel to the UK for a period of 26 weeks, to study a general English course. You have said that upon completion of the course you will return to Vietnam looking for a better job. You appear to have completed your full time studies in Vietnam in 2013, and you have been working in administration role since May 2014. You have not sought to continue your studies in your home country since 2013. and you have not undertaken any English course previously, outside of your high school studies. You are employed and receive a monthly income of VND 5,000,000 (GBP 144.70). Of your GBP 144.70 income you spent GBP 100 on living costs. You have said that your study in the UK will cost you GBP 16,000. Therefore I am unclear why you would elected to travel; to the UK now, at the course involved - when courses are available in Vietnam, considerably cheaper.   As evidence of funds available for your trip you have presented a Sacombank savings book, on 14/08/2015 you credited VND 800,000,000 to this account, this is equal to GBP 23,151, and equates to over 13 years total income, before considering your living costs. As such, I am not satisfied of the origin of these funds, or if they are genuinely available to support your visit now. In light of the above, noting the costs involved, in fact you have not sought to study English previously, and there is no evidence that completion of this course would offer you better employment in Vietnam. Coupled the fact that I am not satisfied that the funds a genuinely available to support you visit means I am not satisfied that you intend to leave the UK at the end of the study. Furthermore, I am not satisfied you have enough funds to support your return journey, or that you will be maintained and adequately accommodated out of funds available to you.      First of all, after completing high school, I was not able to make it to a college or university. I got the job as a arrangement of my father with his friend's company. I could live quite easily without the salary thanks to my parents' financial support. In another word, all I needed was just a so called job, no matter how much it would pay me. After a year of being bored of the jobs as well as family dependence, with my parents' encouragement, I decided to go to study abroad to improve my knowledge and experience. I simply think that if I continue being in my country, no matter how much I want to do it, my family will give me everything I need when I am in trouble. And more than to become independent, I want to get a job with my very own sources when I return. I think the course will afford me that.  The funds for my course, obviously, came from my parent. And if the UK Immigration officers have doubt about my return or my bond to my hometown which can assure my return (such as a high salary job or real estate ownership) I just don't know what to show to convince them.  At the moment, all I think of to add to my reapplication are my parents' income statements (though I am not quite sure if it will help because legally, I have been no longer their dependant). Just so you know, I've already had my bank statement, employment description, return ticket booking, study record etc. I desperately want this, and even much more after the refusal, as I don't want to be called parasite any more.  What should I prepare and do to reapply?    I'm so afraid of being refused again and that would be the end of all of this because every time of being refused, it's only getting harder and harder to apply next time.


If a creature is the target of a witch hex, such as Evil Eye, Slumber, or Charm, are they aware that they have been targeted?  Would they be able to determine who hexed them?  Does it matter if the target passed their save or not?

Some  (like  or ) specify some form of action to be taken by the witch when activating them, but most hexes do not specify, does the witch just look someone and then the hex is active? Can anyone notice when someone is being hexed?


I am preparing some data using FME, which I end up writing to an Esri file geodatabase. Unfortunately, FME doesn't appear to update the written feature classes' spatial indices. This results in display problems when I later inspect the written data with ArcMap (or other ArcGIS desktop tools).  It appears that there are two seemingly easy solutions for this problem:   Recreate any spatial indices after writing data. Compact the file geodatabase after writing data.   Compacting seems like the easier choice, because it can be done per geodatabase (vs. recreating indices per feature class).  I don't want to compact the geodatabase manually; ideally I'd want to compact the geodatabase inside my FME workbench, using a shutdown Python script. However, there appears to be no ArcGIS geoprocessing tool for compacting a geodatabase (only one for compressing, which is not the same thing).  Does anyone have a solution here?   Updating the spatial indices directly in FME; or compacting a file geodatabase using ArcPy (in an FME shutdown script).

I am trying to write a script to walk through all folders in my workspace and find and compact all geodatabases in my workspace.  I feel like I'm on the right track but I am stuck.  import acrpy, os from arcpy import env  arcpy.env.workspace "C:"  for (path, dirs, files) in os.walk(arcpy.env.workspace)     for file in files         if ".gdb" in file:         workspaces = arcpy.ListWorkspaces("*", "FileGDB")             for workspace in workspaces:             arcpy.Compact_management(workspace)   I am using ArcGIS 10.2.2 for Desktop.


Powershell now handily remembers history from previous sessions, and I can get to earlier commands simply by using the up-arrow. What I would like though is to be able to display this history, but I can't figure out how to do it.  The command get-history for some reason only seems to be able to display the history for the current session. Even passing the -count option doesn't help.  At the moment the only way I can get to a previous command is to manually up-click through all previous commands to find the one I'm looking for. This obviously can be quite tedious if the command was run a while ago.  Is there some trick to make get-history work correctly, across sessions. This list is obviously stored somewhere, so it aught to be possible to display it.  edit: This isn't a duplicate question. This is about accessing the full history which is already recorded by Powershell, not about adding a new (custom) way to save session history. Those other questions and associated answers were relevant before Powershell had the ability to automatically record full command history.

I can export my Powershell history using the scripts outlined in ,   Get-History | Export-Clixml ~\PowerShell\history.xml   and I can automatically load up the saved history when I start a Powershell session using this line in my powershell profile,  Import-Clixml ~\PowerShell\history.xml | Add-History   But is there any way that my history can be automatically saved when I exit the session? I'm using  as my console.


class B{     public void p(double i){         System.out.println("B");     } } class A extends B{     public void p(double i){         System.out.println("A");     } }   class Demo{     public static void main(String args[]){       //way of using polymorphic 1         A a=new A();         a.p(10.0);        //way of using polymorphic 2         A a=new B();         a.p(10.0)     }  }   Both 2 ways provide same answer.But I want to know what is the difference between these 2 ways of using dynamic polymorphic.what is the best way to use in a program?

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


I've inherited a C system which makes use of function return values to check for errors and exceptions; something like this:  #define OK 1  int create_cheese(const char * myType, float myCost, char * myCheese) {    // Do Stuff...     if // everything looks good        return 1;    else        return // error/exception code }  int main() {     rc = create_cheese("cheddar", 12.99, &cheese);     if (rc != OK) { exit(rc); }      return 1; }   Is this considered proper C technique?  These functions are not very, well, functional. In other words, they don't use the function return values as meaningful data relevant to program execution; they're used for error and exception handling. Thank you, Keith :^)

What do you consider "best practice" when it comes to error handling errors in a consistent way in a C library.  There are two ways I've been thinking of:  Always return error code. A typical function would look like this:  MYAPI_ERROR getObjectSize(MYAPIHandle h, int* returnedSize);   The always provide an error pointer approach:  int getObjectSize(MYAPIHandle h, MYAPI_ERROR* returnedError);   When using the first approach it's possible to write code like this where the error handling check is directly placed on the function call:  int size; if(getObjectSize(h, &size) != MYAPI_SUCCESS) {   // Error handling }   Which looks better than the error handling code here.   MYAPIError error; int size; size = getObjectSize(h, &error); if(error != MYAPI_SUCCESS) {     // Error handling }   However, I think using the return value for returning data makes the code more readable, It's obvious that something was written to the size variable in the second example.  Do you have any ideas on why I should prefer any of those approaches or perhaps mix them or use something else? I'm not a fan of global error states since it tends to make multi threaded use of the library way more painful.  EDIT: C++ specific ideas on this would also be interesting to hear about as long as they are not involving exceptions since it's not an option for me at the moment...


Hi: I could try to prove there is a bijection $f$ from $A$ into $G$. There is a bijection $A\to A^g$. Then $|G|= |A||A^g|/|A\cap A^g|=2|A|/|A\cap A^g|$. If $|A\cap A^g|=2$ then $G=A$, because $G$ is finite. But how do I prove it? And how do I find $f$? Suppose $f(a)=aa^g$. If I can prove $f$ is onto then $A=G$. But if $g \in G$ then $g=xy^g$ for $x,y\in A$. Why would $x=y$? Another way would be to find an injection from $G$ into $A$. P.S.: $a^g:= g^{-1}ag$. $A^g:= g^{-1}Ag$.

Let $H \leq G$. If $G = H H^x$ then $G=H$.  According to the source, it should solve with elementary knowledge of group theory, but my tries have no result! Any help would be appreciated.   Thanks in advance.


I have a file  Other - Analogue Clock-JEJqy1Wlovw.mp4  which is just a download from     It's 2 minutes 13 seconds long.  I had some issues cutting it to the second.  I was able to use this command   ffmpeg -ss 0 -i infile.mp4 -c copy -t 60 output.mp4  to make a file that was 60 seconds, so no problem so far.  That's the file exactly 1 minute, no issue there so far.  C:\vids\a>dir blahhclo.mp4   9,590,540 bytes  C:\vids\a>   C:\vids\a>mediainfo blahhclo.mp4 General Complete name                            : blahhclo.mp4 Format                                   : MPEG-4 Format profile                           : Base Media Codec ID                                 : isom File size                                : 9.15 MiB Duration                                 : 1mn 0s Overall bit rate                         : 1 278 Kbps Writing application                      : Lavf58.3.100  Video ID                                       : 1 Format                                   : AVC Format/Info                              : Advanced Video Codec Format profile                           : High@L4.0 Format settings, CABAC                   : Yes Format settings, ReFrames                : 3 frames Codec ID                                 : avc1 Codec ID/Info                            : Advanced Video Coding Duration                                 : 1mn 0s Bit rate                                 : 1 146 Kbps Width                                    : 1 920 pixels Height                                   : 1 080 pixels Display aspect ratio                     : 16:9 Frame rate mode                          : Constant Frame rate                               : 25.000 fps Color space                              : YUV Chroma subsampling                       : 4:2:0 Bit depth                                : 8 bits Scan type                                : Progressive Bits/(Pixel*Frame)                       : 0.022 Stream size                              : 8.21 MiB (90%)  Audio ID                                       : 2 Format                                   : AAC Format/Info                              : Advanced Audio Codec Format profile                           : LC Codec ID                                 : 40 Duration                                 : 1mn 0s Bit rate mode                            : Constant Bit rate                                 : 126 Kbps Channel count                            : 2 channels Channel positions                        : Front: L R Sampling rate                            : 44.1 KHz Compression mode                         : Lossy Delay relative to video                  : 40ms Stream size                              : 920 KiB (10%)    C:\vids\a>   But I do have an issue when I try to cut it at the following times, and it's whether I try to cut the 1 minute one or the whole 2 min 13sec one.  If I cut with -ss 0 -t 1,   it produces a file that is 1s 22ms.  So that's not too bad that's fairly close to one second. 1.022 seconds is quite good for an attempt to cut one second.  If I cut with -ss 0 -t 2, it produces a file that is 3s 19ms   That is terrible! it's meant to be one second!  If I cut with -ss 0 -t 30 then it is fine it does 30s 1ms.  Or this video for example, also an mp4   C:\blah>ffmpeg -ss 189 -i vid.mp4 -c copy -t 6 someoutput.mp4  C:\blah>mediainfo someoutput.mp4   produces a duration of 8s 383ms  That is so wrong though 'cos it should be 6 seconds! So that is two seconds too long!  C:\blah>ffmpeg -ss 191 -i vid.mp4 -c copy -t 6 someoutput2.mp4  C:\blah>mediainfo output2.mp4   shows that ffmpeg produced a duration of 10s 403ms  which is crazily wrong 'cos the ffmpeg command specified 6 seconds!  So that's not just one second out, that is 4 seconds out!  That's almost 50% longer than it should be!

I'm having trouble finding a cli application that can take a video file (avi, mkv, and mp4 preferably) and cut out very short clips (2-6 seconds) with precision time accuracy. I've tried ffmpeg, mencoder, avidemux, and mp4box but they all cut on keyframes which creates 6+ second clips. Is there a tool that will re-encode the input file and cut the accurate time or cut inaccurately, re-encode, and then cut accurately?


I have written the below code - select          PAPF.PERSON_NUMBER,          BP.NAME                                       BENEFIT_PLAN,          BBR.BENEFIT_RELATION_NAME,          Round(BPER.BNFT_AMT, 2) * 100                 COVERAGE_AMOUNT,          TO_CHAR(BPER.ENRT_CVG_STRT_DT, 'YYYYMMDD')    ENROLMENTCOVSTARTDATE         TO_CHAR(BPER.ENRT_CVG_THRU_DT, 'YYYYMMDD')    ENROLMENTCOVSENDDATE FROM    PER_ALL_PEOPLE_F               PAPF,         BEN_PRTT_ENRT_RSLT             BPER,          BEN_PL_F                       BP,          BEN_BENEFIT_RELATIONS_F        BBR         WHERE PAPF.PERSON_ID               = BPER.PERSON_ID          AND     BPER.PL_ID                   = BP.PL_ID          AND     BBR.PERSON_ID                = PAPF.PERSON_ID  AND     BBR.BENEFIT_RELATION_NAME    = 'DFLT' AND     SYSDATE BETWEEN PAPF.EFFECTIVE_START_DATE AND PAPF.EFFECTIVE_END_DATE  AND     SYSDATE BETWEEN BP.EFFECTIVE_START_DATE   AND BP.EFFECTIVE_END_DATE  AND     SYSDATE BETWEEN BBR.EFFECTIVE_START_DATE  AND BBR.EFFECTIVE_END_DATE   This will give me an output like - PErson_number           BENEFIT_PLAN                COVERAGE_AMOUNT  ENROLMENTCOVSTARTDATE          ENROLMENTCOVSENDDATE     1010                    US Basic PLAN               20000               20200901                    20201020 1010                    US Basic PLAN               20000               20201021                      1011                    Us Spouse PLAN              160000              20200901                    20201020 1011                    Us Spouse PLAN              160000              20201021                    47121231  I want to retrive only the max of the ENROLMENTCOVSTARTDATE for each person. The expected output should be - PErson_number           BENEFIT_PLAN                COVERAGE_AMOUNT  ENROLMENTCOVSTARTDATE          ENROLMENTCOVSENDDATE     1010                    US Basic PLAN               20000               20201021                      1011                    Us Spouse PLAN              160000              20201021                    20201220  how can i use Max in the main query for this ?

Table:   UserId, Value, Date.   I want to get the UserId, Value for the max(Date) for each UserId. That is, the Value for each UserId that has the latest date. Is there a way to do this simply in SQL? (Preferably Oracle)  Update: Apologies for any ambiguity: I need to get ALL the UserIds. But for each UserId, only that row where that user has the latest date.


I have a PHP script that checks my database's code for validity. How can I have this run everyday at a certain time so then I can just have it run on autopilot.

I have a site on my webhotel I would like to run some scheduled tasks on. What methods of achieving this would you recommend?  What I’ve thought out so far is having a script included in the top of every page and then let this script check whether it’s time to run this job or not.  This is just a quick example of what I was thinking about:  if ($alreadyDone == 0 && time() > $timeToRunMaintainance) {    runTask();    $timeToRunMaintainance = time() + $interval; }    Anything else I should take into consideration or is there a better method than this?


I need to be able to add 1, 2 , 5 or 10 days to today's date using jQuery.

How to add days to current Date using JavaScript. Does JavaScript have a built in function like .Net's AddDay?


I am working with eclipse Keplerr IDE for a Dynamic Web Project  The Problem occuring is that, even if java conditional if statement is correct, simple with right data, its not returning the 1st (True) part of IF statement even if its true.  my code:  GetSetClass (Model)  package tempTryOct15;   public class GetSetClass {      String Conditionalz(String txt1){          String t1 = txt1;         System.out.println("The String Received is:" + t1);          String ret="NULL-Value";         if(t1=="ssc")             ret="SSC";         else             ret="Non-SSC";          System.out.println("returned: " + ret);         return ret;     }  }   tryServlet.java (Controller)  package tempTryOct15;  import java.io.IOException;  import javax.servlet.RequestDispatcher; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse;   /**  * Servlet implementation class tryServlet  */ public class tryServlet extends HttpServlet {     private static final long serialVersionUID = 1L;      /**      * @see HttpServlet#HttpServlet()      */     public tryServlet() {         super();         // TODO Auto-generated constructor stub     }      /**      * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)      */     protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {          String txt1=request.getParameter("txt1");         String txt2=request.getParameter("txt2");          System.out.println("The 1st String Entered is:" + txt1);         System.out.println("The 2nd String Entered is:" + txt2);          request.setAttribute("text1",txt1);          /*         GetSetClass GSC = new GetSetClass();         String text2 = GSC.Conditionalz(txt1);         System.out.println(text2);          */          if(txt1=="ssc")             txt2="SSC";         else             txt2="Non-SSC";          request.setAttribute("text2",txt2);          System.out.println("The 2nd String Got is:" + txt2);          RequestDispatcher view = request.getRequestDispatcher("Display.jsp");             view.forward(request, response);      }      /**      * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)      */     protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {         // TODO Auto-generated method stub     }  }   The Same code is working fine with core plain java and Notepad++ editor. as:  Try.java  class Try{      String Conditionalz(String t1){          System.out.println("The String Received is:" + t1);          String ret="NULL-Value";         if(t1=="ssc")             ret="SSC";         else             ret="Non-SSC";          return ret;     } }   TryDemo.java  class TryDemo{     public static void main(String[] args){          Try t = new Try();         String ret = t.Conditionalz("ssc");         System.out.println("returned: " + ret);      } }

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?


Well, I have read a lot of answers to this question, but I have a more specific one. Take the following snippet of code as an example.  public class GenericArray<E>{     E[] s= new E[5]; }   After type erasure, it becomes  public class GenericArray{     Object[] s= new Object[5]; }   This snippet of code seems to work well. Why does it cause a compile-time error?  In addition, I have known from other answers that the following codes work well for the same purpose.  public class GenericArray<E>{     E[] s= (E[])new Object[5]; }   I've read some comments saying that the piece of code above is unsafe, but why is it unsafe? Could anyone provide me with a specific example where the above piece of code causes an error?  In addition, the following code is wrong as well. But why? It seems to work well after erasure, too.  public class GenericArray<E>{         E s= new E();     }

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.


Consider two points A and B on a pipe at the same height. Fluid is in a steady flow inside.  External pressure is provided at point A and the fluid travels to point B.  The region at point A has a smaller cross section that point B. Therefore, $v_A > v_B $. As,  $ P_A + 1/2 \rho v_A^2 = P_B + 1/2 \rho v_B^2 $  Thus, naturally, pressure at region A is lower than B.   The question is how then is the fluid travelling from A to B when the pressure difference is actually in  opposite direction and flow should be reverse?

In , it was stated that     particles in high pressure air always flow to lower pressure.   In a pipe with a constriction, fluid flows from from low to high pressure after the constriction. (From .)  How are these concepts related?


Assume that $A,B \in M_n(\mathbb{R})$ and there is an invertible matrix $P \in M_n(\mathbb{C})$ that $PAP^{-1}=B$.   Prove that there is an invertible matrix $Q\in M_n(\mathbb{R})$ that $QAQ^{-1}=B$   (By the symbol $M_n(F)$, we mean all $n\times n $ matrices over the field $F$.)  Please note the change in field from $\mathbb{C}$ to $\mathbb{R}$

$A  \underset{\mathbb{C}}{\sim} B \overset{\text{def}}{\iff} A=C^{-1}BC, \space C\in M_{n}(\mathbb{C})$ and similarly for $\underset{\mathbb{R}}{\sim}$.     I want to prove that $ A \underset{\mathbb{C}}{\sim} B$ for $A,B \in M_{n}(\mathbb{R})$ therefore $A \underset{\mathbb{R}}{\sim} B$.   My idea is that elementary divisors of $A,B$ over $\mathbb{C}$ are the same, and if $(x-z)^k$ is elementary divisor than $(x-\overline{z})^k$ is also elementary divisor $\implies$ $A,B$ have same elementary divisors over $\mathbb{R}$. But i think it's not clear.


This question does not offer me the vlq flag amongst the flags, even though it's at -1.    Could it be that it is hidden once someone else has used it?

Why is the option very low quality  sometimes hidden in the flag menu?  About a moment ago, I saw a post of very low quality on Stack Overflow, and I wanted to flag it as very low quality but this option was not in the flag menu.   Why?


It shows - "the authentication servers are currently offline servers are currently offline". I just got Minecraft yesterday.

Similar to  on the bugs in Minecraft, I would like a complete list of what error codes exist in Minecraft and how they occur, as well as how they can be resolved.


I am currently wondering if there is a good way of implementing an equals method for a non-static inner class in Java. I basically a class Foo with an inner-class Bar like this:  public class Foo {    private final String foo; // constructor omitted    public /* non-static */ class Bar {      private final String bar; // constructor omitted      @Override     public boolean equals(Object other) {       return other != null && other.getClass() == getClass()         && ((Bar) other).bar.equals(this.bar)         && Foo.this.equals(Foo.((Bar) other)); // Will, of course, not compile.     }   }    @Override   public boolean equals(Object other) {     return other != null && other.getClass() == getClass()       && ((Foo) other).foo.equals(foo);   } }   My classes are a lot more complex in reality and I want to reuse the Foo#equals method from within Bar#equals in order to save me a lot of code. I am now considering to make the "inner-class-relationship" explicit in order to being able to refer to the "outer" class. However, then I have to add accessor methods manually and I want to avoid this. I cannot get rid of the feeling that there should be a Java approach of doing this.

I'm using the Apache Commons EqualsBuilder to build the equals method for a non-static Java inner class. For example:  import org.apache.commons.lang.builder.EqualsBuilder;  public class Foo {     public class Bar {         private Bar() {}          public Foo getMyFoo() {             return Foo.this         }          private int myInt = 0;          public boolean equals(Object o) {             if (o == null || o.getClass() != getClass) return false;              Bar other = (Bar) o;             return new EqualsBuilder()                 .append(getMyFoo(), other.getMyFoo())                 .append(myInt, other.myInt)                 .isEquals();         }     }      public Bar createBar(...) {         //sensible implementation     }      public Bar createOtherBar(...) {         //another implementation     }      public boolean equals(Object o) {         //sensible equals implementation     } }   Is there syntax by which I can refer to other's Foo reference apart from declaring the getMyFoo() method? Something like other.Foo.this (which doesn't work)?


In Star Wars what is the farthest planet from the center of their galaxy? Does it have life on it? Does it have an appearance in one of the movies?

What is the planet farthest from Coruscant in the Star Wars Galaxy? I understand that this information might not be available. If it isn't, please tell me.


Currently my list of figures looks like this List of Figures      Figures 1 ........................x      Figures 2.........................x  How to make like this? List of Figures  Figures 1 ........................x  Figures 2.........................x  Thank you  My code is:  \documentclass[a4paper,12pt,openleft]{book} \begin{document}  \tableofcontents \listoffigures  \chapter{chapter 1} \begin{figure}[h] \centering \includegraphics{images.png} \caption[Figure~\ref{fig:fig1}]{caption} \label{fig1} \end{figure}  \chapter{chapter 2} \begin{figure}[h] \centering \includegraphics{images2.png} \caption[Figure~\ref{fig:fig2}]{caption2} \label{fig2} \end{figure} \end{document}

I am just starting to use Latex to write a university report. It does feel like a steep learning curve, and is at times frustrating, but I guess it is because I'm very new to it.  I got a question regarding TOC/figures/tables.  Basically, my document structure currently gets displayed in TOC as follows:    Contributions *section*   Summary *section*   List of Figures *section*   List of Tables *section* 1 Introduction *chapter*   1.1 Background *section*   1.2 Other Section *section* 2 Other Chapter *chapter*   However, I'd like it to be displayed like this:  Contributions Summary List of Figures List of Tables 1 Introduction   1.1 Background   1.2 Other Section 2 Other Chapter   Notice, that the first four unnumbered sections are not indented, but keep the indentation of numbered sections. Also, related to this question. I'd like my Lists of Tables/Figures to be NOT indented.   For example, instead of this:  List of Figures    1. Caption ------------------------------------------ 4   Have this:  List of Figures 1. Caption --------------------------------------------- 4   Thanks for you help!  ** EDIT (added more info)  Here is the minimal working example:  \documentclass[11pt]{report}  \usepackage{graphicx}  % Remove "Chapter" from title. No break between # and name. \makeatletter \renewcommand{\@makechapterhead}[1]{% {\setlength{\parindent}{0pt} \raggedright \normalfont \bfseries\Large\thechapter.\quad\ #1 }} \makeatother  \begin{document}  \pagenumbering{roman}  \section*{Contributions} \addcontentsline{toc}{section}{Contributions}  This is a contributions sections.   \section*{Summary} \addcontentsline{toc}{section}{Summary}  This is a summary section.  \cleardoublepage \tableofcontents %TOC  \cleardoublepage \listoffigures \addcontentsline{toc}{section}{List of Figures} %List of Figures  \pagenumbering{arabic} \chapter{Introduction}  Welcome to introduction chapter.  \section{Background}  This is a background section.\ref{capt} \begin{figure} \caption{Sample Figure.} \label{capt}  %must be after caption \end{figure}   \end{document}


I am wanting to remove a flag I posted on a comment on EL&U, and can't see how to remove it, there is no 'retract flag button'.  I can't see how to do it in the help centre and would like to know if you can.

I'm wondering (since it just happened to me), is it possible to "cancel" ("undo", "delete", "retract", whatever) a flag I just raised if I misclicked it, so the mods won't waste time?  I looked everywhere, but I can't find such a feature.


SuperClass object = new SubClass();   Why use a superclass to instantiate a subclass object like above? Because the only way i learnt to instantiate an object is to:   SubClass object = new SubClass();   I'm learning java.

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


I'm trying to get data from mysql database with php and JSON and it's not working because of the collation I've chosen. I'm using these characters  : ® ,é, è , ™, É My deafult collation in mysql is: latin1_swedish_ci,and my server default collation is: utf8mb4_unicode_ci.  Should I just remove those special characters or what?  this the php code:   <?php  require "conn.php"; $sql = "select * from produit"; $result = mysqli_query($conn, $sql); // result contient tous les produits  $response = array(); // on déclare un array // pour chaque ligne de la table  while ($row = mysqli_fetch_array($result)) {  array_push($response, array("id_produit"=>$row[0] , "nom"=>$row[1], "catégorie"=>$row[2], "description"=>$row[3], "type"=>$row[4], "prix"=>$row[5], "qte_stock"=>$row[6])); } echo json_encode(array("server_response"=> $response)); mysqli_close($conn);   ?>   show create table produit :   CREATE TABLE `produit` (  `id_produit` int(11) NOT NULL AUTO_INCREMENT,  `nom` varchar(255) COLLATE utf8mb4_unicode_520_ci DEFAULT NULL,  `catégorie` varchar(255) COLLATE utf8mb4_unicode_520_ci DEFAULT NULL,  `description` text COLLATE utf8mb4_unicode_520_ci NOT NULL,  `type` varchar(255) COLLATE utf8mb4_unicode_520_ci DEFAULT NULL,  `prix` int(11) DEFAULT NULL,  `qte_stock` int(11) DEFAULT NULL,  PRIMARY KEY (`id_produit`) ) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci

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


Here is my ticks (timeclock) table:  _id_ #employee_id   created_at   This table stores, for each employee, the timestamp they tick. Sometimes some of them tick multiple times a day, some only once or none at all when they didn't come to work.  I have a query which allows me to know exactly how many times an employee wasn't at work during the last 7 days, but I would like to have in the results the days they didn't work. Which means, every employee who worked less than 6 days in the last 7 days, and which dates are missing. And I have no clue.  Here is how I query who was absent more than once during the last 7 days, and how many times:  SELECT `id`, `employee_id`, COUNT(`date`)-6 missing FROM (     SELECT `id`, `employee_id`, DATE(created_at) date     FROM `ticks`     WHERE `created_at` >= '2017-09-16' AND `created_at` < '2017-09-23'     GROUP BY `employee_id`, `date` ) ticks GROUP BY `employee_id` HAVING missing < 0   Based on that or another query, I would like to know which date is missing in that range (by the way, I can get the range from another query, there is always at least 1 tick per day, even on Sunday).  Here is an  with an example dataset. The results I'm expecting, would be:  +-------------+--------------+ | employee_id | date_missing | +-------------+--------------+ |           2 |   2017-09-18 | |           2 |   2017-09-19 | |           3 |   2017-09-20 | +-------------+--------------+


I just booted up my ubuntu partition, it was working and I've installed the updates via the software updater but it crashed at the end, so I've restarted the pc and now I'm getting this:    I guess it's a kernel panic related to the hard drive. How can I fix this, I need to copy my SSH keys at least.  PS: I have windows 7 also installed on a different partition and it works fine.

Upon trying to upgrade from 10.10 to 11.04 all seemed to go well until the restart. This error message is what comes up:  Kernel Panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)   How do we fix that?


Find all the integral solutions of   $$x^4+y^4+z^4-w^4=1995.$$  Please elaborate the solution. I tried but can't understand what to do.

Find all integral solutions of $ x^4 + y^4 + z^4 -w^4 = 1995 $.    Attempt: From FLT it can be concluded that either all of $ x , y , z$ and $w$  are multiples of 5 ( which is not possible since that would lead to $ x^4 + y^4 + z^4 -w^4 $ being a multiple of $5^4$ which it is not since it's equal to 1995) or $ w^4 $ and  exactly one of $x^4, y^4, z^4 $ are of the form $5k+1$ . So, there can be 3 cases with each having either $x^4, y^4  $ or $ z^4 $, along with $w^4$ , of the form $5k+1$ . I am unable to find the solutions from there.


I'm using a Dell laptop with Ubuntu 16.04 LTS.  I tried to make a bootable USB after downloading the Windows 10 ISO file, but it doesn't appear as an option in the UEFI bootable screen.  I didn't use woeusb or any other program as I couldn't install them. I just made it using the Disks utility, then I formatted it as FAT32 then used **Restore Disk Image and restored the Windows ISO file. Is this a correct method of making a bootable USB?

I'd like to create a Windows bootable USB stick, but I don't have a Windows machine with me at the moment to do so. How could I achieve the same using Ubuntu?


Find all functions $f:\mathbb{R}_{>0}\rightarrow \mathbb{R}_{>0}$ such that $$ f(xy+f(x))=f(f(x)f(y))+x, \forall x,y\in \mathbb{R}_{>0} $$  If someone can give me a hint for this question I would be very grateful. edit: We can see that $f$ is injective because: $f(x)=f(y)$ then the equation above tell's that $x=y$.

Let $ \mathbb R _ { > 0 } $ be the set of positive real numbers. Find all functions $ f : \mathbb R _ { > 0 } \to \mathbb R _ { > 0 } $ such that $$ f \big ( x y + f ( x ) \big) = f \big( f ( x ) f ( y ) \big) + x $$ for all positive real numbers $ x $ and $ y $.  What I thought: We could change $ x $ by $ y $, and then subtract. Source: Brazil National Olympiad 2019 #3


$p \rightarrow q$ is read as ${\rm{if}}\:p\:{\rm{then}}\:q$. It is clear that the result of the statement when $p$ is true is $q$. So, when $p$ is true, the truth value of the statement is the same truth value of $q$. But how should I understand the cases when $p$ is false? I don't get why the statement is true when the hypothesis is false and the conclusion is true, and when both the hypothesis and the conclusion is false. I know that this can be made clear with some examples of a promise or a contract. But I want to understand it independently from specific examples (might not be a good idea). So how can I interpret the cases when $p$ is false only with the statement "${\rm{if}}\:p\:{\rm{then}}\:q$" without putting anything in $p$ and $q$ or using logical manipulations (converse, inverse, contrapositive)?

Provided we have this truth table where "$p\implies q$" means "if $p$ then $q$":  $$\begin{array}{|c|c|c|} \hline p&q&p\implies q\\ \hline T&T&T\\ T&F&F\\ F&T&T\\ F&F&T\\\hline \end{array}$$  My understanding is that "$p\implies q$" means "when there is $p$, there is q". The second row in the truth table where $p$ is true and $q$ is false would then contradict "$p\implies q$" because there is no $q$ when $p$ is present.  Why then, does the third row of the truth table not contradict "$p\implies q$"? If $q$ is true when $p$ is false, then $p$ is not a condition of $q$.  I have not taken any logic class so please explain it in layman's terms.       Administrative note. You may experience being directed here even though your question was actually about line 4 of the truth table instead. In that case, see the companion question  And even if your original worry was about line 3, it might be useful to skim the other question anyway; many of the answers to either question attempt to explain both lines.


Unless I am blind, the mobile web editor does not offer a preview of an answer, unlike the desktop web and Android application which do.  I would use the Android application (which I like) for the previews, but its MathJax is reportedly outdated and is not compatible with all SE sites due to site extensions, like \pu from mhchem at the Chemistry SE site.  Could the preview be implemented for the mobile web version as well? Perhaps similarly like in the application as the switching links, maybe among the link list at the page bottom.

I suggest a preview on the mobile page. For questions, answers and edits to both, like on the desktop page.  I messed up formatting often enough to be annoyed that there is no preview on the mobile page and I'm surprised that noone suggested it before (at least I didn't find anything).  If it's too performance heavy to have a live preview update after every change in the text box, there could be a preview button next to the save button which leads to a page with only the preview, a back button and a save button (and the title bar and so on).


I am getting this error in valgrind report.     ==31766== 8 bytes in 1 blocks are definitely lost in loss record 3 of 825   My code looks like:  struct FooList {   FooList() {}   FooList(const vector<Foo*>& fooList_): fooList(fooList_) {}   ~FooList() {       BOOST_FOREACH(Foo* fooPtr, fooList) {         delete fooPtr;       }   }     vector<Foo*> fooList; }  Foo* createFoo(bool flag) {   if(flag) return new FooDerivedA();   else     return new FooDerivedB(); }  void main()  {   FooList fl;    Foo* fooA = createFoo(true);   // some manipulation on fooA, if an exception happens at this point, the memory leaks.   fl.fooList.push_back(fooA);    Foo* fooB = createFoo(false);   // some manipulation on fooB, if an exception happens at this point, the memory leaks.   fl.fooList.push_back(fooB);    // fl's desctructor will release memory for all elements. }   I am not sure if it's because the new and delete statement are not in the same function which causes the definitely lost. How can I fix this?

I have a solid understanding of most OOP theory but the one thing that confuses me a lot is virtual destructors. I thought that the destructor always gets called no matter what and for every object in the chain. When are you meant to make them virtual and why?


Recently one post was deleted (not mine) on  as inappropriate. But before deletion I've up-voted it.  I can't share the full conversation with moderators, but they used the information about my vote against me.  I've found several related conversations:        But they say, that moderators can't see who votes on questions.   So:   Has something changed? Can moderators/CM/SE employees see the list of voters? If so, can they use this information against members?

This was just my second downvote (though unintentional) but the person whose answer I downvoted came to know that I downvoted his answer. Here's the link : .  I searched so much to find out who upvoted or downvoted my questions and answers but all I found was that the votes are anonymous to all except the site admins. Then how did this person (Name: RASG) come to know that I downvoted him when This person never knows me, nor do I know him?


I know that the sequence $\{\frac{e^n}{n!}\}$ diverges and that for prove it i have to limit it, but i don't know how do it. In fact, i know that $\{\frac{x^n}{n!}\}$ diverges, but i don't know prove it.

Why is     $$\lim_{n \to \infty} \frac{2^n}{n!}=0\text{ ?}$$   Can we generalize it to any exponent $x \in \Bbb R$? This is to say, is     $$\lim_{n \to \infty} \frac{x^n}{n!}=0\text{ ?}$$     This is being repurposed in an effort to cut down on duplicates, see here: Coping with  duplicate questions.  and here: .


Pretty straight forward, I can answer a question which was tagged as unclear and put on hold. What should I do?  The question mentioned is  one. Essentially, what the OP asks is help on an algorithm that fills any empty space (O) that has at least two adjacent 1 values.  I understand very clearly the need to put unclear questions on hold but it is disturbing when you understood the question and think you have a valid answer to give, but you can't because it's on hold...

Questions can be closed or marked as duplicates.  What does it mean for a question to be "closed"? What does it mean for a question to be marked as a "duplicate"? Who can close a question? What are the reasons for closing a question ? Is closure the end of the road for a question? When are closed questions eligible for deletion?   Related        For more information, see "" in the .


I came across following statement:     The set of all bijective functions on a finite set forms a group under function composition.   The proof was given as follows:     We can have identity function as $\{(1,1),(2,2),(3,3),(4,4)\}$.   Since function is bijective and mapping to same set, we can have an inverse for any function by inverting the relation (changing the mapping $a\rightarrow b$ to $b\rightarrow a$).   Since the function maps to the same set, it must be closed and associative also.   I was thinking is associativity really holds in above set. For example, consider the finite set: $\{1,2,3,4\}$ and two bijective functions $f_1$ and $f_2$ as follows:   Now, $f_1(f_2(1))=f_1(3)=3$ and $f_2(f_1(1))=f_2(2)=1$. So, I feel its not bijective. Am I incorrectly evaluating associativity?

If I have $f:\mathbb{R}\rightarrow\mathbb{R}$ such that $f$ is onto and $f\circ f\circ f = f$, how can I prove that $f$ is bijective? I know that I only have to prove that it is 1-to-1 because I'm given the fact that it's onto, but how can I use the fact that $f\circ f\circ f=f$ to prove that it is 1-to-1?  Thanks!


I know full well its not safe to store logins in plaintext however I've been unable to find an answer to my specific question. What I'm trying to do is store server passwords in a database for recall with an automated php script however I'm paranoid about the db being hacked so I need to insure they are not retrievable in the event it does get hacked. As with any project I'm planning for a "worst case" situation. The passwords themselves are generated randomly.

It is currently said that MD5 is partially unsafe. Taking this into consideration, I'd like to know which mechanism to use for password protection.  This question,   suggests that hashing multiple times may be a good idea, whereas  suggests using salt.  I'm using PHP. I want a safe and fast password encryption system. Hashing a password a million times may be safer, but also slower. How to achieve a good balance between speed and safety? Also, I'd prefer the result to have a constant number of characters.   The hashing mechanism must be available in PHP It must be safe It can use salt (in this case, are all salts equally good? Is there any way to generate good salts?)   Also, should I store two fields in the database (one using MD5 and another one using SHA, for example)? Would it make it safer or unsafer?  In case I wasn't clear enough, I want to know which hashing function(s) to use and how to pick a good salt in order to have a safe and fast password protection mechanism.  Related questions that don't quite cover my question:


A right circular cone has a depth of 103 mm and a top  diameter of 82.4 mm. The cone contains water to a depth of 30.0 mm. How many more  millilitres of liquid need to be added in order to fill the cup?   I'm not sure where to start for this question. Could someone help me please?

A right circular cone has a depth of 103 mm and a top  diameter of 82.4 mm. The cone contains water to a depth of 30.0 mm. How many more  milliliters of liquid need to be added in order to fill the cone?   I understand how to find the volume, but I'm confused about the water depth. Do I just need to subtract 30 from 103 then calculate volume?


What is the integral of the square of a non-standard univariate gaussian distribution? The following is what I have so far, is it right? $\int_{-\infty}^{\infty} p^2(x)dx$, where $p(x)\sim N(\mu, \sigma^2)$ $\int_{-\infty}^{\infty} p^2(x)dx = \int_{-\infty}^{\infty} (\frac{1}{\sqrt{2\pi \sigma^2}} e^{\frac{-(X-\mu)^2}{2\sigma^2}})^2 dx$ $= \int_{-\infty}^{\infty} \frac{1}{2\pi \sigma^2} e^{\frac{-2(X-\mu)^2}{2\sigma^2}} dx$ $= \frac{1}{2\pi \sigma^2} \int_{-\infty}^{\infty} e^{\frac{-(X-\mu)^2}{\sigma^2}} dx$ $= \frac{\sigma \sqrt{\pi}}{2\pi \sigma^2} $ $= \frac{1}{2\sigma \sqrt{\pi}} $ And what is the integral if it is a 2D gaussian? $\int_{-\infty}^{\infty} p^2(x, y)dx$, where $p(x, y)\sim N(\mu, \Sigma^2)$ $\int_{-\infty}^{\infty} p^2(x, y)dx = \int_{-\infty}^{\infty} (\frac{1}{2\pi \sqrt{\Sigma}} e^{\frac{-(X-\mu)^2}{2\Sigma}})^2 dx$ $= \int_{-\infty}^{\infty} \frac{1}{4\pi^2 \Sigma} e^{\frac{-2(X-\mu)^2}{2\Sigma}} dx$ $= \frac{1}{4\pi^2 \Sigma} \int_{-\infty}^{\infty} e^{\frac{-(X-\mu)^2}{\Sigma}} dx$ $= \frac{\sqrt{\pi\Sigma}}{4\pi^2 \Sigma} $ $= \frac{1}{4\pi\sqrt{\pi} \sqrt{\Sigma}} $

Does someone know what the integral of the square of the normal distribution with standard deviation sigma over the range $-\infty$ to $+\infty$ is?  Thanks!


I have a an Indian passport and a valid residence permit for Denmark until December 2016. I am travelling to India from Germany via British Airways. I just have a connection for 2 hours in the UK. Do I need a transit visa?

Is there a website or some other way to find out if I need a transit visa for a short stop in the UK on my way somewhere else? Ideally this should give me the answer for all nationalities, and take into account any other visas I may have.


I am declaring a template class and defining the methods on an inline file (foo.hpp) template<typename T> class Foo { public:   using Result = T::Result;    Foo();   ~Foo();    Result Bar(); };  (foo-inl.hpp) template<typename T> Result Foo<T>::Bar() {   ... }  But I get an error error: 'Result' does not name a type; I thought, since i declare Bar as part of Foo<T> the method definition should know about Result Any suggestons on how to fix it?

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


Let $A$ and $B$ be two rings (not necessarily with unit, so rng i guess?) and $f$ a group homomorphism from $(A,+)$ to $(B,+)$. We also have the property that $f(xy)$ is $f(x)f(y)$ or $f(y)f(x)$ for all x,y in $A$. Prove that $f$ is a ring homomorphism if and only if there exists at least one pair $(a,a')$ of distinct elements in $A$ such as $f(aa')=f(a)f(a')$.  Essentially, we have to prove that if there is one pair for which the "good order" holds, then it holds for all pairs.  I have no idea how to approach this problem.

This is an exercise out of Herstein which seems pretty straightforward but is eluding me.  Let $R,R'$ be rings and let $\phi:R\to R'$ be a mapping such that, for every $x,y\in R$: $${\rm 1.}\qquad\phi(x+y)=\phi(x)+\phi(y)$$ $${\rm 2.}\qquad\phi(xy)=\phi(x)\phi(y)\qquad{\rm or}\qquad\phi(xy)=\phi(y)\phi(x)$$ I'm to show that one of the conditions holds uniformly. That is, for all $x,y\in R$, $\phi(xy)=\phi(x)\phi(y)$ or, for all $x,y\in R$, $\phi(xy)=\phi(y)\phi(x)$. Of course, this doesn't exclude the possibility that both conditions hold uniformly (which happens when e.g. $R'$ is commutative).  Herstein hints to fix $a\in R$ and to consider the sets $$W_a=\{x\in R\mid\phi(ax)=\phi(a)\phi(x)\},$$ $$V_a=\{x\in R\mid\phi(ax)=\phi(x)\phi(a)\}.$$ I have shown that one of $W_a$ or $V_a$ must be the entire ring $R$. I think I'm missing something simple to complete the argument. Any hints?  Edit  I forgot to mention that in my copy of the text, the condition to be shown is stated as "$\phi(xy)=\phi(x)\phi(y)$ or $\phi(x)=\phi(y)\phi(x)$". I am pretty confident that it's a typo, but maybe not?