Following is case scenario:    user visits site and enters mobile number in landing page on form submission (clicks submit button), i am looking for sending 4 digit pin in provided msisdn user will enter received pin in pin validation page if user entered pin matches sent one, access to the protected resource will be granted   Is there any java library or algorithm available to generate 4 digit pin for authentication purpose ?? What would be the best way to realize the above requirement?? Many thanks......
How do I generate a random int value in a specific range? I have tried the following, but those do not work: Attempt 1: randomNum = minimum + (int)(Math.random() * maximum);  Bug: randomNum can be bigger than maximum. Attempt 2: Random rn = new Random(); int n = maximum - minimum + 1; int i = rn.nextInt() % n; randomNum =  minimum + i;  Bug: randomNum can be smaller than minimum.
How to identify polygons with "flag" sliver errors Working in ArcMap, I have come across errors in a polygon layer that I will call "flag slivers" (taken from similar language in parcels call "flag lots").  These sliver polygons (see image below) are typically composed of just one additional node that user has  accidentally added.    In the images below, the "flag" and the "flagpole" are one single-part feature where the "flagpole" just overlaps itself.  The left-hand image has a total of 5 nodes.     When seen alone the errors are very obvious, but when multiple polygons are adjacent, they are nearly impossible to see because they appear to be the boundary between 2 polygons.  This likely happens because they are using a shapefile based editor, and therefore I cannot implement any topology-based editing rules to prevent this from happening in the future.  Does anyone have a way of identifying and resolving these types of errors?  I would prefer an automated method of both identification and resolution since field users are the ones who created the errors, but I am stuck cleaning up after them.  Thanks. Euler's equations of rigid body motion from least action principle I would like to derive Euler's equations of rigid body motion from least action principle.   Suppose we are in free space so we have no gravity so Lagrangian is equal to kinetic energy.   $$ L = T = \int_M \rho(x)(x\cdot \Omega_B)^2 d^3x $$  where $\rho$ is density, $\Omega_B$ is angular velocity bivector in reference body frame and $M$ is the rigid body.  The action principle says(if I haven't messed up something) that   $$ 0 = \frac{d}{ds}\bigg|_{s=0}\int_0^T \int_M \rho(x)[x\cdot (\Omega_B(t)+s \delta \Omega(t))]^2 d^3x $$  for every $\delta \Omega$ with zero ends i.e. $\delta \Omega(0)=\delta \Omega(T) = 0$. I should get these equations:  $$ I(\Omega_B) - \Omega \times I(\Omega_B)=0 $$  where  $$ I(\Omega) = \int_M \rho(x) (x\wedge (x\cdot \Omega)) d^3x. $$  But I can't see where I would get the time derivative of $\Omega_B$ from the action principle. Can someone tell me what I'm doing wrong? I guess there is some trouble with that $\delta \Omega$ can't be completely arbitrary. What can I do if I'm the victim of serial downvoting? While browsing Stack Overflow, I noticed that I lost a lot of reputation:        Is this serial downvoting? Will it be corrected by a rep-recalculation? How often are those done?    Here's a second instance: OS volume shows as type 'FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF' Do Mandalorians truly never remove their helmets? In episode 3 of The Mandalorian, it is said that Mandalorians never remove their helmets for any reason. Really? Not even to sleep or bathe? Is there any canonical source for this idea? I’m going to assume that the “never” implies “Never removes their helmets in public…” right?  But in flashback scenes to the Mandalorian’s childhood, nobody is really pictured wearing Mandalorian armor let alone helmets. They simply seemed like basic humans who might just be unified by wearing maroon wardrobes all the time.  So what is the deal with this claim? What is the canonical context of the claim?      Looking for in-universe, canonical explanations; not armchair speculation and theories. If none (currently) exist, legends explanation would suffice. Regardless, please provide references and context. You can't see the question owner's special color When I am writing I often come across the words "around" and "round." I was wondering what is different between them, and how they would be used in different contexts. $A$ abelian variety. Is the multiplication by $n_A$ surjective? System.ListException: Before Insert or Upsert list must not have two identically equal elements - Deep Dive I had the following exception thrown at me when trying to process more than one selected records via a custom button in the list view.    Class Code  global class MerchandiseInventoryClass {      webservice static void ConverttoInventory(String[] merchandise_id)    {        //Convert Merchandise collection into Inventory Collection...         Merchandise__c[] merchandise_collection = [SELECT ID,Author__c,Book_Title__c,Edition__c,Publisher__c,Total_Merchandise_QtyTotal_Qty__c,Status__c FROM Merchandise__c WHERE ID = :merchandise_id];          Inventory__c i = new Inventory__c(); //Line 1        List&lt;Inventory__c&gt; newInventory = new List&lt;Inventory__c&gt;();        for(Merchandise__c m : merchandise_collection )        {            if(m.Status__c !='Fully Converted')            {            i.Author__c = m.Author__c ;            i.Book_Title__c = m.Book_Title__c;            i.Edition__c = m.Edition__c;            i.Publisher__c = m.Publisher__c;            i.Qty_Available__c = m.Total_Merchandise_QtyTotal_Qty__c;            i.Merchandise__c = m.Id;            m.Uninventoried_Qty__c = 0;            m.Status__c = 'Fully Converted';            newInventory.add(i);            }        }        insert newInventory;        update merchandise_collection;    }  }   By moving the Line 1 to within the for loop solved the issue for me.  Thanks to this post (refer the Best Answer in that post)    What puzzles me is that WHY i have to instantiate "i" for every iteration within the loop.  Why the list collection ("newInventory") is complaining that are duplicate elements and why should it even confuse in the first place when I am performing an "insert" even ? Non-static variable cannot be referenced from a static context Is it correct to use "their" instead of "his or her"? Is this sentence grammatically correct?  Anyone who loves the English language should have a copy of this book in their bookcase.  or should it be:  Anyone who loves the English language should have a copy of this book in his or her bookcase. Georeferencing vector PDF/SVG/DXF linework using QGIS? I want to  create a small web application to visualize election results on a per poll site basis for my city. The result is going to be very similar to what has been done for Berlin . Hopefully this helps in understanding what I'm going for.  The election raw data on the scale I need is published and I know how to visualize this on the grounds of a shapefile with separate polygons lining out the election districts. My problem is - as you could probably guess - that something like this doesn't already exist.  What actually is published though, is a PDF file lining out the borders of the districts I'm interested in:   I'm not keen on redrawing the linework myself, so I'm looking for a way to make a shapefile out of this. Luckily, the PDf includes the linework as separate vector objects, I extracted these into a SVG file:   I already tried converting the SVG to a DXF and importing it into qgis 2.0.1. This actually works, but (as expected) places the vectors in the atlantic ocean and I can't find a way to edit it and fix this.  What can I do now to georeference these vectors with open source tools and finally produce a shapefile? Finding the Public IP address in a shell script I can find my IP address using ifconfig or hostname -i command.  But how do I find my Public IP?  (I have a static public IP but I want to find it out using unix command) Pairwise independence of Random variables does not imply indendence Show by a counterexample that for a family $(X_i)_{i\in I}$ of random variables the independence of all pairs $(X_i,X_j)$ with $i,j\in I, i\neq j$ does not imply the independence of the family (It is enough to consider $\mbox{card}(I)=3$.).      Hello, I am searching for a simple example. The professor gave the hint that one might consider random variables which only can take two different values, but I do not know exactly what is meant.  By the way:  We call the family $(X_i)_{i\in I}$ of random variables independent, if $(\sigma(X_i))_{i\in I}$ is independent, whereat we call a family $(\mathcal{E}_i)_{i\in I}$ with $\mathcal{E}_i\subset\mathcal{A}$ independent, if for any finite subset $I_0\subset I$ and any choice $E_i\in\mathcal{E}_i, i\in I_0$, it is $$ \mathbb{P}(\bigcap_{i\in I_0}E_i)=\prod_{i\in I_0}\mathbb{P}(E_i). $$ I have a service (kado-demo.service) that a normal user (kado) should be able to restart without entering any password.   I created /etc/sudoers.d/user_restart and added  kado ALL=NOPASSWD: /bin/systemctl restart kado-demo.service   Permissions:  -r--r-----   1 root root   585 Mar  5 10:47 user_restart   As user k, I now should be able to execute the given command, but this happens:  /bin/systemctl restart kado-demo.service  ==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-units ===  Authentication is required to restart 'kado-demo.service'.   Multiple identities can be used for authentication:   (...)   Which is the same result as before I added the file.   The /etc/sudoers contains  #includedir /etc/sudoers.d   And I even get the same result when I add content of the user_restart file directly to /etc/sudoers.  I'm running out of ideas... What's the difference between denizen, resident, inhabitant? What's the difference between , , and ?  Even if their ODO definitions suggest they are interchangeable most of the time, are there fine differences in meaning between them? Use filecontents environment to write a binary file In  of mine, I was trying to show how to embed an audio file into the pdf with the multimedia package. The resulting MWE does not stand on its own because it requires an example audio file.  I guess my first question is, does TeXLive include any example audio files? The second, and potentially less uninteresting question is, can I use the filecontents environment, or some other environment, to create a binary file?  \documentclass{article} \usepackage{graphicx} \usepackage[implicit=false]{hyperref} \usepackage{multimedia}  % What goes in here to produce a usable wav file. Happy to use a different environment. \begin{filecontents}{\jobname.wav} \end{filecontents}  \begin{document} \sound[inlinesound]{\includegraphics{example-image}}{\jobname.wav} \end{document} Does applying the Collatz conjecture algorithm to negative integers always result in sequences ending with $-1$ and then repeating themselves an infinite number of times? It is so for the first several seed values.  After hours of thinking and research, I don't know how to answer the question. My exterior door deadbolt has gotten stuck - it'll open with the lever but not the key. By spraying WD-40 inside the lock, I've been able to get it to work but it's very stiff. I'd like to remove the lock and inspect the inside, either to clean/lube it or replace it. But I can't figure out how to remove the lock; there's no obvious way to do this. (I'm used to seeing two screws on the inside of the deadbolt, usually under the lever arms when it's horizontal.)    How do I remove this? I can loosen the cover plate on the inside but it doesn't do anything other than rotate a few degrees. If I take a sponge and place it in a shallow dish of water (i.e. water level is lower than height of sponge), it absorbs water until the sponge is wet, including a portion of the sponge above the water level. In other words, it seems the sponge pulls some water from the bath up into itself, doing work, and the water gains some gravitational potential energy.  Where does the energy required to do this work come from? My suspicion is that the answer involves physical and/or chemical bonds between the water and the sponge, or possibly the change in the surface area to volume ratio of the water.