Who made the Dyson's sphere in Star Trek TNG?

Question: According to this wikia, the Dyson's sphere discovered by the Enterprise in the episode, "Relics" was large enough to support the life of 4 million earth sized planets, if you do some rough math, that's billions upon billions of people (potentially 24 quadrillion people), and 3,999,750 more planets than all the member planets of the federation, yet, they find it uninhabited, abandoned, and somehow have no clue who built it, or where they went. You could have literally fit the entire population of the federation of planets inside this sphere (if the star inside the sphere had not been unstable and emitting deadly amounts of radiation), and they would only have occupied about 0.0000375% of its surface area. How is it possible that no one in the known galaxy knows about this megastructures history, or its former inhabitants?
Comment: I like the way the sphere is always externally illuminated by a point source when on screen...
Comment: Yes, the whole episode smacked of a set-up for a larger story arc. But then Scotty showed up and the Dyson sphere was completely forgotten.
Comment: Because space is big, and a Dyson sphere blocks all relevant signals that would be used to map a star system?
Comment: @cde - It doesn't block gravity. This sphere would have altered the course of any asteroids passing by it. Astronomers would have noticed that. They also would have noticed the mysterious dark spot that blocked the light of the known starts behind it.
Comment: @cde - Thermodynamics indicates all energy-harvesters must give off some waste heat, and a Dyson sphere, just by virtue of having a temperature different from the microwave background radiation, would emit a significant amount of thermal radiation with a spectrum probably close to that of the [blackbody radiation](https://en.wikipedia.org/wiki/Black-body_radiation) for a perfectly light-absorbing body of the same size & temperature. SETI has tried to look for Dyson spheres using this fact, see [this article](http://www.space.com/24269-how-to-search-for-alien-civilizations.html) for example.
Comment: And *A black body looks similar to galactic dust in the infrared* so the sphere could have between dismissed
Comment: As is every ship in deep space.
Comment: also this technically isnt a dyson sphere its a dyson shell, a sphere would be rings of satellites.
Comment: Shem, assuming they are tracking that asteroid, or looking in that direction, or that the sphere even with its size is significantly close enough to block light of any sun behind it.
Comment: This article supports my position {Dyson Sphere} = {Dyson Shell}{Dyson Swarm}{et al}.  Essentially the Dyson Sphere is the set of all solutions that captures all sunlight from a star.  This solution, a Dyson Shell, is a type of Dyson Sphere.
Comment: In STO its stated that this sphere as well as 1 other were made by the solanae.http://en.memory-alpha.org/wiki/Dyson_sphere
Comment: @ShemSeger True, but maybe they had tractor devices pushing those asteroids back, so as to remain hidden - then again, since standard federation hailing frequencies opened the sphere up, they would most likely have been a welcoming bunch with no need for that kind of subterfuge.
Comment: @Himarm, so they abandoned their sphere and traveled to a new dimension? Then years later found it necessary to study the dimension they left?
Comment: Well there's STO (Star Trek Online) which takes most everything built by unspecified "extinct" races and says the Iconians did it
Comment: @IG_42 STO does a pretty good job of tying aspects of all the shows as well as continuing a decent plot line. And the iconians are one of the few races in TNG who are massivly advanced in tech (basically making stargates) so a dyson sphere is not unrealistic for them to have made anyways.
Comment: @Himarm promote your comment to an answer and I'll upvote you.  Small quibble though.  The ST episode I think does show a Dyson Sphere with the Dyson Shell being just one type of implementation of that concept (with the sphere of satellites being a different implementation).  Remember the concept is to capture all energy from the star.  Just because Dyson's originally envisioned method was a cluster of satellites doesn't limit people to just that design fulfilling the concept requirements.
Comment: @Jim2B reading the wikipedia page lead me to this conclusion http://en.wikipedia.org/wiki/Dyson_sphere
Comment: Its science fiction with a basis on some theory by Richard Dyson... but back to point its science fiction... its not real..... the idea is designed to entertain.
Comment: Considering that we already have systems for waste energy reclamation and energy conversion is improving in efficiency, a civilization like the Federation or even a civilization that built that Dyson Sphere would not really be emitting any waste energy to begin with. It simply wouldn't happen. It would be reclaimed and utilized by other systems.
Answer: Why is the Dyson Sphere uninhabited and abandoned?
This is answered in the episode itself. The star is unstable:

DATA: The sphere appears to be abandoned. Sensors show that the star is extremely unstable. It is experiencing severe bursts of radiation and matter expulsions.
PICARD: Then that would explain why they abandoned it. But if there's no one still living there, how were we brought inside?
DATA: I believe we triggered a series of automatic piloting beams designed to guide ships into the sphere.
WORF: Sir, Sensors show a large magnetic disturbance on the star's surface.
DATA: It is a solar flare, Captain. Magnitude twelve, class B.

How does no one in the known galaxy know about it?
First, it's hard to find. Since it completely obscures the star it surrounds, it's pretty hard to distinguish it from open space. It also seems to not be emitting much in the way of communications signals. Data finally reports "something on the sphere which could be a communications device" but not until after they've been in orbit for some time. It is only "emitting low intensity subspace signals." It's likely that from a distance, there's nothing to detect at all.
It also seems to be a bit out of the way. The Jenolan crashed on it and was broadcasting a distress call for seventy-five years before the Enterprise passed by.
As for why there aren't any former inhabitants telling people about it, the episode makes no indication how long the sphere has been abandoned. It could easily be a long long long time. The Iconians, for instance, were highly developed when their homeworld was destroyed 200,000 years ago. And some of their technology (i.e. the Gateway) is still functional. It's not a stretch to think that a civilization that could build a Dyson Sphere could make it last hundreds of thousands or even millions of years uninhabited. (And even a million years isn't much in the lifetime of a star.)
So I feel like there are two possibilities:

The Dyson Sphere was not evacuated. The unstable star irradiated the inside of the sphere, killing quadrillions of sentient humanoids in a gruesome mega-genocide.
The sphere was evacuated, but so long ago that the memories of it only live as myths and legends (at best) in the diaspora.

Neither has ever been addressed, in either canon or in any licensed material.
Comment: The first possibility seems dubious. A species advanced enough to build the sphere would have decent star sensing technology. I mean we can detect changes in the sun at our limited tech level
Comment: @vap78 unless of course that energy is converted into some other type of energy or matter. As the memory alpha wiki says, it could be used to make the sphere (replicator like) or it could be converted into gravity (which is what caused the plot in the episode to happen, crashing the shuttle and making the enterprise jump around unexpectedly). As stated in the episode with 80/90's understanding of the dyson sphere idea, it was not detectable. And an advance technology like that might be made to be undetectable by design.
Comment: @cde: Even a very advanced species could've missed something that made the star "die" 100 Million years earlier than they expected. Maybe their entire civilization was focused on the sphere and all resources they every harvested where used to build the sphere (the amount of material is incredible after all). So there was nowhere to go with maybe hundreds of billions of people.
Comment: `First, it's hard to find. Since it completely obscures the star it surrounds, it's pretty hard to distinguish it from open space.` Thermodynamics does not look that way.  Anyone looking at the right region of space with the right equipment would see a pretty distinctive thermal signature recognizable as a Dyson Sphere to anyone with enough theory to develop the concept.
Comment: STO is licensed, by CBS so it has been addressed.
Comment: @MasonWheeler - Sure, anyone looking at exactly that point in *infinite* space. Which means that your odds at looking at that point are basically 1/∞ = 0%.
Comment: @Davor: No, what I meant is that a Dyson sphere shines too, in a distinctive way that makes it look like a Dyson sphere, specifically, and not like a star.  It's just like how you don't have to look at a *specific point in infinite space* to see stars; you just look up at night and... stars!
Comment: @Davor Even for the current tech level we don't look for start only on the visible part of the EM band. Pulsars for example were detected only by the highly focused beams of radiation that the emit from their poles. Only later and with very precise optical devices we detected visible light from some of them. A Dyson sphere shall emit exactly the same amount of energy as the star encircled by it, else it will slowly heat up until it melts and collapses. Considering the tech level of the Star Trek time, actually Dyson spheres would be easily detectable.
Answer: In what we consider true "canon" of star trek (tv show/movies), this is not answered. In the lower tiers of cannon it was answered in the star trek online mmo. In sto this and another dyson sphere were created by a race called the solangae, we also have instances in game of dyson spheres being created by the iconians. http://en.memory-alpha.org/wiki/Dyson_sphere
Answer: TL;DR : We never get an official answer, but one of the TNG follow-up novels takes a few guesses and attempts to expand on the Dyson Sphere artifact.

The only Star Trek novel to expand on the story of the Dyson Sphere is "Dyson Sphere" by Charles Pellegrino & George Zebrowski. It's TNG novel #50 and has the following summary:

Two hundred million kilometers across, with a surface area that
  exceeds that of a quarter-billion worlds, the Dyson sphere is one of
  the most astounding discoveries the Federation has ever made. Now the
  U.S.S. Enterprise has returned to explore the awesome mysteries of the
  sphere. Intrigued by what is possibly the greatest archaeological
  treasure of all time, Captain Jean-Luc Picard hopes to discover the
  origin of humanoid life throughout the galaxy -- or perhaps the
  ultimate secret of the Borg.
But when a neutron star approaches on a collision course with the
  sphere, a mission of discovery becomes a desperate race against time.
  The many sentient species inhabiting the sphere face extinction -- can
  even the Starship Enterprise save them all?

In the novel, Picard leads an expedition back to the Dyson Sphere for more in-depth study. What they find is that the sphere is far more sophisticated than they believed, and is hardly lifeless. Rather, the sphere is functionally a gigantic zoo-ship that houses countless species, some of whom are just becoming warp-capable. The Macguffin of the story is a neutron star which seems to have been fired at the sphere to purposely destroy it.
Throughout the novel, Picard and his team make guesses as to who built the sphere and why they abandoned it. The author's pet theory - the one he keeps coming back to - is that the race that built the Sphere eventually

 evolved into The Borg. Furthermore, it would seem to be the modern Borg who fired the neutron star at it, perhaps wishing to erase the work of their "imperfect" ancestors. This theory is supported at the end, when a Borg cube is spotted watching events unfold, then warps away without attacking.

The novel also notes that the area around the Dyson Sphere has unusual subspace properties, properties that can only be found in one other area of space - the planet Sarpeidon, focus of the TOS episode "All Our Yesterdays". However, nothing further is made of that connection after its initial mention.
In the end, Picard and crew were able to

 save a few species' arkships, but the Dyson Sphere itself narrowly avoided the neutron star and then shrunk away into subspace. The epilogue reveals that the Sphere and its inhabitants are still fine, but now smaller than an atom - apparently a self-defense mechanism of the Sphere's artificial intelligence system.

Note: It's also revealed that the star located at the center of the Dyson Sphere is not unstable as believed during the TNG episode, but rather is

 being siphoned to provide enough energy for the Sphere to move. Therefore, the theory that it was abandoned because of an unstable star is proven false.
Comment: For a summary of the weirdness that is Star Trek canon, see this question: http://scifi.stackexchange.com/q/31035/20557
Comment: Far more interesting than the STO stories. Thank you for this answer.
Comment: How authoritative are the novels?
Comment: A licensed material such as a novel is considered loosely canonical, but only to the point that an official licensed material - such as a Technical Manual or the Official Encyclopedia - doesn't override it. Obviously, anything on screen is the highest level. However, this novel and Star Trek Online provide conflicting information, and I'm not sure which would be considered higher canon.
Comment: Does the novelization of "Relics" provide any additional information? I remember that it had an away team (led by Riker?) beaming down to a city on the inside of the dyson sphere, but don't remember whether or not they learned anything useful there.
Answer: From a canonical point of view of TV shows and movies, the question as to who build the Sphere was not answered.
I do recall the Sphere being mentioned/used in Star Trek Online game detailing its history etc., but personally I hadn't played that part myself as of yet so I wouldn't know of the said details.
That said, Star Trek Online is NOT considered canon.
In regards to the novel that deals with the Sphere... well, again, the pocket books (including the technical manuals) are NOT considered canon.
But, the authors 'pet theory' which infers that the Borg's imperfect ancestors created it and then evolved into the Borg makes little sense.
For one thing, the Sphere's outer hull was made from Neutronium. Not even the Borg were able to create that material (which was said on screen by 7 of 9 - in Season 5 of Voyager, episode 'Think Thank).
You would think that if the Dyson Sphere was made from Neutronium by the ancestors who 'evolved' into Borg, it would be the choice of material used in construction of Borg ships and uni-complexes by default - which would make them impervious to all conventional weapons (unless of course the Federation improved phaser technology to the point it can incur damage to Neutronium, which you'd expect in the 100 odd years since they encountered the Planet Killer in TOS which used the same material and gave Starfleet plenty of time to analyze it in detail), however, the Borg on the shows (specifically in Voyager) were mentioned to be using Tritanium in their hulls (both regular and Tactical cubes) and relied heavily on nanoprobes and collective 'willpower/intelligence/energy' to repair and adapt their ships.
Janeway said that Starfleet theorized about making materials such as Neutronium but was not close in producing them... 7 of 9 answer to that was 'neither have the Borg'.
If Neutronium was difficult to produce due to resource shortages, that's one thing... not having an ability to produce it though is another matter.
Also, I doubt it would be impossible for the Borg to find needed resources in the Milky Way to produce enough Neutronium, especially with TW drives and highly advanced sensors.
No, from a canonical point of view, it does NOT appear that the Borg created it.
For all we know, the Sphere could have been created by the Iconians or another space-faring race.
In actuality, the Federation could have easily made its own Dyson Swarms around each Federation member world... although an actual sphere would not have been that much more difficult (and I disagree with Geordi's assessment that it wouldn't have been impossible - because the Federation technology is so far advanced that its not even funny), especially if each section of the sphere (made up of massive solar collectors) had fully integrated sensors, thrusters/impulse drives, transporters/replicators, etc. for self-replication).
In the real world, we could have already started and finished construction of our own Dyson Swarm by the year 2000 (if we started construction in 1990) using fully automated construction bots and Mercury for raw materials. Because construction would be automated, it would proceed on an exponential pace (something which scifi shows and many writers apparently have a difficulty showing/comprehending).
Anyway, point remains that we can only speculate on which species might have created the Dyson Sphere we saw in TNG.
There is no conclusive evidence on the subject matter.
The only thing that comes close (at least hypothetically) is the Planet Killer (which was made out of solid Neutronium much like the Sphere was). And it was mentioned that it likely originated outside of the Milky Way (possibly Andromeda).
It is possible that a species decided to come to the Milky way or has evolved in Milky Way, build the Dyson sphere, then left/evacuated to another galaxy and eventually built the Planet Killers too (who then found its way into Milky Way and started devouring planets during TOS).
Again, too little information.
Any number of species could have developed Neutronium as a material and built the sphere given enough time, or if they just used AI to radically accelerate R&D (something which the Federation could/should do).
TOS explained that the Kelvans migrated from the Andromeda Galaxy because it was experiencing a sudden increase in radiation which would have made their species extinct in 10 000 years.
They were also described to have been highly technologically advanced in comparison to the Federation of the 23rd century (probably/roughly on par with 24th century Federation given that the Enterprise-D was also stated in 'Where no one has gone before' by Data it would have taken just over 300 years to cross 2.7 million lightyears and get back to the Milky Way - putting at least their engine/Warp capabilities on par - which was of course completely discarded/forgotten by second season of TNG and later on by Voyager - or at least available/sustainable speeds were much lower than what was initially told).


can i Dubai stopover package (from US/Canada) even your ticket from air canada and from dubai you are taking emirates air

Question: can i Dubai stopover package (from US/Canada) even your ticket from air canada and from dubai you are taking emirates air
Comment: Your question is not clear. Are you asking about stopping over (layover or transit) in Dubai?
Comment: Related: [How do you book an Emirates Dubai stopover package (from US/Canada)?](https://travel.stackexchange.com/q/71804/3221)
Answer: Emirates has a service named Dubai Connect which will provide a free hotel and transfers for passengers who have a connection time between 8 and 24 hours (6 to 24 hours for first and business). But it is not available if one segment of the flight is Air Canada. Both segments must be on Emirates or Qantas.
From the terms and conditions:

Both your inbound and outbound flights to and from Dubai must be an Emirates flight (marketed by Qantas or Emirates) or a Qantas flight (marketed by Emirates or Qantas). Codeshare flights are not eligible other than EK5000 and QF8000 flights. The offer is not available on flights with other airlines and/or where Emirates is the marketing carrier only.
The itinerary must be a single booking and ticketed on one ticket. The ticket must be issued on an Emirates (176) document or a Qantas (081) document.

You can still obtain a UAE visa through Emirates and book a hotel yourself, or you can purchase a stopover package from Emirates, or you can stay in an airside hotel without a visa.


Extracting values from a list

Question: I had already solved this problem, but in an unnecessarily convoluted way that seems too specific. Can this be done better?
From a list:
(8 "layer-name" 10 x1 20 y1   10 x2 20 y2  10 x3 20 y3)
8, 10 and 20 are the "key-words" for layer-name, x-coord and y-coord respectively. The actual values follow the "key-words".
Return values should be --> '(("layer-name" x1 y1 x2 y2) ("layer-name" x2 y2 x3 y3))
<code>#lang racket

(require srfi/1)

(define test-list '("multiple-lines" 8 "layer-name" 10 30 20 30   10 40 20 40   10 50 20 50))

(define (get-values lst lst2)
  (cond ((eq? lst2 '())
         '())
        (else
         (cons (cadr (member (car lst2) lst))
               (get-values lst (cdr lst2))))))

(define (get-multiple-values lst key key2) ; key is single values. key2 is repeatable values
  (define (splitter lst keyword) ; (splitter '(10 x1 20 y1 10 x2 20 y2 10 x3 20 y3) 10 20)  --->  '((x1 y1 x2 y2 x3 y3) (x2 y2 x3 y3) (x3 y3))
    (cond ((not (member keyword lst)) '())
          (else (cons (member keyword lst) (splitter (cddr (member keyword lst)) keyword)))))
  (define (joiner lst lst-of-lsts) ; (joiner '(1 2) '((a b) (c d)))  --->  '((1 2 a b) (1 2 c d))
    (cond ((empty? lst-of-lsts) '())
          (else (cons (append lst (car lst-of-lsts))
                      (joiner lst (rest lst-of-lsts))))))
  (define (trimmer size lst-of-lsts) ; (trimmer  '((x1 y1 x2 y2 x3 y3) (x2 y2 x3 y3) (x3 y3)))
    (cond ((empty? lst-of-lsts) '())
          ((> size (length (car lst-of-lsts)))
           (trimmer size (rest lst-of-lsts)))
          (else (cons (take (car lst-of-lsts) size)
                (trimmer size (rest lst-of-lsts))))))
  (joiner (get-values lst key)
          (trimmer 4 (map
                      (lambda (lst) (remq* key2 lst))
                      (splitter lst (first key2))))))

> '(("layer-name" 30 30 40 40) ("layer-name" 40 40 50 50))
</code>
Answer: I have a strong suspicion that this is an XY Problem, or at the very least, that you're using the wrong abstraction and/or data structure for representing data, using numbers as keywords somehow doesn't seem right. Anyway, I think the requested functionality can be implemented in an alternate, simpler way:
<code>; obtain all values for a given keyword
(define (key-values lst kwd)
  (cond ((null? lst) '())
        ((equal? (first lst) kwd)
         (cons (second lst) (key-values (cddr lst) kwd)))
        (else (key-values (cddr lst) kwd))))

; interleave elements from two lists
(define (interleave lst1 lst2)
  (cond ((null? lst1) lst2)
        ((null? lst2) lst1)
        (else (cons (first lst1) (interleave lst2 (rest lst1))))))

; create all layers according to the defined structure
(define (joiner name lst1 lst2)
  (let loop ((lst (interleave lst1 lst2)))
    (if (null? (cddr lst))
        '()
        (cons (list name (first lst) (second lst) (third lst) (fourth lst))
              (loop (cddr lst))))))

; main function, receives a list of values and a list of keywords
(define (get-values lst kwds)
  (let ((name (first (key-values lst (first kwds))))
        (xs   (key-values lst (second kwds)))
        (ys   (key-values lst (third kwds))))
    (joiner name xs ys)))
</code>
For example:
<code>(define test-list '(8 "layer-name" 10 30 20 30 10 40 20 40 10 50 20 50))
(define keywords '(8 10 20))
(get-values test-list keywords)
=> '(("layer-name" 30 30 40 40) ("layer-name" 40 40 50 50))
</code>
Comment: Is it really a XY problem? TO give more context, i am reading DXF files. The output stream from the DXF file is a list of strings, and the format is a keyword-number anywhere from 0 to 329, which specifies the type of the following value. Perhaps i should create a general function that reads the entire list of strings and converts the values into their proper type from a string depending on the keyword?
Comment: @krc that might be a good idea, I'm not familiar with that file format, but I'd suggest that first you look for an existing library to do the job, or perhaps a generic parser for reading streams with a given format. Anyway, the question in the comment doesn't resemble the original question, so it's up to you if you deem my answer useful. You should have explained the _real_ situation from the beginning, this was indeed and XY problem.
Comment: @ÓscarLópez Some Context: DXF is the file format used by AutoCad. It is a text file representation of a more compact binary format, DWG. People have been using Lisps to manipulate it since 1986 when AutoLisp was introduced. The rough analogy I like is that AutoCad is Emacs for vectors and by extension carries similar historical baggage. Anyway, the question is a bit of an iceberg and there's a meaningful mass under the surface.

Extracting values from a list


My Nokia Lumia 610 - bad performance

Question: My Nokia Lumia 610 performs very slow and poor. Even opening my applications takes very long before they start to run. What should I do?
Answer: You could try a factory reset (Using the Nokia Software Recovery tool). This will delete your files + apps though! You can back them up and restore them, but then you might have the same problem (slow phone)..
The 610 is really beginning to be an older model. You could consider upgrading to the 635 or 535; they're not very expensive and much faster.

My Nokia Lumia 610 - bad performance


combining sql server spatial and NHibernate with CreateSqlQuery

Question: I have not mapped geography table in sql server 2008, and I want to query it with a polygon instance in c# using nhibernate.
In the beggining I was trying to use sql server spatial directly but encountered this problem:
Using SQL Server 2008 Geography types with nHibernate's CreateSQLQuery
My second try was this:
session.CreateSQLQuery("select [shape] from [table] where (:codeShape).STIntersects([shape]) = 1").SetParameter("codeShape", codeShape, NHibernateUtil.Custom(typeof(MsSql2008GeographyType)));

however this try also raise an exception:

Could not execute query [select [shape] from [table] where (?).STIntersects([shape]) = 1")] Name:codeShape - Value:POLYGON((30 40, ...))

and the inner exception is:
The specified input does not represent a valid geography instance.

That's despite codeShape.IsValid returns true.
When I run this query directly in sql server I get the expected result.
any ideas or solutions?
Thanks.
Answer: problem resolved. I had to reverse the points of the polygon.


Using Cauchy's integral theorem without polynomial in denominator

Question: I'm trying to find $$\oint_C \frac{z^2+1}{e^{\frac {z}{10}}-1}dz$$
where $C$ is the unit circle traversed counterclockwise. I think I should use Cauchy's integral theorem but I don't understand how because the theorem specifically has a polynomial in the denominator. The integrand has a singular point at $z=0$ so I can use the Residue theorem but I don't understand how to compute the residue in this case either.
Comment: (1) What singularity has the integrand? Anwser: a pole of order... (2) The residue in a pole of order... can be calculated with the formula...
Answer: I'm not sure how Cauchy's theorem would be applied here, but in the case of computing the residue, note that $$\lim_{z \to0}(z-0)\frac{z^2+1}{e^{\frac {z}{10}}-1}=\lim_{z \to0}\frac{z^3+z}{e^{\frac {z}{10}}-1}=10\lim_{z \to0}\frac{3z^2+1}{e^{\frac {z}{10}}}=10\neq0$$
Where l'Hopital's rule was used in the second equality, so $z=0$ is a simple pole of the integrand. Therefore
$$\text{Res}_{z=0} \frac{z^2+1}{e^{\frac {z}{10}}-1}=\lim_{z \to0}\frac{z^3+z}{e^{\frac {z}{10}}-1}=10$$
as calculated above and so using Residue theorem$$\oint_C \frac{z^2+1}{e^{\frac {z}{10}}-1}=2\pi i \text{Res}_{z=0} \frac{z^2+1}{e^{\frac {z}{10}}-1}=20\pi i$$
Answer: We can write
$$\begin{align}
\oint_{|z|=1}\frac{z^2+1}{e^{z/10}-1}\,dz&=2\pi i \text{Res}\left(\frac{z^2+1}{e^{z/10}-1},z=0\right)\\\\
&=2\pi i \lim_{z\to 0}\frac{z(z^2+1)}{e^{z/10}-1}\\\\
&=2\pi i \lim_{z\to 0}\frac{(z^2+1)+2z^2}{(1/10)e^{z/10}}\\\\
&=20\pi i
\end{align}$$
Answer: It has a simple pole at the origin because $(\mathrm e^{z/10}-1)' = \frac{1}{10}\mathrm e^{z/10} \neq 0$ when $z=0$.
You need to find
$$\lim_{z \to 0} z \times \frac{z^2+1}{\mathrm e^{z/10}-1} = \lim_{z \to 0}\frac{z^3+z}{\mathrm e^{z/10}-1}$$
To do this, use L'Hopital's rule:
$$\lim_{z \to 0}\frac{z^3+z}{\mathrm e^{z/10}-1} = \lim_{z \to 0}\frac{3z^2+1}{\frac{1}{10}\mathrm e^{z/10}}=10$$


How does integration find average?

Question: I am slightly new to calculus. I haven't been able to get the concept that how plotting the area under the line gives us average value, not the instantaneous value. Then, how do you find the instantaneous value? I have seen few answers but they are not very beginner friendly.
Comment: $\int_a^b f(x)\,dx$ is, loosely speaking, the algebraic sum of the areas between the curve, the $x$ axis and the lines $x=a$ and $x=b$. There is no average here. What's the instantaneous value?
Comment: Mh, how can we say it better than "the instantaneous value is... the value" ?
Comment: @YvesDaoust In my previous classes, I was taught that.
Comment: The average from $a$ to some $b>a$ is $\frac{1}{b-a}\int_a^bf(x)dx$; the instantaneous value is just $f$ at whichever value of $x$ you want it, no calculus needed.
Answer: In order to get that reasoning, it's key to understand integrals as infinite sums. I guess you see clear how a discrete sum of values, when divided by the total number of values turns out to be the (arithmetic) average of the set of numbers you summed. This is, if you have, say, a succession of $n$ numbers $\{a_n\}$, now:
$$\frac{1}{n}\sum_{i=1}^{n}a_i=\frac{1}{n}(a_1+a_2+...+a_n)=\bar{a}$$
Where $\bar{a}$ stands for the average of the ensemble. Just to make it clear, let $\{a_n\}={2,3,4}$, so that $n=3$. We would have precisely $\bar{a}=\frac{1}{3}(2+3+4)=3$, just as we knew it would turn out.
Now, imagine that, instead of having a discrete set of numbers (say {2, 3, 4}), you have a continous distribution of these. In order to make it easy, let's say you have the continuous straight line that joins $(x,y)=(2,2)$ to $(x,y)=(4,4)$, which can be mathematically expressed as $y(x)=x$ from $x=2$ to $x=4$.
If you were to sum all of these numbers one by one, you'd never see the end of the task! Since there's an infinity of them. Here's when integrals kick in.
Performing an integral of a function over some interval means summing all of the values of that function, which is continuous, over that interval. This clearly would go towards infinity, since you're summing infinite values... But there's a way around this. See how, in our previous sum, we took 2, 3 and 4 and divided that by 3? Now think about it this way: We took a sample of the interval we wanted to sum (from 2 to 4), calculated the value in 3 points, and then divided by the total value of points we calculated the value of. We could have taken, say, 15 points: {2, 2.2, 2.4, 2.6, 2.8, ..., 3.8, 4}, and we would have divided by 15 instead of 3. This is, now each number contributes with a smaller fraction to the total value of the sum. If you were to follow this argument towards infinity, you would now have an infinite sum of values that contribute $\frac{1}{\infty}$ to the total value of the sum. Those two effects combined converge to a finite value, and this is taken into account when you multiply the integrand by the inginitesimal displacement of $x$, $dx$.
So, back to our integral, we would now have: $\int_2^4xdx$, which would stand for the sum of all of the infinite values between two and four, pondered by their infinitesimally small contribution to the total sum. Performing this calculation gives $\frac{x^2}{2}\bigg\vert_2^4=\frac{4^2}{2}-\frac{2^2}{2}=6$. Dividing this by the interval we took into consideration, which is $\Delta(x)=4-2=2$, we get 3, which is precisely the mean we got when we first did our sum.
We can now do a generalization and see how the average of some continuous set of numbers x in the interval from point a to b, is given by $\bar x=\frac{1}{b-a}\int_a^bxdx$.
In our example, performing the mean by summing or by integrating yielded the same value. This is because all of the numbers we summed over were distributed over a straight line. Were them distributed according to a different function f(x), the values could have been different. It's straightforward to see though, that $\bar f(x)=\frac{1}{b-a}\int_a^bf(x)dx$ will hold for an arbitrary $f(x)$, and if you were to evaluate this function in $N$ different $x$ values and take the average of those, this discretely calculated average would tend to the value of the integral as N tends to infinity.
Hope this makes it clear enough. Good luck!
Answer: Here's an intuitive way to look at it:

Suppose the function $f(t)$ represents something physical, like the height of a water level over time. If the graph of $f(t)$ is piecewise constant (made of horizontal lines) like this:

then you can compute its average value over any time period using algebra (no calculus needed). It's a weighted sum:
For each height level, you measure the height and multiply it by whatever percent of the time the function is at that height (in other words, the length of time the function is at that height, divided by the total time). Then you add all those weighted values together to get the average height overall.
For example, if the function is at height 6m for 3 out of 10 total seconds, and at height 21m for 7 out of 10 total seconds, then the average height is 6*0.3 + 21 * 0.7 = 16.5m.
Your answer has the right physical units: height. And it has the right behavior in extreme cases, like if the function is at height 6 for 99% of the time, the average value will be close to 6.

Another way of writing this weighted sum is like this: for each height, you multiply it by the length of time the function is at that height. You add up all of those values, then divide by the total length of time. This gives your average height just like the earlier formula.
To reuse the earlier example, we could also have computed the average as (6*3 + 21*7)/10.

This second formula is convenient because it corresponds to something in the picture. It says that to compute the average height of this function, just compute the area of each of the rectangles. Add up those areas, then divide by the total width of the time interval (!).

We've arrived at a formula: To compute the average height of a function over a certain interval of time, compute the area under that function during that interval, then divide by the length of that interval.

You can think of integration, in part, as a tool for calculating the area under curves that are not made of straight lines. If a curve has the formula $f(t)$, then its integral $\int_{a}^b f(t)\,dt$ tells you the area under that curve.
Intuitively, the formula for average height should still be the same: compute the area under the curve, then divide by the length of the interval.  Turns out, that's exactly right: if $f(t)$ is a function, then its average height over the interval between $t=a$ and $t=b$ is its area divided by the length of the interval, or in symbols:
$$f_{ave} = \frac{1}{b-a} \int_{a}^b f(t)\,dt$$

(Nitpick: technically the areas are *signed*, so areas under the curve count as negative, but I didn't want to clutter the discussion with that detail.)
Answer:
As $x$ varies over $[a,b],\;$ $f(x)$ continuously attains different
values.
The average $A_{[a,b]}$ of all these values $\{f(x):a\leq x\leq
   b\}$ is their sum divided by the amount/length $(b-a).$
But this (infinite) sum is just the signed area
between the curve $y=f(x),$ the $x$-axis, and the vertical lines
$x=a$ and $x=b,$ isn't it? This equals $\int_a^bf(x)\,\mathrm{d}x.$
Hence, $$A_{[a,b]}=\frac1{b-a}\int_a^bf(x)\,\mathrm{d}x.$$

The instantaneous value of $f(x)$ at $\alpha$ is just
$f(\alpha).$

So, if $f(t)$ represents instantaneous velocity at time $t$,
then the average velocity over $[t_1,t_2]$ is $$\frac1{t_2-t_1}\int_{t_1}^{t_2}f(t)\,\mathrm{d}t.$$

How does integration find average?


Slow power window issue

Question: On my 2021 Kia forte, the passenger side power window behaves strangely. The window rolls down just fine. However, when closing it, it begins rolling up in the normal rate, but half-way up gets slower until completely stops. I then wait some time and able to continue the roll-up some more - and repeat this sequence until it is completely closed. We just changed the window motor but it still acts the same way and it's really slow. What can be the problem?
Comment: Welcome to Motor Vehicle Maintenance & Repair!
Answer: The rest of the assembly is called the "Window Regulator" and it is the mechanism that allows the window to move up and down in the frame without binding.
First off I'd check for any obstructions in the track.  Next check the regulator parts for wear or damage.  Often these just wear out due to being cheaply made. Once the regulator is out of alignment, the window will bind, especially when going UP and you have exactly what you're describing.  Replace it.

Slow power window issue


Passport number not capitalized in Electronic Travel Authorization (eTA) application to travel Canada

Question: I recently got Electronic Travel Authorization (eTA) approved to travel to Canada by air. One thing I worry is that one alphabet letter in my passport number in the eTA approval email is not capitalized Should I reapply for the eTA in this case?
Answer: No, you don't have to re-apply.
The case of the letters in passport number does not matter.
This follows from the ICAO 9303-3 standard which has this about the characters used in the Machine Readable Zone:

Printed characters are restricted to those defined in Figure 4.

Figure 4 does not have separate upper and lower case letters:

And 9303 part 4 which talks about travel documents mandates the passport number to be in the machine readable zone:

So if there would be two passports with the same characters except one of them in lowercase and the other in uppercase this would not be discernible for any machine readers which is clearly unacceptable. Perhaps you've seen when the border official scans your passport it's only the lower edge which gets swiped? That's the MRZ. Here's an example:
Comment: @phoog interestingly enough the standard does not explicitly say this for the passport number -- but everything in the MRZ is case insensitive so the passport number is so as well. Added.
Comment: I am quite sure that this is correct, but it would be a far better answer if you could find a source.
Comment: @chx the calculation for the check digit also ignore case; letters A through Z have the values 10 through 35, respectively.
Comment: That's another good point!


Regular expression to create xpath with Robot Framework

Question: I'm automating an application with the Robot Framework (Python 2.7). I use the xpath to locate the objects. I have seen that the xpath of the objects is different when I change the language application. For example:
ES
// * [@ id = "dnn_ctr489_ViewINT_Cupones_ibtnAdd"]
FR
// * [@ id = "dnn_ctr644_ViewINT_Cupones_ibtnAdd"]
EN
// * [@ id = "dnn_ctr583_ViewINT_Cupones_ibtnAdd"]
This forces me to redo the Test Case because the xpath is different.
Is it possible to use a regular expression to form the xpath? How can I avoid having to redo the test cases for each different language?
Thank you.
Marta
Answer: XPath 1
xpath 1.x doesn't support wildcards or regular expressions. However, xpath supports several string functions which can be combined to match what you want. For example, there's a starts-with function. There's no ends-with, but there is a contains, so you could use something like this:
//*[starts-with(@id, 'dnn_ctr') and contains(@id, 'ibtnAdd')]

Of course, that will match somethign like "dnn_ctr blah ibtnAdd blah". If you need precisely "starts with cnn_ctr" and "ends with ibtnAdd" you can do that with a little more work:
//*[starts-with(@id, 'dnn_ctr') and substring(@id, string-length(@id) - string-length('ibtnAdd') + 1) = 'ibtnAdd' ]

XPath 2
With xpath version 2 (which not all browsers support at the time I write this) you can use ends-with, making for a much more readable expression:
//*[starts-with(@id, 'dnn_ctr') and ends-with(@id, 'ibtnAdd')]

You can also match against a regular expression with matches:
//*[matches(@id, 'dnn_ctr.*ibtnAdd')]

Comment: Bryan Oakley, Thanks a lot. It has worked for me with the first option:

"//*[starts-with(@id, 'dnn_ctr') and contains(@id, 'ibtnAdd')]"
Answer: You can use a variable file as input and put all your xpath values in it. I am using JSON in my example.Robot framework JSONlibrary can be used to parse JSON file (https://github.com/nottyo/robotframework-jsonlibrary)
input.json
{
    "Languages": {
         "ES": {
            "xpath1": "// * [@ id = "dnn_ctr489_ViewINT_Cupones_ibtnAdd"]",
             },
         "FR": {
            "xpath1": "// * [@ id = "dnn_ctr644_ViewINT_Cupones_ibtnAdd"]",
             },
         "EN": {
            "xpath1": "// * [@ id = "dnn_ctr583_ViewINT_Cupones_ibtnAdd"]",
             }

you can pass values to test cases based on your language selection in application by using a variable something like following
test.py
language_selected = 'EN'

Comment: Thanks for your answer. I have installed the JSON library but I do not know how to put your example into practice. Can you help me? How do I use the .json file?
Comment: What would be the motivation to create an object store in JSON when Robot Framework natively supports variable files in [Python](http://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#variable-files) or [YAML](http://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#variable-file-as-yaml) format
Comment: @A.Kootstra That is a good point, It was just to show an example but Python dictionary can also be used instead of JSON format for input.


Is using 人口 when referencing animal populations alright?

Question: I am writing about that Isle of Dogs movie and I wanted to write 日本の犬の人口. Since it has the character for person in it, I was wondering if it is appropriate for animals. Any help would be appreciated!
Comment: a) By "population" do you mean "the *number* of inhabitants" or "a group of inhabitants"? b) Do you want to refer to the population of dogs in the movie, who seems to be able to speak human language, or a population of dogs in the real world?
Answer: I think 個体数{こたいすう} is the term that you are looking for. It's also used for counting plant populations. Another term that you could use is 飼育数{しいくすう} as dogs are pets, but this cannot be used for wild animals and strays.
Comment: 個体数 sounds very technical and academic.  Depending on the overall formality of the questioner's writing, it could (rather easily)  be too big of a word to use.
Comment: Yes, I understand. Environmental engineers use it in their technical report so you are right. 飼育数 on the other hand means the dogs are pets, so it cannot be used for strays. (In case some dogs in the movie, which I haven't watched btw, are strays.) So can you suggest something else @l'électeur?
Answer: Unless you're trying to write in a particularly technical/scientific/formal manner, I would say the safest word choice is simply 日本の犬の数.
Answer: 人口 isn't generally used for animals. I think of a word 生息数{せいそくすう}. You can say 日本にいる犬の生息数.
Answer: I watched the ISLE OF DOGS here.
Here I confirmded that dogs are expressed personalized.

Is using 人口 when referencing animal populations alright?

Yes and No.
I recommend that you should express the dogs as 犬族, and 犬族の人口 for the dogs' populations.
族 has various meanings, but one of them has a meaning of an unpublished tribe or an undeveloped race.
So 犬族 could imply the meaning of an unpublished tribe called 犬.
In order to identify the dogs of this movie, expressing them as "犬"族 instead of mere 犬族 is also more effective for personilizing these dogs on this island.
https://www.youtube.com/watch?v=dt__kig8PVU


countably normed spaces and countably normed spaces

Question: Why locally convex spaces are not presented as countably normed spaces i.e an infinite sequence of norms (see Generalized functions Tome 2 by Gelfand and Chilov)  in the western mathematical references ? I think in my humble opinion that Gelfand's presentation is more intuitive and is a direct generalization of normed spaces. Is it correct to say that 2-normed spaces (introduced by Gahler and White) are spaces with a continuous family of norms ?
Comment: What do you mean? In general a locally convex space is not a countably normed space.
Answer: First, as Pietro Majer notes, certainly not every topological vector space is countably normed...
But, yes, books in English called "functional analysis" seem to mostly ignore "rigged Hilbert spaces" (a.k.a., "scales of Hilbert spaces") as ways to present (projective) limits and inductive limits (colimits) of Hilbert spaces. But many modern PDE sources do use (Levi-) Sobolev spaces, perhaps without letting on that one could take limits and colimits usefully.
I myself have found rigged Hilbert spaces very useful as a finer descriptive device than merely test-function/distribution and Schwartz-function/tempered-distribution. Even the discussion of convergence of Fourier series is saner and more robust in the context of $L^2$ (Levi-) Sobolev spaces and the Sobolev imbedding theorem, rather than feeling an obligation to fret over continuous functions whose Fourier series don't converge to them in sup norm. In contrast, the Sobolev space that is strictly smaller but includes into $C^o$ consists of continuous functions whose Fourier series do converge to them in $C^o$ also, by Sobolev imbedding.
I do also think that the discussion of nuclear Frechet spaces is more intelligible when slightly restricted to address (projective) limits of Hilbert spaces with Hilbert-Schmidt transition maps. (My course notes at http://www.math.umn.edu/~garrett/m/fun/ systematically take this viewpoint.)
Comment: In your last paragraph, do you mean your notes 06d? I have recently had cause to look up some of the basics of Schwartz kernels, and your notes look interesting. (Have you thought of putting some of this on the nLab? The stuff about tensor products would be a valuable addition, in my personal opinion)
Comment: @YemonChoi, Yes, specifically, 06d on that page addresses nuclearity. I wouldn't mind at all if people mirrored something to "nLab", and/but I do try to update/correct things, so I'd not want an outdated version sitting elsewhere. I'm not informed about procedures for mirroring (or whatever) there... I'm open to advice, since, obviously, my goal is offering-up whatever information I've come across or puzzled out...


Frequency of longitudinal waves on a string

Question: I recently heard the composer Ellen Fullman on her Long String Instrument, which consists of steel wires of approx. 20 m length played by rubbing/stroking the string longitudinally. Changing the tension of the string while playing does not affect its frequency but just increases the intensity, unlike normal transverse vibration which goes up with increased tension. Does anyone know why this is the case? What is the relationship of frequency to the other parameters?
Answer: If a string of length $\ell$ is clamped firmly at both ends, it can support standing (stationary) waves of fundamental frequency $f_0=v/2 \ell,$ in which $v$ is the speed of wave propagation along the string. So it is the how the speeds of the two types of wave depend on tension that determines how the frequencies depend on tension.
The speed of a wave depends on the accelerations of portions of the string, when disturbed.
For transverse waves, the transverse acceleration of a small portion of string depends on the difference in transverse components of the string's tension either side of the portion. The transverse components arise because of differences in transverse displacements of the string making the string at different angles to its undisplaced direction. These transverse force components are proportional to the tension, $T,$ itself (which we can show to be hardly changed anywhere along the string by the passage of the wave, provided its amplitude is small compared to the wavelength). By following through this argument we arrive at a famous equation for the speed of transverse waves on a string of mass $\mu$ per unit length:$$v_\text{tr}=\sqrt{\frac{T}{\mu}}$$
For longitudinal waves, the acceleration of a small portion of the string depends on the difference in local tension in the string either side of that portion. This difference doesn't depend on $T,$ the mean tension or tension when the spring is undisturbed. Instead it depends on the string modulus, $\lambda$ (change in tension per unit fractional stretching), as well as the difference in displacements of either end of a small portion of string. The speed of longitudinal waves is given approximately by
$$v_\text{lo}=\sqrt{\frac{\lambda}{\mu}}.$$
Comment: Note that $\mu$ itself would decrease ever so slightly as you increase the tension, but  it's unlikely that this would cause a change perceptible to the ear.
Comment: Wow fantastic and clear response! Thank you very much! So frequency still depends on the density of the string but not on the average tension arrived through stretching from end to end. As I understand, the modulus $\lambda$ is a constant for a given material?

In this case, the fundamental frequency of a string with length $L$ vibrating longitudinally is:
$$f_0=\frac{1}{2L}\sqrt{\frac{\lambda}{\mu}}$$
Comment: Agree.  Thank you for the question – it made me think! I called $\lambda,$ the increase in tension per unit fractional extension, the  'modulus' after the spring modulus of the applied mathematics of my schooldays. But as well as depending on the material of the string, $\lambda,$ will be proportional to the string cross-sectional area, $A.$. We could write $\lambda=\lambda'A,$ in which $\lambda'$ depends on just the material. $\mu,$ the mass per unit length, is of course given by $\mu=\rho A,$ in which $\rho$ is the density. So we have the alternative from, $v=\sqrt (\lambda'/\rho).$
Comment: Actually this is very insightful, thank you. Just doing dimensional analysis was useful for me: I guess the modulus $\lambda$ would be measured in Pascals ... it would have to be given for the entire cross-sectional area $A$ in $m^2$ to work out as a velocity in the end:
$$\sqrt{\frac{kg}{m \cdot s^2} \cdot m^2 \cdot \frac{m}{kg}} = \frac{m}{s}$$

Does this seem to make sense to you?
Comment: Took me a minute or two to figure out what was going on under the square root, but it's fine. In $v=\sqrt(\lambda/\mu,$ the modulus, $\lambda,$ has the units of force, because it's the force per unit $fractional$ extension. But you knew that!
Comment: Ah that's it! Okay then all for nought, same situation as with $T$. Thanks for your help!
Comment: It would benefit anyone who reads this answer, as well as me, if the down voter (on 21st March 2020) gave a reason for the vote. For a start, is the answer considered to be (a) wrong, or (b) poorly explained or (c) not answering the question?


Can I use real presidents (past and present) and real companies in a fictional story?

Question: I'm not sure if I want to use real people and companies or make up an entirely different world with different people, presidents, and companies than our real world. If I did the latter I would offer the possibility of other universes in the preface and then use completely fictitious people. My main characters are of course fictitious, but they will be going on a journey to uncover hidden secrets from our nation's past and even from the world's past, so I need to know if these secrets they uncover can be about real people and companies (written in our real world) or if it would be better to make up companies and similar secrets to satisfy the story(written in an alternate universe).
Comment: Historical figures are used in fiction all the time, from Queen Victoria to Abraham Lincoln (they say he was a vampire hunter, you know?!)
Comment: Hi, and welcome to Writers. What's your definition of "better"? Easier to write? Easier for the reader to suspend disbelief? Runs less risk of a lawsuit?
Comment: Related: http://writers.stackexchange.com/questions/3119/disclaimer-when-writing-about-governmental-entities
Answer: The name of historical people or places is public domain(Our history is a shared one after all!) and no harm comes from involving any aspect of history in published fiction.
Having said that, using real companies(or their products) who have trademarks and copyrights will run you into complications that might just be best to avoid all together. If you are truly curious about the details, then this article and the blog it is from might be of help to you:
Can I Mention Brand Name Products in My Fiction?
Comment: Note: if the presidents in question are still alive, and the story implies them performing questionable activities, make sure you made it perfectly clear your story is a work of fiction. Otherwise you run at risk of libel.
Answer: There are two potential categories of issues to using real people and organizations in a fiction story: legal and literary.
On the legal side, let me give the standard disclaimer, I am not a lawyer.
Casual references are no problem. Authors are always writing, "Bob drank a Coke" or "The old Ford had broken down again." Occasionally companies get picky about trademarks. Like writers have gotten letters from the Coca-Cola Company's lawyers because they wrote "coke" with a small "c" rather than a capital.
But I think you run into the risk of being sued for libel if you attribute illegal or scandalous behavior to real people and organizations. If you write a story in which you describe a real company as paying bribes or covering up accidental deaths in the factory or whatever, and you name specific, real officers in the company, they might well sue you for libel. Whether they would win depends on the specific details of what you said and how it was presented, not to mention the opinions of the judge and jury. But unless your goal is to paint people or organizations that you dislike as evil, you are taking a lot of risk for no apparent gain. If your goal is to say that this is the sort of behavior that you think these folks engage in or are likely to engage in, then be prepared to face the repercussions. If you end up in court, even if you win you could be out a lot of money for lawyers, etc.
The courts generally consider political figures to be "fair game". I recall a few years ago someone made a pornographic movie about a female politician that he didn't like in which he portrayed her as having sexual relations with pretty much every man she met, in which he openly used her name in the title of the movie and got an actress made up to look just like her, and I don't think it ever even went to court. I'm sure she knew she would lose and all she would accomplish would be to give free publicity to the movie.
From a literary point of view: Putting in casual background references to real people, places, companies, etc, can add to the realism of a story. It creates the catch that if you use real details, you should go to the effort to make them right. Like if you say, "Bob drove a 1967 pickup truck", no one's going to question it. But if you say, "Bob drove a 1967 Studebaker pickup", a reader might have trouble with that if he happens to know that Studebaker went out of business in 1966. (I've had times when I've noticed mistakes like that in a story and I've wondered if the WRITER made a mistake or if the CHARACTER made a mistake and this turns out to be a crucial clue to the identity of the criminal or some such.) Also, if you overdo it, it can make your story sound like one long commercial.
Using real people, etc, in a story where they are clearly presented as heroes or villains can limit your readership. If you present, say, the Catholic Church as a corrupt institution made up of superstitious lunatics, your book may be a hit among atheists but will likely be a hard sell to Catholics. You might manage to get your book categorized as "controversial" so that the people you attack feel obligated to read it so they can offer rebuttals. But for the most part that's a long shot -- only one novel every few years really makes a success out of being controversial. Books that offend a large percentage of the potential market tend to just not be read, because most people will say, Why should I give this person money to deliberately insult me? Again, if your goal is to attack some person or group you dislike, then that changes the equation, then you have to figure out how to do it most effectively. But if you're just trying to write an entertaining adventure yarn, painting some group as the villains when millions of potential readers are members or at least respect them, is just sabotaging yourself.
Answer: I love alternate history, this is where you take a historical account and change something, aliens invade during world war two, I travel back in time to kill my grandfather, etc.
There are specific rules to handling historical characters, firstly they aren't your character, be true to their known character. If you change a historical character you must have a good and obvious reason for the change that is clearly explained. Companies are built of people If you change a company you must either change the regulatory environment first, or change which people or change a historical character subject to the above guidelines, otherwise the company is not your character, be as accurate as possible. when in doubt let the company or historical character be great whether it be like taco bell in demolition man or like Sampson as he died.
If a historical character won't do what you want, kill him, all dead men are heroes or mayrters and the guy who took over can be your own creation.
Although these rules may not fit what you are doing exactly I still think they may be of help.
Answer: On the question of companies (ex-leaders of countries are open season) it comes down to if you are suggesting that the company itself is bad.
Max Barry has John Nike (who works for Nike) commit a number of acts of terrorism for the benefit of Nike in his book "Jennifer Government". Despite all the bad things (and morally dubious actions) of the employees of the companies mentioned Max never says that these are bad companies and not one organization or company has, to my knowledge, made the least bit of fuss at being acknowledged in his book.
You are only going to be in the danger zone if you cast the company itself as the maker of poor products or as inherently evil. In other words talking about them in such a way that the legal department might be able to ague that you have damaged their reputation.
Leave the company reputation intact and you are (probably) going to be able to name drop freely.
I am not lawyer but this is my experience on the subject.
Answer: Live "Presidents" should be "minor characters" (in your fiction), performing a "public" act. For instance, in one screenplay, I featured a film clip of President George H.W. Bush (father) declaring war on Iraq in order to set a "backdrop" for early 1991.
On the other hand, you should not feature a real President e.g. seducing the heroine (and thus playing a major role in your fiction). That goes beyond "public figure" into the "private" realm and may expose you to a charge of libel.
If the President is a major character, you should change the name. "Primary Colors" was about a Presidential candidate who could have been Bill Clinton, so they renamed him "Jack Stanton." They also changed the Presidential election year to 1998, thereby creating a "parallel universe" with a timeline that could not have been real.
Comment: I think there may be exceptions to this for presidents who are long dead. However, you should clearly state that this is a work of fiction.
Comment: @JasonHutchinson: Changed it to "live" Presidents to make my point clear. But the point is, you should use Presidents in their "natural" roles as public figures, and not as integral parts of your story.
Answer: Legally, Presidents are largely free game.  Largely.
You run a serious legal risk using real companies.
The problem with any legal advice I can offer is it's dependent on hypothetical scenarios. The law is not a clear-cut mechanism, it's diluted and subject to interpretation by plaintiffs, defendants, judges, and juries. This is not my specific area of law, but you run the risk of libel, slander and a number of other torts defined by the states. Lost dollars could mean serious trouble. You run a risk, 100% of the time, using an actual company's name. They have grounds to sue you in a US court even if you paint them as saints. –
Comment: What you said in your comment would be a great addition to your answer.  Could you [edit] that in?  Thanks.
Comment: The problem with any legal advice I can offer is it's dependent on hypothetical scenarios.  The law is not a clear-cut mechanism, it's diluted and subject to interpretation by plaintiffs, defendants, judges, and juries.  This is not my specific area of law, but you run the risk of libel, slander and a number of other torts defined by the states. Lost dollars could mean serious trouble.

You run a risk, 100% of the time, using an actual company's name.  They have grounds to sue you in a US court even if you paint them as saints.
Comment: Can you clarify "largely" (when not?) and add some support for your second sentence?  (Real companies show up in fiction, so when is there risk and when not?  How do you know?)  Thanks.
Comment: @MonicaCellio I would imagine that writing a fictional story about a sitting president may give some people the wrong idea.


Hot liquid reverse spherification

Question: Can i uses a hot liquid such as a sauce for a meat dish, to make spheres and still maintain the heat of the sauce?
Answer: Gelled sodium alginate melts at 150F. So, this should be possible.  Maybe spherify with cooler liquid, then heat and maintain a warm temperature with a pan floating in a sous vide bath.

Hot liquid reverse spherification


Russian children's book about a boy's first train journey

Question: This is probably a Soviet-era children's book. It is about a boy's journey by train. As I remember it, not much happens plot-wise, but the boy's sense of wonder makes everything he encounters (The washbasin! This is how the door works! This is how they serve tea on the train!) seem marvelous. I think the book is meant to introduce young children to these phenomena. My mother read this book (in Chinese translation) to me when I was a child. I would love to know the name of the book.
Answer: My guess would be "What I Saw" by Boris Zhitkov. But I don't know if it was translated in other languages.
Comment: I looked at the description of this book online and it may very well be the one I am looking for. Thank you very much!


Key length greater than block size

Question: In AES, if I have 192-bit key to encrypt 128-bit block size, won't it only be using the first 128-bit of my 192-bit key? So what's that extra 64-bit key used for, and how does that increase security?
Comment: What research have you done? I was able to find [this](https://en.wikipedia.org/wiki/Rijndael_key_schedule) fairly easily.
Comment: No, [this one](https://crypto.stackexchange.com/q/5733/1172) explains it better. This Q would be better placed on the crypto site, *if* it would not be closed as a duplicate (which it would).
Comment: check this link i think it can solve your question https://crypto.stackexchange.com/questions/8121/aes-plaintext-is-smaller-than-128-bits-how-to-expand
Answer: The key is first put through an algorithm called a key schedule, which splits it up and expands it into a number of 128-bit round keys. These round keys are always 128 bits in length, regardless of the size of the AES key itself. Each of these round keys are fed into the end of each single round of the block cipher using the XOR operation. AES128 expands a 128-bit key into 11 round keys, AES192 expands a 192-bit key into 13 round keys, and AES256 expands a 256-bit key into 15 round keys.
The internals of the AES algorithm are described excellently in A Stick Figure Guide to AES.
Comment: That guide is really good.
Comment: @ThoriumBR Agreed. It's by far the best description of AES that I have ever come across.
Answer: Any given 128-bit block can only benefit from 128 bits of entropy, but that doesn't mean the other bits are wasted. By the pigeonhole principle, using AWS-192 means that there must be on average at least 2^64 keys that, if used to encrypt block A, output block B. However, decrypting a single block usually doesn't get you the whole message, and of those roughly 2^64 keys that can map A to B (or vice versa), probably only one of them works for the rest of the message.

Suppose you had plaintext P0 and corresponding ciphertext C0 (both one block long) and you wanted to mount a known-plaintext attack and extract the key. You would (on average) only need to try 2^128 candidates (note: this is, for practical purposes, impossible) to find some key that works, even though each candidate is 192 bits long, because there are probably 2^64 working keys.
However, suppose you have two pairs of blocks, P0,C0 and P1,C1, which are not equal. Now, you still only need to search (on average) 2^128 candidate keys to find one that works for P0,C0 or P1,C1... but there is probably (likelihood of about 2^64:1, assuming the cipher is as strong as we think) only a single 192-bit key that works for both.
This has huge implications for known-plaintext key-recovery attacks, of course; if you only have one block of known plaintext, you still have to try on average half of the 2^64 keys that work for that single block before finding the one that works for the rest. This is of course the same 2^191 candidates you'd need to check (on average) to guess the right 192-bit value.
Full key recovery from known plaintext is utterly impractical even at 128 bit keys, but imagine you knew the first 80 bits? Then the search for a 128-bit key requires trying only at most 2^48 candidates - practical (given some time) even on a home PC - while trying to find a key that correctly decrypts an entire message consisting of at least two distinct blocks encrypted with AES-192 would require trying up to 2^112 candidate, which is probably still functionally impossible even for nation-state attackers. That generalizes to other attacks too, such as using (theoretical) quantum computers to cut the effective entropy in half; 64 bits of effective entropy probably aren't enough, but 96 bits would be for at least a while (and 128 bits effective - from halving the entropy of an AES-256 key - would be functionally impossible to crack).

Key length greater than block size


Comparison of noise reduction tools for raw images

Question: There are some editors for raw images running on Linux (Dark Table, Raw Therapee, Bibble, ...).
What about their skills at reducing digital noise? I'm interested in quality of the result and also in the CPU time required for the operation.
Comment: tools I could try: Clean CCD Noise Gimp plugin http://registry.gimp.org/node/17241; G'MIC Gimp Plugin http://registry.gimp.org/node/13469; Zero Noise http://www.guillermoluijk.com/software/zeronoise/index.htm
Comment: Looks relevant, though it's not focused on open-source solutions: http://photo.stackexchange.com/questions/483/recommendation-for-noise-removal-tools
Answer: For me the Gimp plugin Wavelet Denoise showed best results mainly because of the option to manually adapt settings to your needs.
Answer: While i do not know the quality or the time taken you should try ufraw it is avaliable as a gimp plugin and as standalone software as well.
ADD by Spanky: ufraw is very flexible, for a wide range of cameras, and can be used by eye, with your cameras, ufraw color profile, or you can make one(or many) per camera. That give you instant results. The curves, which can also be loaded, and customized, are like D-Lighting (local contrasts) an more.
My point is, ufraw does not do the best NR, so I leave that off, and do it elsewhere, like Gimp. However, by shooting doing Raw, you will eliminate JPEG artifact noise. ufraw, is for quickly doing all 16-bit, light adjustments, when needed. Don't let its many options, through you. Read the ufraw web site.


OTM puts or ITM puts in fear of market crash

Question: If I own some shares, but at the same time I am afraid of a market crash, should I buy OTM puts or ITM puts?
Comment: Look at "Ratio Backspread" or "Slingshot Hedge", in conjunction with your stock. You can create a "Box Spread" by synthetically shorting your stock by combining a "long Put & short Call". There are many "Hedges".
Comment: My hope is you had a hedge in place, or locked profit with this market move.
Comment: Creating a "Box Spread" by synthetically shorting the  stock by combining a "long Put & short Call" is a good hedge if you can time the drop.  For an ongoing position, it's dead money since the synthetic locks  the position in with no gain or loss other than the small credit that one might receive if the synthetic was ATM.
Answer: If you are planning to hedge your stocks by buying, say, a put on the SPY, it's an expensive way to go. SPY is 208 right now, and the Jan16 (five months out) put is $8.20 or 4% of the value. i.e. you'd need more than a 4% drop to just break even.
If you fear a 20% sized crash, 40 points or so, a $190 strike is at $3.37. And at SPY $168, you'd have $22 in return.
To generalize, it's out of the money that works best for your 'crash' concern. You still need to decide on the timing, go out to Dec17 and that $190 put is $16.53, as well as the risk/reward by choosing the strike price.
Comment: I think I can also obtain protection if I buy ITM puts? Because if OTM puts provide protection in case of crash, then so must the ITM puts?
Comment: Yes. But you how expensive the ATM put is? You need to look at the cost for each strike and decide what your goals and expectations are.
Answer: In general, broad based indexes  tend to have lower implied volatility and therefore lower premium per day per $ hedged  than stocks.   If hedging a single stock, use its options.  If hedging a portfolio, use the index.
Buying ATM index puts (SPY) as a portfolio hedge  will cost you about 6–8% per year, even more when the market is frothy and implied volatility is higher. That's a lot of drag on your portfolio which will have to appreciate that much in order to break even.
Premium decay is non linear so the premium paid per day is higher for near term options than long term. That means that you should  buy further out in time. However, if the stock moves up and the stock gets further away from the put's strike price, then the amount of protection diminishes (the put does not protect the appreciated amount). So buying too far out in time can be counter productive.
To your question.  Risk and reward go hand in hand.  If you want less risk, you must give up more reward.  The further OTM the strike of your protective put is, the less it costs but the more you can lose due to the greater the distance down to the strike price.  That's your 'deductible'.  As with buying standard insurance, if you want a lower deductible, you buy a higher put  strike price which means a higher premium cost.
Buying an ITM put greatly reduces the 'deductible' since it has a higher delta and a much lower amount of time premium.  That's a good thing.  The problem  is that to the upside, you forego any profit equal to the cost of the put.  For example, if XYZ is $100 and you buy a $110 put for $11, on an expiration basis, your position makes or loses nothing between $100 and $111.  Your max loss to the downside is $1 (at or below $110).  Above $111, the profit is $ for $ to the upside.  This hedge is fine for a brief period of time but to me it makes no sense whatsoever for the long term.
IMO, a more efficient way to protect the stock is a long stock collar it but that involves a willingness to sell the stock at a higher price. For every 100 shares that you own, sell an OTM call and use the proceeds to buy an OTM put which  defines a floor beneath which you cannot lose as well as a ceiling, above which you do not profit (unless you can roll the calls up and/or out later).
Collared long stock is equal to a covered call and a long put. A covered call is synthetically equal to a short put so if you make the substitutions, a collar is synthetically equal to a bullish call vertical spread. That's what your risk graph looks like.
Collars can be structured for no cost. That is efficient. If you want to skew the risk graph to having more upside than downside, the call will be further OTM than the put and the collar will have a net cost. Skewing  it in the opposite manner will generate a credit but  the collar will have more downside loss potential than upside gain..
If you do collars 2–3 months out with a short call strike that is reasonably far enough OTM, there's a chance that the stock will appreciate and not be taken away by assignment by expiry. Then, add the next month's collar at higher strikes. Wash, rinse, repeat.
Whether you bought long puts or collared the position, my approach if the stock collapsed would be to roll the long puts down, pulling money out of the position and lowering the cost basis.  But that's another story.
Caveat? Don't monkey with collars if you don't want to sell the stock.


Suddenly, outbound scp, sftp, rsync, & ssh /bin/true fail; ssh still works

Question: Problem
On my MacBook Pro running Mac OS 10.15.7, I cannot do outbound scp, sftp, or rsync to seemingly any server (I've tried ~10 I own). I also cannot run remote commands by ssh, e.g. ssh othermachine /bin/true fails just like scp. However ssh othermachine works as normal. This problem arose out of the blue last week after scp had worked flawlessly with these same machines for many years.
Tried So Far

All other machines can still scp and sftp to and from each other, including to and from the same network my laptop is on. That seems to narrow the problem to with my laptop specifically and in particular eliminate network problems.
This doesn't seem to be a problem with ~/.bashrc or ~/.profile -- even entirely deleting those file on both machines changes nothing and the former already contains proper handling for non-interactive sessions.
sudo'ing scp fails just like if I run it as a normal user. Trying that also required using password authentication, so that seemingly rules out problems with ~/.ssh/authorized_keys that I'm otherwise using for automatic login.
Different versions of ssh/scp/sftp fail the same. I've tried both the built-in version (OpenSSH_8.1p1, LibreSSL 2.7.3) and the latest from Homebrew (OpenSSH_9.4p1, OpenSSL 3.1.2 1 Aug 2023). In particular, scp -O on the newer version fails the same way.

Typical Outputs
I'll post typical outputs as I can. (SE claims they "[look] like spam" but I see everyone else is able to post them, so I must be doing something wrong!)
Last 20 lines from scp -vvv randomfile localserver:~:
debug1: Remote: Ignored authorized keys: bad ownership or modes for file /home/me/.ssh/authorized_keys
debug3: receive packet: type 4
debug1: Remote: /home/me/.ssh/authorized_keys2:1: key options: agent-forwarding port-forwarding pty user-rc x11-forwarding
debug3: receive packet: type 91
debug2: channel_input_open_confirmation: channel 0: callback start
debug2: fd 3 setting TCP_NODELAY
debug3: set_sock_tos: set socket 3 IP_TOS 0x20
debug2: client_session2_setup: id 0
debug1: Sending subsystem: sftp
debug2: channel 0: request subsystem confirm 1
debug3: send packet: type 98
debug3: client_repledge: enter
debug1: pledge: fork
debug2: channel_input_open_confirmation: channel 0: callback done
debug2: channel 0: open confirm rwindow 0 rmax 32768
debug3: send packet: type 1
client_loop: send disconnect: Broken pipe
scp: Connection closed

Comment: `bad ownership or modes for file /home/me/.ssh/authorized_keys` would seem to be the issue - did you check and fix the owenership of said file?
Comment: This was due to ~/.ssh/authorized_keys having a mode other than 600 on the remote server. I've fixed it, but it doesn't seem to have any bearing. (The remote ~/.ssh/authorized_keys must work or else I couldn't auto-login.)
Answer: As suddenly – poof – it works again! I did little or nothing, not even restarting the computer.
I don't have a good explanation as to what happened here. Perhaps some kind of OS X micro-update or very subtle problem on my local network. In case you have any hypotheses, I'm happy to hear them.


I want to merge some images at start and end of video to generate new video

Question: I am working on small project where i need to merge some images at start and end of existing video.
At start of video i need to merge one image and at the end of video there will be multiple images merged.
After merging the video the output file will be the video file having those images embeded as video.
Comment: This link may help you http://stackoverflow.com/questions/1789881/video-editing-using-php
Answer: Since you have not provided much details and as per you question I think it is complicated but I would suggest you to combine all of those videos into one let say -
I. You have created a image and then convert that image to video.
First, rename your pictures to follow a numerical sequence. For example, img1.jpg, img2.jpg, img3.jpg,...
<code>ffmpeg -f image2 -i img%d.jpg /tmp/a.mpg
</code>
You can refer - How do I encode single pictures into movies?
II. Then you have to merge created videos and existing videos into one. You can refer How-can-I-concatenate-video-files
For full information you can refer FFMPEG
I hope this will help you, at least guide you to right direction.


Traveling to London with a dismissed misdemeanor

Question: So  I am US citizen and I want to travel to the UK but I heard you have to wait 12 months after you have gotten off probation. My misdemeanor only came with a fine, but I wanted to get it removed from my record, so I asked for a withheld judgment which they gave me 6 months of unsupervised probation before I could apply to have it dismissed from my record. So my trip date falls 3 months short of a year from the end of that probation. I want to know that since I got the misdemeanor dismissed will that affect me? Should I wait the year or can I go earlier?
Comment: @Moo The suggested dupe is about visa applications, while OP is a non-visa national
Comment: While your conviction is brand new, and the referenced question is regarding an old conviction, I think the answer is still directly relevant here - it doesnt matter that the US consider the conviction to be discharged, you must still disclose it in your UK visa application as they do not discount discharged or dismissed convictions.
Comment: What was the misdemeanour?
Answer:
I heard you have to wait 12 months after you have gotten off probation

There are no "have to"'s whatsoever in this regard. You don't get a ban due to probation.
At the end of the day, a single misdemeanour is not normally a cause for concern. To be safe, you could bring documentation about your misdemeanour and probation, and if, by chance, the UK border officers ask about convictions, tell them the truth.
Bottom line: yes, you can visit the UK immediately if you want.


Neovim coc-html don't use auto-closing tag for macros?

Question: I am using neovim and coc.vim for lsp.
Also for html used coc-html.
But i have an bug, when write or use macros, have 2 closing tags.
How can i disable this behaviour?
Thanks in advance.
Comment: It would be good if you could give an example of start text, input keys, end text and expected end text such that we can reproduce the problem. Maybe should we also check that there are no collusion with [emmet-vim](https://github.com/mattn/emmet-vim) or Ultisnip or other templating engine if you use some.
Comment: Thanks for unswer.
The problem is in plugin coc-html, because if i uninstall it with `:CocUninstall coc-html` and write or run macros, than don't appear closing tag.
Answer: I found a solution.
Disable coc-html and use this plugin for closing tag https://github.com/alvan/vim-closetag
And don't need to auto close tag, just run :CloseTagToggleBuffer


Archived Apple Messages - How to print or reactivate

Question: Is there a way to print or reactivate text messages that have been archived? I can view the archived messages just fine in the ~/Library/Containers/com.apple.iChat/Data/Library/Messages directory.
Answer: Double-clicking any of those archived messages will reopen that conversation in Messages app.
If you Search in Archive for the caller name [or number if there's no name] then open the most recent archive, that ought to import the entire conversation. If in doubt, bulk-select all the relevant archive files,  Cmd ⌘   O  will open them all & you can test the newest against the earlier ones. Empirically it does seem to work, but I've only tried it with a couple of test cases, & not any of my 'major' conversations.
Caveat…
Whether the conversation will open correctly in the main Messages window depends on whether you had Prefs > "Save History when conversations are closed" checked at the time you closed that conversation.
Without that checked, you can open it in a separate window, but I can find no way to re-merge it to the main window.
If it is checked, it correctly opens in the main window too.


Do the Shayateen know Allah is real?

Question: The first Shaitan (Iblis) knows Allah is real and makes humans and jinns disbelieve in Allah. When we say verses like Ayatul Kursi, the shayateen will go away from our house for a couple of days. If they know why they can't enter our houses when we say verses like Ayatul Kursi, do they know Allah is real? If so why do the choose to not and can they become Muslim jinn?
Comment: Nice question, but it's answer will be no short one
Comment: Devils don't make humans disbelieve, the have no authority to do so, rather they advice us to disbelieve!
Comment: I don't think the shayteen go away for 2 days for just the aayatul kursi, but they do go away for 3 days in a house where surah baqara is recited. I was thinking of a similar thing once, why do magician not believe in the unseen when they make contracts with jinns; it is key in magic to do act that displease God and you fight magic with the Quran
Answer: The Shayateen (devils or demons) are creatures created by Allah (God) from smokeless flame, just like angels and humans. They are considered to be disobedient to Allah and to actively seek to misguide and mislead human beings from the path of righteousness.
The Quran mentions that the Shayateen are aware of Allah's existence and power, and that they recognize Him as their Creator and Lord. However, they have chosen to rebel against Him and to lead human beings astray from the path of righteousness. In the Quran, Allah says:
"Indeed, Satan is an enemy to you; so take him as an enemy. He only invites his party to be among the companions of the Blaze. Those who disbelieve in the verses of Allah will have a severe punishment" (Quran 35:6-7)
The Quran also mentions that the Shayateen will be held accountable for their actions on the Day of Judgment, just like human beings. In one verse, Allah says:
"And [mention, O Muhammad], the Day when We will gather them all together - then We will say to those who associated others with Allah, 'Where are your 'partners' that you used to claim [with Him]?' Then there will be no [excuse upon] examination except they will say, 'By Allah, our Lord, we were not those who associated.'" (Quran 6:22-23)
Therefore, according to Islamic belief, the Shayateen are aware of Allah's existence and power, but they have chosen to reject His authority and guidance. They will be held accountable for their actions on the Day of Judgment, just like human beings.

Do the Shayateen know Allah is real?


php/mysql two variable array

Question: I am allowing user to create up to ten categories using text boxes in a form.  To do this I have ten textboxes in the form with name = cat[]. The first time they enter categories--however many, up to ten, on the receiving end, I just collect the array of categories and save them to a table of categories using an insert statement. So far so good.
However, now I want to let them change categories they already set or add extras up to ten total. The categories they already set have ids.  So I echo the ids to the form along with the category names.  My problem is how do I collect the names and ids now?  New ones need to be inserted and existing ones may need to be updated in the table?  For some reason, I'm at a total loss how to do this.  This is what I have so far>
Table Cats
id | catname | userid

Form page:
//retrieve existing cats if any...also get catids

echo '<form action = storecats.php method=post>';
$i=1;
//Get all existing cats
while($row = mysql_fetch_array($res))
{
    $catname = $row['catname'];
    $catid = $row['id'];
    echo '<input type = "text name="cat[]" value="'.$catname.'">Cat 1';
    echo '<input type="hidden" name="id[]" value = "'.$catid.'">';
    $i = $i+1;
}
//empty boxes up to ten.
while($i <= 10){
    echo '<input type="text" size=18 name="cat[]" value=""> Cat '.$i.'
';
    $i = $i+1;
}//end appending of blank categories
echo '<input type="submit" name="submit" value="submit"></form>';

On receiving end, I can collect the array for cat and id.
$idarray = $_POST['id']; //there will be as many elements as there were ids
$catarray = $_POST['cat'];  //there will be ten elements in array

Where there is an id, I want to perform an update whereas where there is no id I want to insert unless the value is blank.
My problem is I can't figure out how to link the id and the cat names being received in the different arrays.  Note, there will always be ten cat names but there will only be as many ids as were in the table for that user previously.
Answer: You can do it with 2 array on HTML side:
    $x=0;
    while ($row = mysql_fetch_array($res))
    {
        echo '<input type="text" name="updateCat['.$row["id"].']" value="'.$row["catname"].'"> Cat Name';
        $x++;
    }

    // new ones
    for(;$x<10;$x++)
    {
        echo '<input type="text" name="newCat[]">';
    }

and on php side:
    // update old categories
    foreach ($_POST["updateCat"] as $key => $value)
    {
        mysql_update ("UPDATE table SET name = $value WHERE id = $key");
    }

    // insert
    foreach ($_POST["newCat"] as $value)
    {
        mysql_update ("INSERT INTO table {...}");
    }

You have also check that there are not more than 10 Categories when inserting new ones.
Comment: Strictly speaking, that will show more than 10 input fields after the first time.
Comment: You are right, so I edited my answer and added a note that the opener have also check the count when inserting new ones.
Answer: Name the inputs which are for existing categories cat_update[] and name inputs which are for new categories cat_insert[]. When you process the form data with PHP you have three arrays:
$ids = $_POST['id'];                // Ids for update
$update = $_POST['cat_update'];     // Values for UPDATE
$insert = $_POST['cat_insert'];     // Values for INSERT

for($i = 0; $i < count($ids); $i++) {
    //Execute 'UPDATE `table` SET `value` = $update[$i] WHERE `id` = $ids[$i]
}

for($i = 0; $i < count($insert); $i++) {
    //Execute 'INSERT INTO `table` (`value`) VALUES ($insert[$i])
}

Answer: I'm not sure I get it, but you could simply give different names to the two sets of categories.
In your second loop putting 'name = "new_cat[]"' will allow you to distinguish between modified categories ('$_POST[cat]') and new ones to be inserted ('$_POST[new_cat]') in your receiving storecats.php code.
Comment: The problem of the opener is that he don't know the id's of the updated categories. Look on my answer to see how to transmit the form data with an id-value array to the php script.

php/mysql two variable array


how to map a json store or xml store to pie chart in sencha architect

Question: Am new to sencha and all its products.  I started working with sencha architect.  In that when i design some project and when i try to run its asking for url and i uploaded it on a free web hosting site. MY test app. When i preview it its showing an empty page. I thinks that its may be because of not providing any data for piechart. can anybody guide me how to add store in jsonstore or xmlstore and map it to a pie chart. videos highly appreciated.
Answer: If you right click on desktop safari/chrome and choose inspect element when running your app, then look in your console, what error do you see?
Comment: Thanks. Its not the error in the code. The problem is in the structure of my json. Now i solved it


Tridion 2011 adding fields to a security group

Question: How would I add a field on the general tab of a group?
Comment: Can you add some more to this question, it doesn't really explain anything about what you need to do, or what you've tried to resolve your issue
Comment: The problem is: OP wants to add more data to a group object. The solution is probably UI extension + AppData.
Comment: I have some ideas on working with extensions but not sure where to start with Appdata. Seems like good information is hard to find and most of these modifications that I want to add should be easy.
Comment: "should be easy."  typically they are but you must first have a lot of understanding of how the CMS GUI interface (anguilla) framework is built.  It's quite a steep learning curve
Answer: The Tridion 'FBI' project is still under development, it contains some great examples of:

Extending the GUI
Using the 'Extension XML'

you can check it out here: https://code.google.com/p/tridion-field-behavior-injection/
I'd recommend to install it, and review:
1) How the extension is 'hooked into the schema and component dialogs' - you'll need to do this in your security dialog
2) How form fields and field groups are injected into the diaglog
3) How this information is stored (extension XML) into the CM database.  If it's not possible to use extension XML with non-content items, then here you're best best to to look into custom 'app data'
i hope this helps a little.
Answer: Julian Wraith has a post about GUI extensions that might help you further.
http://www.julianwraith.com/2010/10/helloworld-extension-for-tridion-2011/
I do agree with Johnwinter that additional information would be nice to help you any further.


Can't Create Water Refraction in Photoshop

Question: I want to create a water refraction effect that can overlay an image. I'm using Photoshop and have tried a variety of filters with no luck. I'm not very familiar with Photoshop effects, so any help is appreciated. Here's an image with the desired effect.
Comment: That is not refraction directly. Those are light rays that are produced by caustics (produced by refraction).
Comment: This looks like one of more overlays of drapes or other similar material set to screen so only the highlights show up.
Comment: This is unlikely to be something you could achieve with a filter.  You could try [a net curtain texture, in overlay mode, with reduced layer opacity](https://imgur.com/qfGOgNF) as a starting point.
Comment: I think before we go down the rabbit hole of techniques and clicks, we should refine what you mean and are looking for: refraction per se most commonly causes the appearance of 'bending' of an item partially seen through water, partially through air. Caustics are the small bright wave / cell shapes on the bottom of water bodies caused by refractional lensing from the surface wavelets. Neither are "click-a-single-button" results. Which are you trying to create here?
Answer: Wavelets in the surface could project sunlight so that there's apparent light beams in the water when microscopic particles in the water scatter the light. The light could also be emitted downwards by strong lamps. We can see something resembling also in the air in a foggy weather when car lights make visible beams. Or when the sun is behind thick clouds which have holes. In such conditions we can see the ecumenical light from the sky common in religional paintings.
But the rays in your image are not light beams because they are not straight. Light takes curved route only in non-homogeneous medium or under black hole grade gravitation. I guess your light beams are actually a partially transparent curtain made of some thin veil or gauze.
Your image has no color. The graininess suggests that the maker of the photo has worked a while in the darkroom to compensate the contrast loss caused by the curtain. We can try to imitate it.
This is a BW photo. It's taken from an ad of commercial diver training and desaturated:

The 2nd layer has got a grey curtain. It's not a photo, because I do not have one. It's only a low quality fake that I made for this, but I guess it's good enough to show the idea. A proper photo would be better. The contrast is adjusted so that the average brightness is 50% and there's nothing full black nor full white.
The opacity of the curtain is reduced to 44%:

The diver can be seen, but the contrast is poor. For "finer presentation" I inserted a curves layer to increase the contrast:

One effect of the curtain material is still missing. My curtain layer  doesn't make the photo below unsharp. It could be simulated with a noisy displacement map, but I skip it.
In old times increasing the contrast afterwards in the darkroom made the photo easily grainy. It's simulated by adding a grainy layer. It's a 50% solid grey layer which has got grain effect:

The blending mode is hard light and the transparency is reduced. As separated the grain layer is this:

As said above this is still too clean. The curtain doesn't make the diver unsharp. And the curtain resembles too much a piece of fabric.
The diver can be made unsharp in Photoshop with Tiny Lens distortion effect:

This curtain is at least unnatural.

It's a negative which turns dark shadows to lights and there's a massive amount of noise. It's still a fake. But it resembles a piece of glossy plastic
Making this partially transparent allows the diver to be seen, but the contrast is poor:

A curves layer restores the contrast and lifts up the graininess. Now it's at least as detoriated as your example:

I have started to suspect that you actually want the rays to a color photo without heavy noise and unsharpness shown aboveand the rays should be straight without a hint "it's a curtain".
One easy way to make complex, but straight rays is to extrude them in Illustrator:

It started as a black straight line. The line is distorted with the wrinkle tool. Its color is changed to light grey and it's stretched vertically by adding legacy 3D effect Bevel& Emboss. It's still a curtain, but much more regular than the attempts I used above.
In the next image it's copied and pasted to Photoshop and distorted to look to spread downwards. The bottom edge is dragged wider with Edit > Transform > Perspective (or Distort):

Making it partially transparent and compensating the contrast loss with curves cannot be used with color because the colors would be distorted badly. One possibility is to move the rays to the bottom and to change the blending mode of the photo layer to Hard Light:

This method has an accidental advantage: A part of the light looks like it's behind the diver. The effect is not especially strong, because the opacity of the bottom layer is reduced to 23%. Lifting the bottom layer opacity to 40% gives this:

This is too much. It demands something natural looking to make it more plausible. One possibility is to add grain to present particles in the water. Unfortunately adding noise is not the way. The particles must be small, but far less dense than what's got by adding noise. Fortunately the noise can be sparsened by tresholding:

The sharpest light beams are faded by adding 1px Gaussian blur.
The particles are masked so that they occur only in the light beams. This is my particle layer in the bottom as separated:

The layer mask is a copy of the light beams, but with increased contrast.
Comment: @Rafael I drew floating pieces of partially transparent fabric + noise. You drew light. I have inserted an attempt to do it, too.
Comment: My answer was initially only to complement yours... only for the shape of the rays. And it escalated quickly n_n
Comment: In your last update, I would make a shadow on the rays below the person. A cone of shadow.
Answer: This answer escalated really fast.
Caustics is a really complex light projection where light is focused and dispersed depending on the waves of the surface.
This "density" in the light is not flat, so we need to use the "Mesh gradient tool".
I did not make this on Ps but in Corel Draw, but you just follow the concepts.
A. Get the Mesh tool and use 5 nodes. Assign colors similar to the sample B Note that the ones on the bottom are darker (less light) C.

Change them to trapezoidal shapes D.

E. We can not use them like that. We need to use the Add blending mode and play with the transparency of the layer F. If you intersect some rays you start to get a caustics effect.

G is too chaotic, so I'm using on this case concentric rays.

This is not so bad.

But now let's get risky. Let me project the caustics on the girl.
Take a copy of your image I contrast it a lot J and convert this as a mask. Invert it and apply it on a new layer of your image. Here K is what is transparent and what is not.

Take an image of real caustics L, and sandwich it between the layers M, using add blending mode only on the caustics layer L not in the layer K.
N We are almost done.

And now let's add some noise...

Nice.

Here is another method to make the "rays" layer. try to combine both techniques.
Draw some random dots over a black background

Use a Zoom blur, apply it twice and increase the contrast.

Use this as a new layer. I used two of them with some transparency with the "add" blending mode. When two rays intersect make a bit of a caustic effect.
But this could look either caustics or rays through the woods. Experiment.

This example has the two types of rays, the zoom and the meshes. By combining them we denote a more "disturbed" water surface.

Perfect.

In my examples, the rays are straight. They should be in slightly different directions but they should not be curved.