I have an data object in a state, like so:  this.state = {         data: {             newsData: [],             eventData: [],         },     }   How can I get the number of properties defined in the state data? data.length doesn't work since it's not an array.
What's the fastest way to count the number of keys/properties of an object?  It it possible to do this without iterating over the object?  i.e. without doing  var count = 0; for (k in myobj) if (myobj.hasOwnProperty(k)) count++;   (Firefox did provide a magic __count__ property, but this was removed somewhere around version 4.)
Mouse cursor doesn't change to pointer when hovering "full site" on mobile When (accidentally) clicking "mobile" in the footer, one gets the mobile site in a regular browser too. To switch back, one can click "full site" in that same footer:    However: when hovering it, the mouse is changed as to select text, rather than to indicate one can click (even though it's clickable).  All other links do change the mouse into a pointer.  (Not a big deal, except when somehow  getting into the mobile mode, I guess.) How to combine bold and "code sample" in Markdown? I use Ubuntu 12.04 64-bit, I did the following: sudo gedit /etc/apt/apt.conf and added  APT::Install-Recommends "false"; APT::Install-Suggests "false";    But it did not work. When I try to install a package, it still wants to install the suggested and recommended packages. How can I solve this? Any javascript event occurring when user clicks Stop load button? Using WFS-T in OpenLayers? How can I use WFS-T in openlayers-2?  I'm using  in server side. My understanding is that light can not escape from within a black hole (within the event horizon).  I've also heard that information cannot propagate faster than the speed of light.  It would seem to me that the gravitational attraction caused by a black hole carries information about the amount of mass within the black hole.  So, how does this information escape?  Looking at it from a particle point of view: do the gravitons (should they exist) travel faster than the photons? How to lead a moving target from a moving shooter I saw this question: .  My situation is a little different though.   My target moves, and the shooter moves.  Also, the shooter's velocity is added to the bullets' velocities, i.e. bullets fired while sliding to the right will have a greater velocity toward the right.   What I'm trying to do is to get the enemy to be able to determine where they need to shoot in order to hit the player.  Using the linked SO solution, unless the player and enemy are stationary, the velocity difference will cause a miss.  How can I prevent that?      Here is the solution presented from the stack overflow answer.  It boils down to solving a quadratic equation of the form:  a * sqr(x) + b * x + c == 0   Note that by sqr I mean square, as opposed to square root. Use the following values:  a := sqr(target.velocityX) + sqr(target.velocityY) - sqr(projectile_speed) b := 2 * (target.velocityX * (target.startX - cannon.X)       + target.velocityY * (target.startY - cannon.Y)) c := sqr(target.startX - cannon.X) + sqr(target.startY - cannon.Y)   Now we can look at the discriminant to determine if we have a possible solution.  disc := sqr(b) - 4 * a * c   If the discriminant is less than 0, forget about hitting your target -- your projectile can never get there in time. Otherwise, look at two candidate solutions:  t1 := (-b + sqrt(disc)) / (2 * a) t2 := (-b - sqrt(disc)) / (2 * a)   Note that if disc == 0 then t1 and t2 are equal. Why does the zoom sometimes stop at a point? So I integrate the holomorphic function $\frac{e^{iz} -1}{iz}$ over the half disk in the upper half plane, let me name it $\Gamma$. By using Cauchy's theorem, it equals 0.  $$0 = \int_{\Gamma} \frac{e^{iz} -1}{iz} = \int_{0}^{\pi}(e^{iRe^{i\theta}}-1)d\theta + \int_{-R}^{R} \frac{e^{it}-1}{it}dt$$  ($Re^{[0, \pi]}$ and $t: [-R, R]$ being the respective parametrizations.)  By splitting the left integral in two, I get $\int_{0}^{\pi} e^{iRe^{i\theta}}d\theta \rightarrow 0$ by dominated convergence, and $\int_{0}^{\pi} -1d\theta = -\pi$. By making $R \rightarrow \infty$, I'm left with  $$\pi = \int_{-\infty}^{\infty} \frac{e^{it} - 1}{it}dt = \int_{-\infty}^{\infty}\frac{\sin t}{t}dt + \int_{-\infty}^{\infty}\frac{\cos t -1}{it}dt.$$  How do I get rid of the integral on the right? I welcome all feedback. Let $Z_n$ be the set of all $n \times n$ matrices that commute with all $n \times n $ matrices. Show that $$Z_n = \{\lambda I_n \ | \  \lambda \in \mathbb R\}$$  ($I_n$ is the $n \times n$ identity matrix)  I don't know how to use $E_{ij}$ (matrix with $1$ in $(i,j)$ and $0$ elsewhere) and the elementary matrix $P_{ij}$ to prove this question. Can anyone explain it please? Should Java Objects be reused as often as it can be reused ? Or should we reuse it only when they are "heavyweight", ie have OS resources associated with it ?  All old articles on the internet talk about object reuse and object pooling as much as possible, but I have read recent articles that say new Object() is highly optimized now ( 10 instructions ) and Object reuse is not as big a deal as it used to be.  What is the current best practice and how are you people doing it ? Money transfer from India to USA My daughter is a US Citizen. We (parents)are also planning to permanently settle in US. We will go their as Permanent Resident,as per US Law. We have a house here in India worth Rs.2 Crores.  We want to sell it and take money with us. We have ordinary savings Bank account here in India.  My US Citizen Daughter is a Income Tax payer.  Now your advises are required as under:   What are the routes to take money from India to US and our tax liabilities Can I gift this whole amount to my US Citizen Daughter or what is the maximum limit of Gift amount.  What will be the tax liability on me and on my Daughter in case of Gift   Whether I have to show it in my Income Tax Return or in my Daughter's Tax Return. What US Income Tax Laws says. What will be the procedure to send money as Gift to my Daughter. Will the money will go directly from my Bank Act.to my Daughter's Bank Account. Will there will be wire transfer from bank to bank Can I send money through other money sender Certified Companies also.    Please advise. If there is something more on the subject to make me understand, please advise. Thanks, Why do DNGs only show in low resolution on Google Photos? I want to change the default location of "Save a screenshot to Pictures" to save it to Desktop.   If that is not possible, is there any other way to do it? I am using Ubuntu GNOME 17.04.  NOTE: I don't want to change the location with dconf-editor as it changes the location of screenshot applet and not of the shortcut I require. I have End Date column and I want to add 14 Days on it auto when created, can I do it by workflow? Can I do it via jQuery. If yes how? if no how I can do it? How to add custom Modules in magento How do I remove the limit on PC keyboard button presses? A Hollow Black Hole I was just reading a . It was a trivial question, obviously there is no force felt. But then it got me thinking.  Suppose you had a hollow sphere that was massive enough that outside of it, it became a black hole. It's not hard to imagine a situation where the magnitude of the force of gravity at the surface (while strong) is equal to the magnitude of the force on the particles of the sphere due to some phenomenon involving one of the other 3 forces (just so I can allow this hollow sphere to continue being hollow).  Obviously, I don't have to do the integral to know that any object inside the hollow would experience no net gravitational force due to the shell. However, being a few months short of General Relativity, I am curious to know whether there would be any effects from Gravity observed.  Would an observer inside experience any time dilation? There may not be any net force due to gravity, but one cannot deny that there are still some fairly powerful gravitational fields present that happen to superimpose to zero. Furthermore, (assuming a relatively massless observer) would they have access to any of the information that was "lost" in the black hole? If so, then if they were long-lived enough for the black hole to be able to evaporate around them, does this mean that not only would the black hole radiate that information, but it would also store a copy of it in the hollow?  I want to apologize in advance. I know this question seems a bit more like a discussion than a Q&amp;A thing.  To be clear, I am asking: In my scenario, would there be any effects of gravity on things in the hollow? And would information lost in the black hole be accessible to the hollow (which is essentially its own isolated bubble of the universe)? A good answer can address these two questions. If you want to add in your own opinions/contribute to a discussion about it, that'd be a bonus. Removing las2dem streaks from raster DEM? I've created a series of DEM files using the  tool from LAStools; however since I don't have a licensed version they have black streaks running across them. Does anyone know a good method for removing these streaks? I've installed phpmyadmin sudo apt-get install phpmyadmin. Of course, I have also mysql and a web server running properly.  Now how can I reach it?