Alternatives to X-ray vision?

Question: So, I'm creating a superhero story. One of the characters, Jessica Hill, has some of the best superpowers ever seen. She has super strength, flight, and X-ray vision. But, as you all know, X-rays are extremely harmful to everyone, and I don't want any of my heroes to die. So, my question is, is there an alternative to X-ray vision that would allow Jessica to see through stuff, without causing cancer?
Comment: Thermal vision.  Bear in mind that the comics rightly ignore the idea that Superman is using x-rays, which must impact on something (film) and don't bounce back like radar.  Sometimes it's easier to ignore the minor details.
Comment: @MnIce "depicted as actual X-rays" Do you have any source for that claim? Any medium where this is actually explored? The most famous example is Superman and he doesn't do this literally with x-rays but with some fantasy stuff as far as I know. It's not my genre, but I am not familiar with anyone taking this literally. Usually x-ray vision is just a description, you see through things like on an x-ray, because as I said, it makes little sense otherwise.
Comment: @MnIce The link you've provided suggests exactly what I said, there is no statement about actual x-rays anywhere. I think all this confusion is just because of the name. It's like asking "what other material than horseheads could the Horsehead nebula be made out of?" Well, it's not actual horseheads to begin with, it's just a description.
Comment: What exactly do you mean by x-ray vision? Would she be emitting x-rays? If so, how does she see that way? This isn't directly related to the question which is fine as is, but that doesn't make a lot of sense? I think answering this might actually help because if you have come up with a way to detect the x-rays you emit yourself, this would open up a lot of possibilities for other methods
Comment: I used to know a Jessica Hill... Maybe I should ask her. In any case, maybe something like https://en.wikipedia.org/wiki/Range-R
Comment: @Raditz_35, X-ray vision in most media is typically depicted as actual X-rays, users being able to perceive (fairly) well while using the power, and being able to turn it on and off. Prolonged exposure to X-rays has serious detrimental effects. Poster wants to find a less dangerous alternative.
Comment: @Raditz_35,http://superman.wikia.com/wiki/X-Ray_Vision. Stated as such in the series Smallville. The lead limitation also lends credence to the idea that they are actual x-rays.
Comment: I didn't see the need to close this question when I first encountered it, but there appears to be confusion between the actual (and detrimental) use of X-rays and "x-ray vision" which, since the 1940s, has meant nothing more than "the ability to see inside something."  (If Superman really did have x-ray-based vision, his eyes would be the receptors and something on the other side of the target would be the emittor.  Now that would be a neat trick.). Consequently...
Comment: I'm going to VTH until DT clarifies the question, the most helpful form of which would be, "my superhero needs something like X-ray vision to see inside things, but I don't want to refer to X-rays at all.  What other types of 'vision' might give her the ability to see inside things?"
Answer: Human eyesight uses a very narrow range of all available light.
Light is, described more generally, just electromagnetic (EM) radiation.  All EM radiation is light.
What makes visible light special is that we have special sensors in our eyes that react to this EM radiation when it is at specific wavelengths -- when they have certain amounts of energy.
The entire Electromagnetic spectrum includes gamma waves, X-rays, UV light, visible light, infrared light (which is very useful for seeing how hot an object is), and all of the ranges of radio waves, including microwaves.
Different wavelengths of the EM spectrum pass through different objects in different ways, and affect different things in different ways, as well.  Gamma waves pass through nearly everything, but are also a form of ionizing radiation.  They pass through you like bullets pass through paper targets.
Certain objects are transparent to different wavelengths of light. A household pane of glass lets visible light through, but blocks infrared and ultraviolet.  Different types of glass can be used to let IR and UV light through, as well.
Some objects react differently to different types of light. Phosphorous will absorb UV light and accelerated electron, and re-emit it as visible light.  This process is used in fluorescent lights to convert UV into white light, and in old CRT televisions to convert the stream of electrons accelerated by the cathode-ray gun into the images you see.
If the super power worked by expanding a person's ability to see more than just visible light, they would see Wifi transmitters as bright lights casting radio-light onto all of the metallic objects in the room, including the metal inside of various walls, like nails in studs, or steel rebar inside of concrete.
They'd see humans, computers, and other warm objects glowing warmly, even being able to see them walking behind thin curtains, and can tell when a power cable is actually supplying power through IR light.  (They'd also see these power cables in various radio and microwave frequencies.)
They'd see the string of communications satellites in geosynchronous orbit, arrayed like a string of pearls fixed to the sky in, and would be able to see these whether they were indoors or out.
And none of this would require our super-powered friend to do anything that would increase the chance of cancer in any of their friends, because vision is a passive ability. You're just collecting the information that's already there, in ways that no human can.
And, a related video, showing Wifi-frequencies radio waves being used to "see" people through walls and windows: AI Senses People Through Walls
Answer: Only one thing comes to mind for a "vision" that allows you to actually see through objects without another source behind the thing you want to see through (the problem X-ray vision has).
Very advanced sonic detection.
A good sonogram can see through an object. If Jessica can emit a range of very short and very long sounds simultaneously (with a different organ than her voice hopefully) and has some advanced ears she can gauge direction, shape of her surroundings and even the thickness and materiel properties (he's carrying a gun, theres a vial of anti-hero in his pocket, 4 baddies and one tied up guy behind thos wall, this poor victim broke something and has small internal bleeding etc).
Normally this is far fetched even for me, but next to straight up flight and super-strength this one is straight up plausible.
Answer: Echolocation.
I know this sounds stupid, but have you thought of echolocation? In conjunction with super-hearing (increased perception distance and tone range), this would be extremely viable as an option. In addition, if she potentially trained enough with it, ultrasonic noise has been known to mess with people's heads, and is even implemented as a weapon. This would make for an interesting take on super-breath.
Comment: Not a stupid idea. I saw a video of a blind guy skiing at speed downslope using echolocation, bats can do it while flying and chasing insecta and we have instruments using sound to (safely!) look into people. Its a stretch anyone could do them all aimultaneously and at a distance, but compared to any other superpower this one is at least somewhat plausible.
Comment: @Demigan, I saw your post, it's very similar to mine. I would be glad if your version was chosen over mine. It is much more concise, and provides that awesome "comic book" example of its application.
Answer: Maybe superheroes' X-ray vision doesn't use X-rays but something else.  If superheroes emitted X-rays for X-ray vision it would be more like X-ray radar than X-ray vision.
Thus the "X-ray" in "X-ray vision" is probably metaphorical.  It means that superheroes can see through objects just as well as if they were using X-ray machines.  And possibly the "vision" in "X-ray vision" is equally metaphorical.
If superheroes emitted X-rays for X-ray radar the X-rays would not only be bad for human health but would go through many solid objects perfectly well. But those X-rays would not be reflected back to the superheroes well enough for them to see anything.
X-rRay machines work by putting the patient or object between the device that generates the X-rays and the device that records the image.  Any substance that reflects X-rays well enough to be send a lot of X-rays back to the X-ray radar generator would probably reflect X-rays too well for its insides to be seen by X-ray radar.
So Jessica Hill couldn't use natural X-rays in the environment to see through objects that were between the X-ray source and Jessica.  X-rays are adsorbed by the atmosphere after travelling only a short distance, and the main natural sources of X-rays on Earth is the Sun, and solar X-rays are stopped by the miles of atmosphere, which makes it possible for life to survive on Earth.
Maybe Jessica Hill could generate some kind of force field behind whatever they were looking at, and the force field would reflect the X-rays that Jessica generates back at Jessica.  Thus Jessica could use X-ray radar on objects that are relatively close to her.
And if super heroine Jessica is battling the more powerful super villain Invincious and is losing she can use her X-ray radar on Invincious during the fight to ensure that Invincious will eventually get sick and die and no longer be a menace, if that is not against Jessica's code.  I would hope it would be against the code of even super villains.
Or maybe your super heroine Jessica could make an X-ray source appear behind whoever or whatever she wanted to examine, and thus her X-ray vision could work like X-ray machines do.
And if Jessica Hill can somehow "see" neutrinos, then she could fly to the side of a planet opposite the local sun and "see" the internal structure of the planet because some parts would adsorb more neutrinos from the sun and thus appear darker to "neutrino vision".
But she would have to be incredibly sensitive to even the tiniest differences in neutrino flux, because even the most neutrino adsorbent parts of the planet would adsorb only an extremely minute fraction of the neutrinos that pass through them.
So trying to use "neutrino vision" to see the insides of small objects like persons would be millions of times more difficult, and thus probably impossible.
It is possible that Jessica could generate an intense neutrino source behind the person or object they wish to scan, and thus see the object with the neutrinos that pass through that object.  Or maybe generate neutrinos from her body and generate a neutrino reflecting force field behind the object she wishes to scan.
Ground-penetrating radar can penetrate some distance into solids and liquids, so Jessica could generate radio waves at the proper frequencies to use penetrating radar to see inside objects and people.
And there is echolocation, emitting sound waves through air or liquid that are reflected off of solid objects to show where those solid objects are.  It is possible that some creatures that use echolocation process the data in the vision centers of their brains and thus see images of the information from the echolocation.
Some objects would be perfectly "transparent" to the sound frequencies used, others would be perfectly "reflective" to the sound waves, and others would be in between.  Thus it is perfectly possible for echolocation to provide a 3D image of the internal structure of a being or object, just as ultrasound can make a movie of the internal workings of a body.
Thus it is possible that Jessica has the ability to passively receive and sense X-rays, or neutrinos, or radar waves, or sound waves, and/or to generate X-rays, or neutrinos, or radar waves, or sound waves in some sort of radar like system, possibly involving creating a force field behind the object being studied to reflect the waves back to her.
And possibly Jessica can switch between two or more of those systems for different purposes.
And a more plausible superhero Jessica will have some type of machines, gadgets, and sensors which do that and feed the information into the vision center of her brain.
And a less plausible superhero Jessica will have natural abilities to do so, and will have various organic generators and receivers, including extra eyes, or ears, or antenna. No one will ever mistake her for a member of the species Homo sapiens without an extensive disguise.
And an even less plausible superhero Jessica will biologically generate any waves she emits and biologically generate invisible force fields that will receive and detect the waves she receives and feed the date into her brain.  Thus it would be possible for that much less plausible superhero Jessica to look like a human woman or girl, because the nonhuman senses would be achieved with invisible force fields that nobody could see.
Just as in Berserker Man (1979) by Fred Saberhagen the super suit that is the only thing that can save mankind from extermination mostly consists of invisible force fields and the visible parts are comparatively minor.  In this case the force fields are generated by machines, which is much more plausible than biologically generated force fields.
Or maybe your Jessica is an agent for some all knowing supernatural being who puts images of all the hidden stuff Jessica needs to see into her brain's vision center.
In E.E. Smith's Lensman series many nonhuman species were eyeless.  Instead of vision, they used the sense of perception to perceive their surroundings.  They sense the the 3 dimensional shapes and sizes of objects, including the far sides, and the the 3 dimensional location of those objects.
The sense of perception seemed to be a mental or psychic power, since human Lensmen who developed their psychic abilities learned how to use the sense of perception in addition to their natural sense of sight.
Since perception is a psychic ability instead of a biological sense, a superhero like Jessica Hill with perception wouldn't need any strange looking sensory organs that show she isn't human to use an ability like perception to see the insides of objects.
By the way, the Lensmen are examples of sort of "superheroes" whose powers are a lot fewer and weaker than those of Superman but still enable them to achieve very impressive results.
Answer: see and READ the Aura.

https://psychicunicorn.com/see-auras/
https://www.thiaoouba.com/seeau.htm

What is the Aura ? Everything in the Universe seems to be just a
  vibration. Every atom, every part of an atom, every electron, every
  elementary "particle", even our thoughts and consciousness are just
  vibrations. Hence, we may define the Aura as a electro-photonic
  vibration response of an object to some external excitation (such as
  an ambient light for example)...
The most important property of the Aura seems to be the fact that it
  contains INFORMATION about the object.
Aura around living (conscious) objects (people, plants ...) changes
  with time, sometimes very quickly. Aura around non-living object
  (stones, crystals, water...) is essentially fixed, but can be changed
  by our conscious intent. Above facts have been observed by scientists
  in Russia, who have been using Kirlian effect to study Auras for the
  last 50 years.

Your superhero can perceive the auras of things living and nonliving.  This is a good approach if you are less concerned with electromagnetic reality (I suspect you actually are concerned) and more concerned with awesomeness.  There is a boatload about auras on the web - a syncretic gemisch of Indian mysticism, Soviet Kirlian pseudoscience, New Age crystal angels and other elements.  Great stuff because you can borrow liberally instead of inventing it all and aura writings have cultural depth when used as a story element.
Note also: one might need to use one's own aura to perceive auras, which means at a distance your aura might need to be big.  The perception is actually an interaction - like perceiving an object by feeling it.  Interactions go both ways and in widening her aura to perceive the hidden, your hero might become influenced what she perceives.

Alternatives to X-ray vision?


Meteor.js and LDAP

Question: Any chance that LDAP authentication will be integrated into Meteor.js in the near future?
Any hints on how to get this to work today?
Answer: Whenever working with meteor, I would suggest looking at resources that are available for node.js, when and if something isn't in the meteor docs, and there isn't already a relevant discussion here.
The reason this seems like a good start would be that meteor runs inside a node.js server instance inside a fiber. At the very least existing node.js modules may help you understand where to go next.
By performing a cursory google search for nodejs ldap, I had discovered a couple of very useful resources:
http://blog.nodejs.org/2011/09/08/ldapjs-a-reprise-of-ldap/
http://ldapjs.org/
Finally, you will likely need the answer to this question to get you on your way:
it possible use a nodejs package inside meteor app?
Answer: As of 2015 the best available package is https://atmospherejs.com/typ/accounts-ldap
meteor add typ:accounts-ldap

I used this package in a few projects and from my experience it always requires the dn to authenticate. If you want to use the email instead, you would first have to find the dn with a separate query (ideally your LDAP offers you some sort of resolver / API to query the dn by email).
On the server side, you configure the following default (any file exposed to the server):
LDAP_DEFAULTS.url = 'ldap://my-ldap-host.com'

On the client side, you can then call:
Meteor.loginWithLDAP(login, password, { dn: 'the-resolved-dn' }, function(err) {
  if (err) {
    // login failed
  }
  else {
    // login successful
  }
}

Answer: Your best bet at the moment is to look through the code in https://github.com/emgee3/meteor-accounts-ldap and try to adapt it for your own purposes.

Meteor.js and LDAP


Related products dropdown menu in product page

Question: I would like to create a dropdown menu prefilled with related products on the product page.
I came across the code below which displays all products in a dropdown menu. I pasted it in the file view.phtml and proved to be working. How can I modify it to display related products instead?
<code><select>
<?php
    $products = Mage::getResourceModel('catalog/product_collection')
        ->setStore(Mage::app()->getStore()->getId())
        ->addAttributeToFilter('status', array('eq' => '1'))
        ->addAttributeToFilter('type_id', array('eq' => 'simple'));
    foreach ($products as $prod_model) {
        $product = Mage::getModel('catalog/product')->load($prod_model->getId());
        echo "<option value=\"".$product->getId()."\">".$product->getName()."</option>";
    }
?>
</code>

I also found out that I could do it through SKU's and came across this code that retrieves the ID's of the matching products:
<code>$match = substr($product->getSku(), 0, 4);
$resource = Mage::getModel('core/resource');
$read = $resource->getConnection('core_read');

$select = $read->select()
->from(array('e'=>$resource->getTableName('catalog/product')), 'entity_id')
->where("e.sku LIKE '" . $match . "%'");
$ids = $read->fetchAll($select);
</code>
I just want to know how to link both codes together, by either using the related products or SKU.
Can anybody help me on that? Many thanks
Answer: Use this :
<code>$products = $_product->getRelatedProductCollection()->setStore(Mage::app()->getStore()->getId())
    ->addAttributeToFilter('status', array('eq' => '1'))
    ->addAttributeToFilter('type_id', array('eq' => 'simple'));
</code>
To have your collection of related products.


Search and Find a File do not work on all file types

Question: I was testing my new SharePoint site, and found that several of my 'documents' in my library did not come up on search.
As I experimented with the problem, I have concluded that it does not find documents with file extensions like .sql or .sh  or even .txt even though these files are perfectly readable in notepad. Even searches on words in the title do NOT work.   How can I make the search tool find these documents outside of changing the file extension?  I DO NOT want these to be word documents as I need them to be 'clean' files.
Comment: TXT files should show up, not sure about .SQL. See this post for more information: https://technet.microsoft.com/en-NZ/library/jj219660.aspx
Answer: SharePoint chooses files to index based on "Included File Types". Just add the missing file types in the Search Service Application | File Types.


How can I leave a level after donning the Boots of Introspection?

Question: In Candy Box 2, is there any way I can leave a level if I'm wearing the Boots of Introspection? It's great to wear the Merchant's Hat and gain lots of candies, but you could gain even more if you wear the Boots of Introspection and somehow leave. Thanks!
Answer: If you have the Boots of Introspection on, you only don't move forward when you are on the ground. So, you can leave the level by jumping until you reach the end.
Comment: Wow. I just made a million candies in two minutes at the castle walls. Thanks!


What is the difference between the terms "tuning system" and "temperament"?

Question: Are both the terms synonyms, or do they have different meanings?
Comment: Of course, this question seems to be thinking primarily of chromatic keyboard instruments. For any instrument with fewer "things" to tune (or more!, as in the case of split-key organs), the distinction becomes more important. For many string instruments, for instance, any mention of "tunings" becomes a question simply of *scordatura*.
Answer: A temperament is what you get when you compromise the tuning of a keyboard or fretted string instrument to "fix" the out of tune intervals that result from tuning other intervals "purely" or "justly," that is, tuning the two pitches so a harmonic of one coincides with a harmonic of the other.  A temperament is a kind of tuning system.
People often talk about tuning keyboards in "just intonation," but they tend to ignore the fact that doing so leaves the perfect fifth between the second and sixth degrees of the major scale rather far from a 3:2 ratio.  Even tuning the a keyboard with only seven pitches of the diatonic scale is likely to require a temperament of some sort.
(Tuning a keyboard for melodic use only, such as the earliest organs, one does not need to worry about harmonic intervals, so there is little need for temperament; similarly, Pythagorean tuning does not need to be tempered in music that treats the third as a dissonance, such as late medieval polyphony.)
By contrast, consider an ensemble of singers, trombones, or fretless string instruments.  They can basically tune all of their harmonic intervals pure, though this can require some melodic intervals to be wider or narrower than usual to prevent the pitch from drifting too far away from its starting point.
While this constitutes tempering the intervals, that is, modifying them from their expected sizes, it doesn't constitute a temperament.  The main reason for this is that it lacks consistency, because some pitches will be slightly different in different parts of a piece, and the same interval might have a different size in different parts of a piece.
Most commonly, a temperament is a coherent set of frequencies for a fixed set of a relatively small number of pitches, usually twelve.  This is a natural consequence of the origin of the concept in the tuning of keyboard instruments.  "Tuning system" can refer to many different things, but in this context it is essentially a set of principles used to decide how to tune the pitches in a piece of music, or else it is a keyboard tuning (such as Pythagorean tuning) that does not have any tempered intervals.
Comment: I don't see how a clear distinction can be made between "tunings" and "temperaments".  Is 12EDO a "temperament", as it's usually called?  What about 31EDO, which has even closer equivalents to just intonation than 12EDO?
Answer: It's a bit like "scale" and "mode": a "tuning system" is what you do to your notes, a "temperament" is a characterisation of what the resulting character as a whole is.  You could also use "tuning system" to describe the process of getting to a temperament, namely what notes/strings you tune in what order and with what beatings in relation to other notes (like, a system for tuning the guitar, or less ephemerally an organ).  There is some overlap with "intonation" (which makes sense for finishing pitch and possibly sound quality of flute holes or organ pipes or even doing the fretting for a guitar or lute or viol) too.
Answer: They are often used interchangeably, but they are technically different.

Tuning system is a broad term meaning any system of tuning an instrument.

Temperament is a set of adjustments (temperaments) to a tuning system to meet specific musical requirements.

For example, "just intonation" is a tuning system involving "pure" intervals. "Equal temperament" is a system of modifying just-intoned intervals to be of equal distance from each other, allowing for transposition to all keys. "Mean tone temperament" and "well temperament" are other systems of tempering just intonation.

More information can be found in the "About" pages for the tuning tag and temperament tag.

These distinctions are further made clear in Wikipedia's Musical temperament article.
Comment: Would a tuning system such as 7EDO (seven equal divisions in the octave) be considered a temperament?  It doesn't really qualify as adjustments to an existing tuning system.  I don't think the distinction can be clearly made.
Comment: @ScottWallace In it's "pure' form, 7-EDO is a tuning system, but there are tempered versions of it. This is well explained in the [Xenharmonic Wiki](https://en.xen.wiki/w/7edo). This is also covered in Wikipedia's [Equal Temperament](https://en.wikipedia.org/wiki/Equal_temperament), though the terms aren't so rigidly defined.
Comment: but you just said that 12EDO, aka equal temperament, is a temperament.  So some EDO's are tuning systems, but others are temperaments?  How do you decide which is which?  If 12EDO is a temperament, and 7EDO a tuning, what about 19EDO?  31EDO?  I don't see how a sharp line can be drawn between tunings and temperaments.
Comment: To be clear: my argument is not with you, because I have heard very similar definitions of the difference between tuning and temperament, and I think they are widely accepted.  I just don't see how such definitions can be precisely deliminated.


Scale change on Quadratic

Question: Consider the two functions $f(x)=ax^2$ and $g(x)=bx^2$.
Using this transformation form $T(x,y)=(cx,cy)$,
find a scale change that maps $f(x)$ onto $g(x)$
Answer: Temporarily, let $s=cx$ and $t=cy$. Then $x=\dfrac{s}{c}$ and $y=\dfrac{t}{c}$. Inserting in the equation $y=ax^2$ we get
$$\frac{t}{c}=a\frac{s^2}{c^2}.$$
We want this to read $t=bs^2$. For that, we need $\dfrac{a}{c}=b$, or equivalently $c=\dfrac{a}{b}$.
So now our equation reads $t=bs^2$. Replace the letter $s$ by $x$, and $t$ by $y$.
Remark: The result has an interesting geometric interpretation: all parabolas look alike, just like all circles look alike.

Scale change on Quadratic


Gnosis Safe propose MultiSig transaction with contract interaction programmatically

Question: Is there a way of proposing multisig transactions in Gnosis programmatically (with Safe Transaction Service API or Safe Core SDK or anything else) that can interact with external contract (by calling a its method, e.g.) once signed? I see such transactions can be created from Gnosis Safe UI by New Transaction -> Contract Interaction
Answer: With 0xweb you can initialize contract transactions via CLI or with Node.js.

You install the desired contract as a package. For example, the DAI contract to transfer funds.

$ npm i 0xweb -g
$ 0xweb init
$ 0xweb install 0x6b175474e89094c44da98b954eedeac495271d0f --name DAI --chain eth

After you have installed the contract's package. You can view its read and write methods with 0xweb contract abi DAI --chain eth

Add the safe's member to accounts

$ 0xweb accounts add --key 0x... --pin STORAGE_PASSWORD --name fooOwner1

Add existing safe

$ 0xweb safe add --owner fooOwner1 --address 0x... --name fooSafe --chain eth

Create the transfer proposal transaction
a. via CLI
0xweb contract write DAI transfer --dst 0x... --wad 5000000000000000000 --account fooSafe --chain eth

b. with Node.js
import { DAI } from './0xweb/eth/DAI';
import { Config } from '@dequanto/Config';
import { ChainAccountsService } from '@dequanto/ChainAccountsService';

async function transfer () {
    await Config.fetch();

    const dai = new DAI();
    const accounts = new ChainAccountsService();
    const safeAccount = await accounts.get('fooSafe');

    const toAddress = '0x...';
    const amount = 5n * 10n**18n;
    const writer = await dai.transfer(safeAccount, '0x...', amount);
    const receipt = await writer.wait();

    console.log(`DAI(${amount}) was sent to ${toAddress}`);
}
transfer();

Now you have to confirm the transaction before it is sent to the blockchain. For example, if you have a gnosis app, you should have received the push notification with a transaction proposal. After the participants have confirmed the transaction, the CLI process will pick those automatically from the gnosis safe service. Also writer.wait() will also pick the confirmations and send the TX on behalf of the fooOwner1 to the blockchain. And after the tx is mined you'll get the receipt.

You can install any validated contract from etherscan, polygonscan, etc, or you can install a contract by providing the file path to the ABI JSON. And then call any method.

Per default Gnosis Service is used to exchange the confirmation signatures. But you can use also a simple file for this.
$ 0xweb contract write DAI transfer --safe-transport ./my-transaction.json --dst 0x... --wad 5000000000000000000 --account fooSafe --chain eth

This will serialize the transaction and your confirmation by fooOwner1 to the file. You send the file to all participants, they confirm the transaction, and the last one can execute the transaction, or you get the file back, rewrites the original one, and the CLI process will automatically pick the confirmations and sends the transaction to the blockchain.
To do this with code, you provide the file in the configuration:
const writer = await dai
    .$config({ safeTransport: './my-transaction.json' })
    .transfer(safeAccount, '0x...', amount);


Quadrics and quadratic forms.

Question: I'm learning about quadrics. My textbook says that a quadric is a quadratic form $X^TAX = 0$ with $A$ en symmetric matrix and $X$ the homogeneous coordinates in a orthonormal basis. But if we're working in an orthonormal basis, isn't the scalar product  always just $X^TX$ (so $A=I_n$)?
Comment: The text never said that a quadratic form must be a scalar product. It is the converse: the scalar product is a particular quadratic form (with the unit matrix).
Comment: Thank you! So if $A$ is also positive definite, it's a scalar product and it has to be $I_n$?
Comment: In that case, it will be the regular scalar product, possibly expressed in a different basis, yes.
Comment: @RubenVanBelle: no, I don't see how you deduce that. And a matrix can't be a scalar product.
Comment: You seem to be confusing *the* (canonical) scalar product and *a* scalar (or inner) product, or more generally a symmetric bilinear form, corresponding to  a symmetric matrix.
Answer: You're mixing up a number of things.

The quadric (often also called "conic section" or just "conic") is the set of points $X$ which satisfy $X^T\cdot A\cdot X=0$. It's a convention (and required for some operations) to choose $A$ as a symmetric matrix.

The $X$ in this formula is meant to represent homogeneous coordinates. Which usually means that you pick one vector as a representative, but it is implied that multiples of that vector represent the same point. (If you do things more formally, you must phrase everything in equivalence classes all of the way, which makes notation more complicated for little gain.)

For some reason, your text book adds a requirement that the basis used for these homogeneous coordinates should be orthonormal. I must say that I consider this a strange requirement here, since in my opinion it only makes sense if you think of the projective plane as being embedded into some 3-dimensional containing space. While this may be a useful idea when starting with projective geometry, my experience is that by the time you get to quadrics, thinking about a containing space is more confusing than helpful most of the time. And since a projective transformation (which is an invertible linear transformation of the containing space) maps quadrics to quadrics, I see no benefit in adding the orthogonality requirement. Particularly since normalization to length $1$ fits in poorly with the arbitrary choice of representatives you have with homogeneous coordinates.
If it helps you, forget about the "orthonormal" part of your text and continue. You may even skip all the following points of this answer.

If you want to have a closer look at orthonormality, you find that a basis is orthonormal if $\langle X,Y\rangle=X^T\cdot I_n\cdot Y=\sum_{k=1}^nx_ky_k$. In words, if your vectors $X$ and $Y$ are expressed with respect to the same orthonormal basis, then computing the scalar product is the same as computing the bilinear form encoded by the identity matrix. But all of this has very little to do with your original setup. Yes, the standard scalar product is a symmetric bilinear form, just like that matrix $A$ is supposed to be symmetric. If you set $Y=X$ you obtain a corresponding quadratic form, just like your quadric is described by a quadratic form. But here that form describes the metric properties of your containing vector space. It does not describe the conic mentioned originally.

You are of course free to pick the identity matrix and look at the quadric it describes. For $X=[x:y:z]$ you get the equation $x^2+y^2+z^2=0$. Obviously this has no real solutions. So while it makes sense to think of this as a (non-degenerate) complex quadric, there are no points on this conic which you could actually draw in your (real) drawing plane.

Some comments explored the fact that any positive-definite symmetric bilinear form may be called a scalar product. While this is true, I feel that it is taking you further away from the actual issue at hand. It means that you'd most likely have not just one basis, but two of them. The identity matrix in one of them corresponds to some arbitrary symmetric positive definite matrix in the other. But you don't intend to do any coordinate conversions, so this view doesn't help. Again, you can plug the matrix of any such scalar product into the formula for a quadric, and come up with a different quadric which is just as complex as the one I just described for the standard scalar product.
So when you want something to imagine, I suggest you imagine a conic where the matrix $A$ is indefinite. That way you get real solutions and can actually imagine the resulting conic section as a figure in your projective plane. Keep in mind that definite and semi-definite matrices satisfy your formal requirements as well, and may prove relevant corner cases in some situations, but for intuition I'd skip those for now.

Quadrics and quadratic forms.


motor feedback system for linear motion

Question: What is the best way to detect the position / displacement of a linear motor ( solenoid type ) for feedback ?  I was thinking of using a hall effect sensor or an Infrared sensor .
Comment: try googling linear position transducer
Comment: Are you trying to determine if the motor has moved at all (e.g. a binary thing), or exactly how far the actuator has moved?
Comment: trying to find out exactly how far it has moved
Answer: "Best" covers a lot of ground: accuracy, resolution and cost. High resolution was discussed before in terms of LVDTs. If you are willing to trade off resolution for accuracy, then a simple way of doing this is to have a few opto-interrupter sensors spaced at accurately known locations, and attach a flag to the linear motor that blocks the sensors as it moves.
At slightly higher cost, and roughly equal accuracy, but higher resolution is to use an off the shelf rotary encoder with a mechanism that converts linear to rotary motion. The simplest way is by wrapping a string around the shaft of the encoder and fixing the two ends of the string to the ends of the object that moves. Another method is to press a gear onto the encoder shaft and attach a "gear rack" of some type to the linear motion shaft. The gear rack can be an actual rack that mates with the rotary gear or a section of timing belt that is glued flat to act as a rack. This arrangement is generally known as
rack and pinion
Comment: +1. Neat animation. I kept waiting for it to switch directions. Ahh well, another 10 minutes wasted! ;-)
Comment: Wish I could take credit for it, but it's from the rack & pinion wikipedia entry.
Answer: For a really good accurate system try a Linear Variable differential transformer. Here is a link.
Here's the blurb from the supplier above: -

LVDT's are inductive displacement transducers that have proven
  themselves as very robust and particularly suitable for use in
  installations where high vibrations, high accelerations and/or very
  long cycle lifes are to be expected. Even oscillations with small
  sweeps, and measurements under 1mm can be achieved. Displacement
  ranges from 2mm to 200mm are available. Typical LVDT sensors are
  energized with AC voltage, produce an AC output and thereby require
  external electronics for amplification and processing. Our LVDT
  products all incorporate internal electronics allowing the transducer
  to be supplied with either ±15VDC or 24VDC and provide an output
  signal of 0 - 5V, 0 - 10V, 0 - 20mA or 4-20mA. This feature allows for
  simple field integration.

They basically operate like a 3-coil metal detector. Centre coil applies an alternating magnetic field to the outer coils which are wound antiphase. A piece of metal (usually an iron compound) is moved across the three coils by displacement. At midpoint balance there is no net signal; either side there is a signal whose amplitude and phase tell you direction from centre-point and distance.
EDIT Here is a website that shows you how to build one and make the electronics too.
Comment: @Andyaka, if accuracy and precision are the goal, and cost is no object, there are systems out there that can achieve below 1 nanometer. But that's not the "best" solution. The best solution is the lowest cost system that meets the system requirements.
Comment: +1, interesting find, and so obvious once one hears of it!
Comment: You can get really big ones (Used on flight simulator motion systems) and rotary ones. Better than 1mm on 2m stroke if I remember correctly.
Comment: LVDTs have insane resolution, but the signal processing can be a bit hairy and the sensors (transformers) themselves are generally well out of "hobby" price range unless you DIY. I have a couple of industrial LVDT instruments that were around $5k each new. If you don't need resolution down to the micrometer, then a linear magnetic sensor like the ones from Austria Microsystems or an off the shelf rotary encoder coupled to a string or rack & pinion is probably good enough and a couple orders of magnitude cheaper.
Comment: @lyndon Read the question LOL "What is the best way" etc.. Best probably does equate the LVDTs. Why don't you post your comment as an answer?
Comment: @lyndon That looks like an answer, why just post as a comment? :-)

motor feedback system for linear motion


How to get address balance after particular block was issued

Question: How to get address balance if you know the block number?
In solidity you can call address.balance, but without specifying particular block.
Is there a way to do this in solidity or only py/js?
Answer: As @flygoing points out, you cannot get a historical balance in Solidity, but you can get that value off-chain if you're running a full archive node (or have access to a full archive node through the RPC). The RPC's eth_getBalance takes a block argument. If you don't have a full archive node, your only recourse is to build the balance from the transactions which is not easy in a decentralized way (but is not too hard using the fully-centralized Etherscan).
Answer: If I understand correctly, you want to get the balance of a particular address at a given block number, which you can't do in Solidity. If this were the case, it would make any  non-full-sync mode impossible as verifying blocks would require access to the state at any arbitrary block in the past, which geth --fast wouldn't be able to do. Verifying blocks on full nodes would also be a lot more intensive due to the arbitrary block state access.
Answer: On this, you can do checkpoints in Solidity (save a state and then query from that state at a block number):
Here's an example: https://github.com/Giveth/minime/blob/master/contracts/MiniMeToken.sol


How to install sap business one client

Question: Please help, I need to install this software but there are some prerequisites that needs to be installed before I can install it.
Problem is, I can't find download links for those. And it seems that they are not free software.
Even the software itself is not free. Can you provide me with some open-source alternatives for this software. Or if you have used it before, how did you install it.
Comment: Please give specifics. This question as it stands is too vague to be of any use.
Answer: When running the main installation you will be asked whether you want to install the server components, the client components or both. I have not seen the client components available seperately.
Prerequisites to a successful client install generally require the server components to already be installed and the license server services to be running.
All the documentation is on the SAP Business One Customer Portal. You are given log in credentials when you purchase Business One.
I'm not aware of any open-source equivalents to SAP Business One.
Comment: I'm only relying on torrents for this one since I don't have the money to buy the actual software because I'm only a student.

How to install sap business one client


Why do gradient boosting algorithms mostly use trees?

Question: Why do gradient boosting algorithms mostly use trees? Is there any logic in this? (in XGBoost and in boosting which in sklearn library uses trees, not other algorithms).
Answer: Mostly because they are very good base learner. In few words, I woud say because it is easy to boost trees, and the performance (in terms of predictive power) is very good.
Usually, data mining procedures are well suited for particular applications. For instance, LASSO is a good choice if we believe that the true Data Generating Process (DGP) is sparse, while we do not expect a great perfomance when the DGP is dense. However, there exist several Off-the-shelf procedures, which tend to have discrete to good perfomances in several and various applications, and do not need a lot of data pre-processing. Such procedures satisfy few desiderata: among others, low computational burden, ability to handle mixed data (continuous, binary, categorical, ...) and missing values. Moreover, interpretability is often desired. Black-box models can achieve superior perfomances, but sometimes we do wish understanding what is happening inside.
Decision trees are probably the best off-the-shelf procedure we have so far. However, they have a clear drawback: volatility, which probably is the only thing preventing trees to be the ideal algorithm.
So, boosting trees is considered optimal for two reasons: it is easy, and it solves the problem of high variance (sacrifying interpretability), thus improving accuracy.
This is what comes to my mind. I remember a short discussion about this point in Elements of Statistical Learning (Hastie et al., 2009). Looking at the table of contents, you can probably find more details in chapter 10. I am curious if somebody has other explanations for this.
Comment: Thanks, Could you comment on this? > low computational burden.  Aren't trees more difficult to compute than linear models?
Comment: I am not sure about which model takes more computational time. Assuming you mean OLS estimation, my guess is that it depends on the size of the design matrix - big matrices take time to be inverted, even if we rely on some trick (e.g., QR decomposition). On the other hand, fitting a tree is really fast. Of course, trees are greedily grown minimizing a heuristic, with the hope that that is a good approximation to the best tree - the space of possible trees is too large to be explored. In practice, running the `rpart()` command on R takes really low time.


Deleting Message cache

Question: Trying to delete all SMS and iMessage cache.  Other forums and research indicates a SYNC will do this.  Have tried, but old messages keep showing up in Spotlight search.  I want them deleted for good.  How?
Answer: Obviously, it's a cache bug (or more like feature). If you find that it's a little annoying, Apple does provide a way to remove this.
Here's how to delete recent contacts from messages app (and other apps in iOS):

Go to the Messages app and tap on the New Message icon
In the recipient field, tap the name of the recently-deleted contact (or a part of the number)
When the contact shows up in the list, you should see a blue 'i' icon right next to the contact you just deleted
Tap on the 'i' icon. Next, tap on Remove from Recents
That's about it. The contact will no longer show up.

It's really that simple. This will remove the contact from the cache (of recent contacts) and it will make sure that the deleted contact doesn't show up anywhere in iOS.
The problem doesn't appear for contacts that you have not communicated with (via Email, Message or FaceTime). It's mostly for contacts that you have communicated with via these services. The Recent Contacts list holds a cache of contact data (contacts that you have recently talked/messaged to) and it's not available to modify.
Comment: The issue was not about contacts. -1

Deleting Message cache


Oxidation and Polymerization of drying oils

Question: I am having trouble understanding the relationship between polymerization and oxidation of drying oils, specifically linseed oil used for fine art. In refining my own oil by filtering it then leaving it in the summer sun in a pan, the oil thickens and becomes strong and very fast drying. Similar thickened linseed oil from the art store is alkali-refined, and though thickened (therefore supposedly polymerized) still dries slowly. Why? So does polymerization not affect rate of curing? (Art store thickened oil is boiled in the absence of O2, so can polymerization happen without oxygen?) I can use an aquarium pump to blow air through some home-filtered oil for a number of days and rapidly thicken the oil. Is the thickening because it is starting to cure/oxidize, or is it because of polymerization, or both? I am trying to learn the relationship between these concepts, and how they affect cure rate and strength of the dried film.
Comment: Could you give us some ideas of drying times?  How are you applying these oils?  To what?
Answer:
can polymerization happen without oxygen

Yes, under heat the Diels-Alder reaction can occur between double bonds of unsaturated oils without oxygen.  "Boiled oil" is partially polymerized. Solvent (mineral spirits) is used to thin it and "dryer" chemicals are added into the formula for faster drying.
Oxygen can also "cross-link" untreated oils, such as pure linseed, tung, or soya oil, as well as processed oils, but this usually takes longer.
However, drying rates of solvent based product can take markedly longer at lower temperatures simply because mineral spirits does not evaporate as well.  The solvent must evaporate before even "boiled" oil can dry.  "Store bought" product also may not be pure linseed oil$^1$.
In coatings jargon, there are also two degrees of dryness: set to touch and tack free.  The dryers generally help form a film on a surface faster.  So lightly dragging fingertips without sticking should happen sooner.  The whole coating being firm with finger pressure (tack free) can vary, especially if the solvent is slow to dry.
$^1$ "tung oil finish" is an example of this


2010 - Remove the word "home" from the page

Question: I cannot locate where in SP to remove this instance of the word "home", I have tried in edit mode and in SP designer.
Comment: Are you checking the right master page ?
Answer: This looks like the master page has been modified. Edit the site's master page with SharePoint Designer and remove the text. Save and re-publish the master page.
Answer: Use Mozilla Firefox or IE developer tool and find for the exact tag for "Home".
Try to search for "breadcrumbs" in master page and remove the corresponding tag. I think the Home is placed under

 of v4.master.
Answer: Look at the page in SharePoint Designer. Click on Master Pages under Site Objects.
One of the documents listed (probably with a green check mark next to it) will show the "Home" text in the top left corner, but you will not be able to touch it.
On the Editing menu, choose the Advanced Mode option. This will allow you to put a cursor next to the offensive text and remove it from the Master Page. Click on "Preview in Browser" to confirm. Click on the save button (or File/Save).
Go back to your site and the word "Home" will no longer be there.


Date format lost when Import Excel file in asp.NET C#

Question: Date format is 1:55:25 AM in the excel file, after reading using ExcelReaderFactory.CreateBinaryReader, I get the 0.0451388888888889.
Answer: Internally Excel stores the data in that decimal format and applies logic to the value to display the date.  Unfortunately, the transformation from that format into the date format is not always straightforward.
What I would recommend is opening the Excel file using OleDb to read it into a dataset.  Doing it that way preserves the data in the format you see in the spreadsheet.
There are a number of great articles on how to read Excel using OleDb.
You can start with this one:
http://codehill.com/2009/01/reading-excel-2003-and-2007-files-using-oledb/
Cheers!
Answer: Use OleDb to read the data in, like so:
string dsn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="
              + xlsPath + ";Extended Properties=\"Excel 8.0;HDR=Yes;IMEX=1\";"

OleDbConnection newConn = new OleDbConnection(dsn);

string tableName= "MyGlobalNamedRange";
string sqlText = String.Format("SELECT * FROM [{0}]", tableName);
IDbCommand cmd = connection.CreateCommand();
cmd.CommandText = sqlText;

IDataReader res = cmd.ExecuteReader();

For info on using DataReaders, see the KB article
Answer: When Excel recognizes a value as a time value, it stores the time portion in the decimal portion of a number and stores the day portion of the date as the whole number portion of a number. Excel stores all numeric values as double precision floating point values which is why you are getting non-exact results.  However, why you are getting 0.0451388888888889 instead of something like 0.080150462962963 is a mystery. You might try looking the underlying value in Excel by putting a simple formula in a blank cell that points to one of your mystery date values (e.g. =A3). Then format that cell as a numeric value with decimal places and see what number it provides. If the underlying value is also 0.04513... then the problem is in the source data and not the ExcelDataReader library.


Are slugs beneficial or detrimental?

Question: I've noticed quite a few slugs around my garden recently, and I realized that I don't know if that's a good thing or not.  I know some bugs are bad and some are good, and I don't know what category slugs fall into.
Comment: They are a primary ingredient in slug fritters (http://bertc.com/subfive/recipes/slug_fritters.htm).  Not that I've ever tried cooking that....
Comment: @rsgoheen humans can contract meningitis from improperly cooked or raw slugs. For that reason it's also a good idea to really thoroughly wash hands after handling.
Answer: Slugs are considered a pest. I don't know of any benefits they provide.
See answers to this question for ways to deal with them.
Answer: Slugs are one the most common garden pests. If not eliminated they can do much damage. They do most of their damage at night when you are not watching. If you see one then surely there are many that you don't see.
There are many products on the market for slug control. These are mostly baits. The easiest ways are available around the house. The first is beer. Slugs love the yeast in beer. Bury a container in the ground where slugs can climb in. Fill it halfway with beer and the slugs will climb in and the alcohol will kill them.
Ashes and salt also can be effective. Ashes from the fireplace can be sprinkled around the garden perimeter. Same can be done with salt. These practices discourage slugs and snails.
Comment: Deliberately adding salt to a garden is doing a lot more and worse things than controlling slugs.
Comment: @Ecnerwal Agreed - you can use them for directly attacking slugs, but just remember you aren't going to spot half of them as they can live the soil. If you create a line of salt to act as a barrier, the amount needed to be effective will be harmful to plants and most plants will be damaged if they come into direct contact with salt. Ash can be problematic in larger quantities, particularly if you have acid-loving plants. I regularly spread wood-ash in my garden as fertiliser and I can't say it has had any effect on slug damage.
Answer: I know that you have already accepted an answer, but I thought some balance is needed, given that the other answers are all along the lines of "KILL THEM, KILL THEM ALL!".
Most slug species are not problematic and play an important role in breaking down material in compost heaps. Some species even eat other slugs. They are also an important food-source for a range of birds, many of which will help control populations of other pests.
There are some species that are particularly problematic pests though, and you will want to control these. I would avoid using any of the pellets available, even the so called organic ones can be harmful to other wildlife, especially cats and hedgehogs. Salt can be problematic as it is harmful to plants. The most effective control I have found, have been beer traps: they effect only actively foraging slugs (i.e. the ones that are mostly likely to do damage) and they are reasonably specific in the area they effect.
Answer:
I have had hundreds of slugs in my back yard in the flower beds this past fall and winter.  I find them eating my flowers.  I put a solution of ammonia and water (1 part ammonia to 4 parts water) and go out at night with a head lamp on and spray them.  The ammonia water kills them instantly.
Comment: I wouldn't recommend using ammonia - it is harmful to, well pretty much everything, including plants. It will also alter your soil chemistry (not for the better).

Are slugs beneficial or detrimental?


How to use notify-send with C++?

Question: I'm a C++ beginner coder. I'm trying to understand how to send notifications using libnotify-bin library. I've read some guys saying don't to use system calls. Any clue?
Comment: SInce `libnotify-bin` ends up using system calls, you cannot avoid them. System calls are how most things get done. Which guys? What, exactly did they say? I've heard "some guys" saying the Earth is flat.
Comment: I'm sorry, @waltinator, I don't find those "some guys". They argued that isn't a good idea to use system call instead libraries. They didn't explained because. I think may be because security issues.
Answer: Okay so this is how I did it. First install libnotify-dev:
sudo apt-get install libnotify-dev

this will install the lib on your system and put the headers of the lib to /usr/include/libnotify/
You can take a look at the header files to find out how to use the lib. I did the following:
#include <libnotify/notify.h>
#include <iostream>

int main(int argc, char * argv[] )
{
    notify_init("Sample");
    NotifyNotification* n = notify_notification_new ("Hello world",
                                 "some message text... bla bla",
                                  0);
    notify_notification_set_timeout(n, 10000); // 10 seconds

    if (!notify_notification_show(n, 0))
    {
        std::cerr << "show has failed" << std::endl;
        return -1;
    }
    return 0;
}

In order to build this type:
g++ hello_world.cc -o hello_world `pkg-config --cflags --libs libnotify`

And here is the result:
Comment: When I test your code, it works fine! Although, when I put it in my function I receive an error message from the compiler:  `main.cpp:(.text+0x4d7): undefined reference to notify_init
main.cpp:(.text+0x4ee): undefined reference to notify_notification_new
main.cpp:(.text+0x503): undefined reference to notify_notification_set_timeout
main.cpp:(.text+0x514): undefined reference to notify_notification_show`
Comment: My function isn't main... Is this a problem?
Comment: `void notifyUser( const char *app_name,
         const char *summary,
         const char *body,
         const char *icon )
{
 notify_init( app_name ) ;
 NotifyNotification *notifyN = notify_notification_new( summary, body, icon ) ;
 notify_notification_set_timeout( notifyN, 10000 ) ;

 if ( !notify_notification_show( notifyN, 0 ) )
 {
  std::cerr << "show has failed" << std::endl ;
 }
}`
Comment: @AleD no the function name doesn't matter you can name it whatever you want. This is probably the linking order problem.
Comment: I got the same undefined reference error after adjusting the filename, whereupon I had moved it to the end of the command line. The order is important. The source file which references libnotify should come before the pkg-config part. The pkg-config adds the -l option to g++, which is order dependent.

How to use notify-send with C++?


Add button to DeckPage

Question: I would like to create a GUI extension for Experience Manager in Tridion 2011 to add a new button to the WorkflowDeckPage, any ideas on how to do it?
Comment: Could you give a few details of what you have already tried?
Answer: See if this helps, Bart has written a post on adding unanswered SO questions to his Dashboard.
http://www.tridiondeveloper.com/dashboard-extension
Comment: What we would like to do it to add a new  "whereused" button to the WorkflowDeckPage so it is possible to check where the component related to a workflow activity is used by callind the "whereused" command. A similar feature to this is already included in Tridion 2013 but we are currently working with Tridion 2011 so we would like to add this feature before we migrate to the new version. We have create an extension to add the code to the Workflowpanel control and that works fine but I cannot figure out how to add the button to the Workflowpanel control by using an extension.
Comment: Thanks Chris, I have already checked that post but my aim is to extend the already existing WorkflowDeckPage rather than create a new one, nevertheless, I will check the post again.
Comment: Emma, perhaps update your post to better inform exactly what the requirement is. It does state "add a new button" but not what you want that button to do (such as extend xyz functionality). Thanks
Answer: I'm assume you are trying to extend WorkflowPanel. Currently there are no extension points in this panel (like ExtendableArea or extendable controls).
So you can only create script on your own risk which dynamically over js adds new Button to WorkflowPanel. This script can be added to "Tridion.Web.UI.Editors.SiteEdit.Controls.WorkflowPanel" configuration group via groups extensibility mechanism.

Add button to DeckPage


Zooming into RAW images

Question: Hey there I was wondering why is it when I zoom into an image I took it looks grainy & pixalated. The image will be taken at an iso of 100 and look sharp on the the camera but not as sharp on a tablet or computer been it appears larger. My camera is Nikon Z6.
Comment: How far are you zooming? What size images are you taking? Are you certain you're looking at the RAW itself, not the jpg preview? What OS & what viewing software?
Comment: Can you attach an extract (crop, without re-scaling) of such a picture?
Comment: @xenoid The OP does not have enough rep to attach an image. They will need to provide a link to an image hosted somewhere else, like directly to imgur. One of us can then embed the image in the question if the OP desires.
Answer: Any time you zoom in image quality will look worse than when you're not zoomed in. It's like holding a magnifying glass up to a postage stamp or a photo printed in a newspaper. What looked like solid lines or areas of solid colors when you viewed them from normal distance and they were unmagnified are shown to actually be a series of very small dots instead.
This was true of prints made from film negatives. If one looks just as closely at a 16x20 inch print made from the same negative as an 8x10 inch print, it will always be easier to see defects in the 16x20 than in the 8x10 due to the greater enlargement.
It's still true when viewing digital images.
When you increase the enlargement of an image to 100% (one image pixel = one screen pixel), noise that got averaged away when it was scaled to fit the entire image on your screen will be visible when every pixel in the image is displayed using one pixel on the screen.
The more you enlarge an image, the more you will be able to see some parts of the image that looked sharp at smaller viewing sizes are actually slightly blurry. This is why depth of field for the exact same image is reduced when viewed at larger size from the same distance. There's only one distance that is focused the sharpest. Everything else gets blurrier and blurrier the further in front of or behind the focus distance they are. The more we magnify an image, the easier it is to see that things slightly in front of or slightly behind the actual focus distance are blurry rather than sharp.
Also, when you view images at 100% magnification, the more pixels an image has, the more you are enlarging each pixel to view it at 1 image pixel = one screen pixel. If you have two images that were taken with the same sized sensor and one is 20 MP and the other is 40 MP, you are enlarging the second image by twice as much, in terms of area (and 1.414X as much in linear terms) as you are enlarging the first image.
If you view images at greater than 100%, you're actually stretching the image so that each image pixel is repeated on several adjacent screen pixels, so it will really start to look pixilated and blocky.
Your Nikon Z6 has a 24.5 MP sensor. If you were used to a lower resolution camera, when you magnify the images from the Z6 to "100%" (so that one image pixel is displayed by one screen pixel) you're increasing the magnification more than you were with the previous lower resolution camera.

Zooming into RAW images


Having issues in Jmeter while performing the IF Controller, i'm using Jmeter latest version 5.5

Question: INFO o.a.j.e.StandardJMeterEngine: Running the test!
INFO o.a.j.s.SampleEvent: List of sample_variables: []
INFO o.a.j.p.j.s.JavaSampler: Created class: org.apache.jmeter.protocol.java.test.JavaTest. Uses tearDownTest:
INFO o.a.j.g.u.JMeterMenuBar: setRunning(true, local)
INFO o.a.j.e.StandardJMeterEngine: Starting ThreadGroup: 1 : Thread Group
INFO o.a.j.e.StandardJMeterEngine: Starting 1 threads for group Thread Group.
INFO o.a.j.e.StandardJMeterEngine: Thread will continue on error
INFO o.a.j.t.ThreadGroup: Starting thread group... number=1 threads=1 ramp-up=1 delayedStart=false
INFO o.a.j.t.ThreadGroup: Started thread group number 1
INFO o.a.j.e.StandardJMeterEngine: All thread groups have been started INFO o.a.j.t.JMeterThread: Thread started: Thread Group 1-1
DEBUG o.a.j.c.IfController:     >> evaluate Expression [$(RESULTS) == COMPLETED] equals (ignoring case) 'true'
INFO o.a.j.t.JMeterThread: Thread is done: Thread Group 1-1
INFO o.a.j.t.JMeterThread: Thread finished: Thread Group 1-1
INFO o.a.j.e.StandardJMeterEngine: Notifying test listeners of end of test
INFO o.a.j.g.u.JMeterMenuBar: setRunning(false, local)
Answer: What "issues" you are "having"?
If you want the If Controller to execute its children when RESULTS JMeter Variable will be equal to COMPLETED you need to change it a little bit.
Your $(RESULTS) == COMPLETED condition doesn't make any sense, you need to change it to i.e. __jexl3() function:
${__jexl3("${RESULTS}" == "COMPLETED",)}

Demo:

More information: 6 Tips for JMeter If Controller Usage
Comment: Thank you Dmitri For the solution it is working fine now, Actually I am new on Jmeter so its really helpful for me.


Why is a t-test necessary given that we have the z-test?

Question: Can someone give an explanation for why the t-test "happens"? I was taught to use the t-test when you don't know the population standard deviation (i.e., you only know the standard deviation of your sample), but I'm not sure why that would make it different from a z-test.
Comment: I've updated your title to get at the question I think you are asking; feel free to edit if I have misconstrued
Answer: The z-test itself is actually a likelihood ratio test between the likelihood assuming the null hypothesis and the likelihood assuming the alternate hypothesis. Assuming underlying normal distributions with known variances and only testing the means, the algebra simplifies to the z-test we know and love (DeGroot 1986, pp. 442–447).
Using the same maximum likelihood procedure, but treating the variance as an unknown, creates a different pair of likelihoods and their ratio, and letting the algebra simplify out gives the statistic:
$$
\frac{\sqrt{n}\left(\bar{X}_n - \mu_0\right)}{\sqrt{\frac{S^2_n}{n-1}}}
$$
(DeGroot 1986, pp. 485–489). The testing distribution in question changes as well, as the numerator of the above statistic is normally distributed, $\bar{X}$, and the denominator is distributed as square root of squared normals, the $S^2$, which is the square root of a chi-square random variable. Gosset (Student) showed that if you have a random variable:
$$
Y \sim N(0, 1)\\
Z \sim \chi^2_n\\
X \sim \frac{Y}{\sqrt{\frac{Z}{n}}}
$$
then X is distributed with the t distribution and n degrees of freedom.
So, to state it without rigor, the t-test is the natural outcome of the same likelihood ratio process that is behind the z-test when the variance of the data is itself unknown and is being estimated through maximum likelihood.

DeGroot, M. H. Probability and Statistics Addison-Wesley Publishing Company, 1986
Comment: this was very enlightening. I had completely forgotten that the t-test comes from maximum likelihoood
Answer: I don't think I understand your question completely. Are you asking why you would use a t-test?
If you understand why you would use a z-test, you should have a good idea of why you would use a t-test. For large samples, a z-test and a t-test should render similar or identical results. But while a z-test will assume a normal distribution, a t-test will take into account uncertainty in sample distribution at smaller samples sizes.
Comment: Hmm the t-test also assumes a normal distribution. Perhaps what you meant to say is that we require less information about that distribution.
Comment: @JohnK I don't think it makes sense saying a test assumes a distribution in the first place, but I think Benjamin meant that the t-score/statistic assumes the T-distribution and not the Z-distribution.
Answer: The non-rigorous answer is that you want to use a t-test when you have a small number of samples because of the chance that the samples are unusually close together (relative to the actual population variance). In that case, the denominator in the formula for the t-statistic will be unusually small, and so the t-statistic itself will be unusually large. Thus, you're much more likely to get a large value for the t-stat when you have a small number of samples than you would be to get a comparably large z-stat, so you need a larger value to reject the null using the t-test than the z-test at the same significance level.
Comment: I find the argument appealing but, upon reflection, unconvincing. After all, if by chance the samples are unusually far apart (which ought to happen just as easily as being unusually close), then it seems the very same logic would lead to the opposite conclusion.
Answer: The most important differentiator is sample size, as a rule of thumb: If $n$ is smaller than $30$ a t-test should be used, otherwise a z-test.
A good overview of the underlying assumptions and differences (and similarities) of both tests is given here:
http://www.le.ac.uk/bl/gat/virtualfc/Stats/ttest.html


geometric mean and the normal distribution

Question: If you have data that are sampled from a normal distribution, what is the relationship between the arithmetic and geometric means? Would it ever make sense to report the geometric mean instead of the arithmetic mean? (Assume that all the values are positive; no zeros, no negative values)
Comment: Would you be happy to have a geometric mean $\sqrt{x_1x_2}$ have imaginary value when $x_1$ and $x_2$ have opposite sign?
Comment: Any normal distribution, no matter what $\mu$ & $\sigma^2$, will include $0$ & negative values. It is of course possible that your particular sample includes only strictly positive values, but the population must include negative values.
Comment: The geometric mean is sort of built into the Gaussian pdf in its denominator term: $\sqrt{2\pi * \sigma^2}$. The geometric mean is defined as $\left(\prod _{i=1}^{n}x_{i}\right)^{\frac {1}{n}}={\sqrt[{n}]{x_{1}x_{2}\cdots x_{n}}}$. And so the denominator term is really just the geometric mean of $2\pi$ and the variance. I left this as a comment not an answer because it doesn't address your question, it's just an interesting way to look at the Gaussian pdf.
Answer: Why do you want a geometric mean of normal distributed observations? I can see no good reason. Applications of the Geometric Mean  gives several good examples of use of geometric mean. A typical case is return on investment. Returns combine multiplicatively, so If you want one "typical" return that would result in same winning, if the return was held constant over years, you get that from the geometric mean of the yearly returns.
Common to all such examples is that the random variable in question cannot be negative, and, since every normal distributed variable is negative with some (maybe very small) positive probability, geometric means do not look natural to use. So, again, why do you want to use a geometric mean?
See also the related Estimating with the geometric mean,   Which "mean" to use and when?
Answer: Edited because I am an idiot:
If you have normal samples you might have negatives depending on your mean and variance which would flip the sign. It feels unstable to flip a sign irrespective of the magnitude. Bummer.
More interesting are distributions with support on the positive or negative reals.
Comment: (+1) I hope you won't be offended at me upvoting an answer where you self-describe as an idiot --- I just love a good self-deprecating sense of humour.
Comment: Damn you are absolutely right! It would just endlessly change the sign. Feels unstable.
Comment: Can you explain how you get a geometric mean of zero when negative values is included?
Comment: +1 calling yourself out right?
Answer: For a normal distribution then, approximately:
$\mu_g=\mu_a-0.5\sigma^2$, where $\sigma$ is the standard deviation of the normal distribution. I'm defining $\mu_g=\sqrt[n]{(1+r_1)(1+r_2)...(1+r_T)}-1$ where $r_j$ are drawn from a normal distribution. I'm thinking here of the case of finance where r are asset returns, it does make sense to consider geometric returns as they represent growth rates.
Comment: As pointed out in comments and other answers, the underlying Normal distribution does not have a geometric mean.  Moreover, there are plenty of cases where your formula will give an impossible negative value!


hsl() colors: individually control hue, saturation or luminosity

Question: Is it possible today or in any upcoming standards to individually control the hue, saturation and luminosity of a hsl() colour in css?  What can and cannot be done with pure CSS, and what alternative solutions might there be with jquery?
Ideally, I'd like to be able to do something like the following, or be able to emulate it with some other means.
I'd like to create base classes:
.color-10 { color-hsl-hue: 10;}
.color-20 { color-hsl-hue: 20;}
.color-30 { color-hsl-hue: 30;}

etc.
.saturation-10 { color-hsl-saturation: 10%; }
.saturation-20 { color-hsl-saturation: 20%; }
.saturation-30 { color-hsl-saturation: 30%; }

etc.
.luminosity-10 { color-hsl-luminosity: 10%; }
.luminosity-20 { color-hsl-luminosity: 20%; }
.luminosity-30 { color-hsl-luminosity: 30%; }

etc.
Thus we could provide a base color value for any element in CSS, e.g.:
div { color: hsl(50, 50%, 50%); }

And the user would be able to easily tweak colors by combining classes:

...

That would automatically be rendered as:
div.luminosity-30.hue-120 { color: hsl(120, 50%, 30%); }

Also, I'd love to be able to do things like:
div h2 { color-hsl-luminosity: -20%;}
div p { background-color-hsl-saturation: +10%;}
div strong { background-color-hsl-hue: +50;}

Thus, whatever the base color of the
 was, the
 element would be rendered with a slightly darker background, etc.
Maybe I can emulate it with jquery, but how to get the currently calculated value for the individual hue, luminosity, saturation values?
I'm thinking something like this:
 var hue = $(div).hsl-hue();
 hue += 20;
 $(div h2).hsl-hue(hue);

Answer: There's CSS filters.  I built something similar to what you're talking about:
CSSInstaglam
Demo
BUT -- IE support is basically non-existent.
Comment: Thanks. I'm looking into it.


C language beginner

Question: I want to do PIC programming in embedded C. But I don't know the language well. Please help me by suggesting some good sites for getting an idea about C programming.
Comment: Have you learned a programming language before?
Answer: Microcontrollers like the PIC are very unforgiving to the learner. If you're setting out trying to learn C for the first time, practice on a PC first. Test your code as much as you can on your PC where you have a good debugger and protection from memory faults.
Once you're confident that your logic is working right, then compile your code for the PIC.
Comment: +1 The PIC is not a C friendly platform anyway, and the last place I would try to learn C.
Answer: I'd recommend getting K&R because I like to read a book as I learn a language, but if you're looking for an online resource, Wikibooks' C Programming isn't a bad read.
Alternatively, for a topical resource, look at http://www.cprogramming.com or http://www.cplusplus.com - Note that both are C/C++ sites, you must be wary of the differences.  You don't want to use C++ for your PIC projects.
When doing native (PC) programming, follow links to the Opengroup.org Single Unix Specification.  Also be aware of the cross-referenced and searchable Linux kernel source code at http://lxr.linux.no/
The comp.lang.c  mailing list (Searchable Google Groups page) and its FAQ are also useful.  Daniweb's C forum and, of course, the "C" tag on Stackoverflow are also more sources for specific questions.
Last, a Google search for <code>"C Language"  + keyword</code> is a good starting point for many questions, and usually yields better results than just the letter C.
Comment: Provided a C++ compiler even exists for PIC, I see nothing wrong with using the language in an embedded device.  There are some great benefits to be had using an object-oriented language, even in constrained environments.
Comment: @blalor - For a beginner, I didn't want to get into those issues.  See ["Is C++ suitable for embedded systems"](http://electronics.stackexchange.com/questions/3027/is-c-suitable-for-embedded-systems) for more discussion of the issue.
Answer: Get The C Programming Language by Kernighan and Ritchie. They invented C and it's the best introduction to the language there is.
Some of the low-cost C compilers for the PIC are rather non-standard. Microchip's C18 for the PIC18 and Hi-Tech's C for the smaller PICs would be better; free versions of both compiler are available.
Comment: Make sure to get the second edition, with the "ANSI C" box on the cover: http://www.amazon.com/Programming-Language-2nd-Brian-Kernighan/dp/0131103628  The original is for an older version of C (1978). The 2nd edition is for 1988 ANSI C, and you should be aware that it does not cover the C99 standard.
Answer: Once you are ready to apply your C skills to the PIC, I would get a development board, and one of the following books, depending on whether you are dealing with 8-bit (PIC1x), 16-bit (PIC24) or 32-bit (PIC32) devices:
Programming 8-bit PIC Microcontrollers in C: with Interactive Hardware Simulation
Microcontrollers: From Assembly Language to C Using the PIC24 Family
Programming 32-bit Microcontrollers in C: Exploring the PIC32
all available on Amazon (along with lots of similar titles covering PICs and C).
Note: I would shy away from 8-bit PICs lower than the PIC18, as they are not as well suited to the C language.
Answer: If you're really interested in learning PICs and c, I would say you can check out  123 PIC Microcontroller Experiments for the Evil Genius.  This is how I got started with PICs. However, I would at the minimum recommend purchasing the PIC Kit 2 as the 1 doesn't program nearly as many things.
I have really enjoyed playing with the PICs, the HI-TECH compiler for the 16 series (and probably other series) is free for the MPLAB environment.
Good luck. I'm actually attempting to come up with a RTOS (Real Time Operating System) for a 16F913, just to try it out.
Comment: Sorry, I didn't include a site....I actually just used microchips site www.microchip.com , and their datasheets for the chip you're using!
Answer: Thinking in C. There are some bugs, but it's a great free ebook from Bruce Eckel.
Comment: link broken for me.
Comment: For me it's ok. Try this link for direct download: http://www.mindviewinc.com/ThinkingInC/Beta3Download.php.
Or you can try this link: http://www.mindviewinc.com
Thanks
Answer: It all depends on how you learn, but I find its easier to learn with a distinct objective when your'e learning.  If you want to specifically learn C for PICs, here's my recommendations:
Ironically, I'd pick up an Arduino and not a PIC setup.  Programming PIC chips in C has a very large learning curve that assumes you know how to read datasheets, burn code into chips, etc.  Arduinos do not have this.  You program Arduinos in C (*).  If you know nothing/vary little about programming or writing in C or with microcontrollers and don't know where to start or what to do, the example code that comes with it is very simple and will allow you to get up and running quickly.  The documentation for the Arduino is easy to read with minimal experience.  A trip to an electronic store and the Arduino board will give you a way to get started.
In conjunction with that, I would read a book or a tutorial on C.
In addition, I would find someone else who knows how to program PICs or microcontrollers in C and work with them.  A subject like this has a huge learning curve, but a person who can interact with you and help you fill in the gaps is huge.
(*) - It does use a form of avr-gcc in the backend, correct?  I haven't dug into the Arduino IDE source code.
Comment: Yes, the official Arduino website
http://www.arduino.cc/en/Hacking/BuildProcess
specifically mentions that it uses avr-gcc.

C language beginner


Identify a non-Lego Santa set

Question:
Yeah so basically I tried the usual sites, but even putting in "North Pole sign" came up with nothing except one kinda similar. I can't find anything on this set. Please help.
Answer: I could not find anything for 'Santa's letters' and the parts with 'North Pole' where showing different stickers on Bricklink,
Based on the design of the bricks and the strange colour used for the characters I strongly suspect these are not LEGO bricks.
The 2x2 slope for example does not show a visible LEGO logo on the studs and each stud is quite different. The bags they are packaged in are also not standard.

It will be quite difficult to identify this set if you cannot find a box, instructions or some other markings/part numbers. Clone-brands rarely have an online set database where you can find sets or an official website.
Answer: I was not able to find anything in a Google search for compatible +"santa's letters" building construction - this appears to be a product that hasn't made an impact on the Internet.

Identify a non-Lego Santa set


How are sites like Pinterest able to hold all those pictures?

Question: Does anyone know how sites hold massive numbers of pictures in general? I tried researching this, but it seems like they would need massive storage spaces to hold all these, unless there was a trick to it? I'm sure they compress them, but thats still a huge amount of data to hold for one site.
Comment: Yes, they just store them.  Storage is cheap relative to cpu and memory.
Comment: One thing that a site like Pinterest can obviously do is deduplication: store each image only once, no matter on how many people's pages it appears.
Comment: http://www.howstuffworks.com/pinterest.htm havent u seen this?
Comment: My guess is, more than 1 hard drive!  :)
Answer: When it comes to storing large amounts of data, content providers use Storage Area Networks, also known as SANs and SAN storage hardware.
From Wikipedia:

A storage area network (SAN) is a dedicated network that provides access to consolidated, block level data storage. SANs are primarily used to make storage devices, such as disk arrays, tape libraries, and optical jukeboxes, accessible to servers so that the devices appear like locally attached devices to the operating system. A SAN typically has its own network of storage devices that are generally not accessible through the local area network by other devices. The cost and complexity of SANs dropped in the early 2000s to levels allowing wider adoption across both enterprise and small to medium sized business environments.

So what does a SAN storage device look like?  Some look like the following:
.
Every one of those slots (the red square is the drive eject button) is a hard disk drive.  The one in the picture is a relatively small SAN storage device, others can look much different and can be much larger in size.
Where I used to work, we had SAN storage which were boxes, basically the size of 3 refrigerators side-by-side filled with hard drives.  We then took those drives as needed and created RAID arrays for redundancy.  As we needed more space, we could order more SAN storage devices and attach them to our storage area network.  This allowed us to have petabytes of redundant storage.
Sites like Flickr, Picassa, Facebook, etc, have very large SANS filling massive datacenters.
Answer: From your question I gather that you do not have a Computer Science background, so I'd avoid throwing geeky sounding terms.
Popular websites, handling extremely large amounts of data (or traffic), is nothing new or very unique. Usually there is no trickery in terms of massive compression (since most pics uploaded as JPEG are highly compressed already, and further compression can often result in loss of details). What does go in is some clever architecture, lots and lots of computers, fast & reliable network, and of course, several terabytes (or even petabytes) of storage. Actually, storage is often the least of the issues. Storage and compute power is pretty inexpensive these days.
What happens is data is often distributed (several copies) across multiple computers, for redundancy and faster-retrieval, and seek/search of data happens in parallel. Keeping frequently used data closer to the edge of the network or users and keeping such data updated based on usage, are some of the techniques.
Some geeky keywords that are often used, and might be seen as wizardry are:

Multi-level caching
Distributed storage
Data Warehousing
NoSQL
Map-Reduce
Data sharding (mostly in the SQL world)
Parallel processing
CDN (Content Delivery Networks)

How to do this well, more efficiently, effectively is a field of study and also research, in the area of computer science and computer architecture. Different technique are used based on nature of data, nature / frequency of access (more writes, versus more reads), kind of reliability required etc.
Edited:
This picture of google's server rack (from 1999) is epic:! Note the exposed harddrives (3-4 of them) in the middle of each server "tray" (especially the one labelled "g61").

and the full journey is captured in this post here:
Comment: Don't have enough reps to leave comment on @Keltari's otherwise nice answer, so will comment here. SAN's are a popular, more common and slightly more traditional approach, that many big enterprises and their IT depts prefer. There is however an alternative approach which was popularized by the likes of Google and Yahoo. Roughly speaking, this approach is based on the principle of having huge cluster of servers (pizzaboxes), each with large attached storage, where each server not only contributes storage-space, but also computation power. That distributed computation is used to...
Comment: ...breakdown complex search, lookup operations into smaller operations that are spread across the cluster and run in parallel. The search results are then combined together to form the answer to the more complex question. This is typical of search networks, and "read-heavy" operations.  Note that these days, Google, Yahoo and the likes do use SAN too. Those organizations are far too complex and have grown rapidly to stick to one single technology for storage or computing. In the end, it boils down to using the right tool for the right job.
Answer: They can't compress the photos, because photos are almost certainly already compressed, either with JPEG or PNG compression, and it's not possible to compress already-compressed data.  (That's oversimplifying it a bit, but unless you want to get deep into information theory, just accept that as a given.)
There's really no shortcut.  A site that holds massive amounts of data has massive amounts of computers to hold it on.
Let's say an image weighs in at 1 MB.  There are plenty that are bigger, and plenty that are smaller, but just for simplicity's sake let's say the average image is 1 MB.  It's not hard to find affordable 2 TB drives these days, which means that each drive could theoretically hold around 2 million images.  (Obviously there will be some space lost to overhead, but you get the idea.)
A server can have a RAID configuration set up with multiple hard drives.  Some of the data is lost to redundancy, but even so you can have several TB worth of drives per computer.  And a server farm can hold dozens, hundreds, or even thousands of servers.  That's how sites like Pinterest and Facebook manage so much content.
They tend to have massive server farms, with computers in front of them that route requests from Web browsers, looking up the content in the appropriate place in the server farm and serving it back to the user.  It's a really big topic to try to cover here, but that's the basic idea.
Comment: the number of computers has *nothing* to do with storage capacity or capability.
Comment: @Keltari sure it does, you can only hook up so many drives to a controller, and only so many controllers to a server. There is a finite amount of space a single server can handle, so it needs to be distributed over several servers.
Comment: @Richie: That's one reason you use SANs - you no longer need a controller for "so many drives", you only need an interface card to talk to the SAN, and the server need not care how many drives the SAN contains. Of course, there may still be a maximum partition size in the OS, but that is typically very high.
Comment: @RichieFrame, you are correct that a server can physically hold so many drives.  However, this is the reason for SANs and NASs - storage is abstracted, which allows it to be virtually limitless.  Servers can cantain 0 drives and simply be connected to a SAN or NAS.
Comment: In all fairness, a SAN really is just a bunch of computers, each of  which _can_ hold a huge amount of disks. They're built especially for that purpose. But even before SANs became popular, some servers could hold well over a 100 disks.


BO and DAO in Spring + JSF

Question: I have a architecture dillema. I've implemented Bean (@Named) BO and DAO. And I am not sure how communication should be implemented. Let's say I want to register user. I am filling the bean from JSF then I use userBO.registerUser(this) method on injected userBO. I am not sure what should happen next. I think validation should be BO's work and if everything is ok data should be passed to DAO. DAO should create UserEntity and persist it into database. But what if we create UserEntity in BO and pass it to DAO. I am a little bit confused.
Comment: Are you using JDBC or JPA? JPA is at its own already the DAO layer.
Comment: jpa but still I should be able to get elements from database by id or smth like this in the future
Answer: BO should deal with any business logic.
If the creation of the UserEntity is related with any business logic (i.e. the attributes or the values need to be calculated according to a non-trivial logic rule) the creation might stay in the BO. If the creation is simple, and basically puts the values of the form in the object, it can be populated in a previous layer (Controller, or JSF, or whatever).
About the DAO, it should only persist a populated object into your database.
Hope this helps you!

BO and DAO in Spring + JSF


iMac 27-inch, Late 2014, RAM upgrade size combinations

Question: There are 4 slots. 2 slots taken by 2x4GB that came with Mac at purchase. Max memory is specified as 32GB. Can I buy 1x8GB and 1x16GB to fill the remaining 2 slots. Or do I need to use 8GB for both remaining slots. Thank you!
Comment: Personally I would put 2 or 4 matching memory modules in the slots - just to avoid possible mis-matching.
Answer: The general rule is you can mismatch sizes in pairs but not in individual slots.
Computers use interleaved memory, which requires each pair of slots to be populated with the exact same RAM. Having mis-matched slots will 'break' the interleaving & slow down the RAM access. As far as I'm aware this isn't 'dangerous' at all, merely slower.
Some machines can also use triple-channel memory, where three matching memory sticks can be interleaved. I don't know whether your iMac can do that, it may only be the Mac Pros that can - though in this case would make your issue harder to solve [I'm just including it for completeness]
So, your ideal way to achieve 32GB would be 4 x 8GB, which is probably cheaper than 2 x 16 anyway. If you keep the existing 4's I would add a pair of 8's.
Crucial's RAM configurator, on a quick search [check for your exact model] shows no 16GB sticks at all.


How do I run a Lein project in Clojure's new CLI tools version?

Question: I have a Clojure project I started a couple of years ago.
It's all using Leiningen. With a project.clj file etc. And my code in src/myproj/blah.clj etc.
I now want to try using Clojure's new CLI tools.
I tried navigating into the root of this project directory and launching clj then typing (require '[myproj.blah :as blah])
But this throws a FileNotFoundException.
Can the CLI tools find code in a lein type file-structure and work with existing lein projects?
If not what's the procedure to adapt a lein project to use CLI tools?
Answer: Here's a guide to the new command line tools https://clojure.org/guides/deps_and_cli
You need a deps.edn file that contains your dependencies instead of a project.clj file.
Here's some rationale of what deps does and doesn't do:
http://cdn.cognitect.com/presentations/2017/dependency_heaven.pdf


Is the following language is a context free grammar language?

Question:
The question is to determine whether L is a context free grammar language, what do you think?
Comment: Probably best to intersect $L$ with the regular language $0^*1^* \# 0^*1^*$ first.
Answer: Consider the word $w = 0^n1^n0^n \# 0^n1^n0^n \in L$ for a sufficiently large value of $n$.
By the pumping lemma for context-free languages, we know that if $L$ is context-free then there are$a,b,c,d,e = \Sigma^*$, with $|bcd| < n$ and $|bd|>1$ such that $w=abcde$ and, for every $i \ge 0$, $a b^i c d^i e\in L$.
Notice that neither $b$ nor $d$ can contain $\#$, as otherwise setting $i=0$ would show that $a c e \not\in L$.
If $c$ contains $\#$, then $b,d \in 0^*$ and $a b^i c d^i e$ is a word of the form $0^n 1^n 0^{x + i|b|}\#0^{y+i|d|} 1^n0^n$ with $x+|b|=n$ and $y+|d|=n$.  If $|b|>0$ you can make the first part of the word (before $\#$) end with more than $n$ zeros by picking $i=2$, resulting in a contradiction. Otherwise $|d|>0$ and you can make the second part of the word (after $\#$) start with less than $n$ zeros by setting $i=0$.
If $c$ does not contain $\#$ then $b$ and $c$ either both precede or both follow the unique occurrence of $\#$ in $w$. If they precede $\#$, pick $i=2$. If they follow $\#$, pick $i=0$.
In this way the first part of the word becomes longer than the second (and hence not in $L$).
Comment: If $x=y$ (which is the case in the words we are considering) and $|b|=|d|$ then both $b$ and $d$ are non-empty words containing only $0$s. $b$ is in the last group of $0$s of $x$ and $d$ is in the first group of $0$s of $y$. You can either choose $i=2$ (to get more trailing $0$s before the $\#$ character than at the end of the pumped word) or $i=0$ (to get fewer $0$s immediately after the $\#$ character than at the beginning of the pumped word). In any case the pumped word is not in $L$. This seems to be correctly handled in the first case of my answer as it satisfies both $|b|>0$ and $|d|>0$.
Comment: Thank you for your reply! but, notice that I asked if L is context free grammar and not regular.
Comment: Sorry, I fixed it.
Comment: Thank you very much :)
Comment: what if x = y and |b| = |d|? Like in the case that c is exactly equals to #. It seems in that case that picking i = 2 won't work
Answer: This is not a CFL. We can prove this using pumping lemma for CFL.
We prove it as follows: Consider the string $s = 0^n1^n0^n\#0^n1^n0^n \in L$. By pumping lemma, for a significantly large $n$, we can split the string in five parts: $u,v,w,x,y$ such that $s = uvwxy$, $|vx| > 0$, and $uv^mwx^my \in L$ for all $m$.
Basically, you have to find out two parts of the string $s$ (at least one is non-empty), such that no matter how many times you pump it, the pumped string has to be in $L$.
It is not hard to see that no splitting satisfies the pumping lemma:

If both $v$ and $x$ are on left side of #, then the pumped string won't stay substring of the string on right side of #.
Work out other cases...
Comment: Thank you very much :)


Clustering of events

Question: I've a sequence of time ordered set of points: for each $t=1...T$ I have a set of points $(x_{t,i},y_{t,i})$. I need to cluster them together in space-time. I don't know however a priori the number of clusters. What approach do you suggest? My goal is to understand whether the event at time, let's say, $t_1$ belongs to some of other past cluster or forms a new one.
Answer: Why not adding time as a third dimension and use a standard clustering algorithm? I.e. create new "points" $(x_i,y_i,t_i)$ and use k-means or DBSCAN. With this way you can also use a custom scaling/normalization to adjust the weight of the the time dimension.

Clustering of events


Dependent choice and Zorn's Lemma

Question: How much of Zorn's lemma can be saved if we assume only ZF+DC without full choice?
More precisely: assume we have a partially ordered (inductive) set which is of size continuum. Then can we apply Zorn's lemma in this case assuming only dependent choice?
Answer: It is a theorem of Wolk [1] that for every infinite $\kappa$ the axiom $\sf DC_\kappa$ is equivalent to the following statement:

If $(P,\leq)$ is a partially ordered set in which every well-ordered chain has order type $<\kappa$ and has an upper-bound, then $P$ contains a maximal element.

In the case of $\kappa=\omega$ this means that every partial order in which every well-ordered chain is finite and bounded has a maximal element.
Note that there is no limitation on the cardinality of $P$. Only on its well-ordered chains.

Bibliography:

Elliot S. Wolk, On the principle of dependent choices and some forms of Zorn's lemma, Canad. Math. Bull. 26 (1983), no. 3, 365–367.
Comment: What can we save ($DC_{\omega}$ or $DC_{\aleph_1}$) in Solovay's model?
Comment: Solovay's model **satisfies** $\sf DC_\omega$. When we say "save" we mean that we *can* construct a model in such way that $\sf DC_\omega$ (or otherwise) is retained. It cannot satisfy $\sf DC_{\aleph_1}$ as that implies there is a non-measurable set.

Dependent choice and Zorn's Lemma


How to draw a base glyph with one color and its attached diacritic with another one?

Question: MS Word has this capability in its Hebrew and Arabic versions. I would like to achieve this in a windows desktop application, using .Net (may be with win-api calls).
Comment: possible duplicate of [Add accent marks with custom colors in .Net's RichTextBox](http://stackoverflow.com/questions/4016965/add-accent-marks-with-custom-colors-in-nets-richtextbox)
Answer: As explained in the link provided by Otaku here, current rich text edit controls can not handle this (unless you go for the hack OP in that Q did, which did not seem like a very good solution).
You could write code to do this manually yourself, ditching the text edit control completely, but that would probably mean a lot of work. It took Microsoft years to get support for combining diacritics working properly in MSWord. I would search for open source software that has this capability, and look at how other developers have done it. It might be hard to find, though, and you would likely have to step outside .NET-land. Maybe OpenOffice can do this?
This discussion might also be of help.
I am afraid that you will find, though, that you'll have to manually parse the Unicode and assign colors to the correct glyphs. If you want to be complete, that is one heck of a job.