I have very little idea what's going in regards to C++ templates, but I'm trying to implement a function that searches a vector for an element satisfying a given property (in this case, searching for one with the name given). My declaration in my .h file is as follows:  template <typename T> T* find_name(std::vector<T*> v, std::string name);   When I compile, I get this linker error when I call the function:  Error   1   error LNK2019: unresolved external symbol "class Item * __cdecl find_name<class Item>(class std::vector<class Item *,class std::allocator<class Item *> >,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >)" (??$find_name@VItem@@@@YAPAVItem@@V?$vector@PAVItem@@V?$allocator@PAVItem@@@std@@@std@@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@@Z) referenced in function "public: class Item * __thiscall Place::get_item(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >)" (?get_item@Place@@QAEPAVItem@@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) place.obj   Program2   Again, I'm new to templates so I don't know what's going. All instances I've found of LNK2019 through Google have been about not using the correct libraries, but since this is my own function I don't see why this would be happening.  Also, a related question: Is there a way to make a template parameter so that it has to be a subclass of a certain class, i.e. template?

Quote from :     The only portable way of using templates at the moment is to implement them in header files by using inline functions.   Why is this?  (Clarification: header files are not the only portable solution. But they are the most convenient portable solution.)


The  say WSL2 works from build 18362 or greater.  Running Windows 10, updated to version 1903 or higher, Build 18362 or higher for x64 systems.  I've got: 18363 WmiObject -Class Win32_OperatingSystem | % Buildnumber 18363  System information shows the same:  The required features are enabled: C:\WINDOWS\system32> Get-WindowsOptionalFeature -Online -FeatureName "Microsoft-Windows-Subsystem-Linux"   FeatureName      : Microsoft-Windows-Subsystem-Linux DisplayName      : Windows Subsystem for Linux Description      : Provides services and environments for running native user-mode Linux shells and tools on Windows. RestartRequired  : Possible State            : Enabled CustomProperties :                    ServerComponent\Description : Provides services and environments for running native user-mode Linux                    shells and tools on Windows.                    ServerComponent\DisplayName : Windows Subsystem for Linux                    ServerComponent\Id : 1033                    ServerComponent\Type : Feature                    ServerComponent\UniqueName : Microsoft-Windows-Subsystem-Linux                    ServerComponent\Deploys\Update\Name : Microsoft-Windows-Subsystem-Linux     C:\WINDOWS\system32> Get-WindowsOptionalFeature -Online -FeatureName "VirtualMachinePlatform"   FeatureName      : VirtualMachinePlatform DisplayName      : Virtual Machine Platform Description      : Enables platform support for virtual machines RestartRequired  : Possible State            : Enabled CustomProperties :    However, when I run wsl --set-default-version 2  I'm getting: C:\WINDOWS\system32> wsl --set-default-version 2 Invalid command line option: --set-default-version  Any idea what I've missed?

I'm trying to install WSL2 on Windows 10 by this . Both features, Microsoft-Windows-Subsystem-Linux and VirtualMachinePlatform, have been enabled: > Get-WindowsOptionalFeature -Online -FeatureName "Microsoft-Windows-Subsystem-Linux"   FeatureName      : Microsoft-Windows-Subsystem-Linux DisplayName      : Windows Subsystem for Linux Description      : Provides services and environments for running native user-mode Linux shells and tools on Windows. RestartRequired  : Possible State            : Enabled CustomProperties :                    ServerComponent\Description : Provides services and environments for running native user-mode Linux shells and tools on Windows.                    ServerComponent\DisplayName : Windows Subsystem for Linux                    ServerComponent\Id : 1033                    ServerComponent\Type : Feature                    ServerComponent\UniqueName : Microsoft-Windows-Subsystem-Linux                    ServerComponent\Deploys\Update\Name : Microsoft-Windows-Subsystem-Linux  > Get-WindowsOptionalFeature -Online -FeatureName "VirtualMachinePlatform"   FeatureName      : VirtualMachinePlatform DisplayName      : Virtual Machine Platform Description      : Enables platform support for virtual machines RestartRequired  : Possible State            : Enabled CustomProperties :  After enabling each of the features computer was restarted. But I can't set default WSL version as any call to wsl from the PowerShell started with administrative privileges results in "Access is denied": > wsl --set-default-version 2 Access is denied.  > wsl --help Access is denied.  The error doesn't occur if wsl is called without administrative privileges but another one does instead: > wsl --set-default-version 2 Invalid command line option: --set-default-version  The guide says that it means that my OS doesn't meet the requirements for WSL 2:  If wsl --set-default-version results as an invalid command, enter wsl --help. If the --set-default-version is not listed, it means that your OS doesn't support it and you need to update to version 1903, Build 18362 or higher.  Let's check with winver:  Hmmm... Looks like it satisfies the requirements. So what's the problem? How can I finish WSL2 installation? What am I doing wrong?


I was upgrading from 13.04 to 13.10 on my laptop when the battery died.  Now when I boot into it, I can get to the login screen.  After I type my password, the screen appears to load but then I am sent back to the login screen with no error message or anything.  Do I have to reinstall?  Is there anyway to easily recover my data?

Last night I was updating my Ubuntu 10.04 to either 11.04 or 12.04 (I'm not entirely sure which one it was, but I think it was 11.04) and I left it overnight to finish. When I came down in the morning, I noticed that the computer hadn't barely begun installing the updates! The update thing said that my computer was on the installation step, but it was still preparing the libc bin (or whatever its called) . It's like the first part of the step installing the upgrades. So, I stupidly restarted the computer, and when it rebooted, I got five options on a purple screen:  Ubuntu, with Linux 3.0.0-28-generic Ubuntu, with Linux 3.0.0-28-generic (recovery mode) Previous Linux versions Memory test (memtest86+) Memory test (memtest86+, serial console 115200)   Long story short, not matter which way I enter Ubuntu to try and reinstall the updates using the root thing (it's like terminal) after I enter sudo apt-get update it basically said it failed to fetch every url link, and it then says:  W: Some index files have failed to download. They have been ignored, or old ones used instead. W: Not using locking for read only lock file /var/lib/dpkg/lock E: dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem.   So, I entered sudo dpkg --configure -a, and it says:  dpkg: error: unable to access dpkg status area: Read-only file system"   I'm left like wtf, and I really just some guidance here. I just got this laptop, and I can not afford a new one if I broke this one.


I have a port scanner script that scans ports and tells you if they are open or closed. Is there a way I can see the IP addresses that the ports are communicating with? The script:  from threading import Thread import socket host = str(input('host > ')) from_port = int(input('start scan from port > ')) to_port = int(input('finish scan to port > ')) counting_open = [] counting_close = [] threads = []  def scan(port):     s = socket.socket()     result = s.connect_ex((str(host),port))     print(('checking ports > '+(str(port))))     if result == 0:         counting_open.append(port)         print((str(port))+' -> is open')         peer = s.getpeername()         print(peer)         s.close()     else:         counting_close.append(port)         #print((str(port))+' -> is closed')         s.close()  for i in range(from_port, to_port+1):     t = Thread(target=scan, args=(i,))     threads.append(t)     t.start()  [x.join() for x in threads]  print(counting_open)   EDIT: Just to be clear, I wasn't asking for the IP of the local host, that is inputted by the user. I was asking if there was a way to know which external public IP's are communicating with the host through the ports found out after the script is run.

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


I'm a British citizen currently on an exchange semester in Montreal. I entered Canada through an eta which was approved immediately without any issues. I wanted to visit the US during my stay here so I applied for an ESTA. My application was held for two days and then denied. When I called the ESTA hotline, I was told that I "don't meet the requirements of the program". I have never violated any of the terms of ESTA, never been to the US, no criminal record etc.. I'm staying in Canada for one more month so I don't have enough time to apply for a visa. I applied for redress through the TRIP program but I doubt that my case will go through in time. Can I enter the United States by train? From what I understood, VWP citizens only need to fill in the I-94 form at the border. I understand that the CBP officer can see my denied ESTA, but if I show that I meet all the requirements of the VWP, can they let me in? Did I shoot myself in the foot by applying for ESTA? Because if I hadn't applied and went to the border they would have nothing on me. Please advise.

I'm German citizen, planned to visit my gf in US and my ESTA wasn't authorized. I think I did stupid mistake while applying, didn't check properly my answers, contacted ESTA authorities to fix mistake but was told to apply for a visa anyway and not to try to re-apply for ESTA. So I had to cancel my travel plans, because visa takes several weeks for ESTA denied people, so embassy told me. So at that time my gf visited me in Germany as it was easier.  Now I'm in Canada (Montreal) for business and my gf is in New York. I still want to visit her in US and meet her family for 3-5 days. I want to travel by bus.   I know that by law if I cross by land, EU citizen doesn't need ESTA nor visa. That's the rule. But I have ESTA denied in my record if I login, and I don't know if I can still go to US by land? Do they verify your ESTA status at canadian border and is it legal to go to US in my case?


I know this is kinda stupid thing but I had some issues in my mysql database, I fixed them but when I had to delete some folders I executed a command to delete this folder /etc/mysql I have a lot of important databases which disallows me to reinstall MySQL. Is there anything like any command that allows me to recover these files? Everything was in default format so I don't really care about like the old format. If so please reply to this topic with answer or even send me a .zip file contains all files with default format for the latest MySQL version (5.7).  Thanks. I use ubuntu 16.04 by the way.   EDIT: after processing what is showing here as someone linked this topic in comments  So now I have an issue with MySQL itself.   Here's the Error message:  Job for mysql.service failed because the control process exited with error code. See "systemctl status mysql.service" and "journalctl -xe" for details. invoke-rc.d: initscript mysql, action "start" failed. ● mysql.service - MySQL Community Server    Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)    Active: activating (auto-restart) (Result: exit-code) since Sat 2019-12-21 16:59:38 EST; 5ms ago   Process: 3942 ExecStartPost=/usr/share/mysql/mysql-systemd-start post (code=exited, status=0/SUCCESS)   Process: 3941 ExecStart=/usr/sbin/mysqld (code=exited, status=2)   Process: 3933 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS)  Main PID: 3941 (code=exited, status=2)  Dec 21 16:59:38 ns529730 systemd[1]: Failed to start MySQL Community Server. Dec 21 16:59:38 ns529730 systemd[1]: mysql.service: Unit entered failed state. Dec 21 16:59:38 ns529730 systemd[1]: mysql.service: Failed with result 'exit-code'. dpkg: error processing package mysql-server-5.7 (--configure):  subprocess installed post-installation script returned error exit status 1 Errors were encountered while processing:  mysql-server-5.7 E: Sub-process /usr/bin/dpkg returned an error code (1)

I would like to restore LightDM to its default state, because for some reason /etc/lightdm/unity-greeter.conf is now an empty file.  Deleting /etc/lightdm/unity-greeter.conf and then running sudo apt-get install --reinstall unity-greeter doesn't create a new config file as you might expect.   How can I restore a missing config file?


I have a bit of code that runs some stats for a moving 3D window at varying size. I have created a loop to to do this in increments of 5 from 5 to 50 as below.  For example first X = 5, Y = 5, Z = 5, then X = 10, Y = 10, z = 10 etc.  This works fine, but what I'd like to do is run the loop with every possible combination of X, Y and Z in increments of 5.   For example   X  Y  Z 5  5  5 10 5  5 15 5  5 .. .. .. 50 5  5 5  10 5 5  15 5 5  20 5 .. .. .. 10 10 5 10 15 5   etc,   so all in all it would be 1000 possible combinations I think   Can i do this with something like itertools.permutations?   I'm pretty new to python and coding so help would be much appreciated   #python code sizeX = (0) sizeY = (0) sizeZ = (0) count = (0)  for i in range(0,10):  count = (count + 1)             sizeX = (sizeX + 5)  sizeY = (sizeY + 5)  sizeZ = (sizeZ + 5)   #run the code

I have a list with 15 numbers in, and I need to write some code that produces all 32,768 combinations of those numbers.   I've found  (by Googling) that apparently does what I'm looking for, but I found the code fairly opaque and am wary of using it. Plus I have a feeling there must be a more elegant solution.  The only thing that occurs to me would be to just loop through the decimal integers 1–32768 and convert those to binary, and use the binary representation as a filter to pick out the appropriate numbers.   Does anyone know of a better way? Using map(), maybe?


I would like to play different mods. I want to play Attack Of B team on one Minecraft, another on a different mod, and a vanilla Minecraft. I don't know if I have to have separate Minecraft files, but I want to do that. Also, I don't know computer stuff very well so try to explain it as well as you can.

I have lots of mods installed on my Minecraft client. How can I make certain mods only work in certain worlds?  For example, how can I make the train mod work only for one of my worlds not the others and have BuildCraft work for all my worlds except the one with the train mod?


This is my first question here. I am in my academic level. I know html, and a bit of css. I want my career in graphics and web design. As a startup, other than Html and css how many tools and softwares do i need to learn? Is knowing Javascript is mandatory for this filed?

I'm teaching web development to beginners, and it would be useful to show them the basics in design, meaning using a graphic design package to come up with a layout, before turning it into code.   To be clear, I want something for creating the "look and feel" of a page, not the layout. I don't mean prototyping tools. There was some confusion about this, and the meaning of my original question was changed, I just changed it back, half a day later.  The html and css itself will be hand-written.  I need something which is freely available, or really cheap. It can be a program designed for beginners, or a broader program with a "beginners mode", or a less intimidating interface for new users.  Is there software which fits this description?


I have this:         All I need is that when I check the checkbox apply a  tag to the text. Sorry for my bad english

I have a javascript routine that is performing actions on a group of checkboxes, but the final action I want to set the clicked checkbox to checked or unchecked based on if the user was checking the box or unchecking.  Unfortunately, every time I check for whether it is being checked or unchecked, it returns "on" indicating the user is always checking the box!  Any help would be appreciated, I've also included the javascript.  // Uncheck all the checkboxs with the same Tax Credit for (i=0; i<arrChecks.length; i++) {     var attribute = arrChecks[i].getAttribute("xid")     if (attribute == elementName)     {         // if the current state is checked, unchecked and vice-versa         if (arrChecks[i].value == "on")   // <-- This is always returning true, even if the box is being unchecked         {             arrChecks[i].checked = 1;         } else {             arrChecks[i].checked = 0;         }      } else {         arrChecks[i].checked = 0;     } }


Lot of articles recommend deactivating ssh for root user with PermitRootLogin no in /etc/ssh/sshd_config. There is also a lot of questions on serverfault about implementing root ssh deactivation.   But what is motivation for that?  It makes the attacker to guess the user name in addition. But shouldn't the cryptographic strength of public-private keys and RSA encryption be enough?  I am asking not just out of curiosity, but because using non-root user : pipelining (compatibility) or allow_world_readable_tmpfiles(security).

I have recently found an argument against disabling a root user login in Linux at   I assume that, if everybody uses a public key authentication, there's no risk at losing the root password.  Is it always better to disable the root login via ssh?


As a part of the CS50 course we're tasked to create a program (in C) that calculates the least amount of coins ($0.25, $0.10, $0.05 and $0.01) from a value submitted by the user. My idea was to take the input value and multiply by 100 and use integers since the only value of interest is the number of coins and not the monetary value, hence I don't have to tinker with any decimals. The code is: #include <cs50.h> #include <stdio.h> #include <math.h>  int main(void) {     //If it's NOT a positive number, do this.     float n;     do     {         n = get_float("Change owed: \n");     }     while (n <= 0);      //Multiplying change owed with 100 to avoid having to deal with decimals.     int cash = n * 100;      //Calculating the number of quarters ($0.25).     int quarters = cash / 25;                           //How many full quarters per cash.     int quarters_rem = cash % 25;                       //The remainder after full amout of quarters in cash.     printf("Number of quarters: %i\n", quarters);       //Test how many quarters.     printf("Remainder: %i\n", quarters_rem);            //Test how much remainder.      //Calculating the number of dimes ($0.10).     int dimes = quarters_rem / 10;                      //How many full dimes from the remainder when all quarters are deducted.     int dimes_rem = round(quarters_rem % 10);           //The remainder after full amount of dimes in quarters_rem.     printf("Number of dimes: %i\n", dimes);             //Test how many dimes.     printf("Remainder: %i\n", dimes_rem);               //Test how much remainder.      //Calculating the number of nickels ($0.05).     int nickels = dimes_rem / 5;                        //How many full nickels from the remainder when all dimes are deducted.     int nickels_rem = round(dimes_rem % 5);             //The remainder after full amount of nickels in dimes_rem.     printf("Number of nickels: %i\n", nickels);         //Test how many nickels.     printf("Remainder: %i\n", nickels_rem);             //Test how much remainder.      //Calculating the number of cents ($0.01).     int cents = nickels_rem;                            //How many full cents from the remainder when all nickels are deducted.     printf("Number of cents: %i\n", cents);             //Test how many nickels.      //Prints the least number of coins to be returned.     int coins = quarters + dimes + nickels + cents;     printf("%i\n", coins); }  The thing is that when I run the code and enter 2.2, 6.2 or 8.2, the output gives me a remainder of 20 after calculating the quarters. 2.2 x 100 = 220 -> 25 x 8 = 200 which gives a remainder of 20, as expected. This is true for 2.2, 6.2, 8.2, 10.2, 12.2, 14.2 and so on. However, this is not! true if I enter 4.2! If I enter 4.2 I expect: 4.2 x 100 = 420 -> 25 x 16 = 400 which ought to give me a remainder of 20, but instead I get a remainder of 19? I don't understand why the remainder is 19 in this instance but 20 in the others?

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


It is said that “the finite population correction factor is used when you sample without replacement from more than 5% of a finite population. It’s needed because under these circumstances, the central limit theorem doesn’t hold true and the standard error of the estimate will be too big.” This is weird cause intuitively the bigger the sample size is, the more central limit theorem must be true and the amount of standard error must be decreased. If having a big sample have these problems so why we bother ourselves to have a big sample? Intuitively if our sample is bigger, our problems must be less!! What is the explanation?

In an introductory stats book by Nicole Radziwell "Statistics the easy way with R" , an assumption used  for nearly every statistical test (e.g.t-tets, anova, etc) is that the sample size should not be more than 10% of the population size (where the population size in known).   I havent seen it mentioned in other introductory stats books. My question is: how important is theis assumotion and what is the reason for it?  The author didn't say where this comes from (at least as far as I could see). A bit of googling suggests that it refers to making a simple random sample without replacement, if the sample size is above 10% then the observations wont be (approximately) independent, and indepedence of observations is an assumption stated in most textbooks.   In the case where you have a small population (e.g. <50), should you give up on this assumption because it results in sample sizes too small to get decent estimates of variability and to check other assumptions such as normality.    Thank you for any insights.


So I'm getting an error with my code and I can't find where it's at, and after so long I'm reaching out. I'm trying to create a conversation between two users which I have created before, all fine on this part. The problem is when I'm going to create a new conversation, I'm getting a NullPointerException. I think the code is right and I have tried to do it in other ways, but I am always getting the same error and it doesn't create the conversation I want to create the conversation between the two and then retrieve it or retrieve every conversation that one user has with other  The error is the following:  Exception in thread "main" java.lang.NullPointerException  The lines are marked in the code.  Main Class  private static void INC(Scanner in, Chat ch){      int iduser1=0;     int iduser2=0;     int transvalue=0;       System.out.print("Insert ID User 1:");      iduser1=in.nextInt();      if(iduser1==ch.getUserNameID(iduser1)){         System.out.print("Found" + ch.getUserName(iduser1));     }     in.nextLine();      System.out.print("Insert ID User 2:");     iduser2=in.nextInt();      if(iduser2==ch.getUserNameID(iduser2)){         System.out.print("Found"+ch.getUserName(iduser2));     }     in.nextLine();       do{             System.out.print("Factor de Translacao:");         transvalue=in.nextInt();         in.nextLine();         if (transvalue<1 || transvalue>26){             System.out.println("Factor between 0 and 26");         }      }while(transvalue<1 || transvalue>26);      if(!ch.hasConversation(iduser1)){ /*------------------------Here*/          ch.addConversation(iduser1,iduser2,transvalue);          System.out.println("Sucess " +ch.getConversation(iduser1)+ " e " +ch.getConversation(iduser2));      }else{         System.out.println("Conversation" +ch.getConversation(iduser1)+ " e " + ch.getConversation(iduser2)+ "Already exists");     }  }   Conversation  public class Conversation {      private int ids1=0;     private int ids2=0;     private int transvalue=0;      public Conversation(int iduser1, int iduser2, int transvalue){         this.ids1=iduser1;         this.ids2=iduser2;         this.transvalue=transvalue;     }      public int getIds1() {         return ids1;     }      public void setIds1(int ids1) {         this.ids1 = ids1;     }      public int getIds2() {         return ids2;     }      public void setIds2(int ids2) {         this.ids2 = ids2;     }      public int getTransvalue() {         return transvalue;     }      public void setTransvalue(int transvalue) {         this.transvalue = transvalue;     }  }   Chat  public Chat(){     counter = 0;     current=-1;     users = new Users[MaxUsers];      conversation = new Conversation[MaxConversation];      }  public void addConversation(int iduser1, int iduser2, int transvalue){     if(counter == conversation.length)         resizeConversation();     conversation[counter++] = new Conversation(iduser1,iduser2,transvalue); }  public int getConversation(int iduser1){     return conversation[searchIndexConversation(iduser1)].getIds1() ; }  public boolean hasConversation(int iduser1){     return ((searchIndexConversation(iduser1) >= 0 )); /*------------------------Here*/ }  private int searchIndexConversation(int iduser1){     int i = 0;     int result= -1;     boolean found1= false;     while((i< counter) && (!found1))         if(conversation[i].getIds1()==iduser1)  /*------------------------Here*/             found1 = true;         else i++;      if(found1) result = i;         return result; }

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?


When I want to underline text, I have a gap depending on whether the text contains letters that go down or not. For example :          \begin{document} Je teste le \underline{soulignement} \underline{avec} ou sans lettres qui descendent     \end{document}   How to line up the underline or to "cut" the underline for the letters going down?

I am currently using \underline{...} to underline text.  However, I want the underline to be closer to the letters (as of now, there's too much whitespace between the letters and the line).  Is there a simple way to do this?


Seeing below error. Any suggestions please? sudo apt install xpdf  Reading package lists... Done Building dependency tree        Reading state information... Done Some packages could not be installed. This may mean that you have requested an impossible situation or if you are using the unstable distribution that some required packages have not yet been created or been moved out of Incoming. The following information may help to resolve the situation:  The following packages have unmet dependencies:  xpdf : Depends: libpoppler90 (>= 0.80.0) but it is not installable E: Unable to correct problems, you have held broken packages.

I was trying to install EPrints on my Ubuntu 20.04 desktop but it lacked the dependency package xpdf. I have tried multiple ways to install it but failed.  Could anyone please tell me how to install it .


I am apply log-normalization to my non-normal data. However, when I apply log-normalization, the 0 values is converted into inf, which makes it impossible to apply some basic statistics on the data (e.g., correlation). Therefore, I add the score of 1 to all data values. However, I am afraid this is not a very valid approach. I wonder what is a common approach to deal with such situations.

I have analysed my data as they are. Now I want to look at my analyses after taking the log of all variables. Many variables contain many zeros. Therefore I add a small quantity to avoid taking the log of zero.   So far I've added 10^-10, without any rationale really, just because I felt like adding a very small quantity would be advisable to minimize the effect of my arbitrarily chosen quantity. But some variables contain mostly zeros, and therefore when logged mostly -23.02. The range of the ranges of my variables is 1.33-8819.21, and the frequency of zeroes also varies dramatically. Therefore my personal choice of "small quantity" affects the variables very differently. It is clear now that 10^-10 is a completely unacceptable choice, as most of the variance in all the variables then comes from this arbitrary "small quantity".  I wonder what would be a more correct way of doing this.  Maybe it's better to derive the quantity from each variables individual distribution? Are there any guidelines about how big this "small quantity" should be?  My analyses are mostly simple cox models with each variable and age/sex as IVs. The variables are the concentrations of various blood lipids, with often considerable coefficients of variation.  Edit: Adding the smallest non-zero value of the variable seems practical for my data. But maybe there is a general solution?  Edit 2: As the zeros merely indicate concentrations below the detection limit, maybe setting them to (detection limit)/2 would be appropriate?


I read in book recently that when a glass rod is rubbed with a silk cloth, some sort of 'electrostatic interaction' take place that both of them acquires a net electric charge. It also said that the negative charge (electrons) are more mobile than the positive charge so what was going on is simply 'electron transfer' between silk cloth and glass rod. But I had read in chemistry that electrons are held tightly within the atom and breaking that bond (covalent or ionic) releases large amount of energy. Now, how come simple mechanical rubbing provide that sort of energy that electrons escape the atom? I don't know whether my understanding is correct. Please enlighten me!

It is always told as a fact without explaining the reason. Why do two objects get charged by rubbing? Why one object get negative charge and other get positive ?


What is the difference in the meaning of following sentences (I'm asking for detailed anlaysis of these sentences)   If it rains, I will stay at home. If it should rain, I will stay at home. If it should happen to rain, I will stay at home If it happens to rain, I will stay at home.  Can I say 'there is no difference in the meaning among 2 ,3 and 4 sentences ? There is no difference in the meaning and usage among 'should', 'happen to' or should happen to' together. Do they all mean 'by chance' ?   Again , i would like to know if the following sentences are grammatically correct or not:  1.If she should happen to read the newspaper, she would see your article.  2.If they should agree to come ,we would be delighted.  Source :perfect English grammar.com in Advanced conditionals Explained (pdf )

I'm a bit familarized with conditional sentences. But the following sentences with 'should' and 'happen to' are quite confusing too me. They are:   If it should rain, I will stay at home. 2.If it should happen to rain, I'll stay at home   If it happens to rain, I'll stay at home.    What are the meaings of those sentences ? Do they all mean the same ? Thank you a lot in Advance for your answer.


According to the books, and the show, the people of the Seven Kingdoms believe in many gods - the Old and the New. However, the Red God (a.k.a the God of Fire) differs from other gods by the real proofs of his existence:   The ability to resurrect The dragons (pure representation of fire) The dark spirits, such as       The one that Stannis' priestes summoned to kill his younger brother.   These are the proofs of God’s existence that even an atheist would accept.  But are there any other gods in the Seven Kingdoms that do show clear signs of their existence - if there is a God of Fire, maybe there also is a God of Water?

Gods are omnipresent in A Song of Ice and Fire, but do they exist?   The old gods have never listened to the Starks' prayers; the only time was when Arya was in Harrenhal and she heard voices. Was it the gods or just an illusion? The sept does not exist for me because the concept is childish (the Mother, the Father..) and never listened. The Lord of Light may or may not listen to his followers.   EDIT : In the part where Stannis throws leeches into the fire and prays to Rh'llor, some of the processes are already engaged:       Walder Frey had been planning to kill Robb before. Can't say for sure when Baelish began planning to kill Joffrey, so this leech is hard to determine. Balon Greyjoy's freak accident (fall off a bridge) is the only incident that didn't seem to be a mortal's influence, and is the most likely candidate for being the work of R'hllor, but we'll never know.


I have Macbook Pro 13.3 inches Retina display model. The max resolution am able to use is 1440X900. And default is even less. Why Macbook pro retina doesn't work in the native resolution?  Is there any specific reason for the same?

A question I've had in my head since I first saw screenshots of the display preference pane on the new Retina MBP is this: Can it be made to run with what you could call a 1.0 UI scaling factor (same amount of pixels for the same widget as you'd get on a regular MBP or say, an iMac)?  To clarify, the preference pane appears to allow you to select between several predefined scaling factors from "Like 1920x1200" (UI scaling factor = 1.5) through "Like 1440x900" (UI scaling factor = 2.0) to "Like 1024x640" (UI scaling factor = 2.8125) and there is also a radio button for "Best for Retina display".  Does this radio button for "Best for Retina display" set the UI scaling to 1.0 or does it simply set the scaling to the "default" 2.0?  If the latter, has anyone checked if there's some defaults write com.apple.[...] 1.0 setting available which forces the scaling of the UI to 1.0?  It might not always be a useful mode to run things in but I can see several use cases where it would be very useful for me to be able to set the UI scaling to 1.0 rather than somewhere between 1.5 and 2.8125...


I need a tool in QGIS that has the same functionality as the  (native of ArcGIS).

I am working on ownership data at a US county level. I have one shapefile per county that contains thousands of tax parcels. I need to dissolve the polygons representing parcels owned by the same individual. When the shapefile is not clean, the "Dissolve" tool in QGIS doesn't seem to work, it freezes. I have to fix the geometry validity issues first using the "Check Geometry Validity" tool. However, I have sometimes hundreds of errors. It takes a lot of time to fix them manually. Is there any other strategies that could save me some time?  I am using QGIS 2.4.0.


$("#btnClients").click(function () {             var idx;             var stable = $('#Tbody1').DataTable({                 "ajax": {                     "url": '/home/selectCustomers',                     "type": "get",                     "datatype": "json",                     "data": { "critere": txtcr, "ch": txtch },                 },                 "columns": [                     {                         "data": "code", "autoWidth": true, "render": function (data) {                             idx = data;                             return '
' + data + '
';                         }                     },                 ]             });         }); $(document).ready(function () {         $("h6").dblclick(function () {             alert("You have clicked this twice.");         });     });   I have some actions, which should occur on a double-click event on h6. However, I tried with this code but it doesnt work. Any other way than this is appreciated.

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


Trying to boot into Ubuntu from a USB stick. Got all the files on the USB, and set BIOS to look at USB first. When I turn it on, the light flashes on my USB, so I know it's accessing it. It brings up the first screen of Ubuntu--the screen shows the word Ubuntu, the logo, and five dots under the word Ubuntu, but then it hangs up there. Doesn't progress at all. Ideas?

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


I want to cut this image   Into a 3D blender object, how do i do this?

Say I want to automate making extruded-text or a 3d logo from an image.    An answer that uses extruding a monochrome image of the ubuntu logo to an arbitrary number of units with a python script taking only the number of units and the monochrome image as a starting point will receive extra this was awesome re-posts from me.  This could be useful for lots of things.


I have to be able to handle extreme numbers and large es: consisting of eight million bits, but with which I must be able to perform the operations of division and rest.  This number can also be used as an array of bool

I'm trying to work through the problems on  but I keep running into a couple of problems.  The first is a question of storing large quanities of elements in a List<t>. I keep getting OutOfMemoryException's when storing large quantities in the list.  Now I admit I might not be doing these things in the best way but, is there some way of defining how much memory the app can consume?  It usually crashes when I get abour 100,000,000 elements :S  Secondly, some of the questions require the addition of massive numbers. I use ulong data type where I think the number is going to get super big, but I still manage to wrap past the largest supported int and get into negative numbers.  Do you have any tips for working with incredibly large numbers?


The UESP's  states, among its advantages, "Lighter and less movement penalty."  I practically never wear  , so I've only gathered how much it penalizes movement by watching others. I haven't really noticed movement penalization by wearing  (or maybe it's cause I usually lean towards wearing clothing rather than armour since I never expect to get hit as a hardcore sneaker anyway). And if there's a penalty by wearing clothing too, I'd like to know.  To what degree do each of the types "of apparel that is worn on the body" penalize movement? Do they only penalize movement speed, or attack speed as well? Is it binary such that only wearing one piece of heavy armor brings the maximum penalties of wearing heavy armor?

In The Elder Scrolls V: Skyrim what are the various factors affecting movement speed? And to what degree?   Note: Without cheating.  And I'm on the Xbox 360, so no hacking.  Various factors I can think of are:   walking vs running vs sneaking weapon or spells: drawn vs holstered   and type of weapon or spell (specifically two-handed vs single-hand vs dagger vs fists)  armor: heavy vs light vs none   also what % of body covered effects this (specifically just what you wear on your feet vs full body)  direction of travel: forwards vs backwards   I'm also interested in some of the combinations of this, especially:   walking with weapon or spell drawn vs holstered running with weapon or spell drawn vs holstered   When I run, I always put my weapon away because I think I run faster, but it might just be the change in the field of view.  I also have the perk where healing restores stamina, so I run, equip healing spell, cast spell, sheath spells and repeat.  It's a little tedious to always ready and relax my spells.  I'd rather run with the spells equipped and just pull the cast trigger.  I'll endure it until I believe it doesn't help. :)


I want to type the symbol \not\Leftrightarrow. I tried with  \documentclass[12pt,a4paper]{article} \usepackage{amsmath} \usepackage{amsfonts} \usepackage{amssymb} \begin{document} \[\begin{cases} A\cdot B \geqslant 0,\\ A \geqslant 0 \end{cases} \not\Leftrightarrow \begin{cases}  B \geqslant 0,\\ A \geqslant 0.\ \end{cases} \] \end{document}     I think, it is not nice. How can I creat that symbol?

When using \not together with wider symbols such as \Leftrightarrow the diagonal line produced by \not is placed too far to the left. How can the line be properly aligned? For example the following code \documentclass{article}  \begin{document}  \(\not\subset\)% Looks good  \(\not\approx\)% Looks good  \(\not\leftrightarrow\)% \not line is too far to the left  \(\not\Leftrightarrow\)% \not line is too far to the left  \end{document}  produces the following output where the last two symbols has got a misaligned diagonal line  Also, maybe the lines may need other changes than alignment to look good.


I would like to replace <Path_To_BOOST_LIB_DIR> in a file with the content of ${PREFIX}/lib but this command   sed -i .bak 's|<Path_To_BOOST_LIB_DIR>|echo ${PREFIX}/lib|' src/CMakeLists.txt  produced  set(BOOST_LIB_DIR echo ${PREFIX}/lib)  What did I do wrong?

I want to do:  cat update_via_sed.sh | sed 's/old_name/new_name/' > new_update_via_sed.sh   in my program.  But I want to use variables, e.g.  old_run='old_name_952' new_run='old_name_953'   I have tried using them but the substitution doesn't happen (no error). I have tried:  cat update_via_sed.sh | sed 's/old_run/new_run/' cat update_via_sed.sh | sed 's/$old_run/$new_run/' cat update_via_sed.sh | sed 's/${old_run}/${new_run}/'


Let $F$ be a field.Then we know that $F[x]$ is a Euclidean Domain.But can someone give me few examples such that (i)$F[x]$ is not a field, (ii) $F[x]$ is also a field.     Thanks for your kind help.

I'm currently studying Polynomial Rings, but I can't figure out why they are Rings, not Fields. In the definition of a Field, a Set builds a Commutative Group with Addition and Multiplication. This implies an inverse multiple for every Element in the Set.   The book doesn't elaborate on this, however. I don't understand why a Polynomial Ring couldn't have an inverse multiplicative for every element (at least in the Whole numbers, and it's already given that it has a neutral element). Could somebody please explain why this can't be so?


I would like to check hostnames to make sure they follow the standard naming convention in Bash Shell. Let say the hostname is ab-cde-01 wolf@linux:~$ h='ab-cde-01' wolf@linux:~$ echo $h ab-cde-01 wolf@linux:~$   I started by building if else loop and it's working just fine. wolf@linux:~$ if [ $h = 'ab-cde-01' ]; then > echo $h is a valid name > else > echo $h is an INVALID name > fi ab-cde-01 is a valid name wolf@linux:~$   However, when I try to use regex to replace numbers with [0-9], I'm getting an invalid name. wolf@linux:~$ if [ $h = 'ab-cde-0[0-9]' ]; then > echo $h is a valid name > else > echo $h is an INVALID name > fi ab-cde-01 is an INVALID name wolf@linux:~$   update 1: =~ operator =~ operator used as suggested ... wolf@linux:~$ if [ $h =~ 'ab-cde-0[0-9]' ]; then > echo $h is a valid name > else > echo $h is an INVALID name > fi bash: [: =~: binary operator expected ab-cde-01 is an INVALID name wolf@linux:~$   update 2: double bracket wolf@linux:~$ if [[ $h =~ 'ab-cde-0[0-9]' ]]; then > echo $h is a valid name > else > echo $h is an INVALID name > fi ab-cde-01 is an INVALID name wolf@linux:~$    What's wrong in this code? How to fix it? Is this the right/most efficient way to check hostname against certain standard?  update 3: Actual answer for my own reference too wolf@linux:~$ if [[ $h =~ ab-cde-0[0-9] ]]; then > echo $h is a valid name > else > echo $h is an INVALID name > fi ab-cde-01 is a valid name wolf@linux:~$   Lessons learned  Use double bracket instead of single bracket No quote in regex

#!/bin/bash INT=-5  if [[ "$INT" =~ ^-?[0-9]+$ ]]; then  echo "INT is an integer."  else  echo "INT is not an integer." >&2  exit 1  fi   What does the leading ~ do in the starting regular expression?


At page 44 of Modern Quantum Mechanics by Sakurai it's stated that given the following formula for the translation operator ($T$): $$T(d\vec{x}')=1-i\vec{K} \cdot d\vec{x}'$$ (where for some unknown reason $1$ represents the identity matrix $\mathbb{I}$) we can identify $\vec{K}$ with the momentum operator $\vec{p}$. It's stated that we can operate this identification because in classical mechanics the momentum is the generator of translations. My question is: is there a straightforward way to define what a generating function (for a transformation) is? And then how can we easily show that the momentum is the generating function of translation in both the classical and quantum mechanical scenario? EDIT: just to clarify: I know that we choose this particular formula for the translation operator $T$ because we can prove that this form has all the proprieties that we want and also because this formula is made in such a way that we can interprete $\vec{K}$ as the generator of translation. My problem regards the definition of generating function and the application of this definition to the context of momentum. Is there a way to define what a generating function is in an intuitive manner?

I'm reading Sakurai's Modern QM right now and in the first chapter he states a number of conditions required for a translation operator: unitarity, $$T(\mathrm{d}\mathbf{x})T(\mathrm{d}\mathbf{x^\prime}) = T(\mathrm{d}\mathbf{x}+\mathrm{d}\mathbf{x^\prime}),$$ $$T(-\mathrm{d}\mathbf{x}) = T^{-1}(\mathrm{d}\mathbf{x}),$$ and going to 1 for small translations.   He then makes the ansatz (1.6.20 in the new version): $$ T(\mathrm{d}\mathbf{x}) = 1-i \mathbf{K} \cdot \mathrm{d}\mathbf{x} $$ and demonstrates that this form of $T$ meets the requirements and is generally the correct choice. Here, $\mathbf K =(\mathrm K_x,\mathrm K_y,\mathrm K_z)$ with each component hermitian.  I was hoping somebody could provide some motivation for this particular choice. Is there any reason why it is to be expected or natural? How would you come up with this form of the operator by yourself?


I'm new to postgresql/postgis and trying to measure a distance. So st_distance() may be the most accurate, it's the slowest too (as I've read). I read that one can use geometric (instead of geographic) measuring with less accuracy, but the numbers I get don't make sense. This is what I've got:  (all points are geography(Point,4326))  select   st_astext(point),   st_astext(point2),   round(st_distance(point, point2)),   round(point::geometry <#> point2::geometry) -- cast to geometry and use distance operator from testgeo2 limit 50  "POINT(53.887 54.043)","POINT(70.764 80.922)","3053406","32" -- ok "POINT(93.262 59.546)","POINT(84.331 84.334)","2774883","26" -- ok "POINT(99.624 67.098)","POINT(95.718 85.252)","2027908","19" -- ok "POINT(54.406 84.531)","POINT(80.27  83.385)", "326308","26" -- hm?!   So I don't get how this can be right. Any suggestions?  One more example  -- new york, tokyo insert into testgeo2(point, point2) values (    st_geographyfromtext('point(-74.007873 40.717602)'),     st_geographyfromtext('point(139.754333 35.675853)'))  -- get distance select   st_astext(point),   st_astext(point2),   -- km, most accuracy   round(st_distance(point, point2)) / 1000,   -- km, with less accuracy   round(st_distance(point, point2, false)) / 1000,   -- km, Lambert   round(st_distance(     st_transform(point::geometry, 3587),     st_transform(point2::geometry, 3587))) / 1000,   -- km, from degree   round(point::geometry <#> point2::geometry) * 111 from testgeo2  -- results POINT(-74.007873 40.717602) POINT(139.754333 35.675853),     10871, 10847, 11224, 23754   is geometry just not working on a larger scale?

Why am I getting different results?  SELECT ST_DISTANCE(   ST_GeographyFromText('SRID=4326;POINT(13.401111 52.383343)'), --berlin   ST_GeographyFromText('SRID=4326;POINT(9.997559 53.533778)') --hamburg );   = 262077.401614256  SELECT ST_DISTANCE(   ST_SetSRID(ST_MakePoint(13.401111, 52.383343), 4326),   ST_SetSRID(ST_MakePoint(9.997559, 53.533778), 4326) );   = 3.592724162238034  The first result looks a lot closer to reality ;-)  Edit: had to cast the points in the second query to geography.  SELECT ST_DISTANCE(     ST_SetSRID(ST_MakePoint(13.401111, 52.383343), 4326)::geography,     ST_SetSRID(ST_MakePoint(9.997559, 53.533778), 4326)::geography );   Still don't really understand why I have to do this. Isn't SRID=4326 enough for ST_DISTANCE to know what type of point I am passing?


Let $X \sim \operatorname{N}\left(0,1\right)$ be a standard normal distributed random variable: Can someone please please show me the whole way how to find the density of $\left\vert X\right\vert$. My tries: I saw sites where someone gives tips and I wanna do it with Cumulative distribution function but everywhere are only few tips and I didn't understand it. Can someone please explain how to do it for someone who never did tasks with densities before? I only know the density of $X$ :  I would be very thankful for help.

I came across this question as an exercise, had a brief idea, but didn't know how to proceed.     Let $X \sim N(0, 1)$. What is the p.d.f of $|X|$ ?   I know the final p.d.f looks just like the right half of the original pdf, but extended vertically for a factor of 2.  Could someone please show mathematically what the p.d.f of variable |X| is going to be, and explain briefly? Thank you.


import java.util.*; public class test {     public static void main(String [] args) {         Scanner scn = new Scanner(System.in);         double s = 253.3;         while(s > 9) {             s = s/10;         }         System.out.println(s);     } }   Why the output is 2.5330000000000004 and not 2.533?

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


When I press Esc in Safari, it exits from full-screen mode. There is another shortcut for that: CTRL-CMD-F and I'd rather keep only that one active. Is it possible to disable the Esc keybinding? I've looked at the Keyboard shortcuts and gestures in Safari on Mac page on the Safari User Guide. It says  To turn off or change keyboard shortcuts, see Create keyboard shortcuts for apps. [A page on macOS user guide]  But the Create keyboard shortcuts for apps page explains how to add a keyboard shortcut in the macOS settings section Apple menu  > System Preferences > Keyboard > Shortcuts > App Shortcuts. Obviously, I could remove a setting if it was listed there, but the default settings are not available. I thought of binding the Esc key with an undefined menu item, but in some contexts that keybinding executes actions that I'd keep configured as they are, ideally. In particular, it will perform the following (as presented in the Safari User Guide):   "While typing in the Smart Search field, restore the current web page address" "Close Reader" "Cancel editing a bookmark name in the sidebar"   I've also tried inspecting the situation with CheatSheet. The app is really cool, it displays (almost) all the keyboard shortcuts for an app and allows to edit them via another app (not tested), but the "Esc" is not on the list so I guess it also can not be edited.

Some apps (Safari, iTunes...) quits fullscreen mode on Esc keyboard shortcut. Is there a way to disable it? It interferes e. g. with web apps control resulting in unintentional quitting fullscreen when you just hit one more Escape than you should.


I'm pretty new to blender and followed a few tutorials to learn the basics. Now i'm trying to create a beer bottle scene for one of my customers. The Neck and backside label were no problem since i could copy parts of the bottle. But the oval front label drives me crazy. I didnt get it to bend around the cylinder I've tried to follow to some bend-tutorials but im keep messing it up. I've tried the warp feature as well as the simple deform modifyer. Does anyone know how i can achieve this:     Thanks!!!

I have modeled a wine bottle and created various wine label designs for a client. The labels were created in Illustrator and so I have PNGs. I want to present a render of the same bottle with each label the client. The labels are not simple rectangles.   Should I:    "model" each label and wrap it on the bottle, or  try to map each label image to a portion of the bottle's surface?    I've seen lots of tutorials showing option #2, but something is telling me that the glass of the bottle should be separate from the "paper" label.  Also, with #1, couldn't I use the same bottle blend file and use a different layer for the each label, then turn on a different layer for each new render?  Maybe there's an even better strategy?  thanks,


A year ago I started a memoir and wrote 120000 words, which I password protected in LibreOffice 3 writer. I took a break of many months, and intended to resume writing the document a couple of days ago.  However..  I have forgotten my password.  This is a complete disaster.  I made my wife aware of the password (just in case !) But she has also forgotten it.  Here is my rather obvious question - Is there some way of accessing the memoir with out the password?  I'm very non technical, and following a search I discovered a possible means of using xmlcopyeditor to turn off the password and thereby access the document.  But this doesn't work - the xmlcopyeditor doesn't seem to open.  There are three copies of the memoir, one on a flashdrive thing, one on a cd rom, and one in the laptop, all are protected by the same password.  Very frustrated indeed.

Sometime ago I created an .ods file with Libreoffice Calc which I password protected. I have now forgotten the password and as a result I am unable to access the file. Is there any way of bypassing or recovering the password, e.g. as root using the terminal?


I have a workbook in Google Sheets and it is for a schedule for my company so I have a few sheets in my workbook that have the days of certain weeks and then one more tab that has inventory information. What I am looking to be able to do is type in the WO number into one of the week sheets and then type that into the WO spot on the inventory tab and in that same row on the inventory sheet there will be check boxes we click on that will change the color of the cell on the schedule so we can see what happening with the WO on the schedule and don't have to shift over to inventory sheet every time we want to see where a house is at in the process. I hope that makes sense and I greatly appreciate the help! Here is a link to it

I have a workbook in Google Sheets and it is for a schedule for my company so I have a few sheets in my workbook that have the days of certain weeks and then one more tab that has inventory information. What I am looking to be able to do is type in the WO number into one of the week sheets and then type that into the WO spot on the inventory tab and in that same row on the inventory sheet there will be check boxes we click on that will change the color of the cell on the schedule so we can see what's happening with the WO on the schedule and don't have to shift over to inventory sheet every time we want to see where a house is at in the process. I hope that make sense and I greatly appreciate the help! Here is a link to it:


Im using this code to decrypt AES data:  public static String decrypt(String ciphertext, String password) {     byte[] cipherdata = System.Convert.FromBase64String(ciphertext);      byte[] iv = new byte[AESBlockSize * 4];     Array.Copy(cipherdata, 0, iv, 0, iv.Length);      byte[] input = new byte[cipherdata.Length - iv.Length];     Array.Copy(cipherdata, iv.Length, input, 0, input.Length);      Rfc2898DeriveBytes passwordDB = new Rfc2898DeriveBytes(password, iv, PBKDF2Iterations);     byte[] keyBytes = passwordDB.GetBytes(256 / 8);      RijndaelManaged symmetricKey = new RijndaelManaged();      symmetricKey.Mode = CipherMode.CBC;     symmetricKey.Padding = PaddingMode.ISO10126;      ICryptoTransform decryptor = symmetricKey.CreateDecryptor(keyBytes, iv);      MemoryStream memoryStream = new MemoryStream(input);     CryptoStream cryptoStream = new CryptoStream(memoryStream, decryptor, CryptoStreamMode.Read);      byte[] plainTextBytes = new byte[input.Length];      int decryptedByteCount = cryptoStream.Read(plainTextBytes, 0, plainTextBytes.Length);      memoryStream.Close();     cryptoStream.Close();      return Encoding.UTF8.GetString(plainTextBytes, 0, decryptedByteCount); }   I get the exception Padding is invalid and cannot be removed on the call to cryptoStream.Readwhen the wrong password is supplied.  Is there any way to prevent this exception when using the wrong password, because I'm trying to make a brute-forcer, and the exceptions are very slow to handle.

I needed some simple string encryption, so I wrote the following code (with a great deal of "inspiration" from ):      // create and initialize a crypto algorithm     private static SymmetricAlgorithm getAlgorithm(string password) {         SymmetricAlgorithm algorithm = Rijndael.Create();         Rfc2898DeriveBytes rdb = new Rfc2898DeriveBytes(             password, new byte[] {             0x53,0x6f,0x64,0x69,0x75,0x6d,0x20,             // salty goodness             0x43,0x68,0x6c,0x6f,0x72,0x69,0x64,0x65         }         );         algorithm.Padding = PaddingMode.ISO10126;         algorithm.Key = rdb.GetBytes(32);         algorithm.IV = rdb.GetBytes(16);         return algorithm;     }      /*       * encryptString      * provides simple encryption of a string, with a given password      */     public static string encryptString(string clearText, string password) {         SymmetricAlgorithm algorithm = getAlgorithm(password);         byte[] clearBytes = System.Text.Encoding.Unicode.GetBytes(clearText);         MemoryStream ms = new MemoryStream();         CryptoStream cs = new CryptoStream(ms, algorithm.CreateEncryptor(), CryptoStreamMode.Write);         cs.Write(clearBytes, 0, clearBytes.Length);         cs.Close();         return Convert.ToBase64String(ms.ToArray());     }      /*      * decryptString      * provides simple decryption of a string, with a given password      */     public static string decryptString(string cipherText, string password) {         SymmetricAlgorithm algorithm = getAlgorithm(password);         byte[] cipherBytes = Convert.FromBase64String(cipherText);         MemoryStream ms = new MemoryStream();         CryptoStream cs = new CryptoStream(ms, algorithm.CreateDecryptor(), CryptoStreamMode.Write);         cs.Write(cipherBytes, 0, cipherBytes.Length);         cs.Close();                     return System.Text.Encoding.Unicode.GetString(ms.ToArray());     }   The code appears to work fine, except that when decrypting data with an incorrect key, I get a CryptographicException - "Padding is invalid and cannot be removed" - on the cs.Close() line in decryptString.   example code:      string password1 = "password";     string password2 = "letmein";     string startClearText = "The quick brown fox jumps over the lazy dog";     string cipherText = encryptString(startClearText, password1);     string endClearText = decryptString(cipherText, password2);     // exception thrown   My question is, is this to be expected? I would have thought that decrypting with the wrong password would just result in nonsense output, rather than an exception.


I need your help since I have a problem with accents and special characters. The thing is that I need to save an array in a database, so what I do is the following: $serialized_array = json_encode($products, JSON_UNESCAPED_UNICODE);  The problem is that then when I retrieve this array from the database and do json_decode($serialized_array); it doesn't return anything. Instead, if I do: $serialized_array = json_encode($products);  Then when I do decode it returns the array but with the wrong tildes: ["Platos del d\u00eda","Plato - Los dos juntos"] Database connection: $link = mysqli_connect(DB_SERVER, DB_USERNAME, DB_PASSWORD, DB_NAME);  mysqli_set_charset($link, "utf8mb4");  What can I do? Thank you so much.

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


I am a new US citizen and need to use my US passport to travel to Brazil since I need to show proof of residency and I no longer have my green card that goes with my Cyprus passport. However, I can enter Brazil visa-free with my Cyprus passport and would like to be able to do that rather than getting a visa on my US passport.  My question: Can I depart the US with my US passport and enter Brazil with my Cyprus passport? Or, will the US airline agents demand to see a visa if I'm using the US passport? Will they be OK if I tell them I'm using the Cyprus passport to enter Brazil?  I'd appreciate your help in figuring this out. Thanks much! Stephan

I was just wondering if you have two passports (a Chinese one and an Australian one), and you booked your airline ticket with the Chinese one, will you have to show both of your passports or just one?  The thing is, on my Chinese passport, it has my birth name, but then when I became an Australian citizen, I legally removed my Chinese name and replaced it with my English name. So I don't know whether I should just show the passport officials the one that I booked the airline ticket with.


I don't know why, where or how I picked this up, but I believe that if you power an electric motor while blocking it, and thus stopping it from moving, you'll damage it. I'm thinking of the following type of motor, and possibly servo motors:    Is it indeed true that holding the shaft in place while powering it will damage it? And if so, why? And could this be prevented by simple measures? (Like putting a resistor in front of it.)  Is the "damaging process" any different in servos, or do they get damaged in the same way?

If I keep the shaft of a DC motor in place while it is running does this harm it in any way?  Is it bad for it at all?


A. Do you have a car?   Or     B. Have you a car?   I always use the first form of the sentence but I noticed that the second one is also used. Which is correct?

Is the following sentence correct English?      Have you the address?   The address in question is obvious to the person being asked.  It's normal to ask such a question as "Do you have the address?" or even "Have you got the address?" But is it acceptable to use just the verb have without do or got?


In the context of speech, is there a word like dictator to describe a person who dictates (a person who speaks, says something, etc: dictator)?   I tried to research this, but it seems that the word dictator is used only to describe a person who behaves in an autocratic way.

I only found 'dictator', but even as a non-native-speaker I guess that is overly associated with 'tyrant' or 'despot'.   In my case I need someone who speaks into a microphone for text recognition.


Stop reading here if you do not like stupid yet amusing challenges.   Challenge: produces the shortest document yielding   LaTeX Warning: Label(s) may have changed. Rerun to get cross-references right.   No matter how many times it is run through LaTeX.  I presume there is a cheating solution by which you mess up with the reference information as read from the .aux file. It would be nice to see one.  The challenge in producing the shortest "non-cheating" solution might be in clever ways of searching for a needle in an enormously huge haystack: Those rare documents in which setting changing a referenced label, say from 1 to 2 manages, through the delicate layout algorithm, to change the referenced label back, i.e., from '2' to '1'.    EDIT: In view of , which essentially solves the problem by a different kind of "cheating": forcing in and out text and blocks, using macros, I would rephrase:   The shortest LaTeX document that requests forever: "rerun to get cross-references right", but please do so by using text only.  It is okay to use text generated by, e.g., \lipsum, but it is not okay to sneak in loops.   If memory serves me right, Lamport said in his book that the probability of such an incident is infinitesimal.

It is an unfortunate reality that one must compile a LaTeX file several times in order to get all labels and citations correct. As far as I know, one should go on compiling as long as TeX warns that that "labels may have changed", and two or three passes may not be enough.  Is it possible to write a LaTeX document that never stabilizes, i.e., no matter how many times I compile it, it will go on complaining that labels have changed?  I am thinking about something like a \pageref{something} written in a large font that moves from page 9 to page 10, which requires longer to typeset and thus makes the corresponding label change page and so on ad infinitum.


I have a function      $$f(x)=\frac{x^2-4}{x-2}$$   while solving this simply I get $f(1)=3,f(2)=\frac00,f(3)=5,\cdots$ the problem is when I solve this simply I get $$f(x)=x+2$$ and then I found except $f(2)$ all the values were same. Can someone help me where I did the mistake?

Forgive my ignorance. The below seems 'inconsistent'. If canceling the $(x+1)$ is 'legal', how does the domain change? I realize it does, but would someone be so kind as to provide an explanation?    $$ \frac{x^2 - 1}{x + 1} \mbox{ is undefined when } x = -1 $$  Its domain (the values that can go into the expression) does not include $ -1 $.  Now, we can factor $ x^2 - 1 $ into $ (x - 1)(x + 1) $ so we get:  $$ \frac{(x - 1)(x + 1)}{(x + 1)} $$  It is now tempting to cancel $ (x + 1) $ from top and bottom to produce:  $$ x - 1 $$  $$ \mbox{Its domain now } \textbf{does} \mbox{ include } -1 \mbox{.} $$  But it is now a different function because it has a different domain.    Thanks!


Studying for complex analysis, I stumbled upon this problem. Evaluate $$\int_{0}^{\infty} \frac{\log(1+x^2)}{1+x^2}~dx.$$ So the integrand suggests that I need to use the function $f(z)=\frac{\log 1+z^2}{1+z^2},$ which has two branch points and two simple poles at $z=i$ and $z=-i,$ which lead me to use a semi-circle contour in the right-halfplane having branch cuts at $i$ and $-i.$ But then the process become too lengthy. Is there any other method to go by doing the problem. I was thinking of making a substitution and reducing this to a form to use Gamma function, but wasn't successful. Any help is appreciated.

How would I go about evaluating this integral? $$\int_0^{\infty}\frac{\ln(x^2+1)}{x^2+1}dx.$$ What I've tried so far: I tried a semicircular integral in the positive imaginary part of the complex plane, excluding the negative real axis, but had trouble calculating the residue at $z=i$ (perhaps there is a way of doing this that I don't know of). After that didn't work, I tried a rectangular box integral from $\epsilon$ to $R$, from $R$ to $R+i/2$, from $R+i/2$ to $-S+i/2$, from $-S+i/2$ to $-S+i\epsilon$, from $-S+i\epsilon$ to $-\epsilon+i\epsilon$ and finally a semicircle around the origin, radius $\epsilon$.   Any help would be appreciated.


I am new to java and learning how to implement stateful ejb, I couldn't do that- (I wanted to maintain a list by adding and removing element in a arrayList) and unit testing is working fine, initializing the object throws the javax.naming.NamingException   Is there anything that i am missing.   <%!      private static ListElementRemoteForStateful itemIds;      public void jspInit()      {           try           {             InitialContext ic = new InitialContext();             // next line of code always throw             // here EjbPrototype is the name of the project             // StatefulEjb is the class name which resides in package ejb             // I tested with java:global/EjbPrototype/StatefulEjb             // I tested with java:global/EjbPrototype/ejb.StatefulEjb              // I tested with java:app/EjbPrototype/StatefulEjb              // I tested with java:module/EjbPrototype/StatefulEjb             // I tested with java:comp/EjbPrototype/StatefulEjb but no luck             itemIds = (ListElementRemoteForStateful)ic.lookup("java:global/EjbPrototype/StatefulEjb");             }            catch(Exception e)            {                System.out.println(e);            }     } %>   I have following result produced by accepted answer of

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?


$$\int_0^\infty\frac 1{1+x^n}dx=\frac\pi n\csc\left(\frac\pi n\right)$$  If we want to prove the left side equal to the right side in this case, how do we start? How do we prove this definite integral?

I have found a proof using complex analysis techniques (contour integral, residue theorem, etc.) that shows $$\int_0^{\infty}\! \frac{\mathbb{d}x}{1+x^n}=\frac{\pi}{n \sin\frac{\pi}{n}}$$ for $n\in \mathbb{N}^+\setminus\{1\}$   I wonder if it is possible by using only real analysis to demonstrate this "innocent" result?  Edit A more general result showing that  $$\int\limits_{0}^{\infty} \frac{x^{a-1}}{1+x^{b}} \ \text{dx} = \frac{\pi}{b \sin(\pi{a}/b)}, \qquad 0 < a <b$$ can be found in


The question is :  Does there exist any function $f : \mathbb R \longrightarrow \mathbb R$ such that $f(1) = 1$, $f(-1) = -1$ and $|f(x) - f(y)| \leq |x - y|^{\frac {3} {2}}$?  It is clear that $f$ is continuous over $\mathbb R$ by the given condition and hence it attains all the values between $-1$ and $1$ in $(-1,1)$.Now how can I proceed?Please help me.  Thank you in advance.

Let $f$ be defined for all real $x$ and suppose that $|f(x) - f(y)| \leq |x - y|^{1+ \alpha}$ for all real $x$ and $y$, where $ \alpha > 0$.  Prove that $f$ is constant.  Proof:  I shall show that the derivative of $f$ is zero.  We have that $0 \leq | {f(y) - f(x)} | \leq |x-y|^{1+ \alpha}$. Dividing through by $|x-y|$ we have $0 \leq |\frac{f(y) - f(x)}{y - x}| \leq |y - x|^{\alpha}$ and letting $y \rightarrow x$, we have shown that $f'(x) = \lim_{x \to y}|\frac{f(y) - f(x)}{y - x}| = 0$.  Therefore $f$ is a constant.


Would it be better to say:  “If I was in your circumstance, I hope, I truly hope, I’d do the right thing.” OR “If I were faced with your circumstance, I hope, I truly hope, I’d do the right thing.”

If I was... If I were...   When is it correct to use "If I was" vs. "If I were" in standard English?


Will the downloadable Windows 10 ISO support an OEM license?  I have all the parts to build a computer but the only thing that didn't come in was the OEM disc.  If I load windows from the downloadable ISO, will it accept the key from the disc once it comes in?

I have been a Linux user after switching from Windows 98 and never looked back. However, a friend asked me to set up their brand-new Lenovo ThinkPad with Windows 10. I was totally startled at how terrible the out-of-the-box UX is. Adware all over the place and no luck getting rid of it the gentle way.  So, this question is not about removing adware per se, but about getting a clean install of Windows 10 going. The two things I'm hesitant about are:   Where do I get an ISO image for Windows 10? Where do I find the OEM license key? Back in the day they used to put stickers on the machines.


I trying update security ...  sudo apt-get update   And faiel...  Reading package lists ... Done  W: Duplicate sources.list http://archive.canonical.com/ubuntu/ precise entry / i386 partner Packages  (/var/lib/apt/lists/archive.canonical.com_ubuntu_dists_precise_partner_binary-i386_Packages) W: You may want to run apt-get update to correct these problems   How fix?

I keep getting this warning whenever I try to run sudo apt-get update.  W: Duplicate sources.list entry http://archive.ubuntu.com/ubuntu/ precise-updates/main i386 Packages (/var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_precise-updates_main_binary-i386_Packages) W: You may want to run apt-get update to correct these problems   Below is the output from /etc/apt/sources.list file:  deb http://archive.ubuntu.com/ubuntu precise main restricted deb-src http://archive.ubuntu.com/ubuntu precise main restricted  deb http://archive.ubuntu.com/ubuntu precise-updates main restricted deb-src http://archive.ubuntu.com/ubuntu precise-updates main restricted  deb http://archive.ubuntu.com/ubuntu precise universe deb-src http://archive.ubuntu.com/ubuntu precise universe deb http://archive.ubuntu.com/ubuntu precise-updates universe deb-src http://archive.ubuntu.com/ubuntu precise-updates universe  deb http://archive.ubuntu.com/ubuntu precise multiverse deb-src http://archive.ubuntu.com/ubuntu precise multiverse deb http://archive.ubuntu.com/ubuntu precise-updates multiverse deb-src http://archive.ubuntu.com/ubuntu precise-updates multiverse  deb http://archive.ubuntu.com/ubuntu precise-security main restricted deb-src http://archive.ubuntu.com/ubuntu precise-security main restricted deb http://archive.ubuntu.com/ubuntu precise-security universe deb-src http://archive.ubuntu.com/ubuntu precise-security universe deb http://archive.ubuntu.com/ubuntu precise-security multiverse deb-src http://archive.ubuntu.com/ubuntu precise-security multiverse   How do I fix it?


Java equivalent of JavaScript Date.UTC(1980, 0, 8)  Example in JavaScript :    var base_date = Date.UTC(1980, 0, 8); console.log("base_date:" + base_date)     The result is: base_date:316137600000  How to do it in Java and the the exact same result?  The next java code, gives another result than javascript:  import java.util.Calendar; import java.util.Date; import java.util.GregorianCalendar; import java.util.TimeZone; import java.text.SimpleDateFormat; public class MyClass {     public static void main(String args[]) {      Calendar cal = GregorianCalendar.getInstance(TimeZone.getTimeZone("UTC"));         cal.set(1980, 0, 8);         long time = cal.getTimeInMillis();         System.out.println(time);         System.out.println(cal.getTime().getTime());     } }   316185175487   316185175487

When I create a new Date object, it is initialized to the current time but in the local timezone. How can I get the current date and time in GMT?


In my textbook, i came across the proof for when $x^2$ $\equiv$ -1 (mod p) has a solution, when p is of form 4k+1. This was pretty easy to prove, but then the next part of the proof was to prove that for each prime of 4k+1 there exists a solution. They had written taking x = ($\frac {p-1}{2}$)! , we get desired result. But i couldn't understand why the given value of x works. I know a similar question exists but i need to know how ($\frac {p-1}{2}$)! $^2$ $\equiv$ -1 (mod p) Any help would be appreciated, thanks

I came across this problem and I believe Lagrange's theorem is the key to its solution.  The question is:     Let $p$ be an odd prime. Prove that there is some integer $x$ such that $x^2 \equiv −1 \pmod p$ if and only if $p \equiv 1 \pmod 4$.   I appreciate any help.  Thanks.


I have a 2015 Macbook Pro with 2.5 GHz, 16GB.  I'm trying to run someone's deep learning python script on my macbook. The program has to take in training data and process it. It maxes out my CPU. I ran the fans on max speed and it got part way through the process but because my CPU cores were hitting 90 degrees I had to quit the script early.

I would like to limit the amount of CPU time dedicated to certain processes (e.g. Firefox, Safari, ...). I can't understand why such programs, even when not used (nothing loading, no animations, running in the background, ...), are so resource hungry. Why must a browser eat 50% or more of my CPU? Can I limit it to 10%?


Which is correct: "The teacher spoke to my father and I" or "The teacher spoke to my father and me"?  I don't have any solid reason but I feel "The teacher spoke to my father and me." is the correct one out of the two.  But some claim that the latter is the correct version, i.e. "The teacher spoke to my father and I". Could someone please give reasons as to which one is correct and why? Thank you!

I was listening to the song  by Eminem. I've listened it before many times but from the time I've started learning English grammar I am getting confused while reading or listening English. This time I got stuck at the line "Too much pride, between you and I Not a jealous man but females lie". The phrase "between you and I" always sounded correct to me. But recently I learned that me is only used as an object and hearing that phrase sparked my head. Then I searched over the net and found on  that it is actually a hypercorrection.  says,      "...according to many grammarians and stylists a pronoun in a prepositional phrase in English is supposed to be in the oblique case...   ...though there is still disagreement on whether the phrase itself in today's language is grammatically correct or not."   My first question is, why is there a disagreement? Don't we always use the object form in the oblique case? If not then what are those cases?  Secondly, I want to know how common the phrase "between you an I" is? Is it used colloquially by common native English speakers. By common speakers I mean who don't bother grammar. I searched on  and got some results, e.g. . I found the phrase in another song -- . Is it a common mistake among native English speakers or is it used to give some special linguistic affect? I think this phrase has some linguistic affect that is why the singer would have given the name of her song "Between You and I". Because no one would like to use incorrect English in the title of a song, it must have some purpose.


Prove $∀a, b, c ∈ Z,$ if $ab + ac ≡ 3$ (mod 6) then b $\not\equiv$ c (mod 6).  New to proof work and my problem is I have some general feelings about this problem but don't know how to express it since I'm not familiar enough with modular arithmetic theory.   I've moved forward using the contrapositve to work with.   Prove $∀a, b, c ∈ Z,$  if b $\equiv$ c (mod 6). Then $ab + ac \not\equiv 3$ (mod 6)   I know congruent integers b and c imply $\frac{b-c}{6}$ being perfectly divisible and I know multiplying a same constant $a$ to both numbers does not change their congruence before summing them.   Basically, I'm stuck here. I think that $ab + ac \not\equiv 3$ (mod 6) is true because I think congruent integers $b$ and $c$ multiplied by a same constant $a$ can only take an answer of 0, 1 and 2 in the equation $ab + ac$(mod 6).  Obviously, me thinking things is not very mathematical! Plus I have a strong feeling I'm just flat out wrong somewhere, any ideas or solutions towards proving this statement would be very much stuided and appreciated. :)

Prove by contraposition:      $(\forall a,b,c\in\mathbb Z$) if $ab+ac\equiv 3 \pmod 6$ then $b  \not\equiv c \pmod 6.$   So, by contraposition，it is  $\forall a,b,c\in\mathbb Z,$ if $b \equiv c \pmod 6$, then $ab+ac\not\equiv 3 \pmod 6.$  No idea for next step


Show that in $\mathbb{Z_p^\star}$ (where p is prime under the binary operiation multiplication), an element $\bar{x}$ is its own inverse if and only if $\bar{x} = \bar{1},\overline{p-1}$  This question was in my last homework, and my solution was as follows:  $\overline{x^2} = \bar{1}$ $\iff \overline{x^2-1} = \bar{0} \iff \overline{(x-1)(x+1)} = \bar{0}$   I then concluded that either $\overline{x-1}$ or $\overline{x+1}$ is $\overline{0}$ however, the marker stated I needed more justification from the of:  $\iff \overline{(x-1)(x+1)} = \bar{0}$   to  either $\overline{x-1}$ or $\overline{x+1}$ is $\overline{0}$  I asked my lecturer at the end of one lecture and he said that you need to justify that either $p$ divides $\overline{x-1}$ or p divides $\overline{x+1}$, but I don't understand how p divides either, or how that justifies anything. Could someone please explain?

The proof is a follows:  Let $p$ be a prime number and $x$ in Z. If $x^2\equiv1\pmod p$ then $x\equiv\pm1\pmod p$.  Proof: By assumption, $p | x^2 - 1 = (x + 1)(x - 1)$. Thus $p | x + 1$ or $p | x - 1$. This completes the proof.    However if $p | x + 1$ then $x$ is congruent to $-1 \mod p$. However why is $p$ congruent to $1 \mod p$ ??   I'm struggling seeing this, and been sitting for some hours now trying to figure it out - please help.


My solar power system contains a lead-acid battery but as soon as I use the inverter to power some load, the voltage drops instantly by 1 volt.  Why does this happen? And is it proportional to the load (bigger load = bigger voltage drop)?

I have very low background in electronics.  I have a Li-Po battery connected to an electric motor. The question is:   Why does battery voltage drop under load? Why is each cell of a Li-Po battery limited to 3.0 V (discharging)? Why is each cell of a Li-Po battery limited to 4.2 V (charging)?


I have to write a program at school that allows the user to input a 7-digits of a GTIN-8 barcode and calculate check digit. To calculate the check digit the seven input numbers are multiplied by 3, 1, 3, 1 etc.  for (i = 0; i < 7; i++) {     //Convert String to Character     ch = gtinNum[i];      //Convert Character to Integer     number = Convert.ToInt32(ch);     product = number * weights[i];     total = total + product; }//end for loop   After that, the total is taken away from the nearest higher ten. For example if the total was 43 then it would be 50-43. In the simplest way possible, how do I round up to the higher ten?

How to, in C# round any value to 10 interval? For example, if I have 11, I want it to return 10, if I have 136, then I want it to return 140.   I can easily do it by hand  return ((int)(number / 10)) * 10;   But I am looking for an builtin algorithm to do this job, something like Math.Round(). The reason why I won't want to do by hand is that I don't want to write same or similar piece of code all over my projects, even for something as simple as the above.


Can anyone help, please? in the 80's I read a SciFi in English, translated from French about a 'current' discovery of a 'perfect couple' in a spherical ship found buried in ice. The girl was revived and talked of an earlier Earth where man lived with nature and took 'energy' pills for food. Eventually the girl takes poison and is hurriedly returned to the ship and 'refrozen.' The ship is abandoned with the hope that some future generation can save them. It was a well-written full-length book that I would love to re-discover. Thank you in anticipation that one of you special people know the book.

Years ago (70's or 80's) I read a sci-fi novel.  It started with the discovery in the arctic (or antarctic) of a pair of humans (male and female) frozen in a block of solid helium.  When thawed out, they revive and tell a story of an ancient high-technology civilization (back when Gondwanaland existed I seem to recall).  This civilization had access to incredible energy sources having developed a grand unified theory of everything.      In the end, they destroyed themselves in a conflict so huge that it shifted the earth on its axis.   Does anyone know what the novel was?


Since transporter beam cannot bypass the shields, why can't they be used to lift things (torpedo, antimatter-core) to edge of the other ship's shield so they don't miss?   As defense: wouldn't the transporter array be useful when mounted on the edge of the ship, so they just transport anything incoming? Torpedoes back at enemy shields, transporting armor plates from another part to the offended part, transporting a transporter so they can chain-transport to large distances and make a warp-interrupting field.

Seems like this is the most powerful weapon of all: transport your enemy into a bulkhead, planet, etc. Transport your enemy's ship inside a planet, etc.  Is there some technical reason that it can not be used this way?


I'm a bit confused about what I am supposed to prove in this step of the problem. Am I supposed to prove that for any positive integer $T$, no matter it's size, I can always find positive integers $b<c<d<etc.....$ that are greater than $T$, and such that $a = 1/b + 1/c + 1/d...etc $?  Also, could you avoid giving me any hints on how to solve this problem, or information about rational numbers, when answering the question? I still want to try and figure out how to solve this question.   Thanks in advance.

Let $x$ be a positive rational number, strictly between $0$ and $1$. Prove that there is a finite strictly increasing list of positive integers $2 \leq q_1<q_2<\cdots<q_N $ such that $$x={1\over q_1}+{1\over q_2}+ \cdots+{1\over q_N}.$$  I have tried many methods, such as mathematical induction. I know it is obvious that $\frac{1}{m}$ is right for assumption, but when I begin to prove $\frac{2}{m}$, I feel it is hard to find some patterns for $\frac{2}{m}$. Thus, maybe my thoughts are wrong.  Also, I still tried to change the fraction so that the numerator will be smaller and smaller. But I still cannot find a way to lower the numerator. Can someone help me solve the question? Or, can someone give me some hints. I will appreciate you very much!


I'm a Pakistani national residing in Saudi Arabia due to visit Finland. I have a valid Schengen visa and a multiple-entry visitor visa for United Kingdom. I'm flying with British Airways both ways and have layovers at Heathrow Airport for 2 - 3 hours.  Do I need a Direct Airside 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 got a pair of diamond earrings(worth $1600) for my wife while in India. My question is can I bring it back with me to the US as my personal possession or do I have to declare it at the customs?  Thanks,

I am a US citizen planning to travel to India and I hear the shopping there is quite fair. In particular the electronics. I want to get a few items to bring back home with me. So are there any restrictions? In addition to this, I am not aware of the taxation rules regarding imports.


Let $X\sim HyperGeo(N,M,n)$ thus we get that: $$f_X(x)=\frac{\binom{M}{x}\binom{N-M}{n-x}}{\binom{N}{n}}\;\ \text{with}\ x=max\{0,n-(N-M)\},...,min\{n,M\}$$  Then the expectation of $X$ is given by: $$\Bbb E(X)=\sum_{x=max\{0,n-(N-M)\}}^{min\{n,M\}}x\frac{\binom{M}{x}\binom{N-M}{n-x}}{\binom{N}{n}}=\frac{1}{\binom{N}{n}}\sum_{x=max\{0,n-(N-M)\}}^{min\{n,M\}}x\binom{M}{x}\binom{N-M}{n-x}\\ =\frac{M}{\binom{N}{n}}\sum_{x=max\{0,n-(N-M)\}}^{min\{n,M\}}\binom{M-1}{x-1}\binom{N-M}{n-x}$$  So, since $x=max\{0,n-(N-M)\},...,min\{n,M\}$ we can make $x=1,...,(n-1)$ and clearly $f_X(x)$ has $0$ value for the $x$ values not met in its domain. So:  $$\Bbb E(X)=\frac{M}{\binom{N}{n}}\sum_{x=1}^{n-1}\binom{M-1}{x-1}\binom{N-M}{n-x}$$  And Vandermonde's identity says that:  $$\binom{m+l}{r}=\sum_{k=0}^r\binom{m}{k}\binom{l}{r-k}$$  So let $r=n-1,\; k=x-1,\; m=M-1,\; l=N-M$, thus $r-k=n-x$. So, applying Vandermonde's identity we get that:  $$\Bbb E(X)=\frac{M}{\binom{N}{n}}\binom{N-1}{n-1}$$  and, since $\binom{N}{n}=\frac{N}{n}\binom{N-1}{n-1}$ we get that: $$\Bbb E(X)=\frac{nM}{N\binom{N-1}{n-1}}\binom{N-1}{n-1}=\frac{nM}{N}$$  Thus $$\Bbb E(X)=\frac{nM}{N}$$

How do you show, that the expected value of a hyper-geometric random variable X with parameters $r$,$w$, and $n$ (a box contains $r$ red balls, $w$ white balls and $n$ balls are drawn without replacement) is $$\mathbf{E}(X)=\frac{rn}{r+w}?$$  I was able to reduce this to $$ \sum _{k=1}^{\infty}{r\choose k}{w\choose n-k}/{r+w\choose n} =\frac{n!(r+w-n)!r!w!}{(r+w)!k!} \sum _{k=1}^{\infty} \frac{1}{k!(r-k)!(n-k)!(w-n+k)!}. $$  No text I have seen yet proves this (and I think I know why mine doesn't either!). Any suggestions or references??


Let $f$ be a continuously differentiable function on $\mathbb R$. Suppose that $L=\lim\limits_{x\to \infty}(f(x)+f^{'}(x))$ exists. If $0<L<\infty$, and if $\lim\limits_{x\to \infty} f^{'}(x)$ exists then, can it be proved that $\lim\limits_{x\to \infty} f^{'}(x)=0$?  Let $(x_n)$ be a sequence diverges to $\infty$. Then $f(x_n)+f^{'}(x_n)\to L$.  After that I could not proceed. Please help!

If $$\lim_{x\to\infty}(f(x)+f'(x))=l$$ then prove that $$\lim_{x\to\infty}f(x)=l \text{ and } \lim_{x\to\infty}f'(x)=0 $$    I assume four cases $$\begin{array}{c|c|c|c|}   & f(x) & f'(x) \\ \hline \text{1} & \infty & -\infty \\ \hline \text{2} & -\infty & \infty \\ \hline \text{3} & l & 0 \\ \hline \text{4} & 0 & l \\ \hline \end{array}$$ and elimination(1,2,4) of not possible cases can give the answer(3).    My work is not a correct/perfect or flaw proof.What would be a correct one or is this correct.


On your turn, you break the concentration of an (enemy)  spell with your weapon attack.  When exactly does the spell stop affecting you?   At the same moment that the enemy spellcaster loses the concentration or the next turn? Phrased differently: do you get back your extra attacks, your bonus action, and the second half of your movement right away - on the same turn?

The Slow spell (PHB 277) requires concentration and states the following:     Regardless of the creature's abilities or magic items, it can't make   more than one melee or ranged attack during its turn.   Suppose a PC or monster who could normally make more than one attack is affected by the Slow spell, takes the Attack action, and hits the spell's caster, who then fails their concentration check, causing the Slow spell to end.  Does the attacker then get to take their remaining attack(s) because the slow spell is no longer in effect, or do they still only get 1 because the Slow spell was in effect at the time they took the Attack action?


I've seen other questions covering the topic of how to set the file limit on Leopard/Lion.  For example:            But after  reading through those I'm still not clear on how I would set the open file limit for my instance of emacs.  Can anyone explain that to me?   It seems to me that ulimit -n sets the limit for the current shell.  That won't work for emacs, because emacs is not a shell. Also, apparently launching emacs from the shell would allow the ulimit -n value for the shell to apply to emacs. But I would like to not invoke emacs from a  shell; I'd like to just click the pretty icon.   Also there are some other ways to modify the open file limit but I am not clear  on exactly where those limits apply. At least one of the limits applies to "all open files on the operating system" and for my purposes that is much too broad a brush.   I want to know how to set the file limit for a specific app.  Chrome, Emacs, or whatever. In my particular case, I am interested in emacs but I guess it would be a generic solution.   Thanks.  [I tried tagging this with ulimit but could not, because I am at 101 rep right now]

Which command / configuration file controls the open file limits on OS X?  Is there a different command for OS X 10.5 / 10.6 / 10.7?  The options I explore below are ulimit, sysctl, and launchctl  "Too many open files" is apparently a common error on Leopard, perhaps other versions of OS X:        There are many (related?) ways to view the open file limits:  $ ulimit -a core file size          (blocks, -c) 0 data seg size           (kbytes, -d) unlimited file size               (blocks, -f) unlimited max locked memory       (kbytes, -l) unlimited max memory size         (kbytes, -m) unlimited open files                      (-n) 2048 pipe size            (512 bytes, -p) 1 stack size              (kbytes, -s) 8192 cpu time               (seconds, -t) unlimited max user processes              (-u) 512 virtual memory          (kbytes, -v) unlimited   $ launchctl limit cpu         unlimited      unlimited       filesize    unlimited      unlimited       data        unlimited      unlimited       stack       8388608        67104768        core        0              unlimited       rss         unlimited      unlimited       memlock     unlimited      unlimited       maxproc     1024           2048            maxfiles    2048           4096         $ sysctl -a | grep files kern.maxfiles = 32768 kern.maxfilesperproc = 16384 kern.maxfiles: 32768 kern.maxfilesperproc: 16384 kern.num_files: 2049   It has been claimed in some of the above posts that these can be modified with the following commands:  sudo launchctl limit maxfiles 16384 32768 sudo ulimit -n 32768 sudo sysctl -w kern.maxfilesperproc=16384 sudo sysctl -w kern.maxfiles=32768   However, out of the above commands, only the sysctl commands have any apparently effect (i.e. ulimit -n and launchctl limit show no change after the above commands have been entered, while sysctl -a does show the requested changes).  The corresponding locations to change these parameters for the OS are:  /etc/sysctl.conf /etc/launchd.conf   I also discovered one  which reads that ulimit only controls the current shell.  How can I adjust upwards the max files / max open files limits on macOS?


Couldn't find it anywhere on user profile page. How can I reach some people who just answered my question for some details?

There has been quite a few times that I wished I could send a message to another user on SO - not ask a question for everyone to see, but just a short message informing them of something or requesting them to do something.  Are there any plans to allow this to happen in the future?  Related:


On question pages on SE, the owner of a question is easy to identify: his "post-signature" has additional css-markup: owner.  If the owner comments on the page, his/her username is highlighted, blue on SO.  I'm wondering whether it would be an enhancement if comments of the answerer are highlighted in the comments section of that answer (in another color). This could be useful since:   An answerer is a stakeholder in the process as well and thus has a "more important" status than "just a random user" (no insult intended). He/she is after all, the owner of the answer. There is a better distinction between people who might understand the answer and the person who produced the answer and thus fully understands it; People can identify a third party more easily: it is obvious the answerer will of course defend his/her answer whereas a third party's positive comment gives an answer more "authority".   This is of course a very unimportant enhancement proposal. But as some HCI researchers argue: "Every second counts, and with millions of users, even a tiny increase in user's performance results in saving years for the total user community."  If the request is not accepted, why?

In addition to the highlighting comments made by the question owner (as described ), I think it would be a good idea to highlight comments left by the author of the answer being commented on. This way, the conversation between asker and answerer is more defined/obvious. Edit: This is an edit to bring this to the site owners attention again - It would help people like me with bad eyesight to track down their comments. I originally opposed the questioner highlighting, but experience has shown me that I was wrong, and I think that answerer highlighting of comments would be very useful.


So I have heard things called tilt shift lenses which makes the buildings appear fully flat.  I also heard its mission critical for anyone that wants to take architecture photographs.  Why spend a grand on a lens that only makes buildings appear flat without distortion? Why dont we simply use photoshop?

I've been doing some architectural photography and indoors with the Nikon 14-24 f2.8 lens.  Most of the time I can get my camera high enough to frame my shot and keep vertical lines vertical. But there are times when I want a low- or high-angle shot, so I end up using the new "Upright" tool in Lightroom to straighten my photos out in post.  I've never used or owned a tilt-shift lens before, so my question is how much of a difference is there between photos that have the perspective fixed in post as opposed to being shot with a tilt lens?


Ive been reading properties of inverse trigonometrical functions and the questions like:     What will $ \arcsin(\sin 10)$ be equal to?    confuse me a little.  Okay so I understand that $\arcsin(\sin 10)$ cant be directly equal to $10$ as it isn't an element of the principal branch of $\arcsin(\cdot)$ function. But then in the book it is given that   $3\pi-10$ will be the answer and $\sin(3\pi-10)=\sin(2\pi+(\pi-10))=\sin(\pi-10)=\sin10$  Now I understand it but I don't understand from where to get $3\pi-10$,I mean in questions like this what is the first step or the trick to get $3\pi-10$?

How is $3\pi-10$ element of $[-\pi/2,\pi/2]$? According to me this means that $530$ is an element of $[-90,90]$. i.e. Range of $\arcsin$ function.  (Note:- I was trying to find the value of $\arcsin(\sin 10))$)