text:
Q: Error time out when import file sql into phpmyadmin? I'm using Mac Yosmite. When I import file sql (3MB) into phpmyadmin, I get this error:

Script timeout passed, if you want to finish import, please resubmit
  same file and import will resume.

I already edited file php.ini, but it is still not working.
My config: php.ini
post_max_size = 256M
upload_max_filesize = 256M
max_execution_time = 600
max_input_time = 600
memory_limit = 512M

And ~/Sites/phpmyadmin/libraries/config.default.php, change from
$cfg['ExecTimeLimit'] = 300;` to `$cfg['ExecTimeLimit'] = 0;

A: SEE this
How to solve time out in phpmyadmin?
You can use other tools to connect MySql,for example MySql query browser or MySql Administrator tools in witch you can sett server  ip (or domain) and MySql Port (3306) and username and password,
then use restore database ...


text:
Q: SQL query fetches no value I am trying to run a SQL query which fetches no value.
select distinct gd.segment1
from INV_GENERIC_DISPOSITIONS gd, gl_code_combinations gcc
where gd.distribution_account = gcc.code_combination_id
  and sysdate between gd.disable_date and gd.enable_date;

This is the query and disable_date has null values and hence the complete query does not return any value.

A: You can use ISNULL function to specify a backup value when the one rferenced is null.
select distinct gd.segment1 from INV_GENERIC_DISPOSITIONS gd JOIN gl_code_combinations gcc
 on gd.distribution_account = gcc.code_combination_id
where gd.distribution_account = gcc.code_combination_id
and sysdate between ISNULL(gd.disable_date, replacement_value) and gd.enable_date;

A: Presumably, you want logic like this:
select distinct gd.segment1
from INV_GENERIC_DISPOSITIONS gd join
     gl_code_combinations gcc
     on gd.distribution_account = gcc.code_combination_id and
        (sysdate <= enable_date and
         sysdate >= gd.disable_date or gd.disable_date is null
        );

Note that this use proper, explicit, standard, readable JOIN syntax.

redpajama_set_name: RedPajamaStackExchange


text:
Q: For what conditions of $a$ and $b$, it follows that $ \lim_{x \to \infty} \frac{\ln^a x}{x^b}=0 $? So the elemental limit
$$ \lim_{x \to \infty} \frac{\ln x}{x}=0 $$
Makes it possible to know that for any $b \ge1$ the following limit follows:
$$ \lim_{x \to \infty} \frac{\ln x}{x^b}=0 $$
However, what are the universal conditions for $a$, $b$ such that the limit
$$ \lim_{x \to \infty} \frac{\ln^a x}{x^b}=0 $$
Holds true?
Thanks in advance!

A: $b > 0$, no condition on $a$.  Consider that
$$ \frac{\ln^a x}{x^b} = \left( \frac{\ln^{a/b} x}{x} \right)^b = \left( \frac{\ln x}{x^{b/a}} \right)^a  \text{.}  $$


text:
Q: Pagespeed issues: Leverage Browser Caching I am failing the Google and GTmetrix speed tests miserably for my WordPress site. Both specify that browser caching is not enabled.
I have tried a few caching plugins, such as WP Super Cache, but they have had zero effect.
I have also manually edited the .htaccess file with the following:
##### EXPIRE CACHING - LEVERAGE BROWSER CACHING #####
<IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault "access plus 1 month 1 days"
ExpiresByType text/html "access plus 1 month 1 days"
ExpiresByType image/gif "access plus 1 month 1 days"
ExpiresByType image/jpeg "access plus 1 month 1 days"
ExpiresByType image/png "access plus 1 month 1 days"
ExpiresByType text/css "access plus 1 month 1 days"
ExpiresByType text/javascript "access plus 1 month 1 week"
ExpiresByType application/x-javascript "access plus 1 month 1 days"
ExpiresByType text/xml "access plus 1 seconds"
</IfModule>
##### END EXPIRE CACHING #####

But, again, it  has had zero impact. I have tried my host provider, BlueHost, three times and they have given me a different response each time but they all roughly equate to "nothing to do with us."
Does anyone have an idea what I may be doing wrong?
I feel like I am hitting my head against a brick wall with this one!
I would appreciate any help you can give me.

A: I was having the same issue with WP Super Cache (which is how I found this thread). I switched to WP Fastest Cache which solved it for me (it has it as a toggle setting in the options) - thought I'd post just in case you hadn't fixed it yet.

A: The code that you have added will work only when apache module mod_expires is active.
Alternatively, you can use the following code (add it to .htaccess)
# 1 YEAR
<FilesMatch "\.(flv|ico|pdf|avi|mov|ppt|doc|mp3|wmv|wav)$">
Header set Cache-Control "max-age=31536000, public"
</FilesMatch>
# 1 WEEK
<FilesMatch "\.(jpg|jpeg|png|gif|swf)$">
Header set Cache-Control "max-age=604800, public"
</FilesMatch>
# 1 WEEK
<FilesMatch "\.(txt|xml|js|css)$">
Header set Cache-Control "max-age=604800"
</FilesMatch>
# NEVER CACHE - notice the extra directives
<FilesMatch "\.(html|htm|php|cgi|pl)$">
Header set Cache-Control "max-age=0, private, no-store, no-cache, must-revalidate"
</FilesMatch>

Please note, that this will leverage browser caching only for internal files, you can't control it for external files.


text:
Q: how can we rename _id field returned from groupby query in mongodb I have two schemas users and lessons. I have to fetch lessons group by each user. Also I am storing reference id of user in lesson schema.
To get the result I have done aggregate query in following format
db.lessons.aggregate([{
  $lookup: {
    from: "users",
    localField: "user",
    foreignField: "_id",
    as: "user"
  }
}, {
  "$project": {
    "user": "$user.email",
    "title": "$title",
    "scheduled_at": "$scheduled_at"
  }
}, {
  $group: {
    _id: "$user",
    num_lessons: {
      $sum: 1
    },
    lessons: {
      $push: {
        title: "$title",
        schedule: "$scheduled_at"
      }
    }
  }
}])

From the above query I am able to get the output as below,
{
    "_id" : [
        "harry.quill@gmail.com"
    ],
    "num_lessons" : 1.0,
    "lessons" : [
        {
            "title" : "welcome to Mongoose",
            "schedule" : {
                "endTime" : ISODate("2017-06-12T08:30:00.000Z"),
                "startTime" : ISODate("2017-06-10T04:00:00.000Z")
            }
        }
    ]
}

{
    "_id" : [
        "tom.quill@gmail.com"
    ],
    "num_lessons" : 1.0,
    "lessons" : [
        {
            "title" : "welcome to Angularjs",
            "schedule" : {
                "endTime" : ISODate("2017-05-31T09:30:00.000Z"),
                "startTime" : ISODate("2017-05-21T04:00:00.000Z")
            }
        }
    ]
}

Now I want to rename _id to user. Is it possible to achieve this in aggregation pipeline?

A: we can do it by $project
db.lessons.aggregate([{
  $lookup: {
    from: "users",
    localField: "user",
    foreignField: "_id",
    as: "user"
  }
}, {
  "$project": {
    "user": "$user.email",
    "title": "$title",
    "scheduled_at": "$scheduled_at"
  }
}, {
  $group: {
    _id: "$user",
    num_lessons: {
      $sum: 1
    },
    lessons: {
      $push: {
        title: "$title",
        schedule: "$scheduled_at"
      }
    }
  }
},
{
  $project: {
    _id: 0,
    user: "$_id",
    num_lessons: '$num_lessons',
    lessons: '$lessons',
  }
}
])

I know, i am posting answer too late, but if anybody come here in future, it may helpful to them.


text:
Q: Haskell: make a Writer as efficient as normal code when log is not needed I'd like to write one code that could be run in two "modes":

*

*either in logging mode, i.e. it should log some informations (in my case I want to log the number of calls done on some particular functions at a given time)

*or in efficient mode, i.e. it does not log anything but just runs as fast as possible

I tried to write the following code, which creates two Writers, one normal one (for the logging mode) and one stupid one (that does not record anything, for the efficient mode). I then define a new class LogFunctionCalls that allows me to run my function in one of these two Writers.
However, I tried to compare the speed of the code using the Stupid writer, and it's significantly slower than the normal code without writer: here is the profiling informations:

*

*code without writer: total time = 0.27s, total alloc = 55,800 bytes

*code with stupid writer StupidLogEntry: total time = 0.74 s, total alloc = 600,060,408 bytes (NB: the real time is much bigger than 0.74s...)

*code with real writer LogEntry: total time = 5.03 s, total alloc = 1,920,060,624 bytes

Here is the code (you can comment depending on which run you want to use):
{-# LANGUAGE ScopedTypeVariables #-}
module Main where

--- It depends on the transformers, containers, and base packages.

--- You can profile it with:
--- $ cabal v2-run --enable-profiling debug -- +RTS -p
--- and a file debug.prof will be created.

import qualified Data.Map.Strict as MapStrict
import qualified Data.Map.Merge.Strict as MapMerge

import qualified Control.Monad as CM
import Control.Monad.Trans.Writer.Strict (Writer)
import qualified Control.Monad.Trans.Writer.Strict as Wr
import qualified Data.Time as Time

-- Test using writer monad

-- The actual LogEntry, that should associate a number
-- to each name
newtype LogEntry = LogEntry { logMap:: MapStrict.Map String Int }
  deriving (Eq, Show)

-- A logentry that does not record anything, always empty
newtype StupidLogEntry = StupidLogEntry { stupidLogMap:: MapStrict.Map String Int }
  deriving (Eq, Show)

-- Create the Monoid instances
instance Semigroup LogEntry where
  (LogEntry m1) <> (LogEntry m2) =
    LogEntry $ MapStrict.unionWith (+) m1 m2
instance Monoid LogEntry where
  mempty = LogEntry MapStrict.empty

instance Semigroup StupidLogEntry where
  (StupidLogEntry m1) <> (StupidLogEntry m2) =
    StupidLogEntry $ m1
instance Monoid StupidLogEntry where
  mempty = StupidLogEntry MapStrict.empty

-- Create a class that allows me to use the function "myTell"
-- that adds a number in the writer (either the LogEntry
-- or StupidLogEntry one)
class (Monoid r) => LogFunctionCalls r where
  myTell :: String -> Int -> Writer r ()

instance LogFunctionCalls LogEntry where
  myTell namefunction n = do
    Wr.tell $ LogEntry $ MapStrict.singleton namefunction n

instance LogFunctionCalls StupidLogEntry where
  myTell namefunction n = do
    -- Wr.tell $ StupidLogEntry $ Map.singleton namefunction n
    return ()

-- Function in itself, with writers
countNumberCalls :: (LogFunctionCalls r) => Int -> Writer r Int
countNumberCalls 0 = return 0
countNumberCalls n = do
  myTell "countNumberCalls" 1
  x <- countNumberCalls $ n - 1
  return $ 1 + x

--- Without any writer, pretty efficient
countNumberCallsNoWriter :: Int -> Int
countNumberCallsNoWriter 0 = 0
countNumberCallsNoWriter n = 1 + countNumberCallsNoWriter (n-1)

main :: IO ()
main = do
  putStrLn $ "Hello"
  -- Version without any writter
  print =<< Time.getZonedTime
  let n = countNumberCallsNoWriter 15000000
  putStrLn $ "Without any writer, the result is " ++ (show n)
  -- Version with Logger
  print =<< Time.getZonedTime
  let (n, log :: LogEntry) = Wr.runWriter $ countNumberCalls 15000000
  putStrLn $ "The result is " ++ (show n)
  putStrLn $ "With the logger, the number of calls is " ++ (show $ (logMap log))
  -- Version with the stupid logger
  print =<< Time.getZonedTime
  let (n, log :: StupidLogEntry) = Wr.runWriter $ countNumberCalls 15000000
  putStrLn $ "The result is " ++ (show n)
  putStrLn $ "With the stupid logger, the number of calls is " ++ (show $ (stupidLogMap log))
  print =<< Time.getZonedTime

A: The Writer monad is the bottleneck. A better way to generalize your code so it can run in those two "modes" is to change the interface, i.e., the LogFunctionCalls class, to be parameterized by the monad:
class Monad m => LogFunctionCalls m where
  myTell :: String -> Int -> m ()

Then we can use an identity monad (or monad transformer) to implement it trivially:
newtype NoLog a = NoLog a
  deriving (Functor, Applicative, Monad) via Identity

instance LogFunctionCalls NoLog where
  myTell _ _ = pure ()

Note also that the function to test has a different type now, that no longer refers to Writer explicitly:
countNumberCalls :: (LogFunctionCalls m) => Int -> m Int

Let's stick it in a benchmark, which has all kinds of methodological issues as pointed out in the comments, but still, something interesting happens if we compile it with ghc -O:
main :: IO ()
main = do
  let iternumber = 1500000
  putStrLn $ "Hello"
  t0 <- Time.getCurrentTime

  -- Non-monadic version
  let n = countNumberCallsNoWriter iternumber
  putStrLn $ "Without any writer, the result is " ++ (show n)
  t1 <- Time.getCurrentTime
  print (Time.diffUTCTime t1 t0)

  -- NoLog version
  let n = unNoLog $ countNumberCalls iternumber
  putStrLn $ "The result is " ++ (show n)
  t2 <- Time.getCurrentTime
  print (Time.diffUTCTime t2 t1)

The output:
Hello
Without any writer, the result is 1500000
0.022030957s
The result is 1500000
0.000081533s

As we can see, the second version (the one we care about) took zero time. If we remove the first version from the benchmark, then the remaining one will take the 0.022s of the former.
So GHC actually optimized one of the two benchmarks away because it saw that they are the same, which achieves what we originally wanted: the "logging" code runs as fast as specialized code without logging because they're literally the same, and the benchmark numbers don't matter.
This can also be confirmed by looking at the generated Core; run ghc -O -ddump-simpl -ddump-to-file -dsuppres-all and make sense of the file Main.dump-simpl. Or use inspection-testing.
Compilable gist: https://gist.github.com/Lysxia/2f98c4a8a61034dcc614de5e95d7d5f8


text: Q: Instruction pipelining - how is store/load behaving? So, if I have a pipeline with Fetch, Decode, Execute, Memory Access and Write Back, how does the store/load function work? For example if I have sw $1,$2 (store a word from $2 to $1) will it do something at WB or will store the value at MEM directly And do nothing at WB? If someone could explain to me the instruction above at every stage in pipeline would be great


text:
Q: what is the equivalent of a (python-)module in UML in UML, there seems to be no element that is the equivalent of a module in python, or at least i haven't figured it out yet.
a module in python, represented by one .py-file, has a header where the imports are denoted. it can contain many classes, all classes are in the modules namespace and can talk to each other directly and have access to the packages/modules/classes that the module has imported. how can i draw this in a diagram?
update 1:
finally, i stumbled upon a webpage, where i found something, that seems to be relevant...
on this website(http://www.alan-g.me.uk/l2p/tutclass.htm) in the chapter "Mixing Classes and Modules", the author says:

"...We can represent that graphically in UML in two ways. The logical
  grouping of the classes can be represented using a Package or we can
  represent the physical file as a component...."

if that is correct, a module in python is like a component in UML.
i am still trying to figure out, how this can work(because a component in UML seems  to me not to be the same as a module in python), and how exactly and in which diagram(s) i can model it.
update 2:
i am testing it with visual paradigm community edition(without it's code-generation-feature). for now, i was able to see, that in the UML-model, the component-element has a folder-like behaviour, like a package. and when i hover with the mouse over the classes that are contained in a component, i can see the effect i wanted, of the component representing an own namespace.
now(if this is the right way to model it), where can i specify, which other packages/modules/classes this one module shall import? when i select a package in visual paradigm, it offers me an option to import packages. but when i select a component, no import-functionality is offered. thanks a lot in advance.

A: Note that the module concept is just a method to provide code reusability and organization in Python. The link between Python modules and UML Packages and Components isn't direct and depends on a role of a particular module.
Sorry, I'm not programming in Python so I might have incorrect understanding of a typical module usage (or I can miss something). However as I understand the documentation you can use Python modules for two basic but a bit different purposes. It might represent a component (that is a part of a system) or a library (i.e. reusable set of classes).
The former one has a direct representation in UML that is a Component. Note that a Component is a Namespace for its owned (including imported) elements. However Component cannot be imported yet as a Namespace it can import Packages (see below).
On the other hand (for libraries) in UML you have a Package that you can easily use to model modules that should be importable. Package is also a Namespace but it can be imported by any other Namespece (for instance other Packages and Components). When Package is imported to some Namespece, its owned elements become available within importing Namespace (with some restrictions, see 7.4.3.3 and 12.2.3.2 of UML specification for more details).
The imports are usually shown in a package diagram.
So yes, your direction of thinking is good.


text:
Q: Why is my HSI color wheel weird looking? I'm trying to draw a color wheel in HSI color space. The color wheel I get has cyan, yellow, and magenta very wide, which just looks wrong. All other color wheels I've seen have red, green, and blue having the widest bands.

Is this just how the HSI color wheel looks? Or is my math wrong? I've tried every snippet for HSI to RGB I can find, and looked the equation up in books. The equation has a lot of variations, but they all lead to the same result when I draw my circle. The only thing I'm doing differently is clamping the channels at the end. My Intensity is 1.0 everywhere, the Hue is the angle of the pixel (rotated a little extra), and the Saturation is the magnitude of the distance to the center.
Here is my messy code for converting HSI to RGB (Objective-C):
float r;
float g;
float b;

S = S > 1.0f ? 1.0f : S;
I = I > 1.0f ? 1.0f : I;
H = H > 1.0f ? H - 1.0 : H;
H = H * M_PI * 2.0;
H = fmod(H, M_PI * 2.0);

if(S==0.0f){
    r = I;
    g = I;
    b = I;
} else{
    if((H>=0.0) && (H<2.0*M_PI/3.0)){

        b = (1.0f-S)/3.0f;
        r = (1.0f + S*cosf(H) / cosf(M_PI/3.0-H))/3.0f;
        g = 1.0f-r-b;

    } else if((H>=2.0*M_PI/3.0) && (H<4.0*M_PI/3.0)){
        H = H - 2.0f*M_PI/3.0f;
        r = (1.0f-S)/3.0f;
        g = (1.0f+S*cosf(H)/cosf(M_PI/3.0 - H))/3.0f;

        b = 1.0f-r-g;
    } else if ((H>=4.0*M_PI/3.0) && (H<2.0*M_PI)){
        H= H-4.0f*M_PI/3.0f;
        g = (1.0f-S)/3.0f;
        b = (1.0f+S*cosf(H)/cosf(M_PI/3.0-H))/3.0f;

        r = 1.0f-b-g;
    }
}
if(r<0.0f)
    r=0.0f;
if(g<0.0f)
    g=0.0f;
if(b<0.0f)
    b=0.0f;
float R = 3.0f*I*r;
float G = 3.0f*I*g;
float B = 3.0f*I*b;

if(R>1.0f)
    R=1.0f;
if(G>1.0f)
    G=1.0f;
if(B>1.0f)
    B=1.0f;

A: After reading the comments, it became clear that clamping the RGB values was causing the CMY bias. Decreasing the intensity removed the bias, but there were still strange banding issues, and the color wheel still didn't look like anyone else's color wheel. This result makes sense given the math, but for some reason, nobody mentions these problems anywhere in any of the books or online information about HSI. People show HSI color wheels that look like HSV/B color wheels, but I still have no idea how they got that result when converting to RGB.
The solution: I switched to HSV color space, which turned out to fit my requirements better than HSI.


text:
Q: Intrinsic and Extrinsic curvature I want to understand the basic conceptual idea about intrinsic and extrinsic curvature.
If we consider a plane sheet of paper (whose intrinsic curvature is zero) rolled into a cylindrical shape, then we say that its extrinsic curvature is non-zero. So how can I visualize the extrinsic curvature?
I read somewhere that the extrinsic curvature indicates how the 2D surface is embedded in 3D space. So what does it mean?

A: Exactly what you wrote. It means that a surface appears curved when looked from the space that contains it.
Take the circle, $S^1$,  for example. The intrinsic curvature would be what people call Riemann tensor. Since you can cover this circle globally by a single coordinate, you would get Riemann=0. There aren't any surprises when you parallel transport a vector around any closed loop.
Now, intuitively the circle appears curved. This is because it has extrinsic curvature. But be mindful, this definition makes reference to the ambient space. You only see the circle curved because you are looking at it from outside. Again, if you were constrained to live on the circle, it would pretty much look flat to you.
Look here Wikipedia extrinsic curvature for more details.

A: Intrinsic curvature, which we normally describe in terms of the Riemann tensor $R^a_{bcd}$ and quantities related to it, fundamentally has to do with the effect of parallel transportation on the manifold, and the curvature is responsible for manifolds having non-trivial holonomy.
Now if we have a sub-manifold embedded in some other manifold, the extrinsic curvature, as you more or less say, can be used to describe the way $\Sigma \subset M$ curves in $M$. The best way I have had it put to me is that, extrinsic curvature corresponds to everyone's layman understanding of curvature before we were ever introduced to differential geometry.
If the difference in dimension (or co-dimension) is greater than one, we can define multiple normal vectors to the manifold $\Sigma$, and there is a third notion. In the case of two, $\{n^a,m^a\}$ we can define a normal fundamental form, $\beta_a = m_b \nabla_a n^b = -n_b \nabla_a m^b$ which can be used to describe the curvature as one moves around $\Sigma$ of the normals in orthogonal planes.

A: My understanding comes from Milnor's Morse Theory Ch. 2. He identifies a small open set of a manifold M with the Euclidean space U. This gives him two things: he can now define points on the manifold M as well as tangent vectors originating from these points, all expressed in common coordinate and vector bases of the Euclidean space U, respectively. All local operations such as inner product or covariant differentiation are expressed in these common bases. (This is like using a positive definite matrix expressed in standard bases to compute norms. The inner products of the standard Euclidean basis vectors will likely be something other than 0 or 1.) The covariant derivative operations are happening in the invisible M, but the end result is that we can express it all in terms of vectors originating from points using common Euclidean coordinates and vector bases. The relationships among the weights on these bases in these expressions lead to the two Christoffel formulas. (The weights are all zero for Euclidean spaces. So everything is trivially symmetric.)
The chain rule and bilinearity basically mean that the covariant derivative is defined as long as we have a rule for any two basis vectors. He just asserts that the answer is a weighted sum of the basis vectors with these weights magically emerging from the invisible M for each point in U. So now he can directionally differentiate a vector field in U at any point against any vector emanating from that point, all in a common coordinate and vector Euclidean basis.
Then in Section 10, he doesn't have a curve at hand, only a tangent vector. So he begins with the simplest geodesic, one that just sits at point p and never moves. Yet, being a geodesic, it parallely moves a vector v emanating from p to … itself, so its Jacobian is invertible. He thus gains a diffeomorphism mapping a point and a tangent emanating from it to the endpoints of a local geodesic path emanating from the same point. He then exploits the consequence that locally any path can be expressed as exp$(r(t)\overrightarrow{v(t)})$, so he has a characterization of arbitrary paths that he can use to show that the geodesic is locally the shortest. Globally of course he has to assume that local geodesics can be indefinitely extended, which by the Archimedean principle implies some minimal small extension locally. But the small extension he needs (a limit point, actually) happens locally in a chart, which he exploits to prove the existence of global minimal geodesics using a) local perturbation arguments and b) the global properties of the segment of the global geodesic he has built so far. He needs a global distance metric, which he shows is compatible with the usual topology using local arguments. (A sufficiently small $\epsilon-$ open ball in the tangent space at a point is diffeomorphic to an $\epsilon-$ open ball on the manifold using the geodesic distance definition.)
I found his covariant second derivative intuition footnote on p.48 to be very illuminating. Suppose you want to compute the 'cross partial' of a function f w.r.t. two vector fields X and Y. So you first compute the directional derivative Xf and then apply Y to it. But this 'overdifferentiates' in the sense of the chain rule. Y first 'differentiates' X and then the directional derivative of f. The first term (Y |- X)f needs to be removed.
The curvature 'tensor', he says, then measures how symmetric the covariant second derivative of a vector field is w.r.t the pairs of basis vector fields. It's a purely algebraic trilinear map characterization because of all the weights and the invisibility of M. He uses the word 'tensor' in quotes presumably because this tensor has a lot of relations in the universal property. For one, the range is a vector space of dim U not dim $U^3$.
I would recommend reading Frank Morgan's short book Riemannian Geometry for Beginners (the first edition has typos) along with Milnor. I found switching between them very useful. I also kept a running example of a tangent cone on a sphere touching at a high latitude. This was a useful check on my understanding of Milnor (although the intuition is not generalizable cuz the weights on the cone are all zero). E.g., the centripetal acceleration vector of a particle traversing the latitude at uniform speed has a nonzero projection on the cone, and the two become more equal as you move the latitude higher and less equal as you move to the equator. You then get parallel transport on the equator because the tangent cone is now a cylinder and the projection of the centripetal acceleration vector is thus zero on the cylinder. Of course, in Milnor's calculations, you never see the centripetal acceleration vector, only its projection.
Finally, all this assumes the existence of a global Riemann metric but one can build one from local charts using partitions of unity. A simple intuition for the metric is that you cannot integrate a function on a manifold using charts. It doesn't obey change of variables. By contrast, a density, e.g., the square root of the determinant of the Riemann metric matrix, does, so you can integrate it (even though its value at a point depends on the chart). For example, a Riemann surface has holomorphic transition maps that amplify all tangent vectors at a point in the chart by the same proportion and rotate them by the same angle. The Riemann metric compatible with this structure is a positive scalar multiple of the identity matrix. See Terry Tao https://mathoverflow.net/questions/19152/why-is-a-topology-made-up-of-open-sets/30231#30231

A: Explaining  the idea of a 2 D surface embedded in 3 D Space.
You will get a (much) better answer than this, but a straightforward reason is that for using extrinsic curvature, we need an extra dimension to put the lower dimensional object "into".
Intrinsic curvature of a surface or manifold can be performed by using math techniques developed by Gauss and Riemann and allows us  to do without the extra dimension in curvature calculations.
Obviously everything we see around us is actually in 3D, but we can pretend a sheet of paper is 2D, so looking at a sheet of paper rolled up  into a cylinder is looking at a 2D surface in a 3 D space and we can measure directly how much it's curved.

Image Source: Descriptions of Curvature
From looking at these 3 shapes, it's quite obvious that in a 3 D world, we could physically measure all aspects of them, and determine which of them has, in  any small region on it, positive curvature, (the sphere), negative curvature,  (the "vase" shape) and which has no curvature, (the middle cylinder).
So 2D embedded objects in 3D space are easy to measure.
But we have to describe 4 D objects and events in a 4 D space, so we don't have the "elbow room" of an extra dimension.
So we give up on the visual attempt ( which is why most, if at all depictions of real 4D on TV and books are misleading) and we use expressions such as this:
$${\displaystyle R^{\rho }{}_{\sigma \mu \nu }=\partial _{\mu }\Gamma ^{\rho }{}_{\nu \sigma }-\partial _{\nu }\Gamma ^{\rho }{}_{\mu \sigma }+\Gamma ^{\rho }{}_{\mu \lambda }\Gamma ^{\lambda }{}_{\nu \sigma }-\Gamma ^{\rho }{}_{\nu \lambda }\Gamma ^{\lambda }{}_{\mu \sigma }}$$
to calculate how much spacetime is curved.
This above is an example using intrinsic curvature, we  don't (and actually can't) "lift " ourselves above the space.
We are in 4 D space-time, so to perform calculations in this space, we must use intrinsic curvature math ( differential geometry) as we can't go to a higher dimension.
In slightly more specific terms,you might have read about the metric tensor, which is based around the idea of using basis vector and their components to calculate distances (in 4 dimensions) utilising differential geometry to measure deviations from flat space caused by massive objects.
The other benefit of the intrinsic based metric tensor is that it is applicable in all GR calculations, (invariance).

A: Here is a way of thinking about the difference that I find useful.  It is not particularly rigorous but I think it can be made so.
Think about a manifold $M$ which is embedded in some higher-dimensional flat space: so the manifold locally looks like $\mathbb{R}^n$ and it's embedded in $\mathbb{R}^m$ with $m > n$.  (This is being a bit casual because it really needs to be embedded in some affine space, not a vector space, but it will serve.)
So, now, the way you define curvature of $M$, both intrinsic and extrinsic is in terms of parallel transport.  In particular what you need to do is to take a vector in the tangent space of $M$ at some point $P$ and parallel-transport it around a little loop, ending up back at $P$.  Then you compare the initial and final vectors.  if they are the same (for all loops, and all vectors) then the manifold is flat, and if they are not the same, then it's curved.
In order to actually quantify this notion, you then need to develop a lot of mechanism to describe what parallel transport is on the manifold and what geometrical object describes how vectors change when you parallel transport them around little loops: that object ends up being the Riemann tensor, of course.  But the idea is easy to understand.
Intrinsic curvature is when you do this trick entirely in $M$: you take your vectors around little loops in $M$ and see what you get back: if you don't always get back the same vector then $M$ has intrinsic curvature, if you do, it doesn't.
Extrinsic curvature is when you do this partly in the space into which $M$ is embedded.  It's easy to see that vectors in $M$'s tangent spaces correspond to vectors in the (tangent spaces of) the space into which $M$ is embedded, so at any point you can 'lift' a vector at a point in $M$ out into the larger space and start transporting it there instead, and then drop it back onto $M$ at some other point and continue transporting it in $M$ back to where it started.  So, in particular you can construct loops which are partly in $M$ and partly in the larger space, and transport things around those.  Note that there are two different notions of parallel transport in such a loop: while in $M$ you must transport using $M$'s rules, and while in the larger space you must transport using its rules (and the larger space is flat, of course).
$M$ has extrinsic curvature if you don't always get the same vector back when transporting a vector around such loops.
The best way to think about this is to consider an example.  Think about a 2-dimensional cylinder embedded in ordinary flat 3-space in the obvious way.
Well, you can easily convince yourself that the cylinder has no intrinsic curvature.
But now think about the extrinsic case.  Consider a loop which starts at a point on the cylinder, goes half-way around it, and then hops out into the embedding space and crosses back to the original point (by any path in the embedding space: it does not matter since it is flat).  It is easy to see (draw pictures!) that moving a vector $\vec{v}$ around such a loop results in $-\vec{v}$: it is pointing in completely the opposite direction.
So the surface of a cylinder has no intrinsic curvature, but it does have extrinsic curvature when embedded in the obvious way into 3-space.


text:
Q: AsyncFunction Error using create react app I'm experiencing a weird error using create-react-app:
when using AsyncFunction constructor to create an async function, it works during development but not works after build.
Below code runs fine in development, but will throws an error await is only valid in async function.
I tried logging AsyncFunction in production build, and it became function{ native code } not async function {native code }
I think it has something to do with babel transpiler, but I don't know how to fix this.
Any help will be appreciated. Thanks!
    const AsyncFunction  = Object.getPrototypeOf(async function(){}).constructor;
    let func = new AsyncFunction('await otherAsync()')
    func();

A: I think I found a workaround. Clearly Babel is doing something to rewrite AsyncFunction in terms of older browser primitives. My workaround is to wrap the function in a regular function marked 'async'.  My generated code looks like this:

{
    const add = scope.add
    // ... everything else I want in scope
    const chart = scope.chart
    const histogram = scope.histogram
    const timeline = scope.timeline
    async function foos() {
      return await dataset('elements')
    }
    return foos()
}

In the code above there's an invisible variable called 'scope' which it uses to define local vars.  Then it returns a hard coded async function foos() which contains the actual code to be evaluated: return await dataset('elements')
I can run this with the following. gen_code is a string containing the above generated code.

try {
    let func = new Function('scope',gen_code)
    return func(scope)
} catch (e) {
    console.error(e)
    return e
}

I think that will do it.


text:
Q: Delete element from Array after use - Swift My card is composed of 52 cards, so I created an array for them, and when the user click on the screen, a card is revealed.
I want that when a card is pulled, it can no longer be pulled in the future. I used removeAtIndex to remove the pulled card from the array. The function pullCard is called when the user touch the screen anywhere:
// Cards
let card1 = (1, "AS", "RULE 1")
let card2 = (2, "2", "RULE 2")
let card3 = (3, "3", "RULE 3")
let card4 = (4, "4", "RULE 4")
let card5... (to 52)

// Array
var cards = [
    card1,
    card2,
    card3,
    card4,
    card5... (to 52)
]

func pullCard() {
    let randomCard = Int(arc4random_uniform(UInt32(cards.count)))
    let cardsIndex = randomCard - 1
    let card = cards[cardsIndex]
    cards.removeAtIndex(cardsIndex)
}

Per example, the game pull the card 32, so it delete it from the array, and after if the game pull the same card, it crash because the card was deleted.
I tried to use an if statement :
if cards[cardsIndex] == nil {
    pullCard()
}

But it does not work.
Please help me :)

A: I think there is a problem here:
let cardsIndex = randomCard - 1

It should be:
let cardsIndex = randomCard

Infact you are generating randomCard as a random Int between 0 and (cards.count - 1).
So randomCard is already a valid index for cards, there's no need to subtract 1.
When the random generated number does happen to be 0, you try to access the index -1 of cards and this is bad in this universe.
I admit this bug does not match exactly the description you gave in the question but I suggest you to fix it and try again.


text:
Q: How to do a DELETE/UPDATE at the same time? Django rest ramework I'm new with django rest framework and I have 4 fields in my database table (id, chip, creation date, deletion date), on the front-end there is a button to delete the chip, so far so good, but on the page I have, in addition to the abject (chip) to be deleted, it has 2 more fields (creation date and deletion date) when deleting the object, the deletion date field must have the time of deletion and not simply be empty. How to make this change when doing the deletion?`
at the moment I just created the model and migrated it to the database.
I haven't started yet, I just created a route to list (GET) all the data in the table.
I ask for help to do the Delete/Update or whatever it may be.

my model
class Gateway(models.Model):
    id = models.AutoField( primary_key=True)
    gateway_chip = models.CharField(max_length=20, unique=True)
    creation_date = models.DateTimeField()
    deletion_date = models.DateTimeField()

    class Meta:
        db_table = 'GATEWAY'

A: You wouldn't use both PUT and DELETE together, you can only specify one as the HTTP method. If you have a deletion_date field then presumably you don't want to actually delete the model object, otherwise why record the date? In that case, you can 'soft delete' the object - it still exists but you can filter it away so that users see it as having been deleted but system administrators can still access it.
You can still use the DELETE method despite this essentially just being an update as the process is still essentially a deletion. There is also no strict requirement that the DELETE protocol actually deletes anything.


text:
Q: Argument siliently dropped by std::bind? Below code confused me, I expected it can cause compiling error, but actually not. The stringmy string is silently dropped?
As I understand TaskFunction expetec two arguments, but when I use std::bind there is one placeholder. Why didn't compiler prevent me assign the bind result to TaskFunction varaible tf?
#include <string>
#include <functional>
#include <iostream>

typedef  std::function< void(int , const std::string&) > TaskFunction;

class MyClass {

public:
   void myTask(int i) {
        std::cout << __FUNCTION__ << " i = " << i << std::endl;
    }
};

int main()
{
    MyClass mc;
    TaskFunction tf = std::bind(&MyClass::myTask, &mc, std::placeholders::_1);
    tf(0, "my string");
    return 0;
}

Result:
myTask i = 0


text:
Q: Automated payment notification with php I'm about to integrate automated payments into a site.
To date, I've successfully used paypal for a number of projects, but these have always been sites which sell physical goods, meaning I can upload the cart contents, user pays, person physically ships goods.
This site is a one off payment to enable extra features on a web app.  My current thinking is to go down the paypal IPN route to get a notification back and update the users account based on the successful payment.
Question is in two parts:
1 - is there a better / simpler way? (any payment processor considered)
2 - does anyone know of a code library or plug in for php which will speed up my integration?
Thanks for your help.
Rob

A: I remember coding the IPN handler myself; it was a really fun project, but it's not simple, it does take a while and since we are talking about money you want to be sure you get it right (even though PayPal offers a "testing" paypal website so you can easily see if it works).
Anyways, here is a good PHP IPN library; I took inspiration from it while coding my own.


text:
Q: How to extend & delete SP2013 web application on a SP2013 server having two front end servers? I want to extend SP2013 web application on a sharepoint server having two front end servers and one back end server. How to do that? I have extended one web application but it was on sharepoint server having one front end server. Is it the same way we have to do? or we have to also extend the web application on another front end server.

A: Extend web application as you did in 1WFE farm. You don't need to do anything on each WFE. But if you've got web applications provisioned as HTTPS, you'll need to take the appropriate measures to get the SSL cert configured on the servers, that is something SharePoint won't do for you.
For more info look at this guide: Extend web applications in SharePoint 2013
Think about host names, sometimes it is better to have.
And also take a look at this answer: SharePoint WebApplication publishing


text:
Q: jQuery's getJSON not maintaining original order Having the following file (customers.json):
{"3":"Andy", "1":"Bruce", "4":"Charlie", "2":"David"}

Using this code:
jQuery.getJSON("/Customers.json", function (data) {
    console.log(data);
});

This will output the following:
{"1":"Bruce", "2":"David", "3":"Andy", "4":"Charlie"}

My Json is purposefully in alphabetical order by the name, but this this code seems to put in numerical order. Is this a feature? And how do I stop this from happening?
Whether it makes a difference, I am using Firefox 39.0
EDIT:
The real question here is, is there anyway to do this, keeping ALL the data, and maintaining the order in which is received?

A: What your Json SHOULD look like is
[{"id":"3", "name":"Andy"}, {"id":"1", "name":"Bruce"}, {"id":"4", "name":"Charlie"}, {"id":"2", "name":"David"}]

What you're sending is a series of objects (customers), so your data structure should ideally reflect that. And transferring it as an array you can keep the order, as has already been mentioned.

A:
is there anyway to do this, keeping ALL the data, and maintaining the
  order

Try utilizing $.map() , Array.prototype.sort() to return array of values , properties of returned object

var json = {
  "3": "Andy",
  "1": "Bruce",
  "4": "Charlie",
  "2": "David"
};
var res = $.map(json, function(val, key) {
  // keep all data, maintain order
  // return array having value as string with comma ","
  // as separator between `val` from object `key` from object
  // `val`: `Andy` , `key`: `3`
  return [ val + ", " + key ]
}).sort();
console.log(res);
document.body.textContent = res;
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>

A: If you care about the order, you must submit a list in the response JSON.
But your data is wrong in this case,
response = [{"3":"Andy"},{"1":"Bruce"},{"4":"Charlie"},{"2":"David"}]

And then:
 $.each(response ,function(index,v){
      console.log(v)
      // or
      //console.log(data[index])

      //And to get the number and name, you must do some trick

      for (let [key, value] of Object.entries(v)) {
          console.log(number,value);
      }
 })

Best solution

You should use a key for the number, What is this number? a id, a rank?
    response = [{"id":3,"name":"Andy"},{"id":1,"name":"Bruce"},{"id":4,"name":"Charlie"},{"id":2,"name":"David"}]

And then:
 $.each(response ,function(index,value){
      console.log('Id:',value.id,'Name:',value.name);
 });

A: When the string that comes over the wire is converted to a Javascript object (the object representing the JSON data), what you end up with is an object like any other with properties and values. There is no ordering of properties in an object.
The object created from the JSON:
{"3":"Andy", "1":"Bruce", "4":"Charlie", "2":"David"}

is identical to an object created with this Javascript:
obj = {}; // <-- Not an array!
obj[1] = 'Andy';
obj[2] = 'Bruce';
obj[3] = 'Charlie';
obj[4] = 'David';

If you want to output the object in order of the property values, you'll need to first load the values into an array and then sort the array alphabetically.
Something like:
var sorted = [];
for (var prop in data) {
    if (data.hasOwnProperty(prop)) {
        sorted(json[prop]);
    }
}
sorted.sort();
console.log(sorted);

A:
Is this a feature?

Yes kind of, the order of properties of object can be up to an implementation. Some browsers do maintain the order, some not. This is what ES5 Specification says:

The mechanics and order of enumerating the properties (step 6.a in the first algorithm, step 7.a in the second) is not specified.

So, as soon as you get an JavaScript object from JSON literal the order of the properties can be lost.

And how do I stop this from happening?
Is there any way to do this, keeping ALL the data, and maintaining the order in which is received?

The only real way to solve the issue is to specify the order of objects explicitly.


text:
Q: How to get dependencies size with gradle task in Android Studio? I need to create a task that displays each dependency size when executed.
I've searched for a way to do it and the closest answer is this however, this solution seems to work for non Android projects only.
I'm currently using the tools.build:gradle:3.4.2 and the gradle plugin for android 5.1.1
I would like something to list each dependency and size like:
- Retrofit 2.5.0 ------ 654 KB.

- Butterknife 10.1.0 -- 150 KB.

I tried to implement the gist I linked before but it always says:

ERROR: Cannot change strategy of configuration ':app:androidApis' after it has been resolved.

After removing a piece of the code for multiple configurations:

ERROR: Cannot change strategy of configuration ':app:default' after it has been resolved.

At this point I don't know what to put at configuration...

A: You need to put the script mentioned here inside project.afterEvaluate{}, e.g.
project.afterEvaluate {
    tasks.create("depsize") {
        listConfigurationDependencies(configurations.default)
    }

    tasks.create("depsize-all-configurations") {
        configurations.each {
            if (it.isCanBeResolved()) {
                listConfigurationDependencies(it)
            }
        }
    }

}

def listConfigurationDependencies(Configuration configuration) {
    def formatStr = "%,10.2f"

    def size = configuration.collect { it.length() / (1024 * 1024) }.sum()

    def out = new StringBuffer()
    out << "\nConfiguration name: \"${configuration.name}\"\n"
    if (size) {
        out << 'Total dependencies size:'.padRight(65)
        out << "${String.format(formatStr, size)} Mb\n\n"

        configuration.sort { -it.length() }
                .each {
            out << "${it.name}".padRight(65)
            out << "${String.format(formatStr, (it.length() / 1024))} kb\n"
        }
    } else {
        out << 'No dependencies found';
    }
    println(out)
}

Then run below command you will get the size printed.
$ ./gradlew depsize

For example, my output is as following:
Configuration name: "minApi16ReleaseRuntimeClasspath"
Total dependencies size:                                               2.90 Mb

appcompat-v7-26.1.0.aar                                              980.85 kb
support-compat-26.1.0.aar                                            621.42 kb
recyclerview-v7-26.1.0.aar                                           335.80 kb
support-media-compat-26.1.0.aar                                      304.53 kb
support-core-ui-26.1.0.aar                                           227.63 kb
support-fragment-26.1.0.aar                                          160.75 kb
constraint-layout-solver-1.0.2.jar                                    93.32 kb
support-core-utils-26.1.0.aar                                         85.11 kb
constraint-layout-1.0.2.aar                                           37.28 kb
animated-vector-drawable-26.1.0.aar                                   34.33 kb
support-vector-drawable-26.1.0.aar                                    30.74 kb
support-annotations-26.1.0.jar                                        24.13 kb
common-1.0.0.jar                                                      12.08 kb
common-1.0.0.jar                                                      10.89 kb
runtime-1.0.0.aar                                                      9.38 kb
support-v4-26.1.0.aar                                                  3.01 kb

See: https://gist.github.com/medvedev/968119d7786966d9ed4442ae17aca279#gistcomment-3003945

A: [This site is no longer active] I have launched a new website to just do this. I am hoping to build an index for all libraries. The first time the lookup is going to be slow but subsequent lookups will be faster. Please check out the website at droidanalyser.tools


text:
Q: Why is SQL Server Object Explorer in Visual Studio so slow? I just created a new SQL Server Database in Azure and then opened it in Visual Studio 2015 using the link in the Azure Portal.  I had to add my IP to the firewall but otherwise the process went smoothly.
However, when I am trying to interact with the database server via SQL Server Object Explorer it is painfully slow.  Expanding any of the folders in my Database (e.g., Tables folder) takes 10 to 30 seconds.  The database is brand new, so the only things it has are whatever Azure creates when it instantiates a new DB.
This is the second Azure DB I have created and tried to view in Visual Studio and both have the same problem.  With the first one I thought maybe I did something wrong during setup but this time I made sure to do everything by the book.
Running actual queries against the DB from within Visual Studio (right click the DB, New Query ..., select * from INFORMATION_SCHEMA.TABLES;) is very fast, so it doesn't appear to be a problem with my connection to Azure.
Why is it so painfully slow?  What can I do to make it faster?
I am using Visual Studio 2015 Update 1 (14.0.24720.00) on Windows 10 (fully patched) and during database creation I checked the box to use the latest version.

A: SQL Server Object Explorer (SSDT) in Visual Studio builds a schema model of entire database when you connect a database first time. This is a concept of model based database development which provides benefits such as validating scripts against database without needing to modify the live database etc. When it comes to Azure SQL DB where the resource is limited with your database's pricing tier, the performance of executing queries to fetch database model can vary. Based on our performance tests, pricing tiers above S1/S2 provides a similar interactivity as local or on-prem SQL instance.
More in details, current SSDT's mechanism is to composite minimum number of queries to minimize the number of round-trip operations with SQL server/database hence each query execution time is longer. It affects the interactivity of SQL Server Object Explorer while the query is being executed.
To enhance, SSDT team is revising the design for Azure SQLDB to provide a faster interaction experience while keeping the benefit of model based database development.
Disclosure: I work on the SQL Data Tools team as a PM

A: Good tip from @eric-kang in his comment to use 'Server Explorer' instead of 'SQL Server Object Explorer' - this is much better for basic data queries as its actually usable in real time


text:
Q: botón continuar y añadir con un mismo  hola a todos tengo una situación con mi sitio
tengo dos botones  uno es continuar que me manda a otro cuestionario y otro añadir que me guarda los datos del cuestionario que estoy contestando.
ustedes se preguntaran que por que no realizo la parte de guardar y continuar con el mismo botón y la cuestión es de que quiero con el botón añadir ir llenando una tabla que el usuario este mirando cuando llene el cuestionario este cuestionario puede contestarse infinidad de ocasiones por el mismo usuario hasta no dar continuar para pasar al otro cuestionario.
si me guarda la información pero el problema es que solo tengo un  para los dos botones submit y si precioso cualquiera de los dos, ambos me realizan la operación de añadir.cuando quiero que uno me añada y el otro me de continuar.
tengo lo siguiente.

                                <button type="submit" class="btn btn-primary" onclick="return continuar();">Continuar</button>
                                <input type="hidden" name="metodoque" value="metodoque" />
                                <button type="submit" class="btn btn-primary" onclick="return continuar();">Añadir Riesgo</button>
                                <input type="hidden" name="Anadirriesgo1" value="Anadirriesgo1" />
                                <input type="hidden" name="ID_proceso" value="<?php echo $_id; ?>">
                                <input type="button" class="btn btn-primary" value="Regresar" onclick="history.back(-1)" />

y en mi php tengo esto para guardar

<?php
require_once 'conexion.php';
$_Anadir_Riesgo_que = stripslashes($_POST["Anadirriesgo1"]);
$_Metodo_que = stripslashes($_POST["metodoque"]);

if  (isset($_Anadir_Riesgo_que) == "Anadirriesgo1")
        {
        $ID_Proceso = stripslashes($_POST["ID_proceso"]);
        $ID_QUE = stripslashes($_POST["ID_QUE"]);
        $_que = stripslashes($_POST["que"]);
        $_Riesgo = stripslashes($_POST["riesgo_que"]);
        $_criticidad = stripslashes($_POST["Criticidad"]);
        $_Ocurrencia = stripslashes($_POST["Ocurrencia"]);
        $_Reaccion = stripslashes($_POST["Reaccion"]);
        $_Valor = stripslashes($_POST[""]);
        $_Decision = stripslashes($_POST["Decision"]);
        $_Plan_Accion = stripslashes($_POST["Plan_Accion"]);
        $query = "INSERT INTO riesgo_metodo_que (Id_Proceso,Id_Metodo,que,Riesgo, Criticidad, Ocurrencia, Reaccion, Valor, Decision, Plan_Accion)
        VALUES ('$ID_Proceso', '$ID_QUE', '$_que', '$_Riesgo', '$_criticidad', '$_Ocurrencia', '$_Reaccion', '$_Valor', '$_Decision', '$_Plan_Accion'); ";
        $result = $conn->query($query);
        if (!$result) die($conn->error);
        header("Location: ../form_validation.php?var=$_Proceso");
        exit;
        }
        elseif (isset($_Metodo_que) == "metodoque") {

        header("Location: ../form_validationtwo.php?var=$_Proceso");
        exit;
}

?>

A: Si lo que quieres es que el boton Añadir someta la forma a PHP y el otro solo llame una funcion en javascript, debes de cambiar tu PHP asi:
if  (isset($_Anadir_Riesgo_que) && $_Anadir_Riesgo_que == "Anadirriesgo1")

Luego cambia el otro boton eliminando el submit asi:
<button class="btn btn-primary" onclick="return continuar();">Continuar</button>


text:
Q: Expression-based labels in scripted Atlas fail to update I try to follow Programmatically load composer from template and generate atlas using pyQgis to automate atlas print composer using pyqgis :
specific in atlas code say :
    myAtlasMap = myComposition.getComposerMapById(0)
    myAtlas = QgsAtlasComposition(myComposition)
    myAtlas.setCoverageLayer(atlas_desktop)
    myAtlas.setComposerMap(myAtlasMap)
    myAtlas.setFixedScale(True)
    myAtlas.fixedScale()
    myAtlas.setHideCoverage(False)
    myAtlas.setFilterFeatures(True)

this code work for my task and i take new 100 atlas feutures maps but in my template.qpt i have some labels with code like this :
QGIS [%concat( "OBJECTID" )%]
that OBJECTID is the same for all new 100 atlas feutures maps.
Any idea why? If I use manual atlas export, then for any map OBJECTID change.

I have more details the true Does not work anything related to layer atlas in my template.qpt i have some base styles rules or base labels rules like this :
intersects($atlasgeometry, $geometry )

or
$id = $atlasfeatureid

that is the some in 100 maps :

i think so that Programmatically load composer from template and generate atlas using pyQgis just export one by one my features from my atlas layer and the atlas in my template stay False.
any idea ?

A: Hard to test without a demo.
What happens if you are more explicit in the label so:
QGIS [% concat( attribute(  @atlas_feature , 'OBJECTID'))% ]


text:
Q: Networkx Programatic Network Graph Visualization Hopefully this question isn't too opinion based. If it is, can you point me in the right direction for this question.
I am hoping to create something simple to visualize a twitter network that has been defined with networkx. What are the best available visualization tools for this? I would like to have something along the lines of, I run a script and get display a png or some image of the network that isn't too cluttered. I would definitely like to differentiate between usernames and hashtags and possibly color by community or something along those lines.
I haven't started anything yet other than playing with the built in networkx drawing which is limited and networkx doesn't even recommend. The tools I've found in my search include plot.ly, gephi, d3.js, and cytoscape. Plot.ly is proprietary so I'd like to stay away from it. D3.js seems pretty cool. I plan on using it eventually for some interactive graphs, but I hear there are performance issues and limitations to hundreds of nodes vs thousands of nodes. Also I'm not familiar with javascript at all. Gephi and cytoscape aren't really programmatic. They are nice, but require a human element.
Does anything already exist that meets my needs? Is the human element required to get decent looking output? I can get okay results with the built in networkx drawing, but it requires significant tweaking for each case (remove overlapping, setting up a half decent layout, etc...). Also the fact that networkx mentions they may drop support for drawing in the future doesn't help.

A: No need to use Javascrip. Bokeh is a Python library for D3.
You can also consider NodeBox if on OSX or NetworkX Viewer, but probably what you are looking for is Graph-Tool.


text:
Q: Executing a script takes so long on Git Bash I'm currently executing a script on Git Bash on a Windows 7 VM. The same script is executed within 15-20 seconds on my Mac machine, but it takes almost 1 hour to run on my Windows.
The script itself contains packages that extract data from XML files, and does not call upon any APIs or anything of the sort.
I have no idea what's going on, and I've tried solving it with the following answers, but to no avail:

*

*https://askubuntu.com/a/738493

*https://github.com/git-for-windows/git/wiki/Diagnosing-performance-issues
I would like to have someone help me out in diagnosing or giving a few pointers on what I could do to either understand where the issue is, or how to resolve it altogether.
EDIT:
I am not able to share the entire script, but you can see the type of commands that the script uses through previous questions I have asked on Stackoverflow. Essentially, there is a mixture of XMLStarlet commands that are used.

*

*https://stackoverflow.com/a/58694678/3480297

*https://stackoverflow.com/a/58693691/3480297

*https://stackoverflow.com/a/58080702/3480297
EDIT2:
As a high level overview, the script essentially loops over a folder for XML files, and then retrieves certain data from each one of those files, before creating an HTML page and pasting that data in tables.
A breakdown of these steps in terms of the code can be seen below:
Searching folder for XML files and looping through each one
for file in "$directory"*
do
    if [[ "$file" == *".xml"* ]]; then
        filePath+=( "$file" )
    fi
done

for ((j=0; j < ${#filePath[@]}; j++)); do

    retrieveData "${filePath[j]}"

done

Retrieving data from the XML file in question
function retrieveData() {
    filePath=$1

    # Retrieve data from the revelent xml file
    dataRow=$(xml sel -t -v "//xsd:element[@name=\"$data\"]/@type" -n "$filePath")

    outputRow "$dataRow"
}

Outputting the data to an HTML table
function outputRow() {
    rowValue=$1

    cat >> "$HTMLFILE" << EOF

$rowValue

EOF
}

As previously mentioned, the actual xml commands used to retrieve the relevant data can differ, however, the links to my previous questions have the different types of commands used.

A: Your git-bash installation is out of date.
Execute git --version to confirm this.  Are you using something from before 2.x?
Please install the latest version of git-bash, which is 2.24.0 as of 2019-11-13.
See the Release Notes for git for more information about performance improvements over time.


text:
Q: alt tags of the images are not saving/emtpy When I try to add an alt tag of an image via the library in Wordpress the alt tag is not saving. After leaving and coming back to the library again the alt tag fields are empty.
I've tried the following solutions which did not fix this problem:
Remove and upload the images again
Tried several plugins which overwrite the original alt tag
Disabled the WP Smush plugin
Checked the file permissions
I hope someone knows a possible solution.
Thanks in advance.
Theme that I'm using : https://undsgn.com/uncode/

A: Try changing the theme to wordpress' default theme, twentyseventeen. It could be an issue with the theme


text:
Q: Finding ratio of cevian lines I am preparing for an exam and doing some pratice problems. So I'm having a difficult time with this problem. At first I thought the ratio was 2:1 and then I also thought I would be able to use the angle bisector theorem but then I realized that cevians could be altitudes, medians or angle bisectors. So theorems are not helpful with this problem.
Basically, I asked my teacher for help and he told me that the answer is
EF:FC is $10:7$
and DF:FA is $3:14$
I've been trying to find out how he got these ratios but i'm not getting anywhere. Any ideas?

A: *

*After joining BF, label the areas as shown. For example, p = area of triangle BEF = [BEF].

*The rule:- "$\triangle$s having the same altitude, ratio of their areas is proportional to the ratio of their bases."
For example, $\dfrac {p}{z} = \dfrac {3}{4}$. This means $p = \dfrac {3}{4}z$. Do the same to $\dfrac {q}{x} = …$ to get $q = ? x$. Therefore, $[BEFD] = p + q = \dfrac {3}{4}z + ?x$.

*Apply the same rule to get $\dfrac {[ABD]}{[ADC]} = \dfrac {5}{2}$. Combining all the results, you should get $\dfrac {z}{y} = \dfrac {10}{7}$ (with x disappears miraculously).

*Apply the converse of the rule to get $\dfrac {EF}{FC} = … $.

A: Menelaus' theorem for $\triangle BCE$ and transversal $DA$ gives $
\frac{EF}{FC}\; \frac{CD}{DB}\; \frac{BA}{AE} = 1 = \frac{EF}{FC}\; \frac{2}{5}\; \frac{3+4}{4}$ thus $\frac{EF}{FC} = \frac{10}{7}$. Permute $5 \leftrightarrows 3, 2 \leftrightarrows 4$ to get $\frac{DF}{FA} = \frac{3}{14}$.

A: A general method to solving these kinds of things is through the Ratio Lemma, which is often applied in high school olympiad geometry.  It states that if $AD$ is a cevian in $\triangle ABC$, then $\dfrac{BD}{DC}=\dfrac{AB}{AC}\cdot\dfrac{\sin\angle BAD}{\sin\angle CAD}$.  The proof of this is quite simple; just apply the sine law to triangles $ABD$ and $CAD$.
So for this problem, the ratios $\sin\angle BAD:\sin\angle CAD$ is clearly equal to $\sin\angle EAF:\sin\angle CAF$.  So $EF:FC$ is equal to $(BD/DC)(AE/AB)=10/7$.  $DF:FA$ is calculated similarly.
The Ratio Lemma can also be used to prove many basic facts in projective geometry; e.g. the invariance of the cross-ratio when projected through a point onto a line.

A: Use mass points.
We assign B a mass of 4. So A has a mass of 3 and C has a mass of 10. E has a mass of 7 and D has a mass of 14. So we have $$ \frac{AF}{FD}= \frac{14}{3}$$ and $$\frac{EF}{FC}= \frac{10}{7}$$.


text:
Q: how to write error message to DB with EF when SaveChanges? With EF, any data value in Entity instance can be saved back to database by calling SaveChanges which can be overridden to add custom action.
So I try to override SaveChanges in following way:
public override int SaveChanges(System.Data.Objects.SaveOptions options)
       {
           try
           {
               return base.SaveChanges(options);
           }
           catch (Exception ex)
           {
               //error log here
               //write the error message to database table errorlog
               throw ex;
           }
       }

when SaveChange failed, I want to grab the exception and save the error message to a table in same database.  With about code, even save data to table errorlog, also should call SaveChanges. How to resolve this problem?

A: Initialize a new context instance in your catch block and log the error.
   public override int SaveChanges(System.Data.Objects.SaveOptions options)
   {
       try
       {
           return base.SaveChanges(options);
       }
       catch (Exception ex)
       {
           var context = new MyContext();

           // your log class instance populated with relevant details
           var error = new Error { Message = ex.Message; };

           context.Errors.AddObject(error);
           context.SaveChanges();

           throw;
       }
   }

A: In addition to @Eranga's advice use separate context type just for error logging (it will map only Error entity). This new context type will not have overriden SaveChanges - that will avoid infinite loop in case of error fired during error saving.


text:
Q: $s + \frac{1}{n}$ is an upper bound for $A$ and $s - \frac{1}{n}$ is not an upper bound for $A$. Show $s = \sup A.$
Let $A \subset \mathbb R$ be non empty and bounded above, and let $s \in \mathbb R$ have the property that for all $n \in \mathbb N$, $s + \frac{1}{n}$ is an upper bound for $A$ and $s - \frac{1}{n}$ is not an upper bound for $A$. Show $s = \sup A.$

I am having difficulty proving this statement. It is intuitively clear to me that it holds true but have no idea where to begin proving this. Thanks in advance for any help.

A: For all $a\in A$, $a\leq s+\frac1n$ for all $n$. Then $a\leq s$ (if it weren't, if you had $s<a$, you would be able to squeeze, for $n$ big enough, $s<s+\frac1n<a$, contradicting that $s+\frac1n$ is an upper bound for $A$).
So $s$ is an upper bound for $A$. Given any $s'<s$, you can choose $n$ big enough so that $s'<s-\frac1n<s$. As $s-\frac1n$ is not an upper bound for $A$, there exists $a\in A$ such that $s-\frac1n<a$. Thus
$$
s'<s-\frac1n<a,
$$
showing that $s'$ is not an upper bound for $A$. In consequence, $s$ is the least upper bound of $A$: $s=\sup A$.

A: Pure definitions.
The sup must exist as the reals have the least upper bound property.
$s - \frac 1n$ is not an upper bound for all $n$ so $\sup A > s + \frac 1n$ or all natural $n$.
All $s + \frac 1n$ is an upper bound so $\sup A \le s+ \frac 1n$ for all natural $n$.
So $s-\frac 1n < \sup A \le s+ \frac 1n$ for all natural $n$.
Now either $\sup A < s$ or $\sup A = s$ or $\sup A > s$.
If $\sup A < s$ then $s - \sup A > 0$ and there is an $n$ in $\mathbb N$ so that $\frac 1n < s - \sup A$ an $s < s - \frac 1n$ which is a contradiction.
If $\sup A > s$ then $\sup A - s > 0$ and there is an $n$ so that $\frac 1n < \sup A -s$ and $s > \sup a+\frac 1n$ which is a contradiction.
So $\sup A = s$.
Of course you may need to review why it is true that for all $x > 0$ theren is a natural $n$ so that $0 < \frac 1n < x$....

A: Since $s+1/n$ is an upper bound for $A$ we have $\sup A\leq s+1/n$ and further $s-1/n$ is not an upper bound so that there is an $a\in A$ which exceeds it and thus $s-1/n<a\leq \sup A$. It follows that we have $$s-\frac{1}{n}<\sup A\leq s+\frac{1}{n}$$ for all $n\in \mathbb {N} $. It is now almost obvious by Squeeze Theorem that $s=\sup A$.


text:
Q: Django 1.5: Understanding of AbstractBaseUser and permissions I created an user app MyUser which is an extension of AbstractBaseUser. I was under the impression that the model MyUser will replace the standard Auth.User, as long as it is mentioned in settings.py
AUTH_PROFILE_MODULE = 'profile.MyUser'
My trouble is now that I can't set the permissions for users registered in the MyUser model. When I try to set the group memberships and permissions, I get the error User' instance expected, got <MyUser: username>.
How can I add users of my user model to the permissions and correct groups?
class MyUserManager(BaseUserManager):
    def create_user(self, username, email, phone, password=None, company=False):
        if not email:
            raise ValueError('Users must have an email address')
        if not username: username = email.split('@')[0]
        user = self.model(
            email=MyUserManager.normalize_email(email),
            username=username,phone=phone,)
        user.set_password(password)
        user.save(using=self._db)

        # add to user group and set permissions
        if company:
            g = Group.objects.get(name='company')
            p = Permission.objects.get(codename='add_company')
        else:
            g = Group.objects.get(name='user')
            p = Permission.objects.get(codename='add_user')
        g.user_set.add(user)
        user.user_permissions.add(p)
        return user

class MyUser(AbstractBaseUser):
    username = models.CharField(max_length=254, unique=True, blank=True, null=True)
    email = models.EmailField(max_length=254, unique=True, db_index=True)
    phone = models.CharField(_('Phone Number'), max_length=25, blank=True, null=True,)

    is_active = models.BooleanField(default=True)
    is_admin = models.BooleanField(default=False)
    USERNAME_FIELD = 'email'
    REQUIRED_FIELDS = ['phone']

    objects = MyUserManager()

    def get_full_name(self):
        return self.email
    ...

A: Just add PermissionsMixin to your model declaration! :)
class MyUser(AbstractBaseUser, PermissionsMixin):
    ...

Here is the relevant part of Django docs.

A: You've probably resolved your issue but for completeness did you mean to refer to setting AUTH_USER_MODEL vs AUTH_PROFILE_MODULE when creating a custom user model in Django 1.5.
ref: https://docs.djangoproject.com/en/1.5/topics/auth/customizing/#substituting-a-custom-user-model


text:
Q: ASP.NET: Casting XPath to bool - Possible? Greetings!
I have an XML value that I'd like to use as a boolean value to toggle the visibility of a Panel.  I have something like this:
<asp:FormView id="MyFormView" runat="server" DataSourceID="MyXmlDataSource">
    <ItemTemplate>
        <!-- some stuff -->
        <asp:Panel id="MyPanel" runat="server" Visible='<%# (bool)XPath("Menu/Show") %>'>
        </asp:Panel>
        <!-- some more stuff -->
    </ItemTemplate>
</asp:FormView>
<asp:XmlDataSource id="MyXmlDataSource" runat="sever" DataFile="MyFile.xml" />

However, this throws an exception.  I've tried setting the value of Show in my XML to "true", "True", "0", but to no avail.  Is this even possible?  My XPath definitely works because I've tried moving <%# (bool)XPath("Menu/Show") %> outside so that I can see its value and it is correct.  I have tried this:
<%#((bool)XPath("Menu/Show")).ToString() %>

But this also throws an exception.
Thanks.

A: Try <%#(Convert.ToBoolean(XPath("Menu/Show"))) %>

A: if the xpath returns a string, don't you want to use Boolean.Parse(XPath("Menu/Show"))

A: Yet another:
System.Xml.XmlConvert.ToBoolean()

Valid strings are "1" or "true" for true and "0" or "false" for false.
Do I get bonus points for having the most obscure way of converting to boolean?

A: Try this:
Not sure of the syntax of string equality in classic ASP, but you need to do a string compare, then return true or false.
...Visible='<%#XPath("Menu/Show")).ToString().equals("0") ? return true : false%>'...

A: Visible='<%# (XPath("Menu/Show")) as string == "1" ? true : false %>'
beware of null exception. Use "as string" instead of .ToString()


text:
Q: How can I load a panel at click-time with a ModalPopupExtender? I am creating a checklist, where "checklistitems" are added to a "checklist".  Each of the items has a button next to it to launch a modal popup that will contain additional information about the item.
Because there are so many items, I've put the actual panel that will pop up on the "checklist", so it will only be on the web page once.  The ModalPopupExtender seems to handle this cross-class popup just fine.
My question is how can I load information into this panel?  The "checklistitem" has the data that needs to be passed up into the checklist - and I'd love to accomplish this with an update panel to avoid a full postback.

A: You can accomplish it via javascript without a postback.
Throw a javascript function into the OnClientClick event of the button and make it look something like this:
MyButton.OnClientClick = "ShowModal(); return false;"

And then in javascript:
function ShowModal()
{
var myDiv = document.getElementById("SomeDivInTheModal");
myDiv.InnerHTML = "<b>Some specal HTML to show in the modal.</b>";
var mpe = $find('MyModalPopUpBehaviorId');

if (mpe) {
mpe.show();
}

}


text:
Q: Is $x \times \frac{1}{x} = 1$ an identity or an equation? I understand an identity to be a mathematical statement that is always true e.g. $x + x = 2x$, and an equation to be a statement that is only true for particular values e.g. $x + 1 = 3$ is only true for one value of $x$. Is $x \times \frac{1}{x} = 1$ an identity or an equation? It doesn't seem to be either since it is not true for all values of $x$, but at the same time it can't be 'solved' like an equation can. Or is it just an identity which is true for all values of $x$ in its domain i.e. all real $x$ except $x = 0$?

A: In my opinion,
an identity is an equation
that is true except
for a well-specified
set of exceptions
(which may be empty).
Your example
($x\cdot \dfrac1{x} = 1$,
exception is $x = 0$)
is one,
as is
$\sin^2(x)+\cos^2(x) = 1$
with no exceptions,
as is
$\tan(x)
=\dfrac{\sin(x)}{\cos(x)}
$
with exceptions when
$\cos(x) = 0$
(i.e., $x = (n+\frac12)\pi,
n \in \mathbb{N}$).

A: An equation is any statement with content "equals" other content.
An equation is an identity if it is true for all values in the specified domain (here that would be all nonzero reals or all nonzero values in whatever space you are working in).
To answer your question: it is both (all identities are equations). So, more specifically it is an identity.


text:
Q: Read config properties from another project in the same solution C# I have a solution named WebServiceProject.
Inside this solution I have three projects:

*

*Common (Class Library)

*UserInterface (WinForms Project)

*WebService (WCF Service Project)
In the WebService project I have an app.config file with this content:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <configSections>
    <sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b72a5b561321d079">
      <section name="WebService.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b72a5b561321d079" requirePermission="false"/>
    </sectionGroup>
  </configSections>
  <startup>
  <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/></startup>
  <appSettings>
    <add key="ConnectionString" value="mydatabase@localhost"/>
  </appSettings>
  <system.serviceModel>
    <bindings/>
    <client/>
  </system.serviceModel>
</configuration>

In the WebService project I execute some scheduled routine calling the Common project classes reading the ConnectionString from app.config file:
if (!string.IsNullOrEmpty(ConfigurationManager.AppSettings["ConnectionString"]))
{
    // I do something
}

If I start the WebService alone everything works fine.
Inside the WinForms project UserInterface, I have a button that start the routine inside the Common project as the WebService does.
But if I "Set as StartUp project" the UserInterface project the previous piece of code ConfigurationManager.AppSettings["ConnectionString"] throw an error, because I didn't specified the ConnectionString in the app.config in UserInterface project.
So, my question is: how can I read the ConnectionString property from the WebService project event if I "Set as StartUp project" the UserInterface project? More in general, how can I read an app.config property from another project different from the executed one?

A: Simply read the file and parse it as an XML. Then retrieve your value reading the interested key.

A: I found this link very useful:
AppSettings in App or Web Config Using a Linked File
Thanks to @Daniel Stackendland

A: You can put your application settings from your webservice project into the app.config of your UI-project.


text:
Q: Element Isn't Cloning ..? I was working on a basic commment script. This basically means whatever you type into the textboxes (one for title, and another for message) and then press submit, your comment should be added to the page, similarly how youtube does it. I was planning on having a prebuilt HTML div, and just clone it for every new comment that is made (and of course changing the text to match). The problem is that I can not get my script to work. When you press submit, no element is cloned into the container. This is my issue. What is the problem?
EDIT: I updated the code and the new error is (Cannot read property 'appendChild' of null)

window.onload = () => {
  const template = document.comment;
  const form = document.forms.comment;
  const container = document.querySelector('.container')
  form.submit2.addEventListener('click', () => {
    const name = form.name;
    const text = form.text;
    const newNode = template.cloneNode(true);
    newNode.classList.remove('hidden')
    container.appendChild(newNode)
  })
}
.hidden {
  display: none;
}

.comment-form input {
  display: block;
  padding: 2px;
}
<!DOCTYPE html>

      <link rel = "stylesheet" href = 'style.css'>

      <form name = "comment" class = "comm">
        <input type = "text" maxlength = 20 name = 'name' placeholder = 'name'>
        <textarea name = "text" placeholder = 'comment'></textarea>
        <input type = "button" value = "submit" name = "submit2">
      </form>

Demo

Paragraph

A:

window.addEventListener('load', e => {
  const template = document.querySelector('.comment-template');
  const form = document.querySelector('.comment-form');
  const container = document.querySelector('.container');

  form.querySelector('.submit-button').addEventListener('click', e => {
    const newNode = template.cloneNode(true);

    newNode.querySelector('.name').innerText =
        form.querySelector('.name').value;
    newNode.querySelector('.comment').innerText =
        form.querySelector('.comment').value;

    newNode.classList.remove('hidden');
    container.appendChild(newNode);
  });
});
.hidden {
  display: none;
}

.comment-form input {
  display: block;
  padding: 2px;
}
<form class="comment-form">
  <input type="text" maxlength="20" placeholder="name" class="name">
  <textarea name="text" placeholder="comment" class="comment"></textarea>
  <input type="button" value="submit" class="submit-button">
</form>

I changed the logic to use querySelector instead of the name access.  Also fixed that the container was originally coming back as an array like object, instead of just one element, which is why the append child didn't work.  Also added the logic to actually stick the name and comment text into the cloned node.

A:

window.onload = () => {
  let template = document.comment;
  // You have two elements with a name of comment.  It is being set as the
  // form, and not the div that presumably you are trying to clone later.
  console.log("My template", template);

  // so to fix that, you can select the element by its class instead
  template = document.getElementsByClassName('hidden')[0];
  console.log("My fixed template", template);

  const form = document.forms.comment;
  console.log("My form", form);

  // getElementsByClassName returns an array like object, even if there
  // is only one element matched.  Using [0] lets us get just a single one
  const container = document.getElementsByClassName('container')[0];
  console.log("My container", container);

  // using the name change you said you made to have the button named
  // submit2 instead of submit, we can bind the click event to it
  console.log("My submit button", form.submit2);

  form.submit2.addEventListener('click', () => {
    let name = form.submit2.name;
    console.log("My name", name);

    // The "name" element is not a child of the submit button.  It is a
    // sibling element with it's own name
    // We need to reference it instead, and grab the value
    name = form.name.value;
    console.log("My fixed name", name);

    let text = form.submit2.text;
    console.log("My text", text);

    // Same issue with the text
    text = form.text.value;
    console.log("My fixed text", text);

    const newNode = template.cloneNode(true);
    console.log("My new node", newNode.outerHTML);

    // As you can see, you cloned the node, but you haven't put the name
    // or text on it.  Need to do that before appending it to the DOM.
    newNode.getElementsByTagName('h1')[0].innerText = name;
    newNode.getElementsByTagName('p')[0].innerText = text;

    console.log("My fixed new node", newNode.outerHTML);

    newNode.classList.remove('hidden');
    container.appendChild(newNode);
  })
}
.hidden {
  display: none;
}

.comm input{
  display: block;
  padding:2px;
}
<!DOCTYPE html>

      <link rel = "stylesheet" href = 'style.css'>

      <form name = "comment" class = "comm">
        <input type = "text" maxlength = 20 name = 'name' placeholder = 'name'>
        <textarea name = "text" placeholder = 'comment'></textarea>
        <input type = "button" value = "submit" name = "submit2">
      </form>

Demo

Paragraph

Providing an alternative answer that steps through the original logic, attempting to show the issues, and show how to fix them.  Trying to stay as close to the original logic as possible.

A: The problem was that in my HTML elements I added whitespace. Never add spaces around the = sign. Nothing was wrong with the script itself.


text:
Q: Fullcalendar Remove Event On EventRender With fullcalendar, I want to remove events that are cancelled: those that have event.post_appt_status_id == '3'.
Right now in EventRender, I have icons that are prepended based on the appt status.  They work fine.  I thought that would be the place then to easily remove the cancelled events from the calendar.
It's just not working.  Here's what I'm trying:
   eventRender: function eventRender(event, element, view) {

        //handle icon before time
        if(event.appt_status_id == '1'){
            //confirmed icon
            element.find(".fc-time").prepend(" ");
        } else if(event.appt_status_id == '2'){
            //unconfirmed icon
            element.find(".fc-time").prepend(" ");
        } else if(event.appt_status_id == '8'){
            //walkin icon
            element.find(".fc-time").prepend(" ");
        } else if(event.appt_status_id == '9'){
            //left message icon
            element.find(".fc-time").prepend(" ");
        };

        //handle icon before title
        if(event.post_appt_status_id == '6'){
            //attended alone icon
            element.find(".fc-title").prepend(" ");
        } else if(event.post_appt_status_id == '7'){
            //attended companion icon
            element.find(".fc-title").prepend(" ");
        } else if(event.post_appt_status_id == '4'){
            //no show icon
            element.find(".fc-title").prepend(" ");
        } else if(event.post_appt_status_id == '3'){
            //cancelled icon
            element.find(".fc-title").prepend(" ");
            $('#calendar_full').fullCalendar('removeEvent', event.id);
        };

        //add text to event
        element.find('.fc-title').append("
" + event.appt_reason_name + " with " + event.scheduled_with_name);

        //handle changing menu options at top
        return ['all', event.location_id].indexOf($('#calendar_location_id option:selected').val()) >= 0 && ['all', event.saw_by_id].indexOf($('#calendar_provider_id option:selected').val()) >= 0;

    },

I would have assumed that $('#calendar_full').fullCalendar('removeEvent', event.id) would remove those events from the calendar, but it's not!

A: Event rendering can be canceled if your eventRender callback returns false.

The function can also return false to completely cancel the rendering of the event.

eventRender: function( event, element, view ) {
       //...
       if (event.post_appt_status_id == '3') {
           return false;
       }
       //...
 }

A: the event you are trying to use has been removed from Plugin, they had introduced new one named as "removeEvents " .
For more details please check
https://fullcalendar.io/docs1/event_data/removeEvents/
OLD LINK
https://fullcalendar.io/docs1/removed/removeEvent/


text:
Q: how to solve this c linker error? uint8 *measurements[30] = {(uint8*)0x0041c620};

I have declared a global variable in my program like above but I am getting a linker error as

LNK2005: _measurements already defined in MAIN.obj

I am modifying the code as
typedef unsigned char uint8;
    uint8 *measurements[30];
    measurements[30]= {(uint8*)0x0041c620}

;
then also I am getting the error

A: The error tells you that you have defined this global variable in more than one translation unit - in MAIN.obj as well as in some other. Which one I cannot tell, because you didn't post the whole error message, only one line of it.
Your question does not contain enough information to reproduce the problem, or tell where exactly you made the error. Perhaps you defined the variable in a header file?

A: Is the definition in a header file? If so, you'll get one definition of the variable for each source file that includes the header. Try marking changing the header to only declare the variable, not define it, like so:
  extern uint8_t *measurements[30];

and then define it in one of the files, e.g. main.c like so:
  uint8 *measurements[30] = {(uint8*)0x0041c620};

A: It seems you want array of 30 8-bit values, and that array is already existing at some specific address.
In one source file (measurements.c):
uint8 * const measurements = (uint8*)0x0041c620;

In header file (measurements.h):
uint8 * const measurements;

Usage:
#include "measurements.h"

// In some function
measurements[29] = ... // Set last element to something

Note that I added the const because I think you do not want to change array address (0x0041c620).


text:
Q: 'Drummy' sound when striking with a hammer In building there is a common test for masonsry structures that involves striking the structure with a hammer and listening to the resulting sound. If the sound is ringing the structure is fine but if the sound is 'drummy' (maybe like a dull thud) then there is an issue with the structure.
I'm presuming this somehow relates to vibrations in the structure. But what actually is the difference between the ringing sound and the 'drummy' sound in terms of the vibrations within the structure?

A: in the ringing sound, the structure is vibrating as if it were a solid, seamless metal bar like in a xylophone or a wind chime, which indicates that all the individual bricks in it are tightly and firmly cemented together into a single mass, which is a good thing.
if the sound instead is dull and "drummy", it means there are gaps and breaks or "debonds" between the individual bricks which prevent the entire structure from responding as a single big chunk of stuff. instead it responds like a big pile of smaller chunks that are poorly-connected together- which is a very bad thing for a masonry structure.


text:
Q: What is _transient_random_seed for? This is a very short question. _transient_random_seed is in wp_options.
What is it for?

A: The wp_rand function mixes up the randomization of random numbers with various means, and in between runs it stores the random seed so as to keep the shuffling going every run. The random_seed transient is where it stores that.


text:
Q: MCU/embedded: Position independent code, max size for .got section? I am trying to get my project "position independent", but it won't give...
Some background:

*

*nxp imx rt 1024 evk board

*c++ project

*compiled both C and C++ files with -fPIC, -msingle-pic-base -mno-pic-data-is-text-relative

*a working prototype where I can run a small demo c++ program run which starts some freertos tasks and creates some static c++ objects (with inheritance, with pure virtual classes, to test)

*the strong desire to have 1 binary which we can update "over the air" (OTA) by having a customer bootloader which jumps to either app1 or app2.

When I apply my changes to my "real" project, it works all the same as long as I comment out the vast majority of my c++ static constructors.

When I include one (any) more constructor in my main.cpp, the following will happen:

*

*My bootloader copies the vector table from flash (either app1 or app2) to sram = OK

*My bootloader jumps to 0x202000004 (OC sram where reset handler ISR sits) = OK

*The ResetHandler will start setting up R9 (the register used for the .got) = OK

*The ResetHandler will jump to Startup = hard faults, checking the registers in the CPU, I can see that the LR (link register) has a bogus value (0xfffffff9) some clearly something went wrong.

I verified:

*

*the vector table from disassembly, matches 1-on-1 with vector table in OC sram

*the .got section from disassembly, matches 1-on-1 with .got in DTC sram.

*the address of the Startup function just before the jump is actually done. It matches to an entry in the .got section.

When I REDUCE the amount of code by commenting out stuff, everything behaves EXACTLY the same except for the hard fault and the broken value in LR.
Is there some (officially?!) documentation that confirms there is a hard limit to the .got section when cross compiling for ARM (Cortex m7)?
Is there anybody that can contribute in any way by giving possible hints what the hell is causing this ?
For reference, the startup code that bonks out when "some weird threshold" is reached in .got size (my assumption, could be wrong of course).
extern void Startup(unsigned int flash_start, unsigned int flash_end, unsigned int lma_offset);

extern unsigned int __flash_start__;
extern unsigned int __flash_end__;

extern unsigned int __global_offset_table_flash_start__;
extern unsigned int __global_offset_table_sram_start__;
extern unsigned int __global_offset_table_sram_end__;

//*****************************************************************************
// Reset entry point for your code.
// Sets up a simple runtime environment and initializes the C/C++
// library.
//*****************************************************************************
__attribute__ ((naked))
void ResetISR(void)
{
    __asm ("MOV R11, #1");

    // Disable interrupts
    __asm volatile ("cpsid i");

    unsigned int lma_offset;
    unsigned int *global_offset_table_flash_start;

    // Before doing anything else related to variables in sram, setup r9 for position independent code first.
    // And correct the firmware offset which is stored in r10 (add it to r9)
    // Finally grab the updated global offset table address from r9
    __asm volatile ("LDR r9, = __global_offset_table_flash_start__");
    __asm volatile ("ADD r9, r9, r10");

    __asm ("MOV %[result], R9"
        : [result] "=r" (global_offset_table_flash_start) );

    // Grab the lma offset defined in bootloader from r10
    __asm ("MOV %[result], R10"
        : [result] "=r" (lma_offset) );

    unsigned int flash_start = reinterpret_cast<unsigned int>(&__flash_start__);
    unsigned int flash_end = reinterpret_cast<unsigned int>(&__flash_end__);

    unsigned int *flash;
    unsigned int *sram;
    unsigned int *sram_end;

    __asm ("MOV R11, #2");

    //
    // Copy global offset table to sram
    //
    flash = const_cast<unsigned int*>(global_offset_table_flash_start);
    sram = const_cast<unsigned int*>(&__global_offset_table_sram_start__);
    sram_end = const_cast<unsigned int*>(&__global_offset_table_sram_end__);

    for (int i = 0u; i < (sram_end - sram); ++i)
    {
        sram[i] = flash[i];
        if (sram[i] >= flash_start && sram[i] <= flash_end)
        {
            sram[i] += lma_offset;
        }
    }

    // Update R9, as of now, all functions should be resolvable through the got
    __asm volatile ("LDR r9, = __global_offset_table_sram_start__");

    __asm ("MOV R11, #3");

    unsigned int address = reinterpret_cast<unsigned int>(&Startup);

    __asm__ volatile ("MOV R12, %[input]"
        : : [input] "r" (address)
          );

    // Jump to regular startup code
    Startup(flash_start, flash_end, lma_offset);
}

PS: I know -fPIC is BROADLY used in linux. No such limitation would exist there. Maybe this is something ARM specific, or even CPU (cortex m7) specific). Still maybe some Linux -fPIC guru might have ideas that can help me on my way...
PPS: If I need to share anything else, say the word...

A: I will leave it open just as a reference for people struggling with the same thing. There is no dependency. There is no problem, except for the ones introduced by yours truly: myself.
The main problem for me was not being able to debug my app when it is relocated. This can be resolved by issueing the GDB command add-symbol-file <path-to-elf-file> <address-to-text-section>
As example:

*

*my app is compiled and linked to 0x60020000

*my app is uploaded in flash to 0x60030000 (so with an offset of 0x10000)

*when reading the elf file with arm-none-eabi-readelf -WS myapp.axf I can read that the text section has an offset of 0x2120 in my case.

When I start my bootloader in de debugger, before I jump to the relocated app, I issue the commmand:
add-symbol-file myapp.axf 0x60032120
This loads the symbols, and gbd will add the offset of 0x2120 to all symbols in the .text section. That way I am able to debug through.
Once I had my debugger running, I could see several programming errors on my end. The most critical one was reading linker symbols after setting up r9 with the base of the .got section in sram. I still added the LMA offset to those linker symbols, while that happens 'automagically' behind the scenes. So I was reading garbage memory in some cases, and stored that in the parts that were to be initialized by libc_init_array.
After fixing those, I ran into another strange issue. One nxp driver declared a static const array of all pointers to GPIOs. When I compiled the source file, and pulled it througgh arm-none-eabi-objdump I could see the array in .text, perfectly setup with the addresses to GPIO1..GPIO5. But, after linking, and dumping the contents again through objdump, I noticed that that very same array was altered. The reference to the GPIO5 peripheral somehow was set to 0x0.
Now, I have no idea why that happened, but I thought if I would remove the const part, then the array will be mapped to sram, and maybe I get rid of this issue. I was in luck for once, it solved the issue. Not really a perfect fix, because now I now I have to be very weary of code that declares static const stuff. I'll investigate it later, but for now, I am mostly thrilled that this story came to an end. I have my c++ app compiled with -fPIC and I am able to run it on any location (4 byte aligned) in flash, and on top of that, I am able to debug through it as well.
So for the next guy who's going insane on this "position independent code" journey: don't give up, there is an end to the suffering ;-)


text:
Q: Unity Quaternion.LookRotation meaning I've gone through Unity's documentation for Quaternion.LookRotation, but I didn't get the full understanding of how it works.
using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour
{
    public Transform target;

    void Update()
    {
        Vector3 relativePos = target.position - transform.position;

        // the second argument, upwards, defaults to Vector3.up
        Quaternion rotation = Quaternion.LookRotation(relativePos, Vector3.up);
        transform.rotation = rotation;
    }
}

A: A way to visualize a rotation is with three perpendicular axis-ex. A quaternion is a more compact representation, but you can still view it as having three axis-es.
LookRotation will align one of the rotation axes to the given direction, but with only one direction there is one degree of freedom left, the other two rotation axes.
That is what the 'up' vector is for, it locks in one of the other axes and forces it to be perpendicular to both the direction and up-vector. The third rotation axis is always perpendicular to both, so we have three perpendicular axes, i.e. a complete rotation.
You can do something similar yourself with a cross product, since that produces a perpendicular vector to two others. Pseudocode:
var xDir = direction;
var zDir= xDir.CrossProduct(upVector)
var yDir = zDir.CrossProduct(xDir)
var matrix = CreateARotationMatrixFromAxises(xDir, yDir, zDir)
var quaternion = CreateQuaternionFromRotationMatrix(matrix)

Note that the direction and up-vector cannot be parallel, or you will get some kind of error.

A: There is absolutely no reason for beginners and hobbyist programmers to touch Quaternions.  Unity should remove it from the documentation.
What you want is simply the LookAt command. Fortunately, it's incredibly easy to use.
Say you have a tree that you want your character to look at, it's this simple:
transform.LookAt(tree);


text:
Q: web service in android I installed a web service in my application.A package called web.service got created.This package has RandomWordGenerator class.But when i create an instance of this class in another package of my application i get no class def found error.I set the internet access permission in android.
> 5-26 13:35:25.053:
> INFO/ActivityManager(67): Starting
> activity: Intent { cmp=tam.miru/.Login
> } 05-26 13:35:25.584:
> WARN/dalvikvm(821): Unable to resolve
> superclass of
> web/service/RandomWordGeneratorService;
> (71) 05-26 13:35:25.584:
> WARN/dalvikvm(821): Link of class
> 'Lweb/service/RandomWordGeneratorService;'
> failed 05-26 13:35:25.614:
> ERROR/dalvikvm(821): Could not find
> class
> 'web.service.RandomWordGeneratorService',
> referenced from method
> tam.miru.Login$1.onClick 05-26
> 13:35:25.614: WARN/dalvikvm(821): VFY:
> unable to resolve new-instance 98
> (Lweb/service/RandomWordGeneratorService;)
> in Ltam/miru/Login$1; 05-26
> 13:35:25.614: DEBUG/dalvikvm(821):
> VFY: replacing opcode 0x22 at 0x005b
> 05-26 13:35:29.344:
> ERROR/AndroidRuntime(821): FATAL
> EXCEPTION: main 05-26 13:35:29.344:
> ERROR/AndroidRuntime(821):
> java.lang.NoClassDefFoundError:
> web.service.RandomWordGeneratorService


text:
Q: How to implement dynamic product price calculation on weight basis in magento 1.9? I'm developing an eCommerce website in Magento for Silver business. the price of the product is should be in weight basis.
For example today I've added a 1000 rupees silver necklace of 10 grams to my website with the silver rate 40 rupees per gram, by next day silver rate maybe fluctuates and the price of the product needs to be change.
The final product price in the product/list page and cart page = ( today's silver rate x number of grams (1, 2, 3...etc) + making charges ).
Here Silver rate will be fluctuates depending on market rate. I'm new to magento, please guide me with valuable codes.

A: You can manage weight wise product price in two ways in magento:

*

*By creating configurable product with weight variance. For more information click  here

*By adding custom option in a simple product. For more information click here