Why does the below code not generate an error and print the value stored in arr then followed by a junk value ?  int main() {     int arr[1]={10};     printf("%d %d\n",0[arr], 1[arr] );     return 0; }
As Joel points out in , in  (aka: K &amp; R), there is mention of this property of arrays in C: a[5] == 5[a]  Joel says that it's because of pointer arithmetic but I still don't understand. Why does a[5] == 5[a]?
css vertical centering how could i vertically center a &lt;div&gt; within a &lt;div&gt; ?  my code so far:  &lt;div style="height:322px;overflow:auto;"&gt;     &lt;div style="border: Solid 1px #999999;padding:5px;"&gt;     &lt;/div&gt; &lt;/div&gt;   i have tried "top:50%;" and "vertical-align:middle;" without success  EDIT: okay so it's been discussed a lot. and i've maybe started another mini flame war. but for argument sake, how would i do it with a table then? i've used css for everything else so far so it's not like i'm not trying to employ "good practices".  EDIT: the inner div does not have a fixed height How can I delete my account? Enumerate or list all variables in a program of [your favorite language here] A friend asked me last week how to enumerate or list all variables within a program/function/etc. for the purposes of debugging (essentially getting a snapshot of everything so you can see what variables are set to, or if they are set at all). I looked around a bit and found a relatively good way for Python:   #!/usr/bin/python                                                                                                                                                                                                                            foo1 = "Hello world" foo2 = "bar" foo3 = {"1":"a",         "2":"b"} foo4 = "1+1"  for name in dir():     myvalue = eval(name)     print name, "is", type(name), "and is equal to ", myvalue   which will output something like:   __builtins__ is &lt;type 'str'&gt; and is equal to  &lt;module '__builtin__' (built-in)&gt; __doc__ is &lt;type 'str'&gt; and is equal to  None __file__ is &lt;type 'str'&gt; and is equal to  ./foo.py __name__ is &lt;type 'str'&gt; and is equal to  __main__ foo1 is &lt;type 'str'&gt; and is equal to  Hello world foo2 is &lt;type 'str'&gt; and is equal to  bar foo3 is &lt;type 'str'&gt; and is equal to  {'1': 'a', '2': 'b'} foo4 is &lt;type 'str'&gt; and is equal to  1+1   I have so far found a partial way in PHP (courtesy of ) but it only lists all variables and their types, not the contents:   &lt;?php // create a few variables $bar = 'foo'; $foo ='bar'; // create a new array object $arrayObj = new ArrayObject(get_defined_vars()); // loop over the array object and echo variables and values for($iterator = $arrayObj-&gt;getIterator(); $iterator-&gt;valid(); $iterator-&gt;next())         {         echo $iterator-&gt;key() . ' =&gt; ' . $iterator-&gt;current() . '&lt;br /&gt;';         } ?&gt;   So I put it to you: how do you list all variables and their contents in your favorite language?    Edit by : I propose this question follows the spirit of a little "". If you do not agree, just edit and remove the tag and the link. In the magical world (in Harry Potter) can ghosts use magic?  Can magic be used on ghosts?  Or, once they become ghosts, can they interact with magic at all? Creating new users using PHP not recognized by Apache 2.4 I have a server setup where new linux users are created using (PHP)  shell_exec ( '/usr/sbin/useradd ' . $username ); exec ('usermod -a -G ' . $username . ' '. $username); #add user into the usergroup exec ('usermod -a -G ' . $username . ' www-data'); #add usergroup with the www-data   And then the user script changes the owner and group of the files to this owner. The server is setup with suPHP which then allows these files to be run as the owner.  This setup worked fine with Apache 2.2 but is breaking in Apache 2.4. Everything works fine except when I try to oepn the files, it gives a 403 forbidden error. Restarting apache after the user is added fixes the issue but that is not a viable solution for me. The users are added using a web server and hence I need to be able to do this without having to reload/restart apache everytime.  I have searched for serveral hours and tried to fix the issue but haven't been able to do so! I am running ubuntu 14.04 and I am not able to downgrade to apache 2.2 as well. How can I install a Nautilus script? Question on the coefficients of $(1+x+x^2+x^3+x^4)^{496}$ Consider the expansion $$(1+x+x^2+x^3+x^4)^{496} = a_0+a_1x+\cdots+a_{1984}x^{1984}.$$   $\quad$ (a) Determine the greatest common divisor of the coefficients $a_3,a_8,a_{13},\ldots,a_{1983}$.      $\quad$ (b) Prove that $10^{340} &lt; a_{992} &lt; 10^{347}$.   Is there an easier way to solve this and is there a formula for the multisection for just the sum of the coefficients and not including $x^k$?  I thought of using the Multisection formula to prove (a). That is, $$\sum_{k \equiv r \pmod{m}}a_kx^k = \dfrac{1}{m} \sum_{s=0}^{m-1} \epsilon^{-rs} f(\epsilon^s x)$$ where $\epsilon$ is a primitive $m$th root of unity and $\displaystyle f(x) = (1+x+x^2+x^3+x^4)^{496}$.  Thus we have $r = 3, m = 5$ and so \begin{align*}\sum_{k \equiv 3 \pmod{5}}a_kx^k &amp;= \frac{1}{5} \sum_{s=0}^{4} w^{-3s} (1+w^s x+(w^{s}x)^2+(w^{s} x)^3+(w^{s}x)^4)^{496}\\&amp;=\dfrac{1}{5}\sum_{s=0}^4 w^{-3s}\left(\dfrac{(w^s x)^{5}-1}{w^s x-1}\right)^{496}\\&amp;= \dfrac{1}{5}\sum_{s=0}^4 w^{-3s} \left(\dfrac{x^{5}-1}{w^s x-1}\right)^{496}.\end{align*} Irreducible cyclotomic polynomial I want to know if there is a way to decide if a cyclotomic polynomial is irreducible over a field $\mathbb{F}_q$? Diacritics and non-English letters in anglicized loan words: keep 'em, dump 'em, italicize the words, or what? No sound (speakers/jack) + microphone's dead after spilling water Sadly, yesterday I've spilled some water on my MacBook Pro (El Capitan). Before you yell at me - it was closed, turned off and it wasn't a lot of water, the laptop was wet only on the top and under - not inside.  Today I've turned him on. At first battery wasn't recharging for some reason, but SMC reset fixed the problem.  At the first booting speaker was like talking to me, hard to explain but it was weird. Also only right speaker was "talking", despite the fact that only left side of the laptop was watered. Then there was no sound at all, not from the speakers, nor from the headphones. Also microphone's not working. USB ports are okay. The water was spilled from the left side of the laptop. I know this is hardware issue, and something's broken, but I want to be 100% sure. No it's not muted. I've also tried NVRAM reset a few times, but it doesn't fix the problem :(  There might be one factor, before spilling, my laptop "died" for the first time (battery energy ran off), but I doubt it's the case. (but hey, every info matters, right?)  It wouldn't be weird for me, if only left speaker wouldn't work, but built-in microphone not working is kinda weird in this case, isn't it?  I just want to ask you guys, what else can I check, before I'll be 100% sure it's dead inside?  I've plugged in external microphone - it's not working too. Given that indexing is so important as your data set increases in size, can someone explain how indexing works at a database-agnostic level?  For information on queries to index a field, check out . Let me filter jobs by the employer's Joel Test Scores Nvidia driver updated - mixed versions of 304.88 and 319.32 My problem is that after trying to update my driver through the additional drivers GUI I can't boot Ubuntu with GUI anymore, since Xorg says the kernel module is of version 304.88 (The old version before I updated) but the driver components are of version 319.32 (The new version)  This is the output of dpkg -l | grep nvidia  dkpg -l | grep nvidia ii nvidia-304 : 304.88-0ubuntu0.0.3  NVIDIA binary Xord driver, kernel module and VDPAU library ii nvidia-319 : 319.32-0ubuntu0.0.1  NVIDIA binary Xord driver, kernel module and VDPAU library ii nvidia-common : 1:0.2.44.2  Find obselete NVIDIA drivers ii nvidia-current : 304.88-0ubuntu0.0.3  Transitional package for nvidia-current ii nvidia-settings : 304.88-0ubuntu.0.0.3  Transitional package for nvidia-settings ii nvidia-settings-304 : 304.88-0ubuntu.0.0.3  Tool for configuring the NVIDIA graphics driver ii nvidia-settings-319 : 319.32-0ubuntu.0.0.1  Tool for configuring the NVIDIA graphics driver   That's the output of that file.  The message startx gives me is:  NVIDIA: API mismatch: the NVIDIA kernel module has version 304.88, but this NVIDIA driver component has version 319.32. Please make sure that the kernel module and all NVIDIA driver components have the same version.     Fatal server error:    no screens found   I understand that something went wrong during the update, so I wonder how to fix this so that the remaining parts of 304 are removed and replaced with 319. I don't know hwere to start because I thought that nvidia-current was the one that would update to 319 and so reinstalling that didn't work. And I googled and found that somebody said to try to install/reinstall/uninstall this package: nvidia-current-updates-dev  But I didn't have that package installed so it did not help. Other than that, I am clueless. I hope the information I provided will be enough so I can get an answer soon.  EDIT:  lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 12.04.3 LTS Release: 12.04 Codename: precise  uname -a Linux SQuad 3.2.0-52-generic #78-Ubuntu SMP Fri Jul 26 16:21:44 UTC 2013 x86_64 x86_64 x86_64 GNU/LINUX Subdomain versus subdirectory I recently moved from having a main site like www.example.com with a subdomain associated site yyy.example.com, to moving everything off the subdomain to a subdirectory like www.example.com/yyy/, with the same hierarchy underneath the subdirectory, and now yyy.example.com is just a redirect page to the subdirectory, so yyy.example.com/abc/page-x is redirected to www.example.com/yyy/abc/page-x and so on.  The effect has been that the traffic increased by several times (the total page views are more than ten times at the present rate) what it was to the yyy subdomain. Previously almost all of the traffic to the yyy subdomain was from the www site. This is from monitoring the old yyy site for a year or more.  I'm curious to know if there's any research or results which would indicate whether this is universal (subdirectories beat subdomains) or "just me". piping in real time This is more a conceptual thing than a current problem.  Would it be possible to do this:  tail -f &lt;file&gt; | grep "string" | sed 's/stuff//g' &gt;&gt; output.txt  The problem I'm thinking is that tail -f never terminates so it won't progress in the command. I'm trying to read and output a file in real-time. If this doesn't work how would I do it? Multiple object instances represented by two slightly shifted rectangles In a software diagram, I'd like to be able to represent multiple instances of an object by two rectangles with one of them slightly shifted. I recently learned about the pic style so I'm using it with two nodes to achieve what I want.  The following example does work, but I'd like to know if I can do the same without using the fill=white. My hack kind of assumes the entire picture background is white and that may not always hold. I'd like to be able to crop the unwanted picture part out.  \documentclass[crop,border=3pt]{standalone}  \usepackage{pgf,tikz} \usetikzlibrary{positioning}  \begin{document} \begin{tikzpicture}[     every node/.style={font=\sffamily\small},     block/.style={         rectangle, draw, align=center, minimum width=2cm,         minimum height=1.4cm, font=\sffamily\small     },     multinode/.pic={         \node [block] at (0.1,0.1) {};         \node [block, \tikzpictextoptions, fill=white] at (0,0) {\tikzpictext};% &lt;-- FILL WHITE     } ]     \node [block] (STG) at (2,5) {single\\instance};     \pic [pic text={multi\\instance}] at (5,5) {multinode}; \end{tikzpicture} \end{document}   The following images show first one version with the fill white hack, and then one version without it. Can you quickly tell me if this pseudocode makes sense or not? Why is fundamental group insufficient to classify manifolds? Inheriting from a UserControl in WPF I am fairly new to WPF and I am having a problem with inheriting from a user control.  I created a User Control and now I need to inherit from that control and add some more functionality.  Has anyone does this sort of thing before?  Any help would be greatly appreciated.  Thank you QGtkStyle was unable to detect the current GTK+ theme When I start any Qt app, I get this message in the terminal, and the Qt app doesn't use the same theme as my Gtk apps:  QGtkStyle was unable to detect the current GTK+ theme.   How do I make QGtkStyle detect my current GTK+ theme?  It seems that LXDE is using a settings daemon, and there is no gtkrc-2.0 file in my home folder.