i have an algorithm to upload an image with automatically naming, but i give the name with id from database, but the data in database isn't exist yet, so i insert the data first, then i get the max id as name of image (you can find it out clearly in my attachment code below and id is auto-increment), and the problem is i think if the server get much request to upload image, the image will have wrong name or name with id that doesn't belong to it. is there best practice regard to my problem?? or you have better algorithm about it?? please help me  This code written in php with codeigniter  if(isset($_FILES['gambarProduk'])){     $this-&gt;db-&gt;select_max('idProduk','maks');     $this-&gt;db-&gt;insert('gambarProduk',array('idProduk'=&gt;$this-&gt;db-&gt;get('produk')-&gt;result()[0]-&gt;maks));     $config['upload_path']          = 'images/produk/';     $config['allowed_types']        = 'gif|bmp|jpg|png|jpeg';     $this-&gt;db-&gt;select_max('idGambar','maks');    $config['file_name'] = $this-&gt;db-&gt;get('gambarProduk')-&gt;result()[0]-&gt;maks;     $extension = pathinfo($_FILES["gambarProduk"]['name'], PATHINFO_EXTENSION);     $fullpath = $config['upload_path'].$config['file_name'].'.'.$extension;      if(file_exists($fullpath)){         unlink($fullpath);     }     $this-&gt;db-&gt;where('idGambar',$config['file_name']);     $this-&gt;db-&gt;update('gambarProduk',array('extension'=&gt;$extension));     $this-&gt;load-&gt;library('upload',$config);     if(!$this-&gt;upload-&gt;do_upload('gambarProduk')){         $this-&gt;session-&gt;set_flashdata('uploadGambarProduk',2);     } }
I need to convert some files to PDF and then attach them to an email.  I'm using Pear Mail for the email side of it and that's fine (mostly--still working out some issues) but as part of this I need to create temporary files.  Now I could use the  function but it sounds like it creates a file on the filesystem, which isn't what I want.  I just want a name in the temporary file system (using ) that won't clash with someone else running the same script of the same user invoking the script more than once.  Suggestions?
I just realized I can't unrar .rar files on my Ubuntu machine!  What's the easiest way to accomplish this fundamental task? If possible I'd love something like 7Zip that I can just right Click, and extract and have the program worry about how to do it regardless if it's a .zip, a .rar or a .foo compressed file. \RequirePackage{filecontents} \begin{filecontents}{\jobname.bib} @article{Arter95,     Author = {David Arter},     Date-Added = {2013-08-11 17:38:06 +0000},     Date-Modified = {2013-09-01 15:13:22 +0000},     Journal = {Journal of Common Market Studies},     Number = {3},     Pages = {361-287},     Title = {The {EU} {Referendum} in {Finland} on 16 October 1994:              {A} Vote for the {West}, not for {Maastricht}},     Volume = {33},     Year = {1995}}  @article{Detlef95,     Author = {Jahn, Detlef; Storsved,Ann-sofie},     Date-Added = {2013-08-11 17:14:34 +0000},     Date-Modified = {2013-08-11 17:16:45 +0000},     Journal = {West European Politics},     Number = {4},     Pages = {18-37},     Title = {Legitimacy through referendum? The nearly successful domino‚Äêstrategy of the Eu‚Äêreferendums in Austria, Finland, Sweden and Norway},     Volume = {18},     Year = {1995}} \end{filecontents} \documentclass{article} \usepackage[ngerman]{babel} \usepackage{natbib} \bibpunct{(}{)}{;}{a}{}{,} \makeatletter \renewcommand\@biblabel[1]{} \makeatother  \begin{document}  \cite{Arter95}  \bibliography{\jobname} \bibliographystyle{plainnat}  \end{document}   Please help. I want the author's name displayed like this "Arter, D." instead of David Arter What's the right way to hard boil eggs? That is,     why is $\varphi(AB)=\varphi(A)\varphi(B)$, if $A$ and $B$ are two coprime positive integers?   It's not just a technical trouble—I can't see why this should be, intuitively: I bellyfeel that its multiplicativity should be an approximation at most. And why the minimum value for $\varphi (n)$ should be $ \frac{4n}{15} $ completely passes me by. Retagging questions in terms of possible answer technologies How to format numbers as currency strings Deriving Chinese Remainder Theorem from gcd Bezout identity We want to find the solution $x$ to the congruence system  $$\begin{align} x &amp;\equiv r_1 \!\!\!\pmod{\!m_1}\\ x &amp;\equiv r_2 \!\!\!\pmod{\!m_2}\end{align},\ \ {\rm where}\ \  \gcd(m_1, m_2) = 1$$  These can be rewritten as  $$\begin{align} x &amp;= r_1 + m_1 j\\ x &amp;= r_2 - m_2k\end{align}$$  for unknown integers $j, k$. So we set those two equations as equal and rearrange them to  $$m_1j + m_2k = r_2 - r_1$$  Now assume we perform $\text{egcd}(m_1, m_2)$, which gives us the solution to  $$m_1u + m_2v = \gcd(m_1, m_2)$$  Let the integer $\,h\,$ make $\,h \gcd(m_1, m_2) = r_2 - r_1$.  Then $\qquad hm_1u + hm_2v = h\gcd(m_1, m_2) =  r_2 - r_1 = m_1j + m_2k$  At this point I am lost because I don't think we can just assume  $hm_1u = m_1j$ and extract $j = hu$.   How do I get the values of $j$ or $k$ so I can get the value of $x$? How do they decide Blu-ray/DVD release date? Changed permissions of / to user Why doesn't my Bash script recognize aliases? Display the Number of Comment Upvotes In Recent Activity Pages It would be helpful if we could see the number of upvotes cast for our comments, or other people's comments in response to us directly in the user profile in either the activity tab or the response tab respectively. It should be quite easy to implement (e.g. sharing a single partial view for displaying comments).  It could be useful, since we can evaluate the legitimacy of the comment and address horrible mistakes sooner. How do I create an internet shortcut within a folder? Optional argument to \item I am typesetting an ordered list where the entries may appear out of order, but should be assumed in order otherwise. I don't want to have to jump through \setcounter hoops to do this. That is, I want something like  \begin{enumerate}   \item First   \item Second   \item[8] Eighth!   \item Ninth!   \item[4] Fourth \end{enumerate}   to give the following Good output, instead of the Bad output:    A minimum working example follows.  \documentclass{article} \usepackage{enumitem} % preferably something compatible with this guy \begin{document}  Good:  \begin{enumerate}   \item[1.] First   \item[2.] Second   \item[8.] Eighth!   \item[9.] Ninth!   \item[4.] Fourth \end{enumerate}  Bad:  \begin{enumerate}   \item First   \item Second   \item[8] Eighth!   \item Ninth!   \item[4] Fourth \end{enumerate}  \end{document}   It should be noted that I don't want to have to specify the period afterwards, in case my list using a different numbering, e.g. Roman. Compatibility with enumitem is preferred, but not required.  What is the correct way of going about this? Where did the Q come from, before the Q Continuum? In the Star Trek Universe where did the Q come from? I mean before they were Q in the Q Continuum? In Star Trek Voyager you learn that the race is somewhat intolerant of individualism (in the episode of the Q Civil War) but Q also suggest they have always been Q. Is that statement true, have the Q always been the Q? or were they a race that evolved into omniscience? I have a file containing lists on Solaris:  List A hi hello hw r u  List B Hi Yes  List C Hello   I need to transpose the lists as shown below:  List A    List B    List C hi        Hi        Hello hello     Yes hw r u   How can I do this on Solaris? Make program first read from pipe, then from keyboard How do you make an image emission without washing out the image? I am trying to make a computer monitor. This means I have to have an image texture for the screen. My image texture is currently connected to an Emission BSDF shader. Unfortunately, when the emission is bright enough to emit light, the image is white-washed. I tried adding a Brightness/contrast node to the image before pushing it into the Emission BSDF, but it seems to directly counter the Emission's strength.  The desired light level   The desired image brightness Recovering from a move of /home when it's encrypted (ecryptfs) I had a 20GB / partition at work that dual-booted with Windows and it quickly ran out of space. I usually do 20GB / and 160GB (or whatever the rest of the hard drive is) as /home, so I intended on recovering the space Windows was taking up and turning that into /home.  That went fine and I was able to mount the partition and rsync all my files over.  However, I forgot that the partition was encrypted, so now all my files are sitting in /home/.ecrypt and /home/$USER is empty.  How can I recover my files from /home/.ecrypt and move them to /home/$USER?  I followed this tutorial: Google sheets split multi-line cell into new rows (+ duplicate surrounding row entries) Dynamically adding a form to a Django formset I want to dynamically add new forms to a Django formset, so that when the user clicks an &quot;add&quot; button it runs JavaScript that adds a new form (which is part of the formset) to the page.