I can't sync photos from my iPhone 3gs to my mac

Question: I can't to sync the photos from the camera roll on my iPhone 3gs to my mac. I have had slight water damage to the phone in the past yet it is still functioning. When I went to see someone about this problem they said it was because of the water damage that it did not work and they would have to fix it but may risk losing data on the phone hence defeating the purpose and being completely counterproductive. When I connect the phone to any windows or mac, it is not recognised by the computer but the charging icon appears on the phone. I have tried all of the options that can be googled but none of them help or are clear enough to make any sense. Could someone write a step-by-step explanation of some options that could fix this problem?
Answer: iCloud backup works if you have iOS6.  You must be connected to wifi and plugged into the charger for this to work.
http://9to5mac.com/2013/09/17/getting-ready-for-ios-7-how-to-backup-your-device-setup-ios-7/
iOS 5 should be able to backup / sync via WiFi  Google "How to Set Up Wi-Fi Sync in iOS 5"
If iCloud doesn't work for you... you should be able to save your photos using dropbox:  http://www.idownloadblog.com/2013/08/15/back-up-iphone-photos/


Android - Where and how securely is fingerprint information stored in a device

Question: I have been reading quite a bit about fingerprint sensors and their growing presence in smart phones. I understand that at the basic level, there is a digital image that gets registered and it serves as a template for authentication. I understand that fingerprint related processing takes place in a Trusted Execution Environment. However, I would like to know where the "template" gets saved and in what format?
Answer:
Trusted Execution Environment (TEE)

Google has made a noteworthy step in the right direction by moving all print data manipulation to the Trusted Execution Environment (TEE) and providing strict guidelines for fingerprint data storage that manufacturers must follow.

All fingerprint data manipulation is performed within TEE
All fingerprint data must be secured within sensor hardware or trusted memory so that images of your fingerprint are inaccessible
Fingerprint data can be stored on the file system only in encrypted form,
regardless of whether the file system itself is encrypted or not
Removal of the user must result in removal of the user's existing fingerprint data
Root access must not compromise fingerprint data

Data Source infinum.co
Comment: So basically, your fingerprints are secured by obfuscation and some pseudo-cryptographic magic supposed to make you believe it's not only obfuscation. AFAIC, that's anything but a "noteworthy step in the right direction". Really seems too weak to secure anything reliably.
Comment: If I'm reading right, they've taken pains to hide and obfuscate the data but it's still decyptable. It's not one-way encrypted like a password. I assume that's the nature of the scan image because it's never an exact match.
Comment: So that's basically Hardware-backed storage, right? Does that mean that even with root access a user won't be able to access the fingerprint data?
Comment: Yep, It is. Even with Root access, its useless. Only the creator know how to sniff the storage.
Comment: @jiggy I guess everything is possible either its data hiding or data hacking. Though its kinda possible to extract/view data if you root your device and do some code changes on your custom ROM.


New table ID and directory was used instead of using exist one after upgrade from 3.11.13 to 4.0.7

Question: After I upgrade Cassandra from 3.11.13 to 4.0.7 in a 3 node Cassandra cluster. Most of tables in the keyspace used the existing table IDs and directories. But one table of this keyspace didn't use the existing table ID and directory of 3.11.13, a new table ID and directory was used after upgrade. I checked two table directories, there are data files in both these two table directories in all the 3 pods. Any idea about why this happen? How to avoid it or work around it?
Comment: Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking.
Comment: I'd be curious to know if that table name had any special characters in it; perhaps those are handled differently between the versions?
Comment: No special characters in the table name, only letters and "_".
Answer: The symptoms you described indicate that someone tried to recreate the table so a newer version now exists.
Now I would expect that you would say "no one did it" but it happened, you just aren't aware of it.
It is possible to work out which version is newer from the table ID which is in fact a version 1 UUID meaning it's a UUID with a timestamp embedded in it.
For example, a directory name users-6140f420a4a411ea9212efde68e7dd4b has the UUID:
6140f420-a4a4-11ea-9212-efde68e7dd4b

You can extract the timestamp from this UUID easily by using any free UUID extractor/converter online. In this case, this UUID has the equivalent timestamp of:
02 June 2020 7:40:50 AM GMT

You can do the same for the new directory on your node and use the data to work out who could've done it.
In any case, you can force Cassandra to load the SSTables from the old directory by running the following command:
$ nodetool import ks_name table_name /full/path/to/ks_name/old_table_dir

Cheers!


android bluetooth chat app (device loses connection immediately)

Question: I have been going through several threads on here and didn't come across an answer to the issue I am running into.
My setup:
I have a Mac pc that I am using as a virtual serial port to communicate with my android Nexus S phone. Running the bluetooth chat app on the phone and using it as a client to talk to the virt comm I set up.
Initially I tried the bluetooth chat app with 2 android phones to confirm it works, which it does. I can send texts back and forth.
My Use case:
I have a device that reads RFid tags and sends the data to an android phone to collect the info.
I am using my PC to represent my device for now.
++++++++++++++++++
Ok to the problem,
I try to connect to the pc from my phone and initially I get a "connecting...." status bar update and after 15secs or so I get a toast message saying "I am connected to the pc" but immediately after I get "device lost connection" toast. Then the status bar goes to "not connected"
When I step through with the debugger, it seems to fail at the following portion of the bluetooth chat app. Specifically this line (bytes = mmInStream.read(buffer);)
    public void run() {
        Log.i(TAG, "BEGIN mConnectedThread");
        byte[] buffer = new byte[1024];
        int bytes;

        // Keep listening to the InputStream while connected
        while (true) {
            try {
                // Read from the InputStream
                bytes = mmInStream.read(buffer);

                // Send the obtained bytes to the UI Activity
                mHandler.obtainMessage(BluetoothChat.MESSAGE_READ, bytes, -1, buffer)
                        .sendToTarget();
            } catch (IOException e) {
                Log.e(TAG, "disconnected", e);
                connectionLost();
                break;
            }
        }
    }

When I look in logcat, the i/o exception is "software caused connection abort"
for the read() on inputstream.
Questions:
Does this have to do with my virtual port not setup right? I have the terminal up and waiting to receive input on /dev/tty.Nexus....
using the screen command @ 9600 baud
Otherwise, I thought maybe the socket which the inputstream connects to is unavailable somehow. I printed that to log and it seems like it was not NULL. Every time I step through though it dies at the ConnectThread not in the ConnectedThread.
The following portion of code: specifically this line (mmSocket.connect();)
        public void run() {
        Log.i(TAG, "BEGIN mConnectThread");
        setName("ConnectThread");

        // Always cancel discovery because it will slow down a connection
        mAdapter.cancelDiscovery();

        // Make a connection to the BluetoothSocket
        try {
            // This is a blocking call and will only return on a
            // successful connection or an exception
            mmSocket.connect();
        } catch (IOException e) {
            connectionFailed();
            // Close the socket
            try {
                mmSocket.close();
            } catch (IOException e2) {
                Log.e(TAG, "unable to close() socket during connection failure", e2);
            }
            // Start the service over to restart listening mode
            BluetoothChatService.this.start();
            return;
        }

        // Reset the ConnectThread because we're done
        synchronized (BluetoothChatService.this) {
            mConnectThread = null;
        }

        // Start the connected thread
        connected(mmSocket, mmDevice);
    }

I wonder if the socket variable is losing scope due to multi-threading and the socket is being passed around?
Thanks
Answer: How you set up the virtual serial post on your Mac PC. Since you have tried to run the app on 2 phones and it's working, I think the problem is on the PC.
I have posted an entry about Android and Java Bluetooth here. Hope it will help.


Unable to understand master-chef contract in pancake-swap

Question: **I am going through a master chef contract in pancake swap farm and I am unable to understand some points in that contract.

—>what does reward debt means in user info, Is it the rewards he
need to get or it is the rewards he already harvested

—>what does
the update pool function is for, what it was doing

—>what does
updating the staking pool is for, why we are updating all the
allocation points to the first pool

—>what is the dev address

**
<code> pragma solidity 0.6.12;
//Doubt1-->why we are updating pool[0] by total allocation pointsfrom other farms/3
//Doubt2-->why migrate approval the value is 0
import '@pancakeswap/pancake-swap-lib/contracts/math/SafeMath.sol';
import '@pancakeswap/pancake-swap-lib/contracts/token/BEP20/IBEP20.sol';
import '@pancakeswap/pancake-swap-lib/contracts/token/BEP20/SafeBEP20.sol';
import '@pancakeswap/pancake-swap-lib/contracts/access/Ownable.sol';

import "./CakeToken.sol";
import "./SyrupBar.sol";

// import "@nomiclabs/buidler/console.sol";

interface IMigratorChef {
    // Perform LP token migration from legacy PancakeSwap to CakeSwap.
    // Take the current LP token address and return the new LP token address.
    // Migrator should have full access to the caller's LP token.
    // Return the new LP token address.
    //
    // XXX Migrator must have allowance access to PancakeSwap LP tokens.
    // CakeSwap must mint EXACTLY the same amount of CakeSwap LP tokens or
    // else something bad will happen. Traditional PancakeSwap does not
    // do that so be careful!
    function migrate(IBEP20 token) external returns (IBEP20);
}

// MasterChef is the master of Cake. He can make Cake and he is a fair guy.
//
// Note that it's ownable and the owner wields tremendous power. The ownership
// will be transferred to a governance smart contract once CAKE is sufficiently
// distributed and the community can show to govern itself.
//
// Have fun reading it. Hopefully it's bug-free. God bless.
contract MasterChef is Ownable {
    using SafeMath for uint256;
    using SafeBEP20 for IBEP20;

    // Info of each user.
    struct UserInfo {
        uint256 amount;     // How many LP tokens the user has provided.
        uint256 rewardDebt; // Reward debt. See explanation below.//is rewarddept is how much reward he received tillnow or how much reward he needs to
        //
        // We do some fancy math here. Basically, any point in time, the amount of CAKEs
        // entitled to a user but is pending to be distributed is:
        //
        //   pending reward = (user.amount * pool.accCakePerShare) - user.rewardDebt
        //
        // Whenever a user deposits or withdraws LP tokens to a pool. Here's what happens:
        //   1. The pool's `accCakePerShare` (and `lastRewardBlock`) gets updated.
        //   2. User receives the pending reward sent to his/her address.
        //   3. User's `amount` gets updated.
        //   4. User's `rewardDebt` gets updated.
    }

    // Info of each pool.
    struct PoolInfo {
        IBEP20 lpToken;           // Address of LP token contract.
        uint256 allocPoint;       // How many allocation points assigned to this pool. CAKEs to distribute per block.
        uint256 lastRewardBlock;  // Last block number that CAKEs distribution occurs.//not understood
        uint256 accCakePerShare; // Accumulated CAKEs per share, times 1e12. See below.
    }

    // The CAKE TOKEN!
    CakeToken public cake;
    // The SYRUP TOKEN!
    SyrupBar public syrup;
    // Dev address.
    address public devaddr;
    // CAKE tokens created per block.
    uint256 public cakePerBlock;
    // Bonus muliplier for early cake makers.
    uint256 public BONUS_MULTIPLIER = 1;
    // The migrator contract. It has a lot of power. Can only be set through governance (owner).
    IMigratorChef public migrator;

    // Info of each pool.
    PoolInfo[] public poolInfo;
    // Info of each user that stakes LP tokens.
    mapping (uint256 => mapping (address => UserInfo)) public userInfo;
    // Total allocation points. Must be the sum of all allocation points in all pools.
    uint256 public totalAllocPoint = 0;
    // The block number when CAKE mining starts.
    uint256 public startBlock;

    event Deposit(address indexed user, uint256 indexed pid, uint256 amount);
    event Withdraw(address indexed user, uint256 indexed pid, uint256 amount);
    event EmergencyWithdraw(address indexed user, uint256 indexed pid, uint256 amount);

    constructor(
        CakeToken _cake,
        SyrupBar _syrup,
        address _devaddr,
        uint256 _cakePerBlock,
        uint256 _startBlock
    ) public {
        cake = _cake;
        syrup = _syrup;
        devaddr = _devaddr;
        cakePerBlock = _cakePerBlock;
        startBlock = _startBlock;

        // staking pool
        //adding the pool to the farm
        poolInfo.push(PoolInfo({
            lpToken: _cake,
            allocPoint: 1000,
            lastRewardBlock: startBlock,
            accCakePerShare: 0
        }));

        totalAllocPoint = 1000;

    }

    function updateMultiplier(uint256 multiplierNumber) public onlyOwner {
        BONUS_MULTIPLIER = multiplierNumber;
        //determining the cake tokens allocated to each farm
    }

    function poolLength() external view returns (uint256) {
        return poolInfo.length;
        //Determine how many pools we have
    }

    // Add a new lp to the pool. Can only be called by the owner.
    // XXX DO NOT add the same LP token more than once. Rewards will be messed up if you do.
    function add(uint256 _allocPoint, IBEP20 _lpToken, bool _withUpdate) public onlyOwner {
        if (_withUpdate) {
            massUpdatePools();
        }
        uint256 lastRewardBlock = block.number > startBlock ? block.number : startBlock;
        totalAllocPoint = totalAllocPoint.add(_allocPoint);
        poolInfo.push(PoolInfo({
            lpToken: _lpToken,
            allocPoint: _allocPoint,
            lastRewardBlock: lastRewardBlock,
            accCakePerShare: 0
        }));
        updateStakingPool();
    }

    // Update the given pool's CAKE allocation point. Can only be called by the owner.
    function set(uint256 _pid, uint256 _allocPoint, bool _withUpdate) public onlyOwner {
        if (_withUpdate) {
            massUpdatePools();
        }
        uint256 prevAllocPoint = poolInfo[_pid].allocPoint;
        poolInfo[_pid].allocPoint = _allocPoint;
        if (prevAllocPoint != _allocPoint) {
            totalAllocPoint = totalAllocPoint.sub(prevAllocPoint).add(_allocPoint);
            updateStakingPool();
        }
    }

    function updateStakingPool() internal {
        uint256 length = poolInfo.length;
        uint256 points = 0;
        for (uint256 pid = 1; pid < length; ++pid) {
            points = points.add(poolInfo[pid].allocPoint);
        }
        if (points != 0) {
            points = points.div(3);
            totalAllocPoint = totalAllocPoint.sub(poolInfo[0].allocPoint).add(points);
            poolInfo[0].allocPoint = points;//setting first pool allocation points to totalpool allocation/3
        }
    }

    // Set the migrator contract. Can only be called by the owner.
    function setMigrator(IMigratorChef _migrator) public onlyOwner {
        migrator = _migrator;//setting the migrator who can able to migrate the lp tokens
    }

    // Migrate lp token to another lp contract. Can be called by anyone. We trust that migrator contract is good.
    function migrate(uint256 _pid) public {
        require(address(migrator) != address(0), "migrate: no migrator");//checking whether the migrator address is valid
        PoolInfo storage pool = poolInfo[_pid];//taking the specific pool
        IBEP20 lpToken = pool.lpToken;//grabbing the lp token associated with that pool
        uint256 bal = lpToken.balanceOf(address(this));//getting the balance of old lptoken
        lpToken.safeApprove(address(migrator), bal);//approving the migrator to spend our balance
        IBEP20 newLpToken = migrator.migrate(lpToken);//migrating old token to new token
        require(bal == newLpToken.balanceOf(address(this)), "migrate: bad");//cheking if the balance of the old token and new token pool are same
        pool.lpToken = newLpToken;//setting the pool with newlptoken
    }

    // Return reward multiplier over the given _from to _to block.
   function getMultiplier(uint256 _from, uint256 _to) public view returns (uint256) {
        return _to.sub(_from).mul(BONUS_MULTIPLIER);//multiplying the multiplier from blocks between current block and last block
    }

    // View function to see pending CAKEs on frontend.
    function pendingCake(uint256 _pid, address _user) external view returns (uint256) {
        PoolInfo storage pool = poolInfo[_pid];//getting the specific pool with it id
        UserInfo storage user = userInfo[_pid][_user];//getting user belongs to that pool
        uint256 accCakePerShare = pool.accCakePerShare;//getting the accumulated cakepershare in that pool
        uint256 lpSupply = pool.lpToken.balanceOf(address(this));//how many lptokens are there in that pool
        if (block.number > pool.lastRewardBlock && lpSupply != 0) {
            uint256 multiplier = getMultiplier(pool.lastRewardBlock, block.number);
            uint256 cakeReward = multiplier.mul(cakePerBlock).mul(pool.allocPoint).div(totalAllocPoint);//calculating the cake reward
            accCakePerShare = accCakePerShare.add(cakeReward.mul(1e12).div(lpSupply));//accumulated cake per each share
        }
        return user.amount.mul(accCakePerShare).div(1e12).sub(user.rewardDebt);//get the pending cakes which are rewarded to us to harvest
    }

    // Update reward variables for all pools. Be careful of gas spending!
    function massUpdatePools() public {
        uint256 length = poolInfo.length;
        for (uint256 pid = 0; pid < length; ++pid) {
            updatePool(pid);
        }
    }

    // Update reward variables of the given pool to be up-to-date.
    function updatePool(uint256 _pid) public {
        PoolInfo storage pool = poolInfo[_pid];//specifying the single pool
        if (block.number <= pool.lastRewardBlock) {
            return;//not understood
        }
        uint256 lpSupply = pool.lpToken.balanceOf(address(this));
        if (lpSupply == 0) {//if there is no lp supply
            pool.lastRewardBlock = block.number;//setting the last reward block of the present pool to the present reward pool because if there is no lp supply in the pool therre is sno activity from the last pool
            return;
        }
        uint256 multiplier = getMultiplier(pool.lastRewardBlock, block.number);
        uint256 cakeReward = multiplier.mul(cakePerBlock).mul(pool.allocPoint).div(totalAllocPoint);//calculating the cake rewards still pending for this pool
        cake.mint(devaddr, cakeReward.div(10));//
        cake.mint(address(syrup), cakeReward);
        pool.accCakePerShare = pool.accCakePerShare.add(cakeReward.mul(1e12).div(lpSupply));
        pool.lastRewardBlock = block.number;
    }

    // Deposit LP tokens to MasterChef for CAKE allocation.
    function deposit(uint256 _pid, uint256 _amount) public {

        require (_pid != 0, 'deposit CAKE by staking');

        PoolInfo storage pool = poolInfo[_pid];//assigning the specific pool with pool id
        UserInfo storage user = userInfo[_pid][msg.sender];//assigning the user for that pid
        updatePool(_pid);//updates the accCakereward
        if (user.amount > 0) {
            //sends the pending amount to the user
            //if user had already added money into the pools
            //checking if user provided lp tokens are greater than zero
            uint256 pending = user.amount.mul(pool.accCakePerShare).div(1e12).sub(user.rewardDebt);//why we are subtracting the reward dept
            if(pending > 0) {
                safeCakeTransfer(msg.sender, pending);
            }
        }
        if (_amount > 0) {
            //updates the user amount
            //whenever the user deposit it should be gone into the pool that user is depositig into
            //transferring lptokens from user address to pool
            pool.lpToken.safeTransferFrom(address(msg.sender), address(this), _amount);
            user.amount = user.amount.add(_amount);//adding how many tokens user had provided in his account
        }
        //updates the user reward dept
        user.rewardDebt = user.amount.mul(pool.accCakePerShare).div(1e12);
        emit Deposit(msg.sender, _pid, _amount);
    }

    // Withdraw LP tokens from MasterChef.
    function withdraw(uint256 _pid, uint256 _amount) public {

        require (_pid != 0, 'withdraw CAKE by unstaking');
        PoolInfo storage pool = poolInfo[_pid];
        UserInfo storage user = userInfo[_pid][msg.sender];
        require(user.amount >= _amount, "withdraw: not good");//the amount of lp tokens he had staked need to less than or equal to th eamount

        updatePool(_pid);
        uint256 pending = user.amount.mul(pool.accCakePerShare).div(1e12).sub(user.rewardDebt);
        if(pending > 0) {
            safeCakeTransfer(msg.sender, pending);
        }
        if(_amount > 0) {
            user.amount = user.amount.sub(_amount);//subtracting the amount from the number of lptokens user had staked
            pool.lpToken.safeTransfer(address(msg.sender), _amount);//transfering the lptokens from pool to user
        }
        user.rewardDebt = user.amount.mul(pool.accCakePerShare).div(1e12);
        emit Withdraw(msg.sender, _pid, _amount);
    }

    // Stake CAKE tokens to MasterChef
    function enterStaking(uint256 _amount) public {
        PoolInfo storage pool = poolInfo[0];
        UserInfo storage user = userInfo[0][msg.sender];
        updatePool(0);
        if (user.amount > 0) {
            uint256 pending = user.amount.mul(pool.accCakePerShare).div(1e12).sub(user.rewardDebt);
            if(pending > 0) {
                safeCakeTransfer(msg.sender, pending);
            }
        }
        if(_amount > 0) {
            pool.lpToken.safeTransferFrom(address(msg.sender), address(this), _amount);
            user.amount = user.amount.add(_amount);
        }
        user.rewardDebt = user.amount.mul(pool.accCakePerShare).div(1e12);

        syrup.mint(msg.sender, _amount);
        emit Deposit(msg.sender, 0, _amount);
    }

    // Withdraw CAKE tokens from STAKING.
    function leaveStaking(uint256 _amount) public {
        PoolInfo storage pool = poolInfo[0];
        UserInfo storage user = userInfo[0][msg.sender];
        require(user.amount >= _amount, "withdraw: not good");
        updatePool(0);
        uint256 pending = user.amount.mul(pool.accCakePerShare).div(1e12).sub(user.rewardDebt);
        if(pending > 0) {
            safeCakeTransfer(msg.sender, pending);
        }
        if(_amount > 0) {
            user.amount = user.amount.sub(_amount);
            pool.lpToken.safeTransfer(address(msg.sender), _amount);
        }
        user.rewardDebt = user.amount.mul(pool.accCakePerShare).div(1e12);

        syrup.burn(msg.sender, _amount);
        emit Withdraw(msg.sender, 0, _amount);
    }

    // Withdraw without caring about rewards. EMERGENCY ONLY.
    function emergencyWithdraw(uint256 _pid) public {
        PoolInfo storage pool = poolInfo[_pid];
        UserInfo storage user = userInfo[_pid][msg.sender];
        pool.lpToken.safeTransfer(address(msg.sender), user.amount);
        emit EmergencyWithdraw(msg.sender, _pid, user.amount);
        user.amount = 0;
        user.rewardDebt = 0;
    }

    // Safe cake transfer function, just in case if rounding error causes pool to not have enough CAKEs.
    function safeCakeTransfer(address _to, uint256 _amount) internal {
        syrup.safeCakeTransfer(_to, _amount);
    }

    // Update dev address by the previous dev.
    function dev(address _devaddr) public {
        require(msg.sender == devaddr, "dev: wut?");
        devaddr = _devaddr;
    }
}
</code>
Comment: I have updated it
Comment: Please include the contracts as text.
Answer:
Dev Address - Some percentage of cake minted is sent to the dev address. For every 100 cake, 10 is sent to dev address. The dev address will then burn it.

Update pool fn - Straight forward, it is used to update the number of cake to be emitted/allocated for each pool.

Updating the staking pool - Changing LP token details.

Reward debt - Whatever the user has received so far.
Comment: In Updating the staking pool ,why we are assigning the all the sum(allocationpoints of all pools)/3 to the first pool.allocation points


Does diffraction pattern depends upon thickness of slit?

Question: I know that diffraction pattern depends upon the width of slit but does the thickness of slit also matters?
If so then what happens to the diffraction pattern at variable slit thickness?
Comment: Sound like a good simple testable question. If you tested it I'd be interested in seeing the results.
Comment: The short answer is, no, the thickness does not matter. The wave passes through the gap as it entered. Upon exiting the gap is then when the wave spreads out in all directions. (this is provided the wave enters perpendicular to the slit "face".)
Comment: @BradS Reflections matter. There is Lloyd's mirror. And with a knife edge above a surface, one gets a reflecting slit twice the width.
Comment: @Lambda i believe it may depend. i observed diffraction of light from a mobile camera through a slit formed by 2 bus/credit cards. the source of light, thickness of the slit and the width of it all were. if i increased the width of slit, diffraction couldnt be observed.
Comment: On the other hand, i have also observed diffraction of sunlight through my windows. these were horizontal rolling windows [link](https://stswindows.com/wp-content/uploads/2020/03/Depositphotos_59667789_s-2019.jpg). our windows were covered with wallpaper and you could open it in the center, thereby forming a "slit". I observed diffraction of light on the ceiling even when the width was about 2 inches and the thickness of the windows were also few inches
Answer: As soon as you ask such questions you are considering a real material situation, not an abstract one. Which material is the slit made of? Which particle is diffracted? The answer to your question is that the pattern depends on this and on the thickness of the slit.
Answer: The answer is yes. How much depends on the details of the materials and sizes of the slit and in some cases how many slits and how close they are together. This is also of interest for small circular holes or patterns of holes rather than a single silt.
The math to work out the details is not easy but essentially you have a more complicated boundary layer problem than a thin slit. in short, rather than working a 2D problem, you have to consider all 3 dimensions.
If you think about it, if the hole is very long compared to the wavelength of light then it would act something like a waveguide and only modes that fit the size of the hole would be allowed to reach the other side.
If the thickness is somewhat comparable to the wavelength of the light and you plot the amount of light that is transmitted as the thickness of the metal film is increased you will find that the amount of light increases and decreases almost periodically.
If the metal is conductive, then the electrons in the metal can also be moved around by the electric field causing a group oscillation called a plasmon. This can enhance the electric field at the edges of the slit or hole. The edge on the other side of the hole can also act like a receiving antenna and sometimes this can let more light be transmitted than a calculation where there are no plasmons. This was a somewhat of a surprise to people in the late 1990's early 2000's.
A lot of the complications are local to the areas near the surface of the aperture (the near field) as you get farther from the aperture (in the far field) the effects are less noticeable.
But keep in mind that for both thin and thick slits you will still get diffraction, although the exact details of the intensity and electric fields can be different depending on where you are looking.
Answer: The answer is no.  The original DSE by Young was actually performed not with slits, he used a knife edge ... actually a card.  The card depth does not matter.
The intensity of the pattern may decrease as less light is accepted if the source is angular .... as opposed to coherent like a laser source.
What causes the pattern ... the most in depth explanation is Feynman's path integral.  According to QM light/photons prefer certain paths over others and the preferred paths tend to be ones where the path length is an integer multiple of the wavelength.  In the DSE there are no photons in the dark areas .... they all go to the bright bands.


How to add a simple ESD protection to RDA5807M FM tuner antenna pin?

Question: I am using an i2c controlled FM tuner IC (RDA5807M) in a DIY fm radio, but I am a little bit worried about ESD protection on the Antenna line (A headphone lead being used for this). Can i add standard 1n4148 diodes for this purpose? There will not be any strong human body ESD because i live in a quite hot and humid country, so just basic protection will do. I want to achieve this using standard parts only and not some specialised TVS diode or fancy ESD protection diodes. I want to know if there will be any signal attenuation due to the stray capacitance of 1n4148 diodes (3pF max, according to datasheet) or its leakage currents. I have attached the relevant part of my circuit diagram. Datasheet of the FM tuner IC - https://cxem.net/tuner/files/tuner84_RDA5807M_datasheet_v1.pdf
Comment: why dont u use tvs diode ? https://www.st.com/resource/en/datasheet/esdalc12-1t2.pdf more adapted for ESD protection. your switching diode 1N4148 is not enough!
Comment: I've never seen 1N4148 diodes used as ESD protection for FM antennas or other RF applications. And I wouldn't rely on 1N4148 for these purposes. Instead, I'd prefer low capacitance (<1pF) ESD diodes (e.g. [this one](https://www.onsemi.com/pub/Collateral/ESD8472-D.PDF)).
Comment: i understand that 4148 will not give adequate protection against ESD. Can you tell me if it will cause any rf signal attenuation in the FM band?
Answer: You don't need additional protection.
The radio input is protected if you do not have an outdoor antenna.
Comment: The word is "capacitance".
Comment: @aditya444 Of course, this does not require any additional protection. The radio input is [protected](https://imgur.com/a/7U3LE2Y) if you do not have an outdoor antenna.
Comment: No this will not be an outdoor device. it will be a small battery powered radio, with the earphone leads used as an antenna. Do i still need to add TVS diodes? will 1n4148 cause problems with reception? or attenuate FM signal?
Comment: @csabahu Oh dear god I totally missed that diagram in the datasheet. Thank you. Could you repost this as an answer so that I can mark it as accepted?


Can't create site in trial Enterprise Edition?

Question: A few days into our trial of non-profit (NPSP) EE, I'm trying to test public-facing web pages that don't require login, crucial for our applications. It actually lets me reserve my (sub-) domain, but when I then try to go ahead and create a "site", I get:
<code>Site creation failed: You have exceeded the number of licenses for your organization. You must first acquire a new license to create a new site.
</code>
Plenty of our 10 free licenses left, of course. I would just assume it's a poorly worded error and I can't do this for the trial edition, were it not for the fact it seemed to happily reserve my (sub-) domain name. I also can't quite see the reason for making this a restriction, but perhaps at the trial stage no human has looked at us and after we sign up (still for free!) maybe a human confirms that we're a real charity and they feel more secure then.
Anyway, question is: is this an undocumented (here: https://login.salesforce.com/help/pdfs/en/salesforce_app_limits_cheatsheet.pdf) limitation of trial editions, or did I do something wrong?  If it's a trial limitation, I guess we have to just go ahead and get the free non-profit version to really "try" the software.
Answer: Trial orgs do not have Site.com licences, you have to contact your Account Manager at Salesforce, maybe they can get you one.


Issue with Response.TransmitFile

Question: I have been working on an issue for the past 2 days.I have tried to debug in every way possible but in vain.
Everything works fine on my local.But on production this fails.
Here is a brief description about the problem.
I have a download button and when I click that button I intend to download a file from a server.
protected void Download_Click(object sender, EventArgs e)
    {
    Button downloadButton = sender as Button;
    string filePath = downloadButton.CommandArgument;

     string stuid = Session["browse_files_for_student"].ToString();
    string stuUsername = MyHelper.GetUsernameForStudentID(stuid);
    MyHelper.LogAccess(User.Identity.Name, StudentUsername.Text, filePath, MyHelper.LogAccessType.Read);
    FileInfo file = new FileInfo(filePath);

    // Download the file
    Response.Clear();
    Response.AppendHeader("content-disposition", "attachment; filename=" + file.Name);
    try
    {
        Response.TransmitFile(filePath);
    }
    catch (IOException error)
    {
         Response.Cookies.Add(new HttpCookie("global_last_error", "The file is in use by another process."));
        Response.Redirect("~/Public/KnownError.aspx");
    }
    Response.End();

}

I see on the Event Viewer that it generates:
TransmitFile failed:FileName:dsdfsfd.doc,Impersonation Enabled:0,Token Valid:1 HRESULT:0x8007052e.
Environment: The website is deployed on a Windows 2000 server.
Any help and comments would be appreciated.
Thank you.
Answer: The account under which your application is running (probably IIS pool account) does not have access to the file that you are trying to send. The error code 0x8007052e means:
Error code: (HRESULT) 0x8007052e (2147943726) - Logon failure: unknown user name or bad password.

In the future you can check the error code using for instance cdb command (cdb is a part of the freely available Windows Debugging Tools):
cdb notepad.exe

And then after it has started:
0:000> !error  0x8007052e
Error code: (HRESULT) 0x8007052e (2147943726) - Logon failure: unknown user name or bad password.

Hope it helps :)

Issue with Response.TransmitFile


Illustrator CS6 Rotating a path after Arcing (Warping)

Question: After I Arc a Path using the Warp tool to the desired Arc size radius etc. I then want to rotate the arc so that it is inverted.
However when I flip or rotate it 180 degrees, the Arc returns to the original shape even thought the Original Rectangle path has rotated.
Is there a way to do this so that the Arc stays locked to the original rectangle it was based on?
Thanks in advance,
Nick
Answer: You might want to expand the effect you applied to your path. This causes the path to actually change to the appearance you see with the effect, rather than being the original rectangle with the effect still applied.
Choose Object > Expand Appearance while your object is selected to expand it.
Answer: There are 2 ways to apply the Arc warp to an object:

Effect > Warp > Arc
Object > Envelope Distort > Make with Warp > Arc

If you use #1 above, then the effect is created relative to the artboard. This means is you rotate or distort the object with the effect applied, the effect remains relative to the artboard edges and will not rotate with the object. As Bakabaka answered, if you use Object > Expand Appearance after applying the effect, you "bake in" the effect making it no longer editable and it will then rotate with the object.
If you wish to retain the live aspect of the warp so it can be edited again later if needed, AND have it relative to the object use #2 above. This applies the distortion (warp) relative to the object, not the artboard. This way the envelope is still editable regardless of how you may transform the object. There's no need to expand the appearance if you use the Envelope Distort rather than the effect.
I rarely use the Effect due to this very vast difference in the relationship of the distortion to the object.


Can one keep chocolate uncovered in the freezer?

Question: I bought a chocolate bar and only hate half of it. I want to store it in the freezer, but part of it will be uncovered. Is this a safe way to store it in the freezer ?
Comment: Why do you want to store it in the freezer?
Comment: How long will you store it in the freezer? Why do you want to store it in the freezer?
Comment: @AMtwo I will probably store for 2-3 days.
Comment: What kind of chocolate bar? Pure chocolate (milk or dark) or something more like a Snickers bar?
Comment: Its a dark chocolate bar.
Answer: Food-safety-wise, putting chocolate in the freezer is not an issue and not even necessary.
However, quality may suffer:

Freezers do tend to have some off flavors over the time, and these can be absorbed by the food inside, if not packaged properly. To be safe, I recommend you put the chocolate bar in some kind of airtight package, either a freezer bag or a Tupperware-style box.
Humidity can be a problem for "crisp" fillings like wafers or, to a lesser extent, crispy caramel. The packaging and the chocolate coating protects the original bar, once you have eaten half, it is exposed. Unless you live in an exceptionally humid environment or store too long or in a humid environment where condensation can happen - like a freezer - , this should be a minor issue. Again, wrapping the half-eaten bar with a (mostly) airtight seal should do the trick.
Answer: I don't recommend freezing chocolate. It can cause the chocolate to crystalize. I'd put it in the fridge tightly wrapped and sealed. If you've bitten it directly you can just cut off a centimeter and pop that in your mouth first. Unless your house is particularly warm and humid a chocolate bar will be fine stored at room temperature. If it is not pure chocolate (e.g. a candy bar with nougat) and some of the ingredients may spoil in the air, then putting in the fridge is your best bet.


Travelling against waitlisted-RAC e-ticket on Indian railway

Question: I have 1 Reservation Against Cancellation (RAC) and 2 waitlisted e-tickets for my travel with Indian railways. Can I travel with my family using those?
Comment: Welcome to Travel SE. You have not indicated what is your class of travel. Is it Sleeper, 3-AC or 2-AC? Are all these separate tickets or just different passengers on the same PNR? Waitlisted passengers are not allowed in reserved classes but this rule is generally not observed for sleeper class.
Comment: Related https://travel.stackexchange.com/questions/61189/what-will-happen-if-2-out-of-3-seats-are-confirmed-and-1-seat-is-in-waitlist-whi
Comment: Possible duplicate of [What will happen if 2 out of 3 seats are confirmed and 1 seat is in Waitlist which is booked via IRCTC online?](https://travel.stackexchange.com/questions/61189/what-will-happen-if-2-out-of-3-seats-are-confirmed-and-1-seat-is-in-waitlist-whi)
Comment: @jpatokal Not a duplicate in strictest sense because that question is about confirmed ticket. This question is about RAC. RAC is _not_ a confirmed ticket as per Indian rail.
Comment: @RedBaron But per the other answer, since the RAC holder is allowed to board, the WL holders in the same reservation are also allowed, no?
Comment: @jpatokal It is true that the names of all such passengers will be there on the chart and their tickets are not automatically cancelled. But we don't know the class here (The other question is SL) and we don't know if all these passengers have same PNR or different tickets. For this reason I've voted this as unclear.
Answer: As you have not mentioned, there are two possible scenarios here:
1. All three tickets are on same PNR
In this case, you are entitled to travel. Other two are "elevated" to RAC status. If you get a birth, three people can share it. This link from IRCTC explicitly state that
An additional facility of booking waitlist e-tickets is now available for all trains. The salient features are as under :-

Name of the passengers whose status is fully confirmed / fully RAC
  after chart preparation, their names shall appear in charts & they can
  undertake their journey. Name of the passengers whose names are partly
  confirmed/partly waitlist or partly RAC/partly waitlist, their names
  shall appear in charts including the waitlist passengers.

Same thing is mentioned on the E-Ticket as well:

PNRs having fully waitlisted status will be dropped and the names of the passengers will not appear on the chart. They are not allowed
  to board the train. However the namesof PARTIALLY waitlisted/confirmed
  and RAC will appear in the chart.

As names of all three passengers will appear on chart, you can take the journey. Also, IRCTC automatically cancels the ticket and refunds amount if your ticket remains waitlisted. In this case, they will not do so as one passenger is RAC. So, you have fully paid ticket with which you can board the train but getting a berth depends on TTE.
If you wish to cancel this partial ticket, you will also get the full refund. It is mentioned on E-ticket:

In case, on a party e-ticket or a family e-ticket issued for travel of more than one passenger, some passengers have confirmed
  reservation and others are on RAC or waiting list, full refund of fare
  , less clerkage, shall be admissible for confirmed passengers also
  subject to the condition that the ticket shall be cancelled online or
  online TDR shall be filed for all the passengers upto thirty minutes
  before the scheduled departure of the train.

2. All three tickets have different PNRs.
In this case, person with RAC can only travel. Other two tickets will be automatically cancelled and you will get refund. As they have different PNRs, they are simply, different tickets and IRCTC will not know that you are from same family and travelling together.


Ripple initial distribution of XRP coins

Question: My understanding is there are 100 billion pre-mined XRP coins all belonging to Open Coin who have a vague plan to distribute them at some point in time, fairly. Does anyone else see a problem with this or is there more to it than that? It seems to be far more centralized than any central bank we have at the moment.
Comment: Seems like you want a discussion not a real SE question.
Comment: Hi Dave and Nick. What I was looking for was an answer such as 'Ripple does have pre-mined coins but this is irrelevant because the coins are used as an anti-spam mechanism and have no inherent value' .. or something like that. No need for a discussion and focused more around the strengths / weaknesses of the centralized distribution as pertaining to ripple than an explanation of how they are distributed - they have said themselves they won't reveal this.
Answer: This was extensively discussed @bitcointalk.org, for one example see:
https://bitcointalk.org/index.php?topic=146964.0
There is much more in other threads there.
Comment: Thanks - was hoping to get a more condensed version, it seems to me there is two schools of thought. 1 - they are used for anti-spam so have no inherent value, 2 - the are required for transactions so necessarily have value. These to opposing positions are made in the page you reference but it's hard to interpret which is correct.


Cavity resonator modelling and simulation of em fields inside the cavity

Question: I want to model a cylindrical cavity resonator and study the different modes of em fields inside it using MATLAB/COMSOL. Please refer me books/articles or other resources so that I can achieve my goal.
Comment: In fact, using COMSOL4.2a to solve resonant cavity problem will present nonphysical modes in numerical results, because in COMSOL4.2a, it do not consider divergence-free condition, which will present nonphysical zero modes. For resonant cavity problem with lossless anisotropic media, we can use mixed finite element method to solve this problem, and this method can successfully remove all nonphysical modes, including nonphysical zero modes.
Comment: You can see our paper " Mixed Finite Element Method for Resonant Cavity Problem with Complex Geometric Topology and Anisotropic Lossless Media" by Wei Jiang  etal.
Comment: We are considering resonant cavity problem with conducting media. It is very hard to solve it, because this problem is an eigenvalue probelm about curl-curl operator, and this eigenvalue problem is a nonlinear PDE eigenvalue problem.
Answer: The idea is that you have to specify the equation to solve, usually it is the Helmholtz equation which is of elliptic type. Then, you have to specify boundary conditions and choose a numerical technique to solve the problem (in a complicated geometry it might be FEM or FDM, sometimes one can use a variational method without a grid). After that, you have to choose a solver or write your own code implementing that numerical (or analytical) method. Depending on the solver, it is better to start with a corresponding manual in order to understand how to use it.
There are plenty of literature. To begin with I would suggest following books
1) Jian-Ming Jin, The Finite Element Method in Electromagnetics, John Wiley & Sons, 2015
2) Umran S. Inan, Robert A. Marshall, Numerical Electromagnetics: The FDTD Method, Cambridge University Press, 2011
3) Matthew N.O. Sadiku, Numerical Techniques in Electromagnetics with MATLAB, CRC Press, 2000
I think the last one suits your needs the best. Again, before using a solver, the most crucial is to understand what kind of equation one has to solve. If your know the equation and boundary conditions, using COMSOL is simple and is well explained in the COMSOL manual by numerous examples.
Answer: I just finished doing the same thing using this PDF file provided by COMSOL.
On that page, the PDF is under the 'download application files' tab. In the file, they describe step by step how to to calculate modes and q-factors of three different kinds of cavities: rectangular, cylindrical, and spherical.
Hope this is helpful!


Can the real vector space of all real sequences be normed so that it is complete ?

Question: Let $X$ be the vector space of all real sequences . Does there exist a norm on $X$ which makes it complete ?
Comment: Well, if you find any Banach space with the same algebraic dimension than $X = \Bbb {R}^\Bbb {N} $, you can use any isomorphism between the two vector spaces to transfer the norm. The result will be complete. IIRC then every separable infinite dimensional Banach space has as algebraic dimension the cardinality of the continuum, as should $X $ (did not think too much about it).
Comment: [$\ell^p$ for any $p$ is a complete metric space](https://en.wikipedia.org/wiki/Sequence_space#.E2.84.93p_spaces), but this requires taking the subspace of vectors for which the norm is not infinite. Is that what you are looking for?
Comment: @PhoemueX is right. Your $X$ has algebraic dimension (the size of a basis an an abstract vector space over $\mathbb R$) equal to the cardinality of the continuum, so it is isomorphic (again as an abstract vector space) to any other real vector space of the same algebraic dimension, for example $l^2$. Pick an isomorphism and use it to transport to $X$ the usual norm on $l^2$. (This argument uses the axiom of choice to get bases and so make sense of "abstract dimension".)
Comment: @PhoemueX I did think some about why those dimensions are $c$ and decided I was missing a trick. Asked the Banach space guy at the office. See the Main Lemma in the latest version of my answer if you're still curious.
Comment: @David: Thank you very much (also to the Banach space guy :). Sadly, I can't upvote your answer twice.
Answer: The answer to the question exactly as you asked it is yes; your space is isomorphic as a vector space, with no topology, to various Banach spaces. (See various comments for details.)
Edit: The assertion that the answer is yes has met with vigorous disbelief. Also there's a technical point that I realized after some thought I simply didn't know how to do. I've added an Appendix at the bottom of this answer explaining things in detail, in particular showing that $\Bbb R^{\Bbb N}$ and $\ell^2(\Bbb N)$ do in fact have algebraic dimension $c$. Back to the short version:
But that norm simply has nothing to do with the structure of the space as a space of sequences. There's no complete norm on the space $X$ of all real sequences that has the sort of properties you must have in mind. In particular: For $n\in\Bbb N$ define $\Lambda_n:X\to\Bbb R$ by $$\Lambda_n x=x_n.$$There is no complete norm on $X$ such that every $\Lambda_n$ is bounded. (That is, there is no complete norm such that for every $n$, $x_n$ depends continuously on $x$.) In fact there's no such norm, complete or not.
Suppose on the other hand that $||\Lambda_n||=c_n$. Define $$S_N=\sum_{n=1}^N 2^{-n}c_n^{-1}\Lambda_n.$$Then $||S_N||<1$ for every $N$, which says that for every $x$ we have $$\left|\sum_{n=1}^N2^{-n}c_n^{-1}x_n\right|\le||x||$$for every $N$. This is impossible; for any sequence $c_n$ there exists a sequence $x$ such that $$\sup_N\left|\sum_{n=1}^N2^{-n}c_n^{-1}x_n\right|=\infty.$$
Appendix: Two things: why those bases show that the answer to the question is yes, and why those bases exist. Note that here "basis" means basis in the pure linear algebra sense, often called "Hamel basis": If $B$ is a basis for $X$ then every $x\in X$ is equal to a unique linear combination of finitely many elements of $B$.
$\newcommand\S{\Bbb R^{\Bbb N}}$ $\newcommand\L{\ell^2(\Bbb N)}$
Assume for now that $\S$ and $\L$ both have bases of cardinality $c$. Then there is a bijection betweenn the two bases. This gives us an isomorphism $I:\S\to\L$, defined by mapping linear combinations of the elements of the basis for $\S$ to the corresponding linear combinations of the elements of the basis for $\L$. We can thus define a norm on $\S$ by $||x||_{\S}=||Ix||_{\L}$, and it is straightforward to verify that the new norm on $\S$ is complete (given a Cauchy sequence in $\S$, by definition the corresponding sequence in $\L$ is Cauchy, hence convergent, so that by definition the original sequence in $\S$ is convergent.)
Ok, I left out some details there. Every detail is trivial - this equals that be definition since this or that is an isomorphism.
How do we know there are bases of cardinality $c$? Both spaces have cardinality $c$ so a basis can be no larger than $c$; we need $c$ independent vectors. It seems clear that we somehow should get this from the fact that there are $c$ subsets of $\Bbb N$, but I didn't see how to get the independence. I asked the Banach-space guy at the office:
Main Lemma There exists a map $S:\Bbb R\to\mathcal P(\Bbb N)$ such that $S(r)$ is infinite for every $r$, and such that given finitely many distinct reals $r_1,\dots,r_n$ there exists $N$ so that the sets $S(r_1)\cap[N,\infty),\dots,S(r_n)\cap[N,\infty)$ are pairwise disjoint.
Proof Let $\Bbb Q=\{q_1,\dots\}$. For each $r\in\Bbb R$ choose a sequence $(q_{n_j})$ of distinct rationals with $q_{n_j}\to r$, and let $S(r)=\{n_j\}$. QED.
Now it's clear that $\{\chi_{S(r)}:r\in\Bbb R\}$ is a linearly independent subset of $\S$. And if $(e_1,\dots)$ is orthonormal in $\L$ then $\left\{\sum_{j\in S(r)}\frac{e_j}{j}:r\in R\right\}$ is a linearly independent subset of $\L$.
Answer: As a complement to the earlier (good) answer and comments: the space of all sequences (whether real or complex) arises in at least one fairly natural way, namely, as the continuous dual to the LF-space (strict inductive limit of Frechet spaces) $\mathbb R^\infty=\bigcup_n \mathbb R^n$, where $\mathbb R^n$ has its usual topology and is included in $\mathbb R^{n+1}$ on the first $n$ coordinates. Since the very definition of the thing expresses it as a countable union of nowhere dense sets, by Baire $\mathbb R^\infty$ cannot be complete-metrizable (with its LF-space topology). Its continuous dual is the collection $X$ of all sequences, with the projective-limit topology given by $X\to \mathbb R^n$ by taking the initial segment of length $n$. The latter "projection" maps are compatible... so $X$ is a Frechet space (with topology given by the countably-many seminorms that are any norms on the limitands $\mathbb R^n$). Its continuous dual is (takes a little work...) the LF-space $\mathbb R^\infty$ again, which is the wrong cardinality to be the dual of a Banach space, for example.
Comment: Also, I guess a person should say that this "answer" is mostly unrelated to issues about "algebraic/Hamel" bases, axiom of choice, etc. The point was to argue that _a_ natural structure (complete metrizable topological vector spaces) is Frechet, but not Banach.
Comment: Quick note: by "is the wrong cardinality" you really mean "has basis of the wrong cardinality".


Searching, storing, and finding graph attributes and vertices

Question: I've been reading the 3rd edition of [Algorithms][1] by Cormen, Leiserson, Rivest and Stein. For DFS and BFS their algorithm loops through all the vertices first and colors them white.
1) If the color attribute were part of the node/vertex you would have to traverse the graph before you traverse the graph. And if you color every vertex white and your graph is cyclical then you would have an infinite loop.
clarification: CLRS' algorithm for DFS is
for each vertex u 'in' G.V
    u.color = WHITE
    u.Parent = NIL
time = 0
for each vertex u 'in' G.V
    if u.color == WHITE
    DFS-VISIT(G.u)

If the u.color is part of the node in the graph how do you actually do that loop? Do you have information on all the nodes stored elsewhere? And if you have an adjacency-list as a linked list with over a billion nodes wouldn't that take too long to iterate through the linked list every time you look for an adjacent vertex?
2) When I thought about storing attributes in an adjacency-matrix or adjacency-list I have a hard time contemplating what that data structure looks like. At least in C I can only make arrays so big. And if I use a linked list then I couldn't index into it. I would have to traverse a potentially huge list to get a vertex attribute. I'm having a hard time thinking of how Facebook would store 1 billion users or Google storing all the addresses for Maps.
3) As a follow up to the Facebook and Google thoughts, assuming that information is stored in a graph, I imagine they don't traverse the entire graph every time somebody searches for an address or person. For example if I enter my address and a destination for directions somehow I would think they find the address and get a pointer to the vertex in the graph that represents my address. From there they would do a BFS or something to calculate my address. They wouldn't start by traversing the whole world map to find my address.
*) I apologize if this isn't the correct way to ask my questions. Really these are just concepts I am having a hard time understanding. Hopefully I have communicated what I am confused by and can get some additional clarification. Thanks!
edit: In reading coding examples of DFS I notice people don't even implement the graph. They implement the adjacency-matrix or list and traverse that. In a tree I may have a struct with a "left" and "right" pointer to its children. While I always assumed the graph nodes would contain links to other nodes (edges) I suppose the nodes could be more simple (just contain the data) and the edges are ONLY stored in the adjacency-matrix or list. Is that a common way to implement graphs?
Comment: Sorry, but for me it's really unclear what you're asking.  I hope you don't expect an enlightenment that would clarify in 10 lines what you didn't grasp in the 1300 pages of the book.
Comment: Use lists for things that are processed in order. To look up data, either store it directly on the object, or use a hash table.
Comment: I've added a clarification under comment 1) but my question is probably getting to big and is apparently not very clear. If I understood what I don't understand I'm sure my question would be more understandable.
Answer: Per my understanding, the color is not part of the graph, but part of the node.
Consider you have a graph of nodes.
A->B
B->C
A = {color:white, name:A}
B = {color:nil, name:B}
and etc.
You traverse the graph at the node level.
There are graph storage systems that treats everything as a node, like semantic web / RDF. But in general, when talking about graphs, the unit is nodes, and nodes will have attributes.
Consider 'G,V' a abstract collection or iterator. For u in G,V is just iterating over the nodes. Don't think too deep about the implementation yet. So, you don't have to traverse the graph to color everything.
Over a billion of nodes? Depends, if you have an array list of 1 billion nodes, with modern computer, it take less than 1 minutes to go through all of them (assume the list fits in the memory). From my experience, this is stored as simple object, often time just node ids.

Large scale graph store and search is quite challenging. People don't use adjacency list or matrix. Though you can still fit a simple graph of 5 million nodes under 1 GB plain text. There are compressed formats, such as sparse matrix storage format. This is a well-known problem within CS research and scientists are developing more efficient way to store it every day.
Often time it is not stored in a graph. Graph storage is not a good choice or certain data models. And though you may interface with a graph-theory based query interface, the underlying storage may still be traditional sql relational storage. My assumption is they just query an address service database with your userID and that's it.

To your final thoughts, depends on the exact type of node data, node relationship and graph complexity. You may have complex weighted graph and storing in edges in adjacency matrix will be soon too complicated.
Answer: TL;DR
A graph is the concept you need to have in mind. How it is actually implemented depends on many factors and might not look like a graph at all.

[..] For DFS and BFS their algorithm loops through all the vertices first and colors them white. [..]

You need to differentiate between the - as I'd call it - procedural description of the algorithm and an actual implementation. The description here is actually emphasizing that a node that has not been visited yet is to be considered as 'white'.
How this is implemented depends on the situation. For a graph that you know cannot have cycles, isn't accessed concurrently, etc. it might be a good idea to actually store the color in the graph node.
Another option is to have a buffer storing the nodes that you consider being 'white'. When you start your search, you add only the start node to that buffer. Then you visit the "first" node of that buffer, removing it from the buffer and adding all its direct neighbors to the 'white' buffer.
Depending on what kind of buffer you use you can implement different search strategies: Using a stack (adding == pushing an element on top of the stack, the first == the top most element on the stack) gives you a DFS, using a queue (adding == appending to the end, the first == the first on the front) you get BFS.
Add a buffer to store already visited nodes to get cycle detection.
If you can get hold of it the book Artificial Intelligence: A Modern Approach has a really detailed and IMO good explanation of search strategies (and of course much more).

[..] Do you have information on all the nodes stored elsewhere? [..]

I think you're too focused on this kind of node:
struct node {
  struct node * neighbors;
  int data1;
  char * data2;
  // ...
};

But your node can also be ...
typedef int node_t;

.. and information about neighbors, the data the nodes contain etc is stored in tables (as simple as int **neighbors;, or in a SQL database, or whatever's appropriate).

[..] As a follow up to the Facebook and Google thoughts, assuming that information is stored in a graph, I imagine they don't traverse the entire graph every time somebody searches for an address or person. [..]

I don't know how it is actually implemented, but wouldn't it be kind of weird to even consider (= have in memory) information about streets in Canada when you're looking for a route from Paris to Rome?
A possible solution is to split a huge graph into multiple levels of detail. For example: A top most level, where nodes are countries (France is a neighbor of Italy, so consider only those two, or perhaps their neighbors as well to also consider routes through Switzerland), a mid level where nodes are "regions"/cities and a lowest level where nodes are actually street crossings.

[..] At least in C I can only make arrays so big. [..]

int * buffer = malloc(10 * sizeof(int)); // space for 10 int, add error handling
// ... some code ...
// need more space
void * new_buffer = realloc(buffer, 12 * sizeof(int)); // space for 12 int
if (new_buffer) {
  buffer = new_buffer;
  buffer[11] = 42; // perfectly fine
} else { /* error handling */ }


Hamiltonian of a water molecule bounded to a surface

Question: Where can I find a way to construct the Hamiltonian of a water molecule bounded to a surface? More generally, how can one write the Hamiltonian of an atom bounded to a surface?
Answer: There are lots of different models for water and its interactions, depending on what you want to do with them.
Here are some entry points:

Simulation of water cluster assembly on a graphite surface
Water Dynamics on the Surface of MCM-41
Water–silica surface interactions

They either contain an explicit Hamiltonian or refer to one.
Answer: Arnold gave links to some publications about water adsorption on surfaces described with atomistic modeling. However, there are simples models, with simple hamiltonians, from which you can derive plenty of cool properties of adsorption of atoms on surfaces. (Here, I interpret your "bounded" as indicating physisorption; chemical bonds would be another topic altogether.)

Langmuir model: the simplest, most effective. The Hamiltonian is defined as: 0 if the atom is not on the surface, $-\epsilon$ if it is. Divide your surface as an ensemble of $N$ possible adsorption sites, and treat using statistical physics in the grand-canonical ensemble ($\mu, V, T$). Enjoy!
Possible improvements on Langmuir, such as the BET model, can describe multilayer adsorption.
It is also possible to complement these models (either Langmuir or BET) by accounting for lateral interactions, i.e. interactions between molecules sitting on neighboring sites on the surface.

I hope you find these models interesting, as they describe a lot of the phenomenology of adsorption. I'd be happy to discuss follow-up questions!
Comment: I have to look at the links but basically for now I was interested only on a certain "resolution" for the models. My main interest is to understand the dynamics of the geometry of a molecule which sits on the surface: mainly how can one describe the dynamics,how the properties of the surface and different physical interactions ( i.e electromagnetic) with the surface affect the dynamics of geometry of the molecule. I am certainly new to this problem and I do not have a hunch from where to start and also which level of detail is revelant for this problem.


square wave carrier signal

Question: I am having some trouble to put things together into one picture. Can a modulated carrier wave be a square wave? If yes then How? Because at resonant frequency at the transmitter, the current oscillates between L and C. It takes time to charge and discharge and not abrupt. So how a square carrier wave is achieved? If No then can I ever generate a (say) FSK modulated square carrier wave? Also will there be any advantage/disadvantage (in terms of say transmission loss, energy per bit, suppression of higher order harmonics) of using a square wave over sine wave?
Comment: "suppression of higher order harmonics ... using a square wave" What?
Answer: When sending data over a cable or as light pulses, modulated square waves are common since it's easier to produce square waves than sine waves.  When sending radio waves over the air, however, there are generally very restrictive rules about transmitted spectral content; because of those rules it is generally desirable to avoid using much bandwidth than would be necessary to send information.
If there were no other radio devices in use and one was allowed to transmit whatever and however one wanted, it's possible that sending a modulated square wave might allow better performance than would be achievable with the same level of power using a comparable amount of circuitry; many kinds or resonant structures inherently behave like a comb filters, which will very nicely capture all the harmonics of a square wave just as effectively as the fundamental.
Nowadays, however, one isn't allowed to transmit whatever and however one pleases, but is instead required to confine transmissions to particular frequency bands.  Amplitude-modulating 300-3300Hz audio content on a 1MHz square wave would generate spectral content from 996,700Hz to 999,700Hz; 1,000,300Hz to 1,003,300Hz; 2,996,700Hz to 2,999,700Hz; 3,000,300Hz to 3,003,300Hz; 4,996,700Hz to 4,999,700Hz; 5,000,300Hz to 5,003,300Hz; etc.  The higher-frequency spectral content might help slightly with one's ability to receive the signal, but the potential improvement in receiver performance would be nowhere near sufficient to justify the huge increase in spectrum usage.
Comment: Thanks a lot! :) I just have one more small doubt! If I use a  standard industrial receiver with my frequency of interest say 2.4 Ghz then, can it demodulate the square wave with equal efficiency? Will it matter for the receiver if the wave is sqaure or sine?
Answer: Yes you could modulate a square wave and it could act as a carrier. It is not a given that transmitters or antennae need to be resonant, or - if they are - highly tuned, though it is usually desirable that they are.
An untuned square wave transmitter will be received at its fundamental frequency F, and at every odd harmonic, 3F, 5F, 7F etc with decreasing power at higher harmonics. This is usually undesirable as its principal result is to interfere with other users of the spectrum.
So in practice a sinusoidal waveform delivered to the antenna is highly desirable.
However it's not unusual for an RF power amplifier to work in "Class C" where the power stage itself is highly non-linear (with a spectrum similar to a square wave) It delivers power into tuned circuits which pick out the fundamental and reject the harmonics.
In the amateur bands where home-built transmitters are permitted, which may not be perfectly tuned, this is sometimes mitigated by designating another band at the 3rd harmonic as another amateur band! Hence in the "2 metre band" (144MHz approx) the strongest (3rd) harmonic will lie in the 70cm band (around 432 MHz).

square wave carrier signal


What happens if a new hardware wallet generates an existing seed?

Question: I get that 24^2048 (heck, even 12^2048) are utterly massive numbers and the chance that this happens is practically 0... but I am still curious: What would happen if a hardware wallet (or any seed generation mechanism) generated a seed that happened to already exist/have btc in associated addresses? Since internet connection not required it may not be immediately obvious to the user (and there'd be no way for the wallet to check against existing addresses), but when they connected their hardware wallet/seed to some wallet software would they just have access to that btc? There doesn't seem to be any mechanism preventing this.
Again. I know this is so unlikely that its effectively impossible, but just for arguments sake... would you just all of a sudden have free btc?
Answer: You would be able to spend money belonging to someone else.
It is like discovering your front door key fits the lock on someone else's door. Which does not mean theft is no longer considered theft in law.
So not free money but the means to commit theft.


What does the -p flag do in "mkdir -p"?

Question: What does the -p flag do in mkdir -p?
Answer: The -p flag will create nested directories, but only if they don't exist already.
For example, suppose you have a directory /foo that you have write permissions for.
mkdir -p /foo/bar/baz  # creates bar and baz within bar under existing /foo

It is also an idempotent operation, because if you run the same command over again, you will not get an error, but nothing will be created.
Answer: This -p flag allows a parent folder to be created along with the nested folder.
For example:
mkdir directory/nested_directory

it would return the following error : mkdir: cannot create directory 'directory/nested_directory': No such file or directory
But if you use -p such as:
mkdir -p directory/nested_directory

It will create both directory and it's nested nested_directory folders successfully.
Comment: I think this answer adds clarity to the case when both the parent and the child directories do not exist. This is a superset of the "nested", child directory not existing.
Comment: Welcome to Super User! Before answering an old question having an accepted answer (look for green ✓) ensure your answer adds something new or is otherwise helpful in relation to them. Here is a guide on [answer]. There is also a site [tour] and  a [help].
Answer: It actually does two different things.

No error if existing

Prints no errors like mkdir: cannot create directory '<dir>': File exists

Make parent directories as needed

You may create nested directories like mkdir -p dir1/dir2/dir3
The containing directories (in example: dir1, dir2) will be unaffected by file mode options (-m)

What does the -p flag do in "mkdir -p"?


What is this grounding connector for devices called?

Question: I need to find the grounding connector/socket (male) like in the photo for my device, but cannot find what it is exactly called or if it is rather something custom-made.
Comment: If you are developing for medical work you should know all this already.
Comment: https://www.iso.org/obp/ui#iec:grs:60417:5021
Comment: Arsenii - if you are intending to use equipment such as connectors and wires in a regulated enviroment, such as a hospital, you may have to comply with colour and other specifications, including DIN 42801 compliance.
Comment: @MichaelHarvey yes, thank you for this note! We are developing now a unit for medical endoscopy and have to compy to all the crossing standards. Thank you!
Comment: It is a EN60601 requirement for all medical equipment sold in Europe.  Other international medical standards allow a different connector but this one is accepted in any country.
Answer:

POAG  Potentialausgleich (German: Potential Equalization)
POAG connectors are used for connecting items together for grounding and potential equalisation purposes, often in hospital and laboratory environments, and there is a European standard: DIN 42801, recognised worldwide.
Answer: This is a Stäubli POAG connector.
For more detailled information on the product, refer to the catalogue:
https://ec.staubli.com/AcroFiles/Catalogues/ME_Med-Main-11014109_(en)_hi.pdf
or visit the website
www.staubli.com/electrical


Research that says exercise counteracts bad diet

Question: I remember glancing at an article saying that exercise can counteract the negative effects of diet. I was wondering if anyone has the links to that body of research.
Answer: Even if such a research exists, you should discard it because it's likely based on inaccurate data. While exercises can counteract the negative effects of diet on the short term, it cannot do so on the long run. This is because

1. Unless you're an athlete or someone who does extreme manual daily, you will not burn more calories than you consume daily. Those extra calories will increase your size over time. Even athletes (such as basketball and football players) who consume bad diets feel the effect months later.
2. Bad diets are not usually loaded with good nutrients. As a result, the body is constantly deprived of its needed nutrients. Either you'll have to obtain the nutrients as supplementary pills or your body will have to do without it, which will put it in a vulnerable state.
3. Unless your career depends on exercising, you're likely to stop exercising because your body will not reflect the effects of the exercises.
4. Given the combination of 1 and 2 above, you're likely to develop some high risk diseases (your body is being pummeled through exercises but it's not obtaining the required nutrients).

Caveat: If you're young (14 - 22), it's possible to counteract bad diet with exercises because your body's still developing and your metabolism is high; however, it still won't be sustainable over time. Although there are articles about ectomorphs that claim they can eat anything without gaining weight, many are being debunked.
To answer your question, I cannot find the article (it probably was taken offline because it's inaccurate :)).
Comment: There are a few studies around that show exercise mitigates bad eating. The ones I found were centered around holiday type binging and alcohol consumption, but all were published studies. http://www.colorado.edu/news/releases/2013/04/16/aerobic-exercise-may-protect-cognitive-abilities-heavy-drinkers-says-cu and http://opus.bath.ac.uk/20817/
Answer: Excerise absoultely cannot counteract a "bad diet".
A bad diet is more than just consuming more calories than required. Yes, in that single case exercise would be beneficial. However, a bad diet can also include not consuming enough of the right foods. Chronically low intake of good foods, or chronically high intake of bad foods will lead to health issues, and exercise cannot counter act this.
Not consuming enough fresh fruit and vegetables, leads to poor vitamin C levels. Chronically, this would result in scurvey, and surprisingly, this has happened in recent times. Exercise cannot counter act this.
Same with low calcium levels leading to brittle bones. Chronically low-fat consumption would lead to decreased absoption of fat-soluble vitamins. A diet low in protein (or complete proteins) would lead to slower muscle growth. A diet very high in apex fish such as tuna can lead to mercury build-up. None of these are health states to be in.
A good diet, based on a varied intake of whole foods is fundamental to good health and fitness. Where required supplements help, but should be just that, supplementary to a good diet.


How to copy from current clipboard selection to terminal with a command and without mouse

Question: Thank you for your support.
I wish to make a bash script that uses the latest text copied and currently in clipboard.
Answer: There are keyboard shortcuts for GUI terminals , Ctrl+Shift+V and Shift+Insert already. A script and mouse are unnecessary here.
If you're specifically looking for commands, there are xclip and xsel. Both of them are used to manipulate clipboards ( of which there are two in Linux - primary and secondary, that's why two different keyboard shortcuts were mentioned in the beginning of this answer ). I am personally more of a xclip fan, and i regularly use echo text | xclip -sel clip to copy something to clipboard and xclip -out -sel clip to print out whatever is in my clipboard. This is especially useful when you want to filter out text or process text with another command like xclip -out -sel clip | grep 'some text that I am looking for'
NOTE: xclip and xsel don't come to Ubuntu by default. You must install them with sudo apt-get install PACKAGE_NAME command
If we want to go into TTY, there's no way to copy text there. You must either use something known as named pipe or just a plain text file.
Answer: You can leverage xdotool for simulating the keyboard and mouse.
So for pasting a text from clipboard we use Ctrl+Shift+v, you can simulate this in xdotool by:
xdotool key ctrl+shift+v

Also check of mouse actions, read man xdotool.

If not installed, install it by (available in the Universe repository):
sudo apt-get install xdotool

Comment: `code`(#! /bin/bash
kdeconnect-send $(zenity --text="escriba la url a compartir" --entry --entry-text=$(xclip -o)))
Comment: I have used with good results: :`code`(#! /bin/bash
kdeconnect-send $(zenity --text="escriba la url a compartir" --entry --entry-text=$(xclip -o))) a mini script for sharing url to kdeconnect. However the xdotool solution that you offered seems to work too. I really appreciate your help, but now i'd like to ask if you know some way  to automatically copy chromium's current tab url. Thank you again.
Answer: I found a solution while i was surfing trhough this forum.
i had to install "xclip"
sudo apt-get install xclip

then i use it in the terminal:
"$(xclip -o)"


How to award tokens to users staking NFTs?

Question: How would you create a token without any value and then mint them to the user who staked the NFT when they want to unstake? Do they pay the transaction fee and how much would it cost to mint a single token? (non-custodial staking)
Answer: The tokens that projects use for staking is a simple SPL Token that you can create in code or via a CLI and that you can find here: https://spl.solana.com/token
As for value, the token has none until it is attached to a pool. Regarding mint fees, you indicate in your smart contract who pays. You can take it at your expense from the cash flow of your project, or let the user pay


What is $dx$ on an integral?

Question: I've heard from some of my teachers it's a bilineal form and some other stuff, nobody actually ever explained me the reason of it. Of course i've done practical problems in which $dx$ is a "very small part of somethign", but what can we say about it in some "higher grade" notes?
Comment: [This](https://www.google.ch/webhp?sourceid=chrome-instant&ion=1&espv=2&ie=UTF-8#q=what%20is%20dx%20in%20integral)
And [first link](http://math.stackexchange.com/questions/200393/what-is-dx-in-integration).
Answer: dx on an integral comes (at least) from the definition of Stieltjes integral. Here the definition for real functions:
 Let $f, x:[a,b]\longrightarrow\mathbb{R}$ be real functions defined on the interval $[a,b]$. Consider a partition of the interval $[a,b]$, $P^{*} = (P,\xi)$, where:
$$P = \lbrace a = t_{0} < t_{1} < \ldots < t_{k}=b\rbrace, \ \ t_{i-1}\leqslant \xi_{i} \leqslant t_{i}.$$
The Stieltjes sum associated to this partition and the functions $f$ and $x$  is defined by:
$$\Sigma(f,x,P {*}) = \Sigma(P {*}) = \sum_{i=1}^{k}f(\xi_{i})[x(t_{i}) - x(t_{i-1})].$$
Then, (here is the answer), the Stieltjes integral of $f$ in relation to $x$ is given by:
$$\int_{a}^{b}f(t)dx = \displaystyle \lim_{\vert x\vert\rightarrow 0}\sum(P^{*}).$$
Observe that, the left rand of the equation is just a notation.
Answer: $dx$ is called a differential and you can think of it as the "operator" $d$, known as the differential operator, acting on the expression $x$.
If you have seen the notation
$$y'(x)=\frac{dy}{dx},$$ the same operator is in use, and you are allowed to take the ratio of two differentials.
In the past, $dx$ was understood as an infinitesimally small quantity. In more modern notation, $dx$ represents the linear part of the variation of the expression that follows it.
For example the variation around $x^2$ is $(x+h)^2-x^2=2xh+h^2$, of which the linear part is $2xh$ (when $h$ varies, $2xh$ varies proportionally, while $h^2$ varies quadratically). For this reason, we denote $dx^2=2x\ dx$.
The integration operator $\int$ can be seen as the inverse of $d$, such that
$$\int y'(x)\,dx=\int dy=y(x)+C.$$
It solves the problem "what is the function of which the differential is what follows").
Hence
$$\int 2x\,dx=\int dx^2=x^2+C.$$
The additive constant $C$ is there because the inverse is indeterminate to a constant.
As clumsy as is may appear, this notation becomes indispensable for functions of several variables, where you need to specify on which variable you differentiate/integrate.
Answer: Here "very small" means "infinitesimal".  The problem is that the real number system has the disadvantage of not containing any nonzero infinitesimals. However, the real number system has an extension or an enlargement called the hyperreal number system. The hyperreal view helps clarify the meaning of $f(x)dx$ in an integral $\int_a^b f(x)dx$.
From the hyperreal viewpoint, the integral is defined as the standard part of an infinite Riemann sum of areas of infinitely thin strips: $\sum_i f(x_i)\Delta x$. In the Riemann sum, the term $f(x_i)\Delta x$ is literally a product, and therefore commutative.  Since the infinite Riemann sum uniquely determines the integral (via applying standard part), it follows that in the integral also we are free to commute $f(x)$ and $dx$.

What is $dx$ on an integral?


Know if the app received the notification from server side

Question: I'm building a newspaper-like app and I would like to know how many people received the article's push notification vs how many actually read it.
I was thinking to implement a way in which when the notification is received the app wakes up and send a request to the server saying "Hi I'm _____, I've received the notification of the article  ____" and store it in the database. Then afterwards if the user click on the notification and goes to read the article I send another request saying "Hi I'm ____ and I've read the article _____" and I also store it on the database. Afterwards with some queries I'm able to understand the percentage read/received.
I don't understand if it's even possible to wake up the app even if it was not opened by the user in a while and send a request to the server (for background is meant that the application is not launched or that is in the cache ?).
I would like to achieve what they did with Whatsapp:

I receive a new message on Whatsapp
I don't open the app
I go to WhatsApp Web
I open the conversation on WhatsApp Web
The badge and the notification on the phone goes away because I read it somewhere else

I think that that feature is achieved with silent push notifications that just update the app badge and clear the read notification.
Comment: Android gives you some wake up time when a notification is received. Use a `JobScheduler` service (requiring network) to send your "I have received the push notification" network request. Once the user opens the activity use the same service to send the "I have read the push notification". ||| To ensure you manage the push message yourself at all times don't send it as "push notification", send it as "push message" and build the notification client side from received data. See [notification vs. data payload](https://firebase.google.com/docs/cloud-messaging/android/receive).
Comment: If you really want to deploy this application, please be aware of privacy protection laws according to your country. data preservation based on personal data is forbidden in some countries. Just in case ;) Greetings.
Answer: Thats a very nice question on how to implement such silent notifications. There are few variables here that we need to consider and deal them in a different way.
Push notifications sent to the users - Some of them would have received it,  Some may not have received it at all.
Pushing multiple notifications to the same user in a small amount of time - It becomes difficult here to track the exact notification user opened the app. Because user might have read all the news that received notifications in a single attempt.
The actual content displayed to the user in the app - User might have opened the app because of notifications. Some times he might have seen the notifications and then opened the app directly without interacting with the notifications.
So this is how the implementation can be.

Implement push notifications for the app
User receives the push notifications and the notification badge shows Number (1).
Now when the user views the same news story in any other medium (Your own Mac App or PC app). Server is notified of the users action and the news he/she/whoever just read.
Now the server knows it has sent a notification and it is not read. When you receive the read notification, you can send a remote notification that can be handled by the app in background and update the badge.

Check out this link for more details on how to handle notifications in various modes.
Apple documentation also can be referred here for background mode - remote-notification.
So you will be making your app run in background with certain settings to respond to silent notifications and update the badge just like WhatsApp. I hope this helps.
Comment: Thanks for your answer.. What but I still don't understand if for background is meant that the app is in the cache (on ios it means one click of the home butto or even if it's killed by the user (on ios double click on the home button and the swipe up). Bacouse Whatsapp also works if the app is quitted
Answer: I've already implemented such thing in one of my app, and it's actually tricky.
You'll have a lot of use cases to handle.

First thing (but you seem to already know it): Apple does not provide
any callback to say : "this notification was sent"
Second thing : when your app is killed (not even in background), nothing at all can be done with your notification, meaning your app won't be able to wake up and read the notification, and therefor do something. The only thing you can do is changing the badge number, even if your app is killed.
Third thing : when your app is in background, you can wake up your app during 30sec. During that time you can send a request to the server, but if it takes too long, the process will be killed by the OS.

Saying that, here is a quick explanation of how you could implement the system:

You'll need on the server side to save in your data base any notifications that were sent. As soon as they are sent, save them as "pending"
On the app side: if your app is in background, as soon as the notification is received, you can wake up your app to send a request to the server. Then in your data base, your notification status will change to "receive" or "notified". If your app was killed, when the user launch your app, send a request to the server to ask for all notification in "pending" state, that way your app will be up to date, as well as your badge number.
If the user click on the notification, this will open your app directly on the article, that way you'll be able to send a request and say to your server that the article was received and read.
If the user read your article on the web side, send a notification. Set the notification badge number with the number of actual "pending" notification in your data base.

Hope this will help you in addition of the answer of @Prav :)
Answer: try this Notification Listner service https://github.com/kpbird/NotificationListenerService-Example.
Answer: Reply from Apple Developer Technical Support:

Hello Matteo,
Thank you for contacting Apple Developer Technical Support (DTS). Our engineers have reviewed your request and have concluded that there is no supported way to achieve the desired functionality given the currently shipping system configurations.

So at the end of the games IT'S NOT POSSIBLE
Comment: Ah ok, it's for tracking/statistics purpose. You want to differentiate those who have uninstall your app and those that are just not interested by the news. As you cannot track people who has uninstall your app, it's going to be difficult indeed ^^
Comment: Did they explain why? it seems odd to me, like they didn't even try to give you some idea or else. WhatsApp is doing it, we are doing it in our app, I don't see why it's not possible.
Comment: They just said that. I think that the reset of the badge and of the notifications is simply achieved sending a silent push notification with msgcnt: 0 or badge: 0 in the payload. But I still find very strange that a thing like this is not possible. I think they are still doing it when they say that a message is delivered (gray double checks).

You are doing it with your application ? How ?
Comment: Exactly the way I described in my answer ;) you need to store every notifications in your Data Base though.
Comment: Sorry didn't associate the user :D What you described doesn't work for me because I basically would like to know *how many users have the app installed and are able to receive the notification*... And if you can't wake the app it's not possible to know that at all. If I did your way I would only be able to know about the users that have opened the app. Let's say I send a news to all the user subscribed to my app. I send 1000 notification and only 300 read it. How could I know if the remaining 700 didn't care about the news or instead they didn't see it because they have uninstalled the app?
Answer: You  want to sync your app with web app or website than once you send notification  to application than set notification to particular ID.If user read that message from your web then send push notification again with different message and handle in service or broadcast receiver after that cancel  notification if  received message contains different message.you can also use Notification Listener.Refer thislink
Refer this link for ios.
Comment: This look nice for Android, but does something similar exists on iOS
Answer: Hi @Smile Applications after reading your question I would suggest you  see OneSignal website. OneSignal will allow you to send notifications to your subscribed users. It will also show you how many users are using your app and how many of them have received your notifications. If you want to send notifications and track them from the app itself you can use their API. It is easy and I have implemented this in Android and soon will be implementing in IOS.
Now the second part of your question about knowing how to track how many users have read/opened your notification and on which activity they are on you can use Google Analytics. It will allow you to see from which part of the world your users are using your app and which activities of your app are being opened most. It is also easy and I have implemented this also in Android and soon will be implementing in IOS too.


Shrink NSScroller of NSScrollView in layer-backed view

Question: I'm experiencing a weird problem (Bug?): Say I have a WebView, which will scroll vertically.
I now want to shrink the mainFrame's vertical scroller a little bit, so that its height is smaller than the NSScrollView itself.

The reason for this is that I want to pin two views (on top and on bottom edge) above the webview.
I did that easily in the frameLoad delegate method by altering the verticalScroller's frame (altering origin and height).
It works, but:
However once I set the webView and it's parent NSView to be layer-backed, it stops working, the scroller resets itself to the default position and height.
Now I don't know if this is a bug or not.
Is there any other way I could try to 'inset' the scroller?
Answer: Have you tried subclassing NSScroller, setting it as the vertical scroller for your NSScrollView and overriding
-(void) setFrameOrigin:(NSPoint)origin;
-(void) setFrameSize:(NSSize)size;

I assume making the NSView layer-backed causes frameSize to be set again(NSScrollView seems to take quite a bit of control on this because when you create a custom scroller, there is no "clean" way to set an NSScroller as horizontal or vertical other than calling -initWithFrame: with

height > width to automatically set it as vertical
width > height to automatically set it as horizontal

My other suggestion would be, if you want the NSScroller to not fully reflect the size of its parent NSScrollView would you be better off having an NSView as the content view of the webview. And the NSView have 3 subviews. Two views at the top and bottom pinned, and one NSScrollView in the middle. No custom NSScroller necessary in this case.
Comment: Thanks, lead_the_zeppelin, I ended up using a secondary NSScroller, that observes scroll value changes and also sets the value: [RMSecondaryScroller](https://github.com/raffael/RMSecondaryScroller).  However I will test if your first approach works more reliable!


What is Last Write Wins?

Question: I am trying to use Mobile Data service in Bluemix and I come across the term last write wins. Can anyone explain what it is clearly?
And what are the other options apart from it
Answer: Last write wins is a strategy of deciding which data is most up-to-date when replication is used. Cassandra can be the example. It's simple & fast (uses timestamps) but has limited guarantees - it can cause lost updates / writes. The reason being is that time in computer systems isn't very accurate and nodes sometimes go down.
Answer: Check out CouchDB and MongoDB on how they perform consistency...  MongoDB uses locks to achieve consistency while CouchDB uses eventual consistency.  Mobile data is based on Cloudant (CouchDB under the covers) hence why it Mobile Data uses eventual consistency "last write wins".
Answer: Last write wins is basically used during synchronization of files for mobile applications through the File Sync plug-in.
File Sync is limited to use a "last write wins" policy when multiple applications are updating the same files. In "last write wins", the device's copy overwrites the copy stored by File Sync. The resulting behavior depends on whether you are running in automatic or manual mode."
You can visit below link for the reference:
https://www.ng.bluemix.net/docs/#services/mobiledata/index.html#filesync
Answer: My understanding of "last write wins" is like this:
Using Selenium i was the first user to book a tennis court on a website.  However another user also managed to write to the same booking as we were within milliseconds of each other.  The bookings have to be done at 7am.  That gives us one whole second.  I had managed to book the court and got the email notification that I had successfully booked this court.  However, my colleague, who was slightly later (within the second) ended up being the last user to write (exit) to the booking (within the one second) and he also got a email notification. But much to my annoyance it was his name that appeared on the website as the user who had booked the court.  His was the last write to the database and he wins - even though I beat him initially to the court booking.  Once I had the final write there was probably a thousand of a second left enough for him to get the final write.
Ganz

What is Last Write Wins?


What filter was used?

Question: This accounts filter always moves when you scroll through the photos. Does anyone know how to get this or what it's called?https://instagram.com/p/BCROputkCX3/
Comment: Without describing the effect you desire to emulate this question is useless because 1) It will get lost in all of the other "How do I get this effect?/WHat filter was used?" questions 2) We have no way of knowing what in particular, about the linked example (that may later be a dead link), you are trying to emulate.

http://meta.photo.stackexchange.com/questions/3881/important-information-for-asking-whats-this-effect-questions
Answer: The filter is simply either lightening every other line or darkening it. The "movement" you see when scrolling is an optical illusion. I'm not sure of which photo filters create this effect, but if you use the "Bad TV" filter in Apple's Final Cut Pro X or Motion you can get the same effect. I imagine there's probably a similar filter for Photoshop and other photo editing apps.

What filter was used?


How to include purchase Tax on purchases in QuickBooks

Question: I have prices of products I need to buy from a vendor. However, these prices do not include tax. How do I include tax for a product I am buying from a vendor in QuickBooks Desktop Enterprise: Accountant 18?
Answer: Farai, you don't mention if this is for Asset purchases or expenses (ref accounts), or inventory items (ref items), Or if these should have been non-taxable purchases in the first place. so this may be a bit confusing, but the solution will be similar... essentially you want to break out the sales tax to a separate expense (not payable) account from the purchase made.
There are also several ways to accomplish this, depending on if you're initiating the purchase with a Purchase Order, Bill, or writing a check directly, but the solution boils down to using /creating a separate "Sales Tax Expense" (not payable) account and referencing the expense on the final payment/bill (not necessarily the PO, if the PO didn't already include the tax).
In overview, create the PO including the inventory items being purchased.  When the bill arrives, reference the PO, but then on the bill also select the account tab, indicate you sales tax expense account and amount, and note the tax added to the sale. Similarly, if a bill (or direct check, but no PO) is used, in the bill/check's item tab, show the items purchased, then on the bill/check's account tab (next to Items) indicate the sales tax account, amount and notation.
The only problem with the 'account' reference method is that it tends to 'get lost' because it's not included in the items list. so yet another method is to create an 'item' called "SalesTaxToVendor" that points to the expense.
If these are purchases that should not have been taxed, and are unable to get credited back from the vendor, then be sure to create an account/item that you can identify these purchases.
Hope that helps...
Good luck