I have this code :   if (is_dir($dir)) {             if ($dh = opendir($dir)) {                 while (($file = readdir($dh)) !== false) {                     print_r(" ".$file. " ");                     $data = array(                         'emplacement' =&gt; 'uploads/slidesFiles/'.$file                     );                     $jpgId = $CI-&gt;dataaccess::InsertJpg($data);                     $data = array(                         'idSlideZip' =&gt; $zipId,                         'idSlideJpg' =&gt;$jpgId                     );                     $CI-&gt;dataaccess::InsertJpgToSlide($data);                 }                 closedir($dh);             }         }   My folder :     But when I am using the read dir function to loop into my folder, I dont have the expected order wich is the next :     I tried to reorder with the sort function but that is not the result expected.    Any idea ?
I am reading through a directory with some pictures and such using a pretty simple implementation of readdir() like the following:  if ($handle = opendir($path)) {     while (false !== ($szFilename = readdir($handle))) {     if ($szFilename[0] !== '.') {         if (is_file($path.$szFilename)) {                 // do stuff             }         }      }  }   The problem that I am having is that the files are not being read in alphabetical order as the docs for readdir() state:     Returns the filename of the next file   from the directory. The filenames are   returned in the order in which they   are stored by the filesystem.   Another weird thing is that, on the local testing server, the same code works great.  This is running on a server using the LAMP stack in both cases.  I know that I can build an array and just sort it, but I was wondering if I was missing something in what I was doing.
What is the physics of a spinning coin? When we spin a coin on a table, we observe 2 things:   It slows down and stops after sometime. It does not stay at just one point on the table but its point of contact with table changes with time.   I was trying to explain quantitatively this but I am stuck at how to take frictional torques into account. Any help will be appreciated. How to hook into the CPT's title placeholder? I want to change the default placeholder text in my Custom Post Type title field. This isn't possible while registering a new post type.  The following screenshot describes it. It is given that $X,Y \overset{\text{i.i.d.}}{\sim} N(0,1)$  Show that $\frac{XY}{\sqrt{X^2+Y^2}},\frac{X^2-Y^2}{2\sqrt{X^2+Y^2}} \overset{\text{i.i.d.}}{\sim} N(0,\frac{1}{4})$  I was thinking of making polar transformations $X=r \cos \theta, Y=r \sin \theta$  Then I am getting stuck at ranges of $\theta$ has been solved, in XeTeX, by this code:  \def\kright#1{\leavevmode #1\kern-\XeTeXglyphbounds3 \the\XeTeXcharglyph`#1 } \def\kleft#1{\leavevmode \kern-\XeTeXglyphbounds1 \the\XeTeXcharglyph`#1 #1}   which allows me to align text more precisely to the ink by accessing the side-bearing measurements (\XeTeXglyphbounds1 and 3).  This XeTeX dependency is currently the only thing stopping me from moving to LuaTeX (mainly for microtype). Is an equivalent function available in LuaTeX, or planned?    After reading a bit more on microtype, could the equivalent effect be achieved by an appropriately-tailored set of character protrusions? That way, my move to LuaTeX might be a lot simpler. I think the title says it. Did expansion of the universe steal the energy somehow? Regression without intercept: deriving $\hat{\beta}_1$ in least squares (no matrices) Find angle UFO in the picture attached I sent this problem to Presh Talwalkar who suggested me to send it to this site. I tried many things but was not able to find the correct solution.   I made various segments trying to get an equilateral triangle similar to the Russian triangle problem, but no success.  I also tried to flip the triangle UFO over side NO but again no success.   I tried to find like triangles, but not enough.  Could you please give me a hint?   Thanks, R. de Souza How did Rita know she lost the power? In Edge of Tomorrow, Emily Blunt's character, Rita Vrataski, had the time-resetting power previously.  She details the backstory of how she gained it, and how she lost it.  However, how did she know when she lost the power?  It's only triggered when the wielder dies.  Obviously she didn't die after losing the power, so how did she know the power was gone? Find the maximum value of $72\int\limits_{0}^{y}\sqrt{x^4+(y-y^2)^2}dx$ Find the maximum value of $72\int\limits_{0}^{y}\sqrt{x^4+(y-y^2)^2}dx  $ for $y\in[0,1].$  I tried to differentiate the given function by using DUIS leibnitz rule but the calculations are messy and I tried to solve directly by integrating it but that also is not working.Can someone please help me in solving this question? How to solve 'I found no database files--while read file something.aux' Hi I am trying to include references into my paper but it keeps showing the following when I compile. I am using texstudio. Message: I'm skipping whatever remains of this command The style file: plain.bst I found no database files---while reading file term paper.aux Warning--I didn't find a database entry for "Astrov"  My code is like this:   \documentclass[letter,scriptaddress,twocolumn, prl,showkeys]{revtex4}  \usepackage{amssymb, amsmath, amstext, amscd, verbatim, mathtools, graphicx, float, caption, subcaption} \usepackage[utf8]{inputenc} \usepackage{natbib} \begin{document} This is my reference\cite[1]{Astrov}. \bibliography{term paper} \bibliographystyle{plain} \end{document}   They are all in the same directory. I am really panicing about this at the moment and apologize if similar questions have been asked before. Thanks in advance for your help! I have a financial transaction that looks something like this (pseudo):  begin     select record for update     update record(same record as selected)     insert another record into another table commit   If I call SELECT ... FOR UPDATE within the transaction, will the lock be released for the specific rows only when the transaction is committed ? Use Stokes's Theorem to show $\oint_{C} y ~dx + z ~dy + x ~dz = \sqrt{3} \pi a^2$ I am a little stuck on the following problem:  Use Stokes's Theorem to show that  $$\oint_{C} y ~dx + z ~dy + x ~dz = \sqrt{3} \pi a^2,$$  where $C$ is the suitably oriented intersection of the surfaces $x^2 + y^2 + z^2 = a^2$ and $x + y + z = 0$.  OK, so Stokes's Theorem tells me that:  $$\oint_{C}\vec{F} \cdot d\vec{r} = \iint_{S}\operatorname{curl} \vec{F} \cdot \vec{N} ~dS$$  I have calculated:  $$\operatorname{curl} \vec{F} = -\vec{i} - \vec{j} - \vec{k}.$$  I then figured that on the surface $S$ we must have:  $$\vec{N}dS = \vec{i} + \vec{j} + \vec{k}dxdy$$  since this follows from the equation of the given plane.  However this will then give me:  $$\operatorname{curl} \vec{F} \cdot \vec{N} = -1 -1 -1 = -3$$  And thus I would get, if project this onto the $xy$-plane:  $$\iint_{S} \operatorname{curl} \vec{F} \cdot \vec{N} ~dS = -3 \iint_{A} dA = -3 \pi a^2$$  which is obviously not correct.  I would greatly appreciate it if someone could help me with this.  I actually had multivariable calculus a few years ago, and I know that I knew this stuff then.  However, now that I need it again I notice that I've become quite rusty.  Thanks in advance :) What currency does the galaxy deal in besides credits? In APM and the Clone Wars series, among other media, there are frequent instances where Republic credits are not accepted. These are typically places outside of the Republic and especially in the criminal underworld, Republic or otherwise.  If Anakin wants to pay Hondo to deliver some missiles illegally and not ask any questions, and Hondo does not accept credits, then what does Anakin pay him off with? Help with footer always to bottom Where to find Birth and Death Records for Bucharest, Romania? My husband's family came from Bucharest. Specifically his mother was born in Sibiu.  I have been able to piece together names and relations of several grand and great grandparents from word of mouth and some fortunate pictures they had of the cemetery in Sibiu.  I cannot however find any records of birth's and death's for any of them.   Are there sites or organizations that hold records for Romania? Let $a_n=\sqrt[n]n-1$. Does $\sum_{n=1}^\infty a_n$ converge? how to restore windows 7 to a know working state every time it boots A couple of days ago my mother asked me to set up a computer at her house, she wants to use it to basic web browsing, video chat and nothing more.  The problem is, neither my mother nor my sister know anything about using or maintaining a computer.  What I want is to have a working base install of windows 7 and just discard everything installed, downloaded, ... when it reboots. That way I can set up a partition just for saving files and whatever they do the computer will always return to a working state at start up.  can that be done?  PS: Sadly linux is not an option since my sister wants to be able to play some games with my steam account and not all of them run with wine. How do I share an ethernet connection via wifi on Windows 8? I have a Windows 8 laptop that is connected to a router via Ethernet. I want to make the laptop act like a wireless router via wifi so that other devices could connect to the computer using wifi and gain access to its Ethernet internet connection.  How do I do something like this? Floor a date in SQL server In SQL Server, how do I "floor" a DATETIME to the second/minute/hour/day/year?  Let's say that I have a date of 2008-09-17 12:56:53.430, then the output of flooring should be:   Year:  2008-01-01 00:00:00.000 Month: 2008-09-01 00:00:00.000 Day: 2008-09-17 00:00:00.000 Hour: 2008-09-17 12:00:00.000 Minute: 2008-09-17 12:56:00.000 Second: 2008-09-17 12:56:53.000 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.