How do I document necessarily complex code structures?

Question: If I have a piece of code that is mathematically or structurally quite complex and irreducibly so, how would I go about documenting this piece of code? In particular, how can I ensure that someone who may not have the mathematical or architectural skills that I do can understand it from the documentation? Should I document all of the math too? Link to a tutorial? Do some visual aid linkage in the case of complex structures?
Comment: related: [Where should a programmer explain the extended logic behind the code?](http://programmers.stackexchange.com/questions/143161/where-should-a-programmer-explain-the-extended-logic-behind-the-code). I especially like the tests-as-a-doc approach suggested in one of the answers.
Comment: This would obviously depend a great deal on whether one was talking about mathematical complexity or architectural complexity.  They're not documented in at all the same manner.  Which is it?
Comment: @Gnat, why thanks. I think that overall, [my answer](http://programmers.stackexchange.com/a/143186/22493) to that question would work for this question too.
Comment: @MarkBooth right, it was mostly your answer I had in mind when suggesting related question. Answer is good generally, but the point about tests especially rung a bell as I did use it once for one particularly complicated algorithm implementation
Answer: This really depends on how complicated the code and math is. The code itself should - as always - be as self-documenting as possible. Name variables correctly, implement logical and concise methods (rather than mega-functions), add in-line documentation where appropriate (i.e. when it is not obvious what the code is actually doing).
If you're using a non-obvious algorithm, add a link to a reference it the source. This is a reasonable practice because it gives the developer a very quick way to find out what you're doing. As I said, this is useful if it's a non-obvious yet complex algorithm. This should prove that (a) you are doing something that makes sense, and (b) someone has demonstrated that it works.
A good example is some work I did around fuzzy text matching. I did substantial research into algorithms and implemented what is known as 'Smith-Waterman algorithm' (which is actually used for DNA sequences, but applies to 'matching' generally). So instead of simply implementing the algorithm, I found references online and included a link or two. As above, this demonstrates that (a) my algorithm matches the published algorithm, and (b) the algorithm has been reviewed and shown to work.
However this doesn't necessarily explain how the code works, and what the various classes are supposed to do. When you go to write some 'real' documentation - a developer guide to the system - you should explain what you've done and provide enough information for future support. In my opinion this document should be readable by a technically agnostic person; it doesn't need to be 'dumbed down' but it should exclude jargon and not rely on assumed knowledge.
Answer: Comments surrounding the source is the first thing you should do. This makes sure that there is a direct link to the documentation right by the code. If the documentation is very complicated, consider posting only an abstract in comments, and then a link to some external document that contains a more complete description of the architecture/complex algorithm. If it's not too complicated, however, consider including all the documentation in one place. This will maximize the likelihood of your code/documentation staying in synch and are read together.
Answer: Document the code to the extent your team/company needs it. If a jr. dev is going to be required to maintain the code, you may have to go into detail about some of the math. This is a management decision and they have to give you the necessary time.
I don't think you have to document the code so much that you account for being replaced by a lesser developer. If that is a concern, you need to be given time to document.
You shouldn't have to do the web search for them.
Comment: "If a jr. dev is going to be required to maintain the code..."  In my experience it's better to just assume that everyone reading your comments is a jr. dev.  If they aren't then they wouldn't be reading your comments.  Even if they are not jr. and are still reading your comments, jargon and assumptions lead to miscommunication.  Finally...most devs, like every other field known to man, get through life not really giving a damn and never really get a whole lot better than "jr".


Midori and Java plugin

Question: How can you get java plugin to work in midorι? I have tried to use some web apps that require java and they don't work because it seems that midori can't find the proper java plugin like Firefox does.
Any help appreciated bercause I would like to use mainly midori, since it is very light and fast.
Answer: I solved it by installing java and enabling java plug-in
Instructions:

Install jdk from here
Enable plugin.
Go to preferences --> extensions

Note: You can verify at: https://minecraft.net/
If java plugin not enabled: here
After enabling : here

Midori and Java plugin


Difference between ストーリー and 物語

Question: In media studies academic papers I see sometimes the term ストーリー is used and other times 物語 is used. I feel there might be a nuanced difference between the two. Could someone explain scenarios when something is one but not the other?
Answer: Story in English is a word that can refer to both the work/tale itself and its plot/content. When you say "the plot of this story", story refers to a work. When you say "the story of this movie", story refers to the plot.
In Japanese, both ストーリー and 物語 can refer to both a work itself and its plot. But there are nuances you have to consider.

物語 tends to refer to a work itself, and it's often a dramatic, long and/or old one (tale, legend...). It can also refer to the content of a work, but when it does, it functions more like drama rather than plot.
ストーリー tends to refer to a plot. It can also refer to a work itself, but when it does, it's closer to (often short) episode.

For example, it's natural say この物語のストーリー referring to the plot of some dramatic work (novel, movie, etc.), but このストーリーの物語 sounds a bit puzzling to me.
Things like fairy tales, folklore and legends are almost certainly 物語, not ストーリー. On the other hand, customer stories you can find on business websites are not 物語 because it's short, modern and, um, businesslike.
When you visit the official website of a movie, you can find the ストーリー (or あらすじ) section. It would be rare, if ever, to see 物語 in this situation.
この映画のストーリーに感動しました and この映画の物語に感動しました are almost the same. 彼の演説にはストーリーがあった sounds to me like his speech was technically well-constructed, whereas 彼の演説には物語があった sounds to me like his speech was dramatic and heart-touching.
Answer: In terms of meaning, both are not so different. I think both can be translated as story in English, but sometimes (probably recently) they are used when people want to emphasize the coherence of the whole story. They are more about idiomatic expressions rather than nuances.
For example, typical examples may be like the following:

プレゼンにストーリーを持たせる
物語としてのコロナ騒動

In these ストーリー/物語 are not interchangeable.
The former literally let the presentation have a story. The intended meaning is that the presentation is given as a single coherent story in such a way that it is understandable from the beginning to the end without (too much) diversion.
As for the latter, it is literally covid-19 as a story, and 物語として does not really mean much. The whole phrase means that the prose is composed as a single story rather than a collection of facts. It does have some connotations that the story is partly fiction, but not necessarily that the whole story is invented.
As a practical distinction, I have the impression that ストーリー is more frequently used for expressions common in business contexts.

A dictionary definition of 物語る has 'あるまとまった話をする。' . I think this まとまった話 is the closest meaning in the above usage.

Difference between ストーリー and 物語


Book series, girl who works for a supernatural forces unit?

Question: I am looking for a book series I read approximately 6 years ago (2010), in which a girl works for a special supernatural forces unit. They take down zombies, vampires, werewolves, etc.. She lives there and her best friend is a mermaid and I think her ex-boyfriend is a fairie. I really want to read this book again but I cannot think of the name! Thanks!
Answer: Paranormalcy (2010)

Paranormalcy follows the efforts of the International Paranormal Containment Agency (IPCA), a group tasked with policing various mythological beings who live secretly among humans. The protagonist of the story is an IPCA officer named Evie, a teenage girl who possesses an ability to detect paranormals disguised as human beings.
Evie's allies include a shape-shifting boy named Lend, who she meets as the story begins, and a faerie named Reth, whom she previously admired. Both young men become romantic interests of Evie's as the tale progresses, while the three of them are joined by other companions as well. At its center, Paranormalcy examines Evie's attempts to balance her IPCA duties with her growing desire to lead a normal teenage life.

It was followed by Supernaturally (2011) where Evie flirts with a normal life and learns more about her background and Endlessly (2012), which according to Wikipedia, "Evie must deal with a new IPCA director, as well as the continuing battle against the Dark Faerie Queen."
Comment: @katelynrnyletak: When you return, if could click the checkmark under the voting buttons if this answered your question, I'd be much obliged.


Fortigate - Routing DSCP tagged packets through different WAN connections

Question: I have 3 WAN connections and a remote site with a single WAN address.
What I'd like to do is monitor the latency towards the remote site using a single machine (Opsview) on our LAN but through all 3 WAN links.
I know I can tag the packets using DSCP but I wasnt able to determine if it's possible to route the traffic via the Fortigate unit accordingly.
Comment: If you want to monitor things like latency, there are things like IP SLA to do that. Marking with DSCP can be used with QoS to give preferential treatment to certain traffic. For instance, you probably want most of your traffic to remain as BE, but things like VoIP should get priority, and things like server backups should get the worst treatment to prevent them from hogging the bandwidth. This only works within your network; ISPs will ignore your DSCP markings and policies, and it is likely that everything will be set to BE as it crosses the Internet.
Comment: @RonMaupin I believe the OP is just seeking to use DSCP tags locally as a means to differentiate between the 3 paths in a PBR rule (the tagging being done on the Opsview server I assume), not to actually send VoIP down one and backups down another. However, the fact that your DSCP markings could get removed by the ISP, as you suggest, could be a problem for ensuring that the return path is the same as the initial path, unless the device on the remote site has some sort of proprietary mechanism in its session table that guarantees that.
Comment: That's actually routing 101.
If I initiate the traffic through 184.108.40.206, there's no way for the other end to send it back anywhere else besides my origin. Even if the ISP removes the tags it doesnt matter as it's only for me to tell my router "take these packets and send them through this gateway".
Answer: You want to configure up policy based routing. In the gui this is found: Router > Static > Policy Routes. You can do this by using TOS rather than DSCP.
WAN1:
Incoming interface: LAN
Source Address: Opsview Machine IP
Destination Address: Remote Site WAN IP
TOS: Assigned Value
Outgoing Interface: WAN1
Gateway Address: Next-hop for that WAN.
Do the same for the other WAN links changing the appropriate values.
Comment: Would you happen to know what's the difference between Bit Mask and Bit Pattern?
Comment: You can use it in a similar way to a subnet mask. You can allow for a range to tos values. Page 26 of this Fortigate Documentation talks about it: http://docs.fortinet.com/uploaded/files/1953/Advanced%20Routing%2052.pdf.


Reducing Ammonia Levels in Body through Bowel Movements Only

Question: Can high ammonia levels in body be reduced solely through repeated bowel movements (4-5 per day), i.e., WITHOUT the use of Lactulose?
Answer: Lactulose can decrease the blood amonia levels by either drawing some ammonia from the blood into the intestine (MedlinePlus) or by inhibiting ammonia production by the intestinal bacteria and hence its absorption into the blood (Digestive Diseases, Emedicine).
By having frequent bowel movements, you could theoretically give less time to intestinal bacteria to produce ammonia from the undigested food, but, without laxatives, it may not be realistic to just decide to have 4-5 bowel movements per day.


Only I can initiate ubuntu 12.04 in my notebook, only if I place the memory USB with which I installed it

Question: I installed ubuntu 12.04 from a memory USB, but now to be able to initiate my computer I must place the memory USB, if a black screen does not remain with a script blinking. I reinstalled it to see if it was solved but it followed the problem. How can I arrange it?
Answer: Sounds like grub installed on the USB drive.
Try booting with the USB drive installed,
Safely remove the USB drive.
In terminal run:
<code>update-grub
</code>
Answer: If

sudo update-grub

didn't work, try

sudo grub-install /dev/sda


VW Golf MK4 1.6 to 2.0 engine swap: which ECU to use?

Question: i successfully changed my engine from 1.6 to 2.0 in a MK4 Golf 2001 the engine 2.0 start fine and run soft, but i am using the engine ecu from the 1.6. my question is if i can change the ecu from 1.6 to 2.0 using the wiring harness of the 1.6 engine?
Comment: Welcome to Motor Vehicle Maintenance & Repair! You definitely don't want to run the 1.6 ecu, because the tune is all wrong for the 2.0. The 2.0 is going to need more fuel to run correctly. If you don't, it will run lean and you run the risk of damaging the engine. You can try to put in the 2.0 ecu if you have it ... if the plugs don't match up, then the answer would be no ... I'd highly suggest you *try* to put in the 2.0 ecu, though, just to keep from damaging the new engine.
Comment: yes i know in this moment i am not using the car for this issue i will try some 2.0 ecu, thanks for your time
Comment: @Paulster2 is correct - you need the 2.0 ecu. What you should do is to check the pinouts for the connectors between the two cars - everything should be in the same place, and the components should be the same - tps, cps, map, maf etc etc
Comment: @SolarMike thanks for your time and help!, i will test to day some 2.0 ECU
Answer: Welcome to MVM&R!  As you've already found out, the wiring in the car allows you to start the 2.0 engine with the 1.6 ECU.  The main reason for this is that the wiring loom is effectively the same across most of the Mk4 Golf range.  You will find that pretty much everything between the 1.6 and 2.0 will be plug-and-play with one possible gotcha.  In 2001, the Mk4 Golf was face-lifted.  Externally you'll see little change between the old and new version but mechanically and electronically, the two vehicles have some key differences.
Ideally you want to switch to a 2.0 ECU, or at very least have the 1.6 ECU remapped to suit the fuel and ignition demands of the new engine.  You will however find that if you simply plug an ECU from a 2.0 into the car, it will not start.  The inbuilt immobilisation in the Mk4 ECU ties the ECU, clocks (i.e. instrument cluster) and ignition key together.  If you have all three from a 2.0 and it is the appropriate vintage (i.e. from a pre or post 2001 car depending on what you have) it will go in and work.
Alternatively you can either have the immobilisation defeated by sending the new ECU to a specialist or you can have a specialist program your new ECU to your existing instrument cluster and code in a brand new key transponder chip.  If you do go this route, you'll encounter the terms IMMO2 and IMMO3, this simply relates to the immobilisation system present on the car.
So, in answer to your ECU question, you either want a native 2.0 ECU or have your 1.6 ECU remapped for the new engine.  You should not use the unmodified 1.6 ECU with the 2.0 engine.  As for loom, Volkswagen have been very good at standardising wiring looms since they introduced their CE1 standard back in 1985.  Yes, the 2.0 ought to plug straight into the 1.6 loom but just ensure that any parts vehicle you use is from either pre-2001 or post-2001 depending on the age of your Golf.  If you mix and match pre and post, they will generally still work but you may find yourself chasing odd issues.
Comment: thanks for your time and your answer my friend have some ECU 2.0 and in this moment where testing all IMMO versions
Comment: Hi, guys new update i test some ecu 2.0 the same plug the immo is version 2 whiout pin, i test 3 ecu and on all ecu i have the same error :P1579 - 35-00 Adaptation Not Started and P1565 35-00 Lower Stop Not Reached i think the problema is the ECU Coding i have the same problem in the 3 ecu
Comment: ok, swap succesfully whe have to change som few pints on the wiring harnes now my Mk4 Is full 2.0 Engine and ECU thanks all for the help


PostGIS-syntax: export query-result to QGIS / Shapefile

Question: Using PostGIS: syntax-basics for function, I was able to solve a long-standing problem by creating a geometry, using a SQL-query with PostGIS. However, I want to use the created geometry in QGIS and have problems exporting it.
QGIS 3.8.2. Zanzibar, Windows 10, PostgreSQL 11.5.1., PostGIS 2.5.2
The query I used was as follows - it creates a Medial Axis of a Polygon (Shapefile bufferrail imported to PostGIS with shp2pgsql-gui.exe):
Select ST_ApproximateMedialAxis(geom) from public.bufferrail;

The result is shown in the Geometry-viewer-tab in pgAdmin4 and it looks like what I wanted to accomplish. However, I failed to export this result into QGIS. What I already tried:
1.) Using database-manager in QGIS, when I perform the query there and try to load the result as a new layer (load-Button), I get an error-message - see the protocol-entry (in german, unfortunately, it basically says Invalid PostgreSQL-Layer and WARNING: incorrect query):
Ungültiger PostgreSQL-Layer
WARNING    Fehlerhafte Abfrage: SELECT "" FROM (SELECT row_number() over ()
AS _uid_,* FROM (SELECT ST_ApproximateMedialAxis(geom) from public.bufferrail
             ) AS _subq_1_
             ) AS "subQuery_0" LIMIT 0 ergab 7 [FEHLER: Bezeichner in Anführungszeichen hat Länge
null bei »""«
             LINE 1: SELECT "" FROM (SELECT row_number() over () AS _uid_,* FROM ...
              ^
             ]
2019-08-25T23:47:57     WARNING    Ungültiger PostgreSQL-Layer

2.) Again in QGIS database-manager, I created a view from the query result. When I try to add this view to map (always from QGIS DB manager - right-cick on the view in pubic), QGIS always crashes.
3.) Still in QGIS database-manager, I try to export to file (Geopackage) - however, when I add the saved file as a layer to QGIS, an empty layer with no geometries is added.
4.) In pgAdmin 4: I run the SQL-query mentioned above and than click Download as CSV. I get a text-file with cryptic content (when opened in an editor). So no idea how to use it.
5.) I tried to google export shp from PostGIS and tried to use pgsql2shp - however, all of the many expressions to include pgsql2shp in my query failed - again, no idea how correct syntax works here.
6.) By the way: is there no way to use a simple GUI-method for export - similar to import shp to PostGIS with shp2pgsql-gui.exe? I tried the Export-tab in the GUI there, but export works only with tables. So probably a solution would be to convert the result of my query to a table - but unfortunately, again all my efforts failed - wrong syntax, again!
To come to my question: I don't care much how I can export the result form a relativele simple query in PostGIS to opening it in QGIS. Probably solution 5 is the most promising: so if someone could help with correct syntax, connection my original query and the export-function with pgsql2shp. But any other solution is good, too.
Answer: There was a comment to my question that provided an answer to my problem, but it disappeared meanwhile - however, here is the solution, proposed by user MrXsquared:
I simply have to add a unique ID field - I included the fid from my input-layer bufferrail:
SELECT fid, ST_ApproximateMedialAxis(geom) from public.bufferrail;

With this result, I could add it as a layer in QGIS (solution 2 from above). Still, exporting that layer created another issue with unique ID, but I simply had to select all objects and insert it in an already existing line-layer.
For background-information, more details on QGIS returns "Invalid Layer" message when trying to add PostGIS view?


Hearing and neurons- do ears have a sampling period?

Question: From what I have read, outer hair cells in the human ear amplify incoming signals and inner hair cells "pick-up" the signals and generate action potential. However, neurons have refractory periods during which they cannot fire again. Does this mean that the human ear has a "sampling period" within which it cannot "pick-up" sounds?
Answer: Inner hair cells (IHC) do not fire action potentials themselves. It's the auditory-nerve that synapses with IHC that generates action potentials. The firing rate of the auditory nerve can be as high as few hundred Hz with a refractory period as short as 1 ms or so (depends on the animal).
However, it is important to note that the signal is not sampled at this rate. As you may know, the auditory signal is first transformed to the "frequency" domain through the physical structure of cochlea. Each inner hair cell therefore is roughly only encoding the relative strength of a frequency band. There are presumably inner hair cells in the human cochlea that correspond to a range centered around 18 kHz for example, but neither the neurotransmitters of the corresponding IHC nor the auditory nerve can fire at 18 kHz. Nevertheless, the amplitude modulation at this high frequency is what is transmitted.
Also, thinking of neural firing as a "sampling period" is not always a good analogy. There are debates about this, but it could be that precise timing of action potential carries large amount of information about the stimulus (perhaps not so much so in early auditory system.)
If you want to see some computational modeling work for inner ear, IHC, and auditory nerve, I recommend the Meddis IHC model:

C. J. Sumner, E. A. Lopez-Poveda, L. P. O'Mard, R. Meddis. A revised model of the inner-hair cell and auditory-nerve complex, J. Acoust. Soc. Am. 111 (5) 2002
Comment: @user1155386 No. Signal is ENCODED by the train of action potentials. The information is there and can be DECODED if needed. This is more so because the amplitude envelope of the 18kHz signal will not change very fast. The brain is capable of interpolating through time, and it has many mechanisms for short-term memory. Things do not have to be represented instantaneously.
Comment: It probably bears mentioning that there is an extensive feedback stream from the auditory cortex to the thalamus that serves as a sifting mechanism for the incoming signal.
Comment: I agree with your explanation. I think cochlea can be modeled as a bank of band-pass filters giving a spectrogram-like analysis of the audio. Lets consider the 18KHz IHC for example. If the auditory nerve connected to this IHC fires(sensing a strong 18KHz band), it cannot fire for another 1ms. Does this mean that I can hear the 18KHz signal only after 1ms again?


Ordinal form of an unknown value

Question: In some science and engineering literature, it is common to right the ordinal form of an unknown number m as mth. While the ordinal form of number 1 is first, it is also commonly written as 1st. I was wondering what would be the most appropriate way to write the ordinal form of (m-1)? (m-1)th or (m-1)st?
Comment: Could "second-to-last" work? Even if you don't know the exact number of items, it unambiguously means "the one before the last", so if "last" were the Nth item, "second-to-last" would be the (N-1)th.
Answer: (m-1)th is still appropriate.  The expression in parentheses will still be read without the ordinal, so consider how it sounds when spoken—em-minus-oneth makes more sense than em-minus-onest.
I should also note that it's common to avoid the problem entirely through rephrasing (e.g. 'the value at index (m-1)'), but that may not be applicable to your field.
Comment: @Blade While it may vary from person to person (software dev myself), em-minus-first sounds to me like the mth value minus the first value, rather than the value at m-1.
Comment: I was reading it as em-minus-first.
Comment: Yeah, I would probably say em-minus-first, with the stress somehow avoiding any possible confusion, in which case I would write (m-1)st, if I had to - although I don't think I've ever actually written that, because as @AmaiKotori says, it's often easier to rephrase. But I would have no problem with someone saying em-minus-oneth and writing (m-1)th - I think it's just personal preference :)

Ordinal form of an unknown value


In English, can a whole syllable be aspirated?

Question: Living in Merseyside, I've noticed a phonetic oddity that I can't find described anywhere [I did a Web search and found a transcript of Liverpool speech on a Liverpool University site, but no mention of the following].  When single-syllable words end in T, the T is dropped but, if I'm hearing correctly, the whole syllable is aspirated.  Voiced consonants are still voiced but also aspirated. So 'but' is pronounced /bʰʊʰ/, 'not' pronounced /nʰɒʰ/ and 'that' pronounced /ðʰaʰ/.  Is this a recognized phenomenon, and if so, is it confined to Liverpool?
Comment: Precisely. In Hindi, open syllables beginning with voiced aspirates are all aspirated: /bhu, dha, ghi/ etc.
Comment: @John Lawler Being held captive by whomophiles?
Comment: Could you provide a link to the transcript you found?
Comment: I don't see why not, especially when whispering.  In AmE, "The" is regularly pronounced as /ðʰʊʰ/, for example.
Comment: I wish I could find that transcript.  It was 2 or 3 years ago, but I've only just discovered Stack Exchange.  However, I've just found a document which refers to changing final /t/ to /h/, though not to aspiration of the whole syllable.  See page 3 of:  http://eprints.lancs.ac.uk/4011/1/download2.pdf
Answer: There is no such thing as, "The whole syllable is aspirated." What you are describing is breathy voicing of the vowel, probably. 'Tis not aspiration.
Non-nasal stops may be aspirated. In some languages, voiceless (non-nasal) stops can be preaspirated, but typically aspiration occurs upon the release of the stop. Both voiced and voiceless stops can be aspirated, as shown in many languages of the Indian subcontinent.
Comment: Thanks for that.  So would the Liverpool 'but' as I described be rendered in IPA as /bʊʱ/  -  just the vowel 'breathy-voice aspirated', or maybe /bʱʊʱ/?


Son 2-3 years old doesn't want to eat porridge/cereal

Question: Dear parents and parenting specialists. What to do if my son doesn't want to eat porridge/cereal? We try everything, we want him to eat buckwheat, millet, oatmeal, muesli and semolina, but he refuses. In need of advice.
Comment: @L.B. He mostly rejects it and doesn't open his mouth, if we force it in he spits it out.
Comment: @My guess then would be he either doesn't like the smell or has had one bad experience with the taste of what he's being given and doesn't want to try it again.
Comment: In what way does he refuse it? Spitting it out? Ignoring it?
Comment: @L.B. Maybe pluck his nose with something before he starts eating? Will it help? )) Kidding... Yeh, we did give him semolina cereal and he eat a bit of it.
Comment: Lol... I'm not sure I'd go that far with it :) Perhaps a bit of cinnamon (well mixed), vanilla or maple syrup would help. In my personal experience buckwheat isn't much fun to eat, so I could see him turning his nose up at that :) You could buy regular prepackaged dry cereal such as Cheerios , put milk in them to soften it thoroughly and see if he'll eat that.
Comment: Hope to try it soon.
Answer: Our 3 year old doesn't like things that are mushy and would rather eat the cereal/granola dry with something to wash it down. It takes him a long time to eat it so our preference is scrambled eggs, toast and fruit or french toast and fruit.
Answer: That in itself is nothing to worry about.  You may continue to offer cereal occasionally, without pushing or feeling any alarm if it is rejected.
A nutritionally balanced repertoire, with  enough variety to keep things interesting, is what you should be aiming for.
The American Academy of Pediatrics has built a website aimed at parents, www.healthychildren.org.  In the section called Healthy Living, there is a section on toddler and preschooler nutrition, which says, in part:

Toddlers and preschoolers grow in spurts and their appetites come and go in spurts, so they may eat a whole lot one day and then hardly anything the next. It's normal, and as long as you offer them a healthy selection, they will get what they need.


Percentage of Restaurant Tables Appropriate for Wheelchairs

Question: A local restaurant remodeled and now they have mostly high tables with stools and booths. They only have a few tables appropriate for someone in a wheelchair. If a restaurant has plenty of tables available, but none are suitable for a person in a wheelchair, are they ADA compliant?
Answer: The ADA Standards , in section 226.1 requires that:

Where dining surfaces are provided for the consumption of food or drink, at least 5 percent of the seating spaces and standing spaces at the dining surfaces shall comply with 902.

Where section 902 gives specifics on the requirements for accessible dining surfaces.
It therefore seems that, in order to determine compliance, you would need to know how many dining spaces are available in total, and how many are wheelchair accessible. If less than 5% are accessible then the restaurant is not compliant, otherwise they appear to be OK.
Comment: Thanks. The percentages are approximately 20% normal tables, 20% booths, 60% high tables. So, it appears that they are compliant. 5% is much lower than I expected, maybe the intent was that a restaurant would attempt to reserve them for those that really need them (?).
Comment: They don't have to reserve them necessarily; when the restaurant fills they can tell a customer "you can use this table but if a wheelchair user arrives you'll have to leave". Don't know what happens if all tables are full, but in that case I suppose everyone has to wait.


How do I fix an uneven butt?

Question: I'm 4'11 and 84 lbs and have been doing the 30 day squat challenge. I'm on day 25 and I noticed that the right side of my butt looks better than the left. It's rounder and more lifted. I was just wondering how I could balance them out.
Comment: Did your butt even out? And how long did it take if it did?
Answer: That's pretty normal. Everyone tends to favor one side or the other -- usually your dominant side will be stronger.  One side may always be slightly more toned than the other, but you can make the difference much less noticeable by doing alternating unilateral movements such as weighted lunges, step ups, pistols, split squats, etc.
Answer: An interesting solution for you might be to the following workout every 2nd day for 2 weeks.
Warm Up.
Do some dynamic stretches.
Then only on your right side do a static glute stretch, this is so that you weaken the muscle on the right side a little, but please take extreme care not to over stretch as that can cause injury during the workout.
Now do a single leg squat on your right leg without any weights and on your left leg add 5LB in each hand and do the same.
You can incorporate this in any workout you are doing if you feel it will help.
Another option to look at is to do yoga, I have seen a lot of results in that area on myself with yoga.
Comment: I am not a fan of doing asymmetric training to balance out imbalances, chances are that you simply cause to shift the problem to the other side. Also I am skeptical about your argument that stretching weakens muscles.
Comment: @Informaficker you are right to be concerned, and that's why I wrote "2 weeks" and I agree its not the best solution but good enough if you are trying to avoid cosmetic surgery, and in regards to static stretching, I did not mean say that it weakens the muscle in general but just enough to keep it at bay while working out which has been proven.

How do I fix an uneven butt?


Can the UK and the EU delay Brexit again?

Question: That would be the fourth delay. But is it legally possible to delay Brexit again?
Comment: It should be noted that even if it _weren't_ currently legally possible to delay Brexit again, the relevant laws could simply be changed (with the consent of all the governments involved). Changing laws is what governments do.
Answer: It is legally feasible to delay Brexit again, provided that all EU member states (including the United Kingdom) agree in the same way that was done for the previous three delays.
Whether it is politically feasible is difficult to say with any certainty at this stage, as a large part of this will come down to the UK election result, as well as any elections in other EU member states that may take place between now and then.
Comment: Well they've already delayed it **3 times** already, so yes it's quite feasible.
Comment: Labour plan to offer a second referendum or 'people's vote' - the chance that they could pull this off between mid December and the end of January with enough time to put together a deal if the leave vote wins seems slim, especially given the time of year. So politically it wouldn't be feasible for them to NOT delay.
Comment: @LioElbammalf Assuming they are elected and follow through, of course.  But I'm not going to expand any further on that as it goes outside the scope of the question.
Answer: Legally, yes it's possible there is another extension, the same as before. The revised deal that Johnson agreed with the EU but technically has yet fully pass UK's parliament is in the same legal boat as Theresa May's deal, even though Johnson managed it one step further by getting the House of Commons to pass a 2nd reading of the draft legislation on his deal. But that Parliament is no longer sitting now.
So politically, it's probably too early to tell until after the UK general election. Unless you want an/the answer to delve into predicting the result of that election, and by implication of Brexit... Wikipedia seems to keep track of the latter. The November seat-level polling/models seem to point to a sizeable Conservative majority, perhaps enough to pass Johnson's deal thereafter. Interestingly, while the Conservative aren't doing much better nationally in opinion polls than in 2017, Labour is doing much worse for now, which seem to account for the seat difference.
And an interesting comment on Conservative remainers' electoral choice(s):

this group is also more likely than other party/referendum combinations to be undecided, with one in five saying that they had not yet decided how they would vote [...]
the Conservatives are banking on to ensure they hold on to seats such as Putney, south-west London, where the estimated remain vote was more than 70%, is that these voters will be too concerned about a Corbyn-led government, even a minority one, to "risk" a vote for the Liberal Democrats. [...]
The more the media narrative focuses on how unpredictable the election is, the less likely these Conservative remain voters are to feel they can safely switch their vote, in the end making the election rather more predictable than it first appears, and forestalling the Brexit realignment.

For what's worth it, regarding Brexit, Johnson has said that all future Tory MPs have pledged to back his deal:

Boris Johnson has said that all Tory parliamentary candidates have committed to vote for his Brexit deal if he wins a majority at the general election.
In an interview with the Sunday Telegraph, the prime minister said this pledge means that voters can be "100%" certain that a Conservative government will "unblock" parliament and deliver Brexit. [...]
Johnson told the newspaper: "All 635 Conservative candidates standing at this election – every single one of them – has pledged to me that if elected they will vote in parliament to pass my Brexit deal so we can end the uncertainty and finally leave the EU.
"I am offering a pact with the people: if you vote Conservative you can be 100% sure a majority Conservative government will unblock parliament and get Brexit done."

As far as I can tell, all the MPs whom Johnson removed the whip from are not running as Conservatives candidates. In fact most are not running at all in this election, only one (Anne Milton) seems to be running as an independent. Another (Sam Gyimah) has switched to Lib Dems and is running in a pro-remain constituency. So at least the (known) intra-Tory opposition to the Johnson deal appears to have been effectively eliminated from the ranks of the Conservative candidates.
Comment: Of the 21 MPs who had the whip removed, 10 were re-instated (after loyalty pledges presumably) but only four are standing in 2019 GE: Caroline Nokes, Greg Clark, Stephen Hammond, Steve Brine.

Some of them intended to stand down anyway, but others - such as Margot James - quit because they had lost the support of their local parties.
Comment: "Conservative aren't doing much better nationally in opinion polls than in 2017, Labour is doing much worse for now" The last election result may have focused some of the electorate's mind on the difference between "not liking the Tories" and "Electing Corbyn". And in practice, having completely lost their Scottish Labour MPs, a Labour government is now virtually impossible without SNP support, which they don't seem likely to get.
Comment: @alephzero Labour hold 7 out of 59. I know That's not great, but It's not completely lost. Especially considering Lab/Com/Lib each held only 1 seat in 2015. And Labour is much more likely to be able to work with the SNP on vote by vote basis than say the Conservatives and the DUP.
Answer: The only 'binding' document we have as of now is the United Kingdom's notification of intent to withdraw, then-prime minister Theresa May's letter from March 2017 which started the two-year countdown. Each extension was agreed on by both the United Kingdom (more or less) and the EU member states (unanimously). There is no provision in any of these that would prevent any further extension from being agreed upon; and if there were, the two sides (UK and EU) could agree to change that provision as it is all their agreement.
Therefore, the scenario I have seen perpetrated in jokes of a UK PM in 2119 travelling to Brussels in March as every year to present a letter to the EU asking for extension ('nobody remembers where this custom originated or why it is being upheld') is entirely possible.
The reverse is also possible. Assuming a long extension has been granted (say June 2020) but EU and UK manage to agree on a withdrawal agreement that comes into force on 1st March, an earlier departure than the negotiation period is possible (the wording of article 50 suggests that the two years are a maximum length, not a fixed period).
Furthermore, not even the document I gave the attribute binding is actually binding. The European Court of Justice has ruled that this letter was a unilateral declaration of intent of a sovereign nation and that further this sovereign nation is at the liberty of withdrawing their unilateral declaration of intent, stopping the Brexit process altogether.
Comment: I would also note that in the plain text of article 50 there is nothing preventing earlier departure than any deadline.  As long as all member states agree, the moment of the UK's departure can be at any time whatsoever.
Answer: Unlike ordinary mortals, states are not bound by any laws whatsoever (except for the laws of physics) as long as there is mutual agreement between them on what should happen. If the EU and the UK want Brexit to last for another 100 years, it will last for another 100 years. If both sides want the UK out tomorrow, it will be done tomorrow. Nothing in the current laws really matters, only the actual decisions of the heads of the 28 member states.
So the real question you should be asking is - is there enough political will to extend Brexit one more time? As of now this is unknown, as it hinges on the results of the upcoming UK elections. If Conservatives and the Brexit party gain a majority, the UK will be out very soon. If no majority could be formed, Brexit is likely to be delayed again. If Lib Dems win, Brexit could be cancelled altogether. Whatever the outcome it will depend strictly upon the collective will of 28 sovereign states, not upon some piece of paper someone signed a long time ago.
Comment: "Nothing in the current laws really matters": There is one thing that matters, which is the effect of a lack of agreement.  If there's no agreement, the departure deadline cannot be moved, which would result in the departure of the UK at the appointed moment unless the UK avails itself of the only available unilateral act by revoking Article 50.
Comment: When the rest of the EU consists of 27 entities, the only way for that statement to be true is by circular reasoning.  But my point was about technicalities, as is this question.  As your answer points out, Brexit can be delayed indefinitely and repeatedly by unanimous agreement, and there's no need to invoke the fact that states are not bound by law, because the treaty makes this explicit.  Anyway, the rest of the EU failing to agree on an extension doesn't imply that they want the UK to leave; the countries that reject the extension might be perfectly happy for the UK to revoke Article 50.
Comment: @phoog "there's no need to invoke the fact that states are not bound by law, because the treaty makes this explicit" -> unfortunately it's needed for every question on international laws, as there is a widespread misunderstanding over how these laws really work
Comment: @phoog lack of agreement really means that the EU wants the UK to leave. Having it in a previous agreement is just the excuse, not the true root cause.
Answer: The delay could be expanded again until all the EU members and UK agree to extend it.
Sometimes temporarry is almost definitive, like the Eiffel tower, that was built as a temporary structure.
Is interest for EU to have UK inside EU? Definitively yes, especially if the other option is a no-deal brexit. Uk is really interested to have a no-deal brexit?
I suppose that when all the parties involved will get a swiss-style deal maybe things will change.
About the border controls: Italy  and Frange are both in EU and Shengen area, but last time I've made a trip in France on a bus, cops with dogs asked for an ID and took dogs to find drugs, so even in EU controls at the borders are possible.


What is the ribbon in this picture of a 2006 MacBook?

Question: I accidentally ripped it when removing an old hard drive. Now the computer won't power up. What is it and can it be replaced?
Answer: The orangey cable? I can't say exactly what it does, but it's clearly a data cable of some sort, and so an integral component.
You might want to look through a complete tear-down on ifixit.com, which might identify it. You're unlikely to find that as a spare part, unless you buy another similar model (eBay 'For Spares') and strip out the part you need.
Given the age of the Mac, you might be better off putting money into a newer model. A 2009 or higher MacBook would give you significantly better hardware, more compatible with newer software and hardware.
Comment: Thanks a lot. I'm gonna keep looking for the part. I have a 2014 MBP as my main computer. I was trying to install Linux Mint on this one to use for other things. I'd like it not to go to waste.


Segula Pitum Ketoret on Klaf

Question: I have heard that there is a segula for reading pitum ketoret from klaf.  What is the specific segula and what are the sources?
Comment: Isn't it a problem to write Torah SheBe'al Peh in general? I've heard that the justification for continuing to write it, after Rebbi (who had good reason to do so), is that at least we're not writing it on Klaf. Anyone else know about this?
Comment: great question--I have seen that a lot recently and never remembered to ask!
Answer: This site (which I've never heard of) cites a number of sources for the practice of reciting the paragraph, one of which ostensibly relates to specifically reading it off of קלף, the others of which point out that reading it in general is a סגולה.
The first one is from Seder Hayom, which says

one who fears for himself and for his soul should put great effort into this matter, namely to write the entire text of the ketores (the composition of the incense) on kosher parchment in ksav ashuris (the script in which a sefer Torah is written), and he should read from this scroll daily, once in the morning and once in the evening with great concentration, and I guarantee [that this will help].

The copies of Seder Hayom hosted on hebrewbooks.org have
(bottom paragraph)

ולכן ראוי לכן בעל נפש להשתדל בכל עז לאומרה בכ"י פעמיים בבקר ובערב ולכוין בו מלה במלה

and

ולכן ראוי לכל בעל נפש להשתדל בכל עז לאומרה בכל יום פעמי' בבקר ובערב ולכוין בו מלה במלה

I am no Seder Hayom (or otherwise) scholar, but the first version here could be misread as meaning that it should be read from a manuscript if כ"י stands for "כתב יד", and not "כל יום", which is what appears in all three of the earlier versions. However, none of them mention anything about kosher parchment, כתב אשורית, or a guarantee.
This site gives the citation for the כף החיים in אורח חיים 132:23, which itself cites some other sources including the כף החיים (?), saying that קלף and כתב אשורית are a סגולה for wealth and general success.
Comment: I know the director of that site.  He wrote book published by Feldheim on Tefillin and other Safrut matters.  Generally he is a well respected sofer.  I will have to look up the source in the Kaf HaHaim, however most of the sources he lists are just the reason for reciting the Pitum Ketoret... not necessarily on Klaf.

Segula Pitum Ketoret on Klaf


Are employer 401k matching contributions invested prior to vesting?

Question: Do the employer match contributions to a 401k before they are vested go into the investments that are selected for the employee contribution?
Comment: I would guess so, but have you asked your HR department?
Answer: I have worked with several companies, the vesting investments were handled two different ways.
1) Pre-Enron: All the matching funds were invested in Company stock. We couldn't sell those shares until we retired or closed the account when we left the company. We could also put our money into the company stock, but that wasn't advisable. Eventually they did allow people over 50 or 55 to move existing matching funds into other investments.
2) Post-Enron: The default case was for matching funds to be invested in the same proportions as the employee investments. In one company it was possible to set percentages for employee funds, employer match funds, employee dividends, employer dividends.
HR should be able to answer your question regarding your options.
After the collapse of Enron, the US government opened up many of the policies regarding investments within 401Ks. Locking into company stock was forbidden. They also standardized the rules regarding how long a company has to fully vest the matching funds.
Comment: Pre-Enron is not a "different" way, it is now **illegal** and thus irrelevant.
Comment: I will add that it is illegal. Put I have know people who didn't realized it changed. They still put everything into company stock.
Answer: Generally, it depends. You should check with the plan provider. I would expect (as I've seen on all my 401ks since I started having them) that you will be able to either have them invested per your general investment selection, or be able to select investment options specifically for the match portion.
Comment: @Daniel then the answer is yes
Comment: My question is about whether they are invested before they vest, not whether I can choose how to invest them.
Comment: If you can chose how to invest them - doesn't it mean that they will be invested? Otherwise what are you chosing...
Comment: @littleadv I understood this answer to be talking about employee match after it is vested.
Answer: It depends.
There are two factors here: employer match vesting and contribution source elections.
I have worked for both types - employer match vests immediately and where it has a vesting schedule.
I have only had 401k accounts that allow you to identify contribution elections based on the source (rollover, employer match, employee contribution). Thus, you have control either way.
If a 401k account exists that does not allow you to separate your elections by source, only then would this question come into play. In that instance, you don't get to select differently anyway so it doesn't make sense.


How do I make breakfast when I don't have time to make breakfast?

Question: I'm usually/always caught up in the morning rush hour and sometimes skip breakfast because I don't have time to cook up something and most importantly because I don't know even a bit about cooking. So what's the best way to arrange or make my favorite meals without spending much time in that rush?
Comment: What kind of food do you eat for breakfast? Are you prepared to change? Where do you live, so we know what kind of food is available?
Answer: Learning how to cook and cook quickly is probably too broad a question, so let me suggest some things that count as "hacks"

make extra dinner, keep it in the fridge, and warm it up for breakfast. Not all evening meals make a valid breakfast (or reheat well) but many do.
prepare something in the evening that is ok for breakfast that you can just reheat in the morning. Perhaps make a lot of it on the weekend and freeze it.
stock your home with  things that you can prepare super quickly. Instant oatmeal, frozen sausage patties, bagels, cream cheese, frozen waffles or pancakes, yogurt, granola, whatever it is you like
keep something in your car, bike bag, backpack, briefcase, or desk that you can eat for breakfast if you somehow leave the house without eating. A protein bar, for example

You don't have to eat official breakfast food at breakfast. Eat what works for you.
Comment: As an example on part of this answer, we used to make chocolate chip waffles and freeze them. Plenty of flavor on their own and don't even need to be heated up, can be eaten with your hands while frozen. Make a big batch on the weekend and freeze them separately.
Comment: I always keep protein bars for the lazy mornings. Works fine for me.
Answer: While I'm not a big fan of hurrying meals which not only means a considerable loss of quality of life but is also unhealthy (you could really just get up 15 minutes earlier, you know!), if you truly don't have enough time in the morning, you need to apply the same strategy as in many technical fields: work asynchronously.
That is, put eggs into the egg boiler, and set the electric kettle (and maybe the toaster) on before going into the shower. If you don't shower in the morning, make that "before you shave" or any other daily "biological morning activity".
The eggs will still take their 6 minutes, but the latency is hidden by the fact that you do something else in the mean time. Water will have boiled and only needs another 5 seconds to boil again when you come out of the shower.  The individual times for each procedure do not add up, and thus the overall duration is reduced.
Boiled eggs make a marvelous haste breakfast, too, since you can (although, again, I recommend against it) peel them in about 3 seconds by rolling them if you have some practice, and you can swallow them whole on your way out. Not pretty, no joy, but works for staying alive.
As a bonus, choose the clothes that you will wear the evening before, and lay them on a table or over a chair, ready to dress. This will buy you some 3 minutes "for free" which you can spend on having a real meal rather than swallowing whole eggs, for enhanced quality of life.
Answer: I'm sure you can manage lunch and dinner by buying a sandwich and a ready meal for the evening.
As for breakfast, eat proper oats - buy whole rolled jumbo oats. When you get up and put the kettle on (assuming you have tea or coffee before leaving) throw a couple of tablespoons of oats in a dessert bowl or dish. When the water boils, pour over the oats so you can see a layer of water on top. Now go away and do whatever you do to get ready for work (shower, shave...etc). Check the oats - if the dish is cold, cool or warm (not hot) sprinkle over whatever you fancy - sugar, honey, berries, or nothing, then eat it. Much healthier than easy oats or instant oats, and much nicer too....
Answer: To make sandwiches faster use muffin tins:

Pic taken from above link and source on pic.

Take sandwich toppings and put it in the muffin tin holes the night before then refrigerate. When you wake up the toppings are already cut and organized, so making sandwiches are easier and faster.

Make food beforehand:

Many foods do not have to be made the day of, they can be made days or a day before. Packaging dinner for breakfast or making a salad the night before can save you time. Restaurants/ caterers make food the day before.
Answer: I just have either a Protein Shake or Soylent for breakfast. Its fast an easy and does the job.


Existing InfoPath form to Visual Studio

Question: Can we convert existing InfoPath 2010 form to visual studio and make it applied to list? I am using SharePoint 2010 and InfoPath designer 2010. We have an existing InfoPath form used by a list in our SharePoint site and the user is looking for this change over.
Is it possible?If so can someone give suggestions or steps how to follow?
Thanks in advance
Answer: This might help you, depending on how you publish your InfoPath Form. Try publishing it as a Content type and then it becomes re-usable in one or many libraries. My blog here will help you http://www.legeris.net/blog/2016/1/31/5cis6ei4qmhxqd4sithfi9d2vrs7fi#PubCTDemo

Existing InfoPath form to Visual Studio


Blum Blum Shub PRG

Question: What is the reason behind the fact that the BBS generator only outputs the n least significant bits or the parity bit for each Xn it produces internally? That is, if it outputs the full Xn's that it produces, is there a way to differentiate it from a truly random function?
Comment: "Blum Blum Shub"? Is that a random number generator, or a drowning Stooge?
Comment: @phenry: It is a random number generator: http://en.wikipedia.org/wiki/Blum_Blum_Shub
Answer: The usual answer to this type of question (why use only the lowest-order N bits?) is that it prevents leaking too much information about the internal state of the PRNG.
If you give your attacker your full X_n state at two consecutive states, they could easily(?) determine the modulus and thus calculate all future states of the PRNG.
That is, given the values a = X_n and b = X_(n+1), the attacker need only find the M such that b = a^2 mod M. As long as a^2 is larger than M, I think this should be easy to do. If M is larger than a^2, then b = a^2 and the attacker needs keep asking for numbers until the modulus comes into play.

Blum Blum Shub PRG


My apple juice is not fermenting

Question: We have done two lots of apple pressing recently. One about 6 weeks ago and another 4 weeks ago. On each occasion we got 5 gallons of juice. So far it has not fermented at all. I used sodium metasulphite to rinse everything out and was fairly liberal with it, but not stupidly so. Otherwise we have added pectinase and yeast nutrient to both barrels. The SG has not budged in this time and the juice (on Sunday last) tasted of apple juice. I have used 6 packs of good champagne/cider yeast with one batch and four with the other (three different sorts of champagne/cider yeast) and I have stirred and agitated (I racked off into another barrel and back again to get as much O2 in as possible). The sulphite strips suggest there is about 10 mg/l remaining so, theoretically, this should not inhibit fermentation. The back kitchen is warm enough.
The yeast has been sprinkled on the top several times and on some occasions has been encouraged to begin its fermentation by leaving it to stand in warm water with a bit of sugar added (I make bread, so understand yeast). I have given the yeast about a week to work on each occasion but to no avail.
Anyone any other ideas as to what I can do to encourage 10 gallons of apple juice to ferment? We did not have this difficulty last year (our first year when we had a 'vintage' brew) so we are stumped.
Comment: You say you are fermenting in a barrel? What was in there before?
Comment: A plastic barrel or tub. One was brand new and the other had been used for cider last year and nothing else.
Comment: Did all your yeast packets come from the same place/were they all stored in the same manner? Is it possible something catastrophic happened to your yeast before you pitched it?
Answer: I would say it's the Sodium Metasulphite, inhibiting yeast growth.
You need a lot of pure oxygen to defeat that oxygen absorber.
In one experience it took 4 liters of pure oxygen through a .5 micron stone on a stir plate. For 1 gallon of white grape juice that used a metabisulfide as a preservative.
Or you can do a full pitch of yeast and skip the growth phase the yeast won't need oxygen so the preservative has no effect.
Answer: For a good fermentation you need several things: sugar, yeast nutrients, oxygen, healthy yeast, and the right temperature. Sugar should be fine, given the fact that it's almost impossible not to have any in your case! Yeast nutrient you have added. That leaves oxygen, yeast health and temperature. Oxygenate (or at least aerate) your must and see if that helps. Proof your yeast by dissolving a teaspoon of sugar in about 1/4 cup of luke-warm water, adding a packet of yeast and letting it stand for about 15 minutes. You should see some activity in the form of foam floating on top. If there's none, your yeast is dead. I'm assuming your must is in the temperature range required by the yeast as specified on the package.
If you had been working from commercially produced apple juice, my concern would be a preservative (pimaricin, potassium sorbate, etc.) specifically aimed at killing fungi (molds but also yeast). But apple juice from your own pressings would be free of all that. (Right?)
Also note that not all fermentations are readily apparent to the naked eye (or tongue). A hydrometer is the weapon of choice when it comes to finding out what is really going on. Take a gravity reading, write down the number, and take another one 48 hours after. If the second reading is exactly like the first one, no fermentation takes place. If it is slightly lower (on the order of 1 to 4 gravity points or so) you have a very slow fermentation on your hands (also not good). If it is significantly lower, you've got a proper fermentation.
So in summary, ensure you've got enough sugar, live (and healthy!) yeast, nutrients and oxygen in the mix at the right temperature, and you should get a fermentation. If you don't get any, these are pretty much the only possible causes.

My apple juice is not fermenting


Photos vs iPhoto events

Question: Should I be using Events or Albums? Say I go to the Zoo with my family, take some pictures and then import into Photos. Is that an Event or an Album? I always used Events with iPhoto.
Answer: There are no Events on the Photos.app.
You should have all of your old iPhoto Events, but they are Albums now.
This answer describes a way of manually replicating some of the Events functionality:

(…) you can create an Album from the last imported by selecting all in the Last Imported album and clicking the + icon on the toolbar.
Answer: Unless you don't take many photos, replacing the concept of Events with Albums will quickly become unmanageable in Photos. I'd suggest turning on the sidebar and taking a look at the Photos view to see what Apple has replaced it with - an automatically generated stream called Moments. It basically does what auto-split events during import did in iPhoto, except instead of creating a discrete Event (that was basically an album with a different name), it does it on the fly as you're scrolling.
It has its upsides and downsides, but one nice thing is that if you later add additional photos from the same timeframe, you don't have to manually merge Events or anything like that.

Photos vs iPhoto events


Is Earth's atmosphere 1600 km thick?

Question: Some textbooks say that atmosphere extends up to 1600 km, but exosphere is more than  9000 km thick.
Where is the mistake?
Comment: Could your reference some of the textbooks that say this and what context it is written in?
Comment: Welcome. And a good textbook says why it chooses a certain figure and discusses alternatives.
Comment: it looks like your information is almost correct https://en.wikipedia.org/wiki/Atmosphere it had been nice if you had done a search on the net before asking it here,to learn more about the atmosphere please take a look at the related Q&A on the right side of this page.
Answer: I agree with the comments; some upfront research would be good here, even at a basic level.  A good place to start is this Wikipedia article, which gives not only atmospheric heights but also other characteristics such as composition and the behavior of molecules.
In terms of heights the Wikipedia article suggests 700 km for the lower boundary of the exosphere, versus 1600 km in the question. Neither figure is really wrong because, of course, when you're dealing with atmospheres there is no hard and fast boundary between layers.
Similarly, the 10,000 km altitude given for the top of the exosphere, where it merges with the solar wind, is not hard and fast either; it depends on how you decide where the solar wind becomes dominant over the molecules bound by Earth's gravity.
Moreover, the outer boundary of the exosphere, however you define it, should not really be considered spherical.  The solar wind moves outwards from the Sun, so the exosphere is compressed on the side facing the Sun and pulled out like the tail of a comet on the opposite side.  The same effect is seen with our (and other planets') magnetosphere, because the solar wind also contains electrically charged particles.
I hope I've whetted your appetite for more in-depth exploration.  Good luck!

Is Earth's atmosphere 1600 km thick?


Outbound Messaging and decimal fields

Question: We are facing an issue with decimal fields while using outbound messages to an external system. Basically we are using outbound messaging for opportunity and sending few decimal fields to other systems via Integration. Now when the value in these field is larger than 8 characters, SFDC is adding 'E' to the value. e.g. if the Field value is 87,678,687.00 in SFDC, the value send in the outbound message is 8.7678687E7. Any suggestions to solve this issue?
Answer: Could you try to convert the value to a string and return text form the method and not a number? Maybe if the value is a string the system respect the format and it is not affecting for any conversion.

Outbound Messaging and decimal fields


Do pigs find truffles while you're not in the farm?

Question: I haven't had pigs for long, but it seems like every time I've seen truffles, I was in the farm at the time they were dug up. Similarly, I haven't seen any truffles after being gone from the farm for almost the entirety of the day, but I'm not sure if it's a coincidence. So are pigs able to find and dig up truffles while you're not in the farm to see it happen?
Answer: Yesterday I collected my first truffle. I had been running around town all day, and discovered it sitting in my barnyard at the end of the day. It hadn't been there earlier in the day when I was on the farm. So, I conclude that truffles can be left by pigs regardless of whether you're on the farm or elsewhere.
Answer: Pigs have to be outside. If you check latter you may find truffles even if your are not in farm


When is it appropriate to downvote a question?

Question: Clearly there are some questions asked that are not appropriate for the site.  Many of them come from users that are new to the site.  I have no problem with voting to close the questions, and providing the user with an explanation of why.  But even though the question is poor, downvoting seems to be just adding insult to injury, and seems likely to drive new users away.  So when is it actually a good idea to downvote a question?
Comment: I'm actually a bit surprised that this is getting so many downvotes. I can assume some might be for the sake of expected yield for such a question, but it's not exactly a bad question, nor does it actually decry the act of downvoting.
Comment: @Grace, I think it's some of meta.so's humor leaking into our meta -- since downvotes don't mean anything here, I don't see the harm (and I actually find it *a little* funny).
Comment: Heh, apparently the answer according to one person is "now".
Comment: Hardly ever, since when it's that bad it should be closed
Comment: Not all of us have the rep to vote to close...
Comment: Then flag for moderator attention or leave a comment @Jason
Comment: I disagree @Ivo, downvoting and voting to close are 2 different things with different use cases IMO (they are not related as you state "when it's that bad it should be closed [instead of downvoting]"
Comment: @Juan That would be the "expected yield" I mentioned, and I do find it funny. I suppose I could just chalk them all up to being the expected yield.
Comment: meta-questions that ask about downvoting have an inverted rating scale. the more downvotes you get, the more support you have.
Comment: @alex if we made this the official rule, I'd agree. For now, I'll just do a handstand when voting
Comment: Is there any reason we have voted this question down?
Answer:
You can glean some insight from my answer and the accompanying comments over in this Meta Stack Overflow post, but I'll do a better summary here. This is information for voting on the parent site, by the way. On Meta, it is slightly different but I don't want to bloat this post with that.

Votes have a very important utility, in that they serve to mark the usefulness and clarity of a question, or the lack thereof when it comes to downvotes. People depend on this information to filter quality from our site, and it is also mechanically utilized as well. On the parent site, when a question has a score of -4 or lower, it is no longer eligible to be shown on the front page. So it is important to downvote poor questions, even closed ones, for both the system and its users.
This site is not just a big dump truck that you can pile things on.  We're here to make the internet a better place by providing authoritative, high quality content to users. A good start for this is to mark when questions are good quality, while downvoting poor quality questions is a perfect measure to work towards this. That isn't to say every question with a downvote is poor quality - but that poor quality questions have every reason to be downvoted.
We don't actually have a huge problem with really bad questions here on Gaming. The more technically inclined sites have to deal with things like promoting bad practices or vulnerabilities. Gaming questions generally don't have to worry about that stuff. We only have 19 questions with a negative score, and none lower than -3. They primarily are subjective questions asking about the userbase alongside questions that are completely unclear as what is being asked and questions which don't make sense. More examples would be questions that are more of rants than actually asking anything, or questions that are attempting to circumvent laws. But when it comes to on-topic questions, we actually don't get much which needs downvoting.
Comment: @LessPop Check the [source](http://meta.gaming.stackexchange.com/revisions/53171ace-8004-46f9-8963-fa346573c7f4/view-source).
Comment: +1 for "The site is not just a big truck", +1 Removed for not following up with "Tubes".
Comment: Too clever for me by half clearly.
Comment: hey, we could actually use HTML comments together with some greasemonkeying as spoiler mechanism...


Is there any theoretical limit to the distance at which particles can remain entangled?

Question: As for as I understand (which is admittedly very little) particles that are created together become entangled. Currently, the experiments using entangled particles are over relatively short distances (the longest distance as of now is just over 15 miles).
Comment: 1. there is no theoretical limit to the distance at which particles can remain entangled. 2. Quantum entanglement cannot be used for instant communication at a distance.
Comment: if it has been answered you should check the answer you like best
Comment: I guess I really should have left off why I was asking as everyone really got wrapped around the axle on that one. All I care about is the distance at which entanglement ends. Thanks all. It has been answered.
Answer: Once two particles are entangled, they remain so at any distance, so long as you do nothing which would push them to lose coherence with each other.  Entanglement is independent of distance.
However, as a practical matter, it takes time to move the particles apart.  Increasing distance increases how long it took to get them there.  This means there's a higher probability of some event occurring which drives them out of coherence.  This is merely a technical hurdle, not a theoretical one.
Answer: Instant communication is still impossible  because the transfer of information occurs when the sender measures the quantum state of their photon. That causes the receiver's entangled photon to instantly change.
However, in order to understand the information, the receiver has to know what the original measurement was, along with some other instructions. Those instructions are sent via normal communications, which are limited to being no faster than the speed of light.
current maximum distance covered using entangled particles is 88 miles
Two good link on this are
http://www.forbes.com/sites/alexknapp/2012/09/06/physicists-quantum-teleport-photons-over-88-miles/
and Quantum entanglement faster than speed of light?


Advantage of STFT over wavelet transform

Question: I have learned about STFT and wavelet transform recently, and wavelet transform seems better than STFT in my opinion.
So, I wonder if there is any advantage of using STFT than WT, and if so, what are practical applications of STFT?
Answer: Wavelet transforms and short-term/short-time Fourier transforms are broad names for classes of transformations that are not totally distinct and may overlap (pun intended).
Both can be efficient for non-stationary features of data, and they both have merits or drawbacks, depending on their parameters and signal's properties. STFT is typically analyzing signals on fixed-length windows with different modulations, while wavelets  are similar modulations (zero-crossing) on different support sizes.
I am a promoter of wavelet-type methods. I however should mention that in image and audio JPEG and mp3 are widely spread standards akin the STFT (fixed length), in their critical version (maximally sub-sampled). Wavelets, although at the base of the JPEG2000, is less used, possibly for implementation/use issues.
In video coding, and in deep learning, it is more customary to look at different resolutions (akin to wavelets), yet not exactly in the structured dyadic wavelet fashion.
Comment: In audio deep learning, wavelets are pretty unheard of. They do work, but offer little advantage.
Answer: STFT is frequency-shift equivariant - same absolute shift has same effect on representation regardless of original frequency${}^1$:
$$
\hat x(\omega) \rightarrow \hat x(\omega - c) \Leftrightarrow \text{STFT}_x (t, \omega) \rightarrow \text{STFT}_x (t, \omega - c) \tag{1}
$$
1: rather $|\omega| - c$ in general, if considering negative freqs
This allows it to track linear frequency modulation with a fixed rate over the entire time-frequency plane, so we can tune the time-frequency tradeoff until we've mapped it perfectly. Shift equivariance is also useful for representative linearity depending on application (e.g. quantifying audio frequency transposition).
An overlooked advantage is that, STFT is much easier to implement - even major Python libraries (PyWavelets, scipy) have flaws. It can also be considered faster, per more permissive "hop size".
Overall I do favor CWT over STFT -  with CWT properties in depth here (rather scattering, but some apply to CWT also). Lastly, more comparisons on test signals.
Comment: @graffe [1](https://dsp.stackexchange.com/a/70643/50076) -- [2](https://dsp.stackexchange.com/a/78551/50076) -- remedied in [ssqueezepy](https://github.com/OverLordGoldDragon/ssqueezepy/issues/5)
Comment: Could you list some of the flaws you mention?
Answer: In response to the reply on unifying the STFT and CWT (I can't comment yet): I keep a recoded version of ARSS over here
https://github.com/LydiaMarieWilliamson/ARSS
though it will undergo rebasing and some revisions soon - partly to incorporate the new ideas. The scaling isn't actually done quite in that way in ARSS, but a little differently. Instead of going like $P = \left(e^{kx} - 1\right)/k$, it's better to do it like this: $P = \left(e^{kx} - 1\right)/\left(e^k - 1\right)$, then you can say that the case $k = ln(2)$ produces a simple exponential, $P = 2^x - 1$. This shows that there should also be an offset - which is what ARSS actually has in it, so that the general form would be $P(x) = P₀ B^x + β \left(B^x - 1\right)/\left(B - 1\right)$ - which is how it's actually done by ARSS (up to a change in notation and names). With this scaling, we would then have $ΔP(x) = P(x + 1) - P(x) = α P(x) + β$ with $α = B - 1$. So, the respective cases would be $α = 0$ for the time frequency plane - corresponding to the limit $B → 1$, where $P(x) → P₀ + βx$ and $β = 0$ for the time-scale plane, with the limit $P(x) = P₀ B^x$.
So, that's the generalization that is linear for small frequencies and exponential for high frequencies.
Missing in your description is what Lie algebraic underpinnings there would be to the unified formulation. Since the time-frequency plane corresponds to the Lie algebra of the Heisenberg group, and the time-scale plane to the dilation group (with respective Lie brackets $[q,p] = z$, $[q,z] = 0$, $[p,z] = 0$ in the former case, and $[d,p] = p$ in the latter case), then what corresponds to the unified generalization of the two? If we take your suggestion literally, then perhaps we should first throw together all the generators (and add the Lie brackets $[q,d] = q$ and $[d,z] = 0$) and then restrict to the subalgebra with $y = αd + βq$, $p$ and $z$, to yield the Lie algebra $[y,p] = αp + βz$, $[y,z] = 0$ and $[p,z] = 0$. Then the case $\left(α,β\right) = \left(1,0\right)$ yields the Lie algebra of the dilation group (along with a trivial central extension of it by $z$), while the case $\left(α,β\right) = \left(0,1\right)$ yields the Lie algebra of the Heisenberg group.
Also left unanswered is: how could the CWT, or (more generally) its unified generalization, be streamed? Since an infinite wave train has infinite bandwidth, then the base frequency is infinitesimal. So, the transform would either have to go linear for small frequencies, so that you could get down to zero, in which case $β ≠ 0$ is necessary.
Otherwise, the stream would have to be chopped up - which (however) may put restrictions on what kinds of windowing functions $h$ you could use for the inverse, if you also want a single unified graph for the entire stream that admits an inverse that yields the infinite stream. You might need something like an STFT stage, with really large step sizes (e.g. 1 second), and then run the transform on each (1-second) window. This might be a related reference in that vein
Xisheng Li and Shaochun Wang,
"A WT-STFT combining Algorithm",
J. Univ. Sci. Technol.
Beijing, 7(2000), No. 4, pp. 315-317.
http://ijmmm.ustb.edu.cn/en/article/id/947345fd-718c-4d41-a471-87d01cdf9e16
It doesn't appear to actually be talking about hybridizing the two tranform families, as you just did, but actually to be using an STFT stage for a CWT transform, along the lines of what I just suggested. Perhaps, this could be generalized to the entire "CWFT" family, as you call it.
Comment: Actually, the note on the Lie algebra issue, padawan, may be the lynchpin. I did a search on the matter and found a reference on combining Heisenberg and dilation. The formula under 1.2, with $σ(p)$ taken as $αp + β$, is essentially what I described! So, as they said, constant $σ(p)$ yields time-frequency, while linear $σ(p)$ yields time-scale; and affine $σ(p)$ unifies the two. https://www.researchgate.net/publication/2277209_Extensions_Of_The_Heisenberg_Group_By_Dilations_And_Frames
Comment: I find many getting caught up in irrelevant and overcomplicated continuous-time mathematics for answering engineering questions. The "right answer" is application-dependent, and often not a hard one. For machine learning, the [scattering transform](https://dsp.stackexchange.com/a/78513/50076) cleanly unifies CWT and STFT to produce a close to uniformly tiling filterbank while enforcing critical redundancy (energy overlap), while for component retrieval, [synchrosqueezing](https://dsp.stackexchange.com/a/72238/50076) needs only to solve a boundary problem, and not a hard one.
Answer: First, a quick answer, then a lengthy reply calling into question the question, itself. The main advantage of the windowed Fourier transform (or STFT, as you call it) is that it can be done cleanly on an infinite stream with finite resources - especially because of the regularity of its underlying grid. You can do it in real time on streaming signals.
Though the time increment $Δt$ arises naturally in the signal (as the sampling period), the corresponding frequency increment $Δν$ does not arise from the signal, as it would be $Δν = 1/T$, for a signal of finite duration $T$, if it did, and with the signal being unlimited in length $T → ∞$, then $Δν → dν$ an infinitesimal and the corresponding Fourier transform would be 1/2 continuous and 1/2 discrete. However, a finite $Δν$ does arise from the width of the windowing function used with the transform. The window cuts off the signal into finite-duration chunks, each one which is converted in the usual way.
In contrast, time-scale transforms make essential use of the frequency domain; and it would be very difficult to make it work with streaming signals; particularly, as the sampling points in the time-scale plane are irregularly-spaced - which is normally touted as a strength. Here, though, the strength of the transform is a weakness when it comes to the issue of discretization.
It's been an active area of research; example:
Peter Heinlein, "Discretizing continuous wavelet transforms using integrated wavelets"
Applied and Computational Harmonic Analysis, Volume 14, Issue 3, May 2003, Pages 238-256
https://www.sciencedirect.com/science/article/pii/S1063520303000058
A time-scale transform could be done in the time-domain, though it's not clean. One transform which I devised (actually: stumbled onto, by accident) is
$$\tilde f(q,p) = \int_{-1/2}^{+1/2} f\left(q + {λ \over p}\right) e^{-2πiλ} dλ.$$
The inverse is just simple summation on a logarithmic scale, since:
$$∫ \tilde f(q,p) δ(t-q) {dq dp \over |p|} = ∫ \tilde f(t,p) {dp \over |p|} = f(t),$$
so the time series for $q$, of each $p$ channel (corresponding to the scale $1/p$) is a bona-fide signal component in its own right. The wavelet, here, for the forward transform is just $ψ_{q,p}(t) = exp(2πip(t-q)) |p|$ cut off to a single period in the range $t ∈ [q-1/2p,q+1/2p]$, while for the inverse transform it's not even a windowing function, at all, but just a spike: $δ(t-q)/|p|$.
Either-Or?
Instead of asking this question, you should first be asking the question: is it even an either-or situation, in the first place? That is: is it possible to actually unify the wavelet and windowed Fourier transform seamlessly into a single framework, in such a way that each becomes special cases of the more general transform?
I first encountered this issue when reviewing the code for the open source ARSS program (Analysis and Resynthesis Sound Spectrograph).
http://arss.sourceforge.net/
It's abandonware now, as the author has gone on to make a commercial replacement for it that has a GUI front-end and a broader range of functions.
The author, at the time, was not aware that he actually devised a slightly generalized form of the wavelet transform. But one of the most interesting features of the software is that it has a parameter which, when set to 0, yielded a linear scale suitable for the windowed Fourier transform, and when set to a non-zero cardinal value (the natural log of 2) yielded a logarithmic scale suitable for the wavelet transform.
Unfortunately, he was never able to generalize it beyond the two cardinal values, so the software effectively became a disjoint union of the two transforms, rather than a bridging between the two. The same is true of the commercial version.
So, the question was left unresolved: can the gap between the two actually be bridged? And the answer is - if you make the right generalizations to each of the two families of transforms (with the generalization required for the wavelet transforms also resulting in bringing the S transforms in as special cases), you can actually devise a unified framework that seamlessly combines the two. I'll describe that here, in more detail.
As they are normally defined and formulated, they cannot be combined, because they are defined in a way that imposes unnecessary conditions - and the respective definitions are more constrained than they need to be. So, first, let's look at the respective transforms and make the appropriate repairs to each of them, before going on.
For the following, to simplify the notation (tremendously!), I will be adopting the following convention:
$$1^x ≡ e^{2πix} = \cos 2πx + i \sin 2πx.$$
Under this convention, the Fourier transform of a function $f(t)$ for $t ∈ ℝ$, and its inverse are given, respectively, by:
$$\hat f(ν) = ∫ f(t) 1^{-νt} dt,$$
$$f(t) = ∫ \hat f(ν) 1^{νt} dν,$$
where $ν$ is the linear frequency - which (as you'll see) makes things much simpler than if using the angular frequency $ω = ν/{2π}$. Combining the two transforms yields the respective identity
$$f(t) = ∫∫ f(t') 1^{ν(t'-t)} dt' dν = ∫ f(t') \left(∫ 1^{ν(t'-t)} dν\right) dt',$$
thus showing that the kernel of the transform is just the delta function
$$δ(T) = ∫ 1^{νT} dν,$$
which is defined by the condition that
$$f(t) = ∫ f(t') δ(t'-t) dt'.$$
Windowed Fourier Transform (WFT)
Also called the Short-Time Fourier Transform (STFT), the WFT is a windowed transform that uses a windowing function of the following form:
$$ψ_{q,p}(t) = g(t-q) 1^{p(t-q)},$$
where $q$ and $p$ are, respectively the horizontal and vertical coordinates, suitable for the representation on a spectrogram of a time series given by the sequences of $q$'s for multiple frequency channels given by the different values of the $p$'s.
This is a complex sinusoidal modulated by an envelope, given by the function $g$. The usual shape for $g(Q)$ is a hump centered around $Q = 0$ with rapidly dropping tails as you get away from $0$. Nothing, either above or in the following, requires $g(Q)$ to actually be real-valued, though that's the case for all the choices of envelope functions $g$ that I know of.
Under the transform, a function $f(t)$ of one coordinate (the time $t$) is converted to a function over the Time-Frequency Plane (with coordinates $q,p$), given by
$$\tilde f(q,p) ≡ ∫ f(t) \overline{ψ_{q,p}(t)} dt$$
where $\overline{\left(⋯\right)}$ denotes complex conjugation.
Under certain, very broad, conditions the transform can be inverted - with the inverse given as a windowed transform over the time-frequency plane, itself. To formulate those conditions, suppose we apply the transform with the following choice for the windowing function
$$φ_{q,p}(t) = h(t-q) 1^{p(t-q)}.$$
Then, the condition we want is for the following integral
$$F(t) ≡ ∫ \tilde f(q,p) φ_{q,p}(t) dq dp$$
to yield $f(t)$, itself.
Normally, for the WFT (as best as I understand it), the same windowing function is used in both directions, so that $h = g$ and $φ = ψ$. But $h = 1$ could just as well be used. It's actually more convenient, because with that choice, the spectrogram is showing you actual wave forms for the components of the time series given by the function $f(t)$.
It is also common to insert another factor of $1^{pq}$ is the forward transform, so that the windowing function would actually be $ψ_{q,p}(t) = g(t-q) 1^{pt}$, instead; and a $1^{-pq}$ in the inverse transform to make the windowing function $φ_{q,p}(t) = h(t-q) 1^{pt}$. The values on the spectrogram are complex. One way to denote them is by displaying the amplitude by brightness and the phase by color. However, beyond a certain resolution you won't see the color (it will all be whited out) in a graph. Without the insertion $1^{pq}$, the phase, at each level $p$ is the actual phase of the waveform at $p$ - particularly, if the function $h(Q) = 1$ is chosen for the inverse transforms. With the inserted factor $1^{pq}$, the phase tends toward a constant at those values of $p$ that best match the actual underlying frequency of the component.
To find what the conditions on $g$ and $h$ are, it is best to write the transform and its inverse in terms of the frequency coordinate $ν$, instead of $t$. This is done, here, first in general form in terms of the windowing functions $ψ_{q,p}$ and $φ_{q,p}$, assuming first only the following form of translational invariance:
$$ψ_{q,p}(t) = ψ_p(t - q),$$
$$φ_{q,p}(t) = φ_p(t - q).$$
For the forward transform, we have
$$\tilde f(q,p) = ∫∫∫ \hat f(ν) 1^{νt} \overline{\left(\hat {ψ_p}(ν') 1^{ν'(t-q)}\right)} dν dν' dt$$
The $t$'s are all up in the exponentials, so can be factored and integrated out to a delta function
$$∫ 1^{νt} \overline{1^{ν't}} dt = ∫ 1^{(ν-ν')t} dt = δ(ν-ν').$$
So, upon substitution, and integration over $ν'$ (which becomes trivial, because of the delta function) we get
$$\tilde f(q,p) = ∫∫ \hat f(ν) δ(ν-ν') \overline{\hat {ψ_p}(ν')} 1^{ν'q} dν dν' = ∫ \hat f(ν) \overline{\hat {ψ_p}(ν)} 1^{νq} dν.$$
For the inverse direction, in the frequency domain, we have
$$\hat F(ν) = ∫∫∫∫ \tilde f(q,p) 1^{-νt} \hat{φ_p}(ν') 1^{ν'(t-q)} dt dν' dq dp.$$
Again, the $t$'s are all up in the exponential, so by a similar process the factor $1^{(ν'-ν)t}$ can be collected, integrated out by $t$ to a delta function $δ(ν'-ν)$, and then the $ν'$ integrated out (again, becoming trivial because of the delta function) to yield:
$$\hat F(ν) = ∫∫ \tilde f(q,p) \hat{φ_p}(ν) 1^{-νq} dq dp.$$
When combined with the expression for $\tilde f(q,p)$, this results in:
$$\hat F(ν) = ∫∫∫ \left(\hat f(ν') \overline{\hat {ψ_p}(ν')} 1^{ν'q}\right) \hat{φ_p}(ν) 1^{-νq} dν'dq dp,$$
and now (because of the assumption made about translational invariance for $ψ_{q,p}$ and $φ_{q,p}$), the $q$'s are all up in the exponentials, the factors can be collected to $1^{(ν'-ν)q}$, integrated with respect to $q$ to yield the delta function $δ(ν'-ν)$, as before, with $ν'$ integrated out to yield:
$$\hat F(ν) = \hat f(ν) ∫ \overline{\hat {ψ_p}(ν)} \hat{φ_p}(ν) dp = \hat f(ν) \hat Γ(ν).$$
So, without further conditions on the windowing functions, the result is the same as doing a filter with the function
$$\hat Γ(ν) = ∫ \overline{\hat {ψ_p}(ν)} \hat{φ_p}(ν) dp,$$
with $F(t)$ being the convolution of $f(t)$ and the time-domain version $Γ(t)$ of $\hat Γ(ν)$.
When expressed in terms of the envelope functions $g$ and $h$, we have
$$\hat {ψ_p}(ν) = ∫ g(Q) 1^{pQ} 1^{-νQ} dQ = \hat g(ν-p),$$
$$\hat {φ_p}(ν) = ∫ h(Q) 1^{pQ} 1^{-νQ} dQ = \hat h(ν-p),$$
and, finally, we find that
$$\hat Γ(ν) = ∫ \overline{\hat g(ν-p)} \hat h(ν-p) dp = ∫ \overline{\hat g(P)} \hat h(P) dP = \left<\hat g,\hat h\right> = \left<g,h\right> = ∫ \overline{g(Q)} h(Q) dQ.$$
For the choice $h(Q) = 1$ (i.e. $\hat h(P) = δ(P)$), this reduces to the condition $\hat g(0) = 1$. For $h$ = $g$, it is just the condition that ${|g|}^2 = \left<g,g\right> = 1$. In general, the requirement that $F = f$ is that $\left<g,h\right> = 1$.
Continuous Wavelet Transform (CWT)
The wavelet transform is a windowed transform which uses a windowing function of the form
$$ψ_{στ}(t) = ψ\left({t-τ}\over σ\right) {1\over \sqrt{|σ|}},$$
where $τ$ and $σ$ are, respectively, the time and scale in the Time-Scale Plane. We can just as well write this as just another case of a windowing function already treated in general, by the correspondence
$$σ ⇔ {1 \over p}, τ ⇔ q$$
and write
$$ψ_{q,p}(t) = ψ(p(t-q)) {|p|}^A,$$
with $A = ½$.
(I will ignore the issue, in the following, of what to do about 0 or negative values of $p$.)
The inverse transform is normally taken with the same windowing function as the forward transform. The restrictions on $ψ$ which result from this are severe enough to prevent natural windowing functions from being used - like Gaussian-enveloped complex sinusoidal functions. One can only obtain $\hat Γ(ν) = 1$ for certain, very kooky and arcane shaped functions $ψ$.
However, there is nothing preventing us from generalizing by allowing different windowing functions to be used in the forward and reverse directions. So, we will write the windowing function for the reverse direction as
$$φ_{q,p}(t) = φ(p(t-q)) {|p|}^B.$$
(Note: this notation conflicts with the convention, in the wavelet literature, of using $φ$ to denote another function, which is unrelated to the one we defined here.) In the case where the two sets of windowing functions are the same, we have $φ = ψ$ and $B = ½$.
Again, as before, we have a form of translational invariance:
$$ψ_{q,p}(t) = ψ_p(t-q), φ_{q,p}(t) = φ_p(t-q),$$
where
$$ψ_p(Q) = ψ(pQ) {|p|}^A, φ_p(Q) = φ(pQ) |p|^B.$$
The respective Fourier transforms are
$$\hat{ψ_p}(ν) = ∫ ψ(pQ) 1^{-νQ} {|p|}^A dQ = ∫ ψ(T) 1^{-{νT \over p}} {|p|}^{A-1} dT = \hat ψ\left({ν \over p}\right) {|p|}^{A-1},$$
and similarly,
$$\hat{φ_p}(ν) = ∫ φ(pQ) 1^{-νQ} {|p|}^B dQ = ∫ φ(T) 1^{-{νT \over p}} {|p|}^{B-1} dT = \hat φ\left({ν \over p}\right) {|p|}^{B-1}.$$
Upon substitution, the condition we find that
$$\hat Γ(ν) = ∫ \overline{{\hat ψ}\left({ν \over p}\right)} {\hat φ}\left({ν \over p}\right) {|p|}^{A+B-1} {dp \over |p|}.$$
Assuming that the domains of ψ and φ are restricted only to positive values, then after making the substitution $ν/p = e^x$, this reduces to
$$\hat Γ(ν) = ∫ \overline{{\hat ψ}\left(e^x\right)} {\hat φ}\left(e^x\right) {\left|ν e^{-x}\right|}^{A+B-1} dx.$$
The requirement that $\hat Γ(ν)$ be independent of $ν$ means that we must have $A + B = 1$, with the standard choice being $A = ½ = B$, but actually $A = 0$ and $B = 1$ being more convenient. Under this assumption, the condition that $\hat Γ(ν) = 1$ yields the result that
$$∫ \overline{{\hat ψ}\left(e^x\right)} {\hat φ}\left(e^x\right) dx = 1,$$
which shows that the frequencies are naturally on a logarithmic scale, in the time-scale plane, with $x = \ln(ν/p)$ being equally-spaced between octaves.
This can be just as well written as enveloped sinusoidals by defining $g(Q) = ψ(Q) 1^{-Q}$ and $h(Q) = φ(Q) 1^{-Q}$ (i.e. $\hat g(P) = \hat ψ(P+1)$ and $\hat h(P) = \hat φ(P+1)$). Then, the corresponding condition on $g$ and $h$ become
$$1 = ∫ \overline{{\hat g}\left(P\right)} {\hat h}\left(P\right) {dP \over |P+1|} = ∫ \overline{{\hat g}\left(e^x - 1\right)} {\hat h}\left(e^x - 1\right) dx.$$
There is lots of room available to permit $ψ$ to be just a sinusoidal enveloped by $g$, like with the WFT, e.g. just taking $\hat g(P)$ to be a cosine window in $x$, itself, with $\hat h(P) = 1$. This has close connection to the so-called S-transform (it's a generalization of it) and, I think, also to the Q transform (which might correspond to taking $h(Q) = 1$, but I'm not sure).
CWFT: Unification of the WFT and CWT
A short while back, I posted a reply - elsewhere - that Gabor ... who had devised the WFT in 1946 ... missed the boat on the CWT, because he actually had a little-known section in his pioneering paper discussing the nature of human sound perception, which noted the logarithmic scale, but made an unwarranted assumption in his paper that the windowing functions should correspond to constant window sizes $Δp$ and $Δq$. For the CWT, the window sizes go as $Δp$ proportional to $p$, while $Δq$ is proportional to $1/p$ or to the scale $σ$.
Actually, that was partly a mistaken attribution. I think it was Daubechies who pointed out the details of the mechanisms for hearing pitch on a logarithmic scale in her pioneering work on the wavelet transform, rather than Gabor. The paper by Gabor does discuss human sound perception, but actually points out that the natural windowing size for $Δp$ is constant up to around 1000 Hz, and only then starts to become logarithmic for higher frequencies, with $Δp$ becoming proportional to $p$. In other words, the scaling may actually be hybrid.
This may be what the author of ARSS was trying to embody.
Now that they've been brought into a common form, it is actually possible to take it one step further and write this as two cardinal points of an entire family of transforms, with the two extremes bridged by the cases of hybrid transforms.
First, in order for them to be unified, we have to treat the enveloping functions $g$ and $h$, independently of the sinusoidal in the windowing functions $ψ$ and $φ$, since they were using different combinations of $p$, $q$ and $t$ in the WFT than what appeared in the complex sinusoidals. In the CWT, the same combination $p(t-q)$ appears in both the enveloping functions and in the complex sinusoidal - and that's what needs to be generalized away from.
The ARSS software use a hybrid linear-exponential scale of the form $a + b e^{kx}$ that reduced a linear progression in $x$ as $k → 0$. With that in mind, we first generalize the integral expression for $\hat Γ(ν)$ in terms of $x$ by replacing the $x$ of the WFT and the $e^x - 1$ of the CWF by $\left(e^{kx} - 1\right)/k$:
$$\hat Γ(ν) = ∫ \overline{\hat g\left({e^{kx} - 1}\over k\right)} \hat h\left({e^{kx} - 1}\over k\right) dx,$$
or, upon substitution of $P = \left({e^{kx} - 1}\right)/k$,
$$\hat Γ(ν) = ∫ \overline{\hat g\left(P\right)} \hat h\left(P\right) {dP \over \left|kP+1\right|}.$$
Second, we can then combine the forms $P = ν - p$ for the WFT and $P = \left(ν - p\right)/p$ for the CWT into $P = \left(ν - p\right)/\left(kp + l\right)$, with the WFT and CWT being the respective special cases of $(k,l) = (0,1)$ and $(k,l) = (1,0)$. Then, we may write:
$$\hat Γ(ν) = ∫ \overline{\hat g\left({ν - p \over kp + l}\right)} \hat h\left({ν - p \over kp + l}\right) {dp \over \left|kp + l\right|}.$$
From this, we can read off the respective transforms of the windowing functions which - upon restoring the integrating factors with $A + B = 1$, as before - are:
$$\hat{ψ_p}(ν) = g\left({ν - p}\over{kp + l}\right) \left|kp + l\right|^{A-1},$$
$$\hat{φ_p}(ν) = h\left({ν - p}\over{kp + l}\right) \left|kp + l\right|^{B-1},$$
or in back in the time domain as:
$$ψ_p(Q) = g\left((kp + l)Q\right) 1^{pQ} \left|kp + l\right|^A,$$
$$φ_p(Q) = h\left((kp + l)Q\right) 1^{pQ} \left|kp + l\right|^B,$$
or, finally, substituting back $Q = t - q$:
$$ψ_{q,p}(t) = g\left((kp + l)(t - q)\right) 1^{p(t - q)} \left|kp + l\right|^A,$$
$$φ_{q,p}(t) = h\left((kp + l)(t - q)\right) 1^{p(t - q)} \left|kp + l\right|^B.$$
Related References
I'm not the only one to consider these issues. A recent reference:
Carlos Mateo & Juan Antonio Talavera
Bridging the gap between the short-time Fourier transform (STFT), wavelets, the constant-Q transform and multi-resolution STFT
Signal, Image and Video Processing, volume 14, pages 1535–1543 (2020)
https://link.springer.com/article/10.1007/s11760-020-01701-8
and another from further back:
Xisheng Li and Shaochun Wang, A WT-STFT combining Algorithm,
J. Univ. Sci. Technol. Beijing,
International Journal of Minerals, Metallurgy and Materials 2000 7(4) 315-317
http://ijmmm.ustb.edu.cn/article/id/947345fd-718c-4d41-a471-87d01cdf9e16
Comment: I disagree with the central claim of this answer: CWT isn't inherently slower than STFT. It's true that fast CWT implementations are lacking, but in some future I'll [fix that](https://dsp.stackexchange.com/a/83495/50076).
Comment: "I disagree with the central claim of this answer..." that it's not an either-or but there is a unified formulation that contains both the time-scale and time-frequency planes as special cases, "... CWT isn't inherently slower than STFT", which, however, has nothing to do with anything I said or anything you're responding to. The actual statement "it can be done cleanly on an infinite stream with finite resources" has absolutely nothing to do with speed or efficiency; which is an entirely separate issue. Time-scale transforms (such as the S-transform or CWT), are generally, not streamable.
Comment: I see, then I misinterpreted that. Though that was better than what you're suggesting now - what makes you think we lose precision with a streaming approach? Time-frequency kernels are float-compact in both domains, CWT is as streamable as its time-widest kernel (meaning as streamable as STFT with same width).


Just Cause 2 pipeline Computer hacking failures

Question: I am playing Just Cause 2 on my PC via my Steam account and I am at the stage where I have to hack the pipe line computers.  I start the hack with four numbers displayed(e.g. 1 2 4 3). The hack starts, but every time it tells me that the "HACK FAILED". I have tried the hack about 20 times continuously with no success what  so ever. I am stuck as the game will not let me progress.
Comment: You are entering the numbers correctly, yes?
Comment: Are you being shot by enemy soldiers? It's possible the hacking fails because you're being hit.
Answer: If you enter a number incorrectly or are shot while entering the code, the hack will automatically fail.
However, it could be the case that the mission is simply glitched and is unable to progress in its current state (I once had a mission where I needed to follow someone, but the place they were standing in was outside of the mission area, so I couldn't finish the mission).  If this happens, the only solution is to restart from the latest autosave.  It sucks, but the missions in this game aren't that long, so it's not too much of a pain.