How to disable replication when Distribution db is lost?

Question: I am in the situation that the Distribution database in SQL Server 2014 is lost and I want to disable the replication. I have found a solution how to achieve that when data files are present (also asked here). Unfortunately, I do not have data files of Distribution database. Is it possible to disable the replication when Distribution database is completely lost?
Comment: Do you have a good restorable backup of distribution database ? If yes, you can restore that with KEEP REPLICATION. If not, then you have to clean up replication bits from replication tables.
Comment: I was not backing up the distribution database, since it does not contain critical data. (However, it was not easy for me to find, how to disable the replication when the distribution database is lost.)
Answer: Finally, I have found a solution. Problem was that I was calling the stored procedures from query windows of Management Studio (some stored procedures must be called from sqlcmd).
Then, it is enough to follow instructions for TSQL (with @no_checks and @ignore_distributor).


What is the relation between $\det(A^TA)$ and $\det(AA^T)$ for an $m\times n$ matrix $A$?

Question: Let $A$ be an $m\times n$ real matrix, and $\det(\cdot)$ the determinant. It is rather trivial that when $A$ is of size $1\times 1$, then $\det(A^TA)=\det(AA^T)$.

In general, what is the relation between $\det(A^TA)$ and $\det(AA^T)$?
Comment: If $A$ is not square, then one of the determinants will be zero, because $AA^T$ and $A^TA$ both have at most the rank of $A$, which is at most $min(m,n)$, so they cannot both be full rank. But the other one can be nonzero, so in this case they aren't really related. (For example, if $n=1$, so $A$ is a column vector, then $det(A^TA)$ is $A$'s dot product with itself, while $det(AA^T)$ is zero.) If $A$ is square, then see Kushal Bhuyan's answer.
Answer: Summary: If $n \neq m$, the determinant of the larger of the two matrices will always be $0$.  The determinant of the smaller matrix will be non-zero iff the rows or the columns of $A$ are linearly independent.  Otherwise, the determinant will also be $0$.  If $n = m$, then the determinants are equal and both will be non-zero iff $A$ is invertible.
For parts A, B and C below, assume $m \neq n$.
A) Proof of "one will be $0$":
$A B$'s columns are a linear combination of the columns of $A$. Thus if $A B$ has more columns than $A$, then the columns of $A B$ will not be linearly independent.
In $A A^T$ and $A^T A$, one of these will have more columns than $A$ or $A^T$ respectively.  Thus for one of these the columns will not be linearly independent.  Now both of these are square matrices, thus one of these will be singular, thus $\det(A A^T) = 0$ or $\det(A^T A) = 0$.
B) Proof of "the other will be non-zero only if the rows or the columns of $A$ are linearly independent", i.e. proof of "the other will be zero if the rows and the columns of $A$ are not linearly independent":
Now $A (c_1 {\bf x} + c_2 {\bf y}) = c_1 (A {\bf x}) + c_2 (A {\bf y})$, more generally a matrix times a linear combination of column vectors is a linear combination of the matrix times the column vectors.
The $i$-th column of $A B$'s columns will be $A$ times the $i$-th column of $B$.
Thus if $i$-th column of $B$ is a linear combination of $B$'s other columns, then the $i$-th column of $A B$ will be a linear combination of $A B$'s other columns.
Thus if the columns of $B$ are not linearly independent, then the columns of $A B$ will not be linearly independent.
If the columns and rows of $A$ are not linearly independent, then the columns of $A$ and the columns of $A^T$ will not be linearly independent, thus the columns of $A A^T$ and $A^T A$ will not be linearly independent, thus both are singular, thus $\det(A A^T) = 0 = \det(A^T A)$.
C) Proof of "the other will be non-zero if the rows or the columns of $A$ are linearly independent", i.e. if the other is 0, then the rows and the columns of $A$ are not linearly independent.
The other is zero iff $\det(A^T A) = 0 = \det(A A^T) = 0$.
Assume that $\det(A^T A) = 0$, thus $A^T A$ is singular, thus there exists an non zero ${\bf x}$ such that $A^T A {\bf x} = {\bf 0}$.
Let ${\bf b} = A {\bf x}$, thus ${\bf b}^T = {\bf x}^T A^T$, thus ${\bf x}^T A^T A {\bf x} = {\bf b}^T {\bf b} = \|{\bf b}\|^2$.
But  ${\bf x}^T A^T A {\bf x} = {\bf x}^T {\bf 0} = 0$.
Now $\|{\bf b}\|^2 = 0$ iff ${\bf b} = {\bf 0}$ for any vector ${\bf b}$.
Thus $A {\bf x} = {\bf 0}$ where $x$ is non-zero.
Thus the columns of $A$ are not linearly independent.
Similarly if $\det(A A^T) = 0$, then the columns of $A^T$ are not linearly independent, which implies the rows of $A$ are not linearly independent.
Thus if $\det(A^T A) = 0 = \det(A A^T) = 0$, then the rows and the columns of $A$ are not linearly independent.
D) Proof of "If $n = m$, then the determinants are equal and both will be non-zero iff $A$ is invertible."
Assume $m = n$, thus $A$ and $A^T$ are square matrices, thus $\det(A A^T) = \det(A) \det(A^T) = \det(A)\det(A) = \det(A)^2$.
Similarly $\det(A^T A) = \det(A)^2$.
Now $\det(A^T A) = 0$ iff $\det(A)^2 = 0$ iff $\det(A) = 0$ iff $A$ is singular.
Answer: Case 1: $A$ is a square matrix
If $A$ is a square matrix, then $\det(A^T)=\det(A)$, so
$$
\det(AA^T)=\det(A)\det(A^T)=(\det(A))^2
$$
and the same holds for $\det(A^TA)$.
Case 2: $A$ is not a square matrix
Suppose $A$ is $m\times n$, with $m\ne n$. If $m>n$, then the rank of $AA^T$ is at most $n$ and therefore $\det(AA^T)=0$. If $A$ has rank $n$, then $A^TA$ has rank $n$ (see later), so $\det(A^TA)\ne0$. Similarly if $m<n$.
Thus, the equality $\det(AA^T)=\det(A^TA)$ only holds if and only if the rank of $A$ is strictly less than $\min\{m,n\}$.
Exercise
The rank of $A$ equals the rank of $AA^T$ and of $A^TA$.
Answer: The statement isn't true for generic rectangular matrices $m\neq n$ even though both expressions $\det(AA^T)$, $\det (A^T T)$ are well-defined.
For example, if $A$ is the row containing the entries $(a,b)$, then $AA^T$ is the $1\times 1$ matrix with the entry $a^2+b^2$ whose determinant is $a^2+b^2$.
On the other hand, $A^TA$ is the $2\times 2$ matrix with the rows $(a^2,ab)$, $(ab,b^2)$ whose determinant is zero. Not surprising because the rows aren't linearly independent. Note that the terms of this determinant, $a^2 b^2$, don't even have the same "units" as the terms in the first determinant. The vanishing of the "larger" among the two matrices holds in general.
For $m=n$, $\det A=\det A^T$ is well-defined and one may use
$$\det(AA^T)=\det(A^T A) = \det(A)\det(A^T)=[\det(A)]^2$$
so the identity holds.
Comment: "The statement isn't true" There is no statement in the question.
Answer: For $n\times n$ matrices $A,B$, you have that $\det(AB)=\det(A)\det(B)=\det(B)\det(A)=\det(BA)$.  However, for non-square matrices, without being able to take the determinant of the individual terms, you cannot do the switching in this way.
However, by looking at characteristic polynomials, you can say something quite good about how $AB$ and $BA$ relate. Write $p_A(t)=\det(tI-A)$, so the characteristic polynomial can be thought of as an extension of determinant. Then $p_{AB}(t)$ and $p_{BA}(t)$ will differ only by a power of $t$ (whatever power is required to make the polynomials of the same degree).  In particular, they share they same eigenvalues, and they are of the same multiplicity, with the exception of $0$.   Thus, while one of $AB$ and $BA$ will have zero determinant, they are still very closely related.


How can I optimize a mysqldump of a large database?

Question: I have a symfony application with an InnoDB database that is ~2GB with 57 tables.  The majority of the size of the database resides in a single table (~1.2GB).  I am currently using mysqldump to backup the database nightly.
Due to my comcast connection, oftentimes if I am running a dump manually my connection to the server will timeout before the dump is complete causing me to have to rerun the dump.  [I currently run a cron that does the dump nightly, this is just for dumps that I run manually.]
Is there a way to speed up the dumps for the connection timeout issue, but also to limit the time the server is occupied with this process?
BTW, I am currently working on reducing the size of the overall database to resolve this issue.
Comment: A simple alternative to `screen` for your situation would be to use `nohup`, it will allow your command to continue running on the server, even if your connection gets dropped. E.g. `nohup mysqldump [options] > backup.sql 2> backup.err &`. If you do not provide an output file for `nohup`, it will create `nohup.out` by default.
Comment: Have a look at `at` and `screen` (the latter if installed, but `at` is standard on all unixes) or the `ServerAliveInterval` options for SSH for ways of dealing with the firewall shutting you down after too long idle connection.
Comment: What parameters (if any) are you passing to the mysqldump command?
Comment: I just want to make sure you are using --opt with the mysqldump utility. This is a HUGE time saver when reloading. without it mysqldump creates the sql file row by row. --opt does: Adds locks, drop and recreate with all create options enabled, temporarily disables the keys for a quick reload and then turns keys back on at the end to rebuild the indexes after the writing is done. It concatenates several rows together in inserts to reduce filesize AND parsing time of each statement (by up to 70%) and enables --quick to reduce the load against the dumping DB when running. reduces load time by 80%
Comment: nothing really -- `mysqldump [database] -u[user] -p'[password]' > db_backup.sql`
Comment: It turns out that my connection dropping was not a function of Comcast internet, but the firewall at my office.  It kills any connection that sits idle for too long.
Comment: Adding --compact may be an option for you.
Comment: Why you don't try the mydumper? Take a look in this article: http://vbtechsupport.com/1695/
Comment: You say you have one table that is the majority of the data. If that's the case, you might be better off backing up that table separately, just provide the table flag when doing the backup
Answer: The main bottleneck in the dump like this is drive I/O. You are reading a load of data and writing it again. You can speed this up in a number of ways:

Make sure your output is going to a different drive(s) than the one(s) the database files are stored on - this will make a massive difference with spinning disks as the drive heads will not be constantly flicking between the location being read from and the location being written to.
The output of mysqldump will be very compressible, so if you can not separate the output from the input as mentioned above pipe the output through gzip or similar. This will reduce the amount of writing being done (so reduce the overall IO load, and the amount of head movement) at the expense of some CPU time (which you may have a lot of spare at these times anyway).
Also, (as well or instead of compression) pass the output through a pipe utility (like pv) that supports large write buffers to group blocks written to the drives together more, again to reduce the effect of head-movement latency - this will make quite a difference if using the --quick option to reduce the RAM impact of backing up large tables).
Only run your backup process when IO load is otherwise low.

You may be fixing the wrong issue though: it might be easier to address the connection drops instead (though reducing the I/O load imposed by your backups will help reduce the effect you have on other users so is worth trying anyway). Could you run your manual backups through screen (or similar tools like tmux)? That way if your connection to the server drops you can just reconnect and reattach to the screen session without any processes getting interrupted.
If you are sending the data directly over the connection (i.e. you are running mysqldump on your local machine against a remote database, so the dump appears locally) you might be better off running the dump on the server first, compressing as needed, then transferring the data over the network using a tool (such as rsync) which supports partial transfers so you can resume the transfer (instead of restarting) if a connection drop interrupts it.
As part of your "reducing the size of the overall database to resolve this issue" I would guess that a large chunk of your data does not change. You might be able to move a large chunk of the 1.2Gb from that main table off into another and remove that from those that are copied by the mysqldump call. You don't need to backup this data every time if it never changes. Splitting data between tables and databases this way is usually referred to as data partitioning and can also allow you to spread the data and I/O load over multiple drives. High-end database have built in support for automatic partitioning, though in mysql you will probably have to do it manually and alter your data access layer to account for it.
Straying off-topic for this site (so you should probably nip over to ServerFault or SuperUser to ask if you need more detail): If you seem to be losing connections due to inactivity, check the options in your SSH server and SSH client to make sure keep-alive packets are enabled and being sent often enough. If seeing drops even if the connection is active you could also try using OpenVPN or similar to wrap the connection - it should handle a short drop, even a complete drop if your entire connection is down for a few seconds, such that the SSH client and server don't notice.
Comment: Depth and insight in this answer. You should get a +3 for this. Sorry, I can only give you +1.
Comment: I wish I could reduce the number of dropped ssh connections to my servers.  If I expect to not use the terminal for longer than ~60 seconds I run `top` to ensure the connection doesn't drop.  (And I'm pretty sure it's the comcast connection as we're only using a standard WRT router & firewall at work and my home comcast connection never drops)
Comment: I've added a short note specific to the SSH connections.
Comment: BTW at 2GB it may take a few minutes but it's still very doable. I used to routinely backup servers with almost 1/2TB worth of data, in such cases, it's easier to have a replica db running and do snapshots of the box in the background.
Answer: INSIGHT INTO DOING BACKUPS WITH mysqldump
IMHO Doing backups has become more of an art form if you know just how to approach it
You have options
Option 1 : mysqldump an entire mysql instance
This is the easiest one, the no-brainer !!!
mysqldump -h... -u... -p... --hex-blob --routines --triggers --all-databases | gzip > MySQLData.sql.gz

Everything written in one file: table structures, indexes, triggers, stored procedures, users, encrypted passwords. Other mysqldump options can also export different styles of INSERT commands, log file and position coordinates from binary logs, database creation options, partial data (--where option), and so forth.
Option 2 : mysqldump separate databases into separate data files
Start by creating a list of databases (2 techniques to do this)
Technique 1
mysql -h... -u... -p... -A --skip-column-names -e"SELECT schema_name FROM information_schema.schemata WHERE schema_name NOT IN ('information_schema','mysql')" > ListOfDatabases.txt

Technique 2
mysql -h... -u... -p... -A --skip-column-names -e"SELECT DISTINCT table_schema FROM information_schema.tables WHERE table_schema NOT IN ('information_schema','mysql')" > ListOfDatabases.txt

Technique 1 is the fastest way. Technique 2 is the surest and safest. Technique 2 is better because, sometimes, users create folders for general purposes in /var/lib/mysql (datadir) which are not database related. The information_schema would register the folder as a database in the information_schema.schemata table. Technique 2 would bypass folders that do not contain mysql data.
Once you compile the list of databases, you can proceed to loop through the list and mysqldump them, even in parallel if so desired.
for DB in `cat ListOfDatabases.txt`
do
    mysqldump -h... -u... -p... --hex-blob --routines --triggers ${DB} | gzip > ${DB}.sql.gz &
done
wait

If there are too many databases to launch at one time, parallel dump them 10 at a time:
COMMIT_COUNT=0
COMMIT_LIMIT=10
for DB in `cat ListOfDatabases.txt`
do
    mysqldump -h... -u... -p... --hex-blob --routines --triggers ${DB} | gzip > ${DB}.sql.gz &
    (( COMMIT_COUNT++ ))
    if [ ${COMMIT_COUNT} -eq ${COMMIT_LIMIT} ]
    then
        COMMIT_COUNT=0
        wait
    fi
done
if [ ${COMMIT_COUNT} -gt 0 ]
then
    wait
fi

Option 3 : mysqldump separate tables into separate data files
Start by creating a list of tables
mysql -h... -u... -p... -A --skip-column-names -e"SELECT CONCAT(table_schema,'.',table_name) FROM information_schema.tables WHERE table_schema NOT IN ('information_schema','mysql')" > ListOfTables.txt

Then dump all tables in groups of 10
COMMIT_COUNT=0
COMMIT_LIMIT=10
for DBTB in `cat ListOfTables.txt`
do
    DB=`echo ${DBTB} | sed 's/\./ /g' | awk '{print $1}'`
    TB=`echo ${DBTB} | sed 's/\./ /g' | awk '{print $2}'`
    mysqldump -h... -u... -p... --hex-blob --triggers ${DB} ${TB} | gzip > ${DB}_${TB}.sql.gz &
    (( COMMIT_COUNT++ ))
    if [ ${COMMIT_COUNT} -eq ${COMMIT_LIMIT} ]
    then
        COMMIT_COUNT=0
        wait
    fi
done
if [ ${COMMIT_COUNT} -gt 0 ]
then
    wait
fi

Option 4 : USE YOUR IMAGINATION
Try variations of the aforementioned Options plus techniques for clean snapshots
Examples

Order the list of tables by the size of each tables ascending or descending.
Using separate process, run "FLUSH TABLES WITH READ LOCK; SELECT SLEEP(86400)" before launching mysqldumps. Kill this process after mysqldumps are complete. This is helpful if a database contains both InnoDB and MyISAM
Save the mysqldumps in dated folders and rotate out old backup folders.
Load whole instance mysqldumps into standalone servers.

CAVEAT
Only Option 1 brings everything. The drawback is that mysqldumps created this way can only be reloaded into the same majot release version of mysql that the mysqldump was generated. In other words, a mysqldump from a MySQL 5.0 database cannot be loaded in 5.1 or 5.5. The reason ? The mysql schema is total different among major releases.
Options 2 and 3 do not include saving usernames and passwords.
Here is the generic way to dump the SQL Grants for users that is readble and more portable
mysql -h... -u... -p... --skip-column-names -A -e"SELECT CONCAT('SHOW GRANTS FOR ''',user,'''@''',host,''';') FROM mysql.user WHERE user<>''" | mysql -h... -u... -p... --skip-column-names -A | sed 's/$/;/g' > MySQLGrants.sql

Option 3 does not save the stored procedures, so you can do the following
mysqldump -h... -u... -p... --no-data --no-create-info --routines > MySQLStoredProcedures.sql &

Another point that should be noted is concerning InnoDB. If your have a large InnoDB buffer pool, it makes sense to flush it as best you can before performing any backups. Otherwise, MySQL spends the time flushing tables with leftover dirty page out of the buffer pool. Here is what I suggest:
About 1 hour before performing the backup run this SQL command
SET GLOBAL innodb_max_dirty_pages_pct = 0;

In MySQL 5.5 default innodb_max_dirty_pages_pct is 75. In MySQL 5.1 and back, default innodb_max_dirty_pages_pct is 90. By setting innodb_max_dirty_pages_pct to 0, this will hasten the flushing of dirty pages to disk. This will prevent or at least lessen the impact of cleaning up any incomplete two-phase commits of InnoDB data prior to performing any mysqldump against any InnoDB tables.
FINAL WORD ON mysqldump
Most people shy away from mysqldump in favor of other tools and those tools are indeed good.
Such tools include

MAATKIT (parallel dump/restore scripts, from Percona [Deprecated but great])
XtraBackup (TopNotch Snapshot Backup from Percona)
CDP R1Soft (MySQL Module Option that takes point-in-time snapshots)
MySQL Enterprise Backup (formerly InnoDB Hot Backups [commercial])

If you have the spirit of a true MySQL DBA, you can embrace mysqldump and have the complete mastery over it that can be attained. May all your backups be a reflection of your skills as a MySQL DBA.
Comment: @AlainCollins this is why I run mysqldumps on a replication slave that is read only . Once Seconds_Behind_Master is 0, you run STOP SLAVE. Now you have a consistent point in time for doing mysqldumps in any of the aforementioned styles. I have done this for online trading companies over the past 5 years without so much as a single complaint to me or my company owners. As of this moment, I do parallel mysqldumps every 10 minutes for this client. I also do this for other clients to provide faster backup periods.
Comment: In InnoDB, dumping tables individually will give you an inconsistent backup.
Comment: +1 for nice use of mysqldump as well as for: If you have the spirit of a true MySQL DBA, you can embrace mysqldump and have the complete mastery over it that can be attained. May all your backups be a reflection of your skills as a MySQL DBA....Great lines!!!
Comment: I have a 32GB db so option 3 is exactly what I had in mind! thanks!
Comment: I have to backup and re-import 1TB of data to shrink extremely large `ibdata1`. In times of SSDs backed by hardware RAID the option 3 is the only solution for me.
Comment: Do you mind looking at this [related question](https://dba.stackexchange.com/questions/252190/can-i-use-a-mariadb-mysql-dump-from-older-version-in-newer-version), which is based on your answer?
Comment: +1 for the percona toolkit as it has a number of extra features the OP can use.
Comment: You always want to start with the largest tables in order to spread the work among multiple threads. This keeps threads as busy as possible until the end. I wrote a python tool to perform dump of a 110GB InnoDB database using SELECT INTO OUTFILE as the means to write the data. Reduced backup time from around 70m single threaded to 20m with 40 threads.
Try the mysqlpump tool.
Answer: Have a look at MySQL replication master to slave. It allows you to clone the database of master to another database server with same database. That includes the master and slave identities. Slave makes itself the exact copy of the master database server and or its databases. There may be one-one, one-many, many-one relation among master(s) and slave(s).
Slave continuously reads the binary log at master (bin log stores the queries written at master database server) and get input to its slave database server. ( this means your master database won't be affected at all)
The good news is that it won't affect your MySQL server too much as in you won't notice any downtimes or slow query responses. We use it for 10Gb databases and it works like a charm without any downtime.
MySQL Replication On The Same Machine
Comment: +1 for backing up a replica to remove the IO load of the backup from the main DB, and reduce potential locking related issues, with one significant caveat: be careful with the "replica on the same machine" option as your operations on the slave may compete with the master for IO bandwidth - make sure the slave's data files are a different drive/array than the master in order to mitigate this issue.
Comment: Ditto on David Splllet's Comment. I setup and maintain dozens of Master/Slaves with mysqldump backups on the slaves for My Web Hosting Employer. +1 from me as well.
Comment: while that would work for me, I think it might be a little overkill.  I currently don't need that level of backup, although I will keep this in mind should the requirements of the application change.
Answer: Plan A:
See also Xtrabackup from Percona.  This allows online backup of InnoDB, without any significant locking.
Plan B:
A Slave can be stopped, and you can take a consistent backup by any of several means (copy files, mysqldump, xtrabackup, etc)
Plan C:
LVM Snapshot.  After some cryptic setup, the downtime for a backup is less than a minute, regardless of the size of the database.  You stop mysqld, do the snapshot, restart mysqld, then copy the snapshot.  The last step can take a long time, but MySQL is not down.
Plan D:  Snapshot of a Slave -- zero downtime.
Comment: Hoorah to all four plans. I can only give +0.25 per answer !!! +1 (4 x 0.25)
Answer: A few admin points first:  Are you connecting to do an ftp or are you ssh'ed in and it's dying?  If ssh, then be sure to use screen so that you can resume after the comcast crash.  If ftp, then make sure you're compressing it/tar before the send.
Also try the --opt parameter or --quick
--opt
This option turns on a set of additional options to make the dump and reload operations more efficient. Specifically, it's equivalent to using the --add-drop-table, --add-locks, --all, --quick, --extended-insert, --lock-tables, and --disable-keys options together. Note that this option makes the output less portable and less likely to be understood by other database systems.
--quick
This option tells mysqldump to write dump output as it reads each row from the server, which might be useful for large tables. By default, mysqldump reads all rows from a table into memory before writing the output; for large tables, this requires large amounts of memory, possibly causing the dump to fail.
Comment: --opt is on by default.
Comment: Will --opt not increase the size of the file that will eventually get output?
Comment: @Jordan Thus --quick, included in --opt
Comment: It will add some - I meant to add --quick which is more in answer to his problem .... editing now.  Thanks!
Answer: I used to have problems with timeouts during dumps of big databases as well. I finally solved if by sending individual commands for every table in the db and appending everthing to one file like this:
TABLES=`mysql -u $USER -p$PWD -Bse 'show tables' $DB`
for TABLE in $TABLES
do
    mysqldump -u $USER -p$PWD $DB $TABLE >> dump.sql
done

Comment: This is considered an "inconsistent" backup, in that upon restore you may have data in one table that maps to another but doesn't exist.
Answer: I think the question is about how to restore faster from mysqldump's created dump files, not a different backup solution.
One of the ways, you can do this is by creating groups of tables in your schema, and create a separate DB user for each group then finally use MySQL permissions to not allow tables to be inserted to using all but one DB user.
This is a proven, fast, almost parallel technique but not 100% sure, how long it will take to restore from large dumps like 500G or so. But in my humble opinion, you need something parallel. Checkout the link below for an example.
[Fast, parallel restore from SQL dumps (mysqldump) for MySQL][1]
http://geeksww.com/tutorials/database_management_systems/mysql/tips_and_tricks/fast_parallel_restore_from_sql_dumps_mysqldump_for_mysql.php
"Fast, parallel restore from SQL dumps (mysqldump) for MySQL"
Comment: This is an exact copy of [your answer](http://dba.stackexchange.com/a/91010/1192) to another question. You might want to customize it a bit more for this specific question.
Comment: The question is specifically NOT about how to restore faster.


How to debug the user login process

Question: After the Catalina update I can't login with my main user any more. Mostly all I get is the turning wheel but once I got Welcome message notification and clicking that started Safari. And from the Apple menu I was able the system settings and the app store.
I also have a few secondary users and I can login to those just fine. Which is different to the very many reports of user who where logged out after the Catalina update. Some where the user was left with deleting the hard drive to solve the problem.
Since I still have one working admin user I hope that I'm spared that fate. It seemed that the update itself was successful and the OS itself is still in working order.
I can also login to the damaged user via su.
What I want to know is: Is there a way to debug the login process to see where the login hangs?
Answer: Cleaning out the ~/Library/LaunchAgents directory worked for me.
See https://discussions.apple.com/thread/251132653
I'll find out later which of the auto start applications fail to load.

How to debug the user login process


drupal 7.10: View of Most viewed posts

Question: i am trying to create a most viewed posts page using views. I know how to create a page with most commented post but I can't seem to find the view count option. Any suggestions. Do i need to add a relationship?
Answer: Try using the Statistics modules. It come with Drupal core.
Documents from d.o:
http://drupal.org/documentation/modules/statistics
UPDATE BELOW: (SCREENSHOT)
Comment: @JasmineAhmed Don't forget that statistics is a performance hog as it makes an `INSERT` query on each page viewed.
Comment: No, you don't. The count is globally on all node.
Comment: thanks, i have activated the module and added 'Content statistics: Views today' under sort. Do i need to add anything under filter or relationships in order to get today's most viewed posts?
Answer: I know that Statistics module is in the core but I think Radioactivity module creates a more realistic solution to check the activity of a node. You can add decay profiles and you can assign energy for the different events. For example you can add 1 energy if someone view the node, you can add 5 energy if someone commented on the node and you can add 15 energy if someone flagged as favorite.
I hope it helps.
From the project page:

This module provides a field type which can be used as a hotness metric or a regular view counter for entities and for much much more. In essense, entities receiving attention (views or actions defined by Rules) are heated while inactive ones slowly cool down.
Answer: You generally should avoid using the statistics module as it adds unwanted write queries to the database and won't be accurate while using reverse proxy caching such as Varnish.
The recommended solution would be to use Google Analytics to track your pages statistics and then the Google Analytics Statistics module to retrieve the data and expose it to views.

drupal 7.10: View of Most viewed posts


How do i secure a web server's image upload directory?

Question: For my web application, people can upload images from a web form to my web server.
What should I set the CHMOD settings for that image upload directory so that people can upload images (from the web server) to that directory but not execute any files they upload for security reasons.
Would the chmod settings be? :
chmod 744 directory/

Answer: There are two possible meanings for "executable" in this context, and both are things you need to configure against.

An executable binary file that may run from the command line by typing the file's name into a shell
A file that may be read and processed as script by a web server.

Handling binary-executable
To configure against case 1 on a un*x system, you need to ensure that your upload directory, and files therein, are owned by the web server user and only readable by that user. The directory must be executable; this means that the files inside that directory can be accessed). If the web user needs to list the files in the directory, it must also be readable. It, of course, must also be writable to allow new files to be created.
Thus the octal set you want would be
chown <web-server-user> <upload-dir>
chmod 0700 <upload-dir>

The files must not be executable and should only be readable and writable by the web server,so these should be
chmod 0600 <uploaded-file>

Please note that this means that only the web server user will be able to see these files. This is the best situation for security. However, if you really do need other local users to be able to see these files,then use
chmod 0755 <upload-dir>
chmod 0644 <uploaded-file>

Handling web-server excutable
Coding against case 2 is web server specific.
One option is to place the upload directory outside of the webroot, dissalowing direct URL access to the uploaded files completely and only to serve them via server-side code. Your code reads and echoes the file content, thus ensuring it is never processed as script by the web server
The other option is to configure your web server to not allow script processing of files in the upload directory. This configuration is web-server specific. However, for example, in Apache you can achieve this this by entering into your server configuration:
<Directory "path-to-upload-dir">
  AllowOverride None
  Options -ExecCGI
</Directory>

AllowOverride None is important, as it stops anyone uploading a .htaccess file to your uploads directory and re-configuring the web server permissions for that directory.
Comment: Not my area of expertise, but I had the php_admin_flag highlighted as something else to add to this. Add "php_admin_flag engine off" below the Options line.

 AllowOverride None
 Options -ExecCGI
 php_admin_flag engine off
Answer: Chmod on the directory can't do this, and moreover your web server may interpret .php as executable no matter what the mode is. You'll probably want to specify what server you're using, there may be a .htaccess or similar directive you can use.
Note that 'execute' on directories means 'can access files inside the directory', so that must be set if you want your web server to have access to the files inside...


Remove lines between paragraphs

Question: I am typesetting a Bible right now and the current status is that each verse is it's own paragraph, so that there is a newline after each verse. I want to have them as freeflowing text, is it possible to have paragraphs on the same line in indesign?
Answer: You can run a Find/Replace from menu Edit → Find:
Find ^p which is a paragraph end and replace it for a space  .
Answer: Danielillo's answer is correct, but be advised in InDesign you cannot have multiple paragraphs on the same line. Default InDesign logic says every paragraph ends with a ¶ character and this is important because it also affects the way Paragraph Styles are applied in the formatting stage.
You can hit Ctrl+Alt+I to show these 'hidden' characters so you have a better view of where your paragraphs start and where they end.

Remove lines between paragraphs


Hard Disk Drive Storage Space

Question: I have been wondering for sometime now why Hard Disk Drives define storage space in thousands (1000) instead of the real (1024). So, for example, 1GB = 1000MB; 1MB = 1000KB. Is there any significance for this convention? Why is it still being used?
Comment: Certainly because it allows manufacturers to show bigger numbers on their marketing brochures. Not sure it's on-topic, though.
Comment: This has been asked a bunch of times on superuser.
Comment: As far as I am aware HDD storage space has always been base 2 convention meaning \$ 1KB = 2^{10}, 1MB = 2^{20} \$
Answer: This is a cut and paste from Wikipedia:

Despite standardization efforts, ambiguity still exists in the meanings of the SI (or metric) prefixes used with the unit byte, especially concerning the prefixes kilo (k or K), mega (M), and giga (G). Computer memory has a binary architecture in which multiples are expressed in powers of 2. In some fields of the software and computer hardware industries a binary prefix is used for bytes and bits, while producers of computer storage devices practice adherence to decimal SI multiples. For example, a computer disk drive capacity of 100 gigabytes is specified when the disk contains 100 billion bytes (93 gibibytes) of storage space.

Look up Kibi, Mebi, Gibi bytes. These prefixes where invented to differentiate from Kilo, Mega, Giga etc which are defined in SI units as base 10.
Answer: Hard drives are measured in base-1000 because everything else is.

A kg is 1000 grams.
A km is 1000 meters.
A MHz is 1 000 000 cycles per second.

This is the way we designed these factor prefixes, and it's the way the entire world is using them. Why should hard drives be any different?
Note that most other things in computers also uses base-1000. A 3GHz CPU is designed to tick at 3 000 000 000 cycles, not 3 221 225 472 cycles per second. Similarly, Gigabit Ethernet transmits 1 billion bits per second, rather than 1.073 billion.
The only exception to this is memory chips; in particular RAM, but also CPU cache memories and to a lesser extent flash chips. The reason is that the design of these chips naturally favour addressing in powers of 2:

Both the row and column selection are decoded from binary addresses; addresses which by definition have a domain of \$2^n\$. Contrast this with the design of hard drives:

Contrary to RAM chips, where the design is primarily governed by the base-2 addressing scheme, hard disks design is primarily about stuffing as many pieces of data (called sectors) on the round platter as possible. There is nothing inherently \$2^n\$ about this, so there is no reason to measure hard disk capacity in base-1024 units.
The abuse of the existing prefixes by computer people to refer to base-1024 quantities (i.e., calling 1024 bytes 1kB) has unfortunately been the cause of much confusion. I can only hope this abuse will go away in time; Current human society overwhelmingly uses base-10, and computers should adapt to that — not the other way around.
An attempt to
In an attempt to solve this, the world came up with a binary variation on the si prefixes:

1 KiB = 1024 bytes
1 MiB = 1024 KiB
1 GiB = 1024 MiB
1 GiB = 1.074 GB
1 GB = 954 MiB

I recommend everyone use them, so we can hopefully one day eliminate this confusion surrounding computer storage units.
Answer: Since RAM memory was always growing with address bits and binary leaps, we always knew 64KB was really, "a bit" more than 65 kB. ( the current abbrev KB must ALWAYS mean 1000 to be consistent so they invented the "Kibibyte" for the binary version. KiB or Kib for Kibibits )  (pun intended)

But remember B=Bytes and b= bits and K should never be capitalized in Units of measure unless there is ambiguity ( like (m,M):(milli, mega) as ONLY proper names like Ohm are capitalized when abbreviated except KB and Kb were invented before the SI units of measure standard  included them and were just considered as abbreviations and not formal units of measure.

But since HDD's were not bound by address space but by limitations of the magnetic medium and heads, it was more relevant to use decimal values.

Except now, the size is so obtuse who cares how big 2 Terrabytes really is. Of course HDD OEM Sales Mgr's in the early 80's insisted on calling the capacity by it's more competitive value. In 1982 I was testing a 5+5MB cartridge HDD from Santa Barbara in Santa Clara and then someone from Japan came out with a 10MB HDD then 13MB woow..

Hard Disk Drive Storage Space


How to stack 2x4 table legs?

Question: I have a desk made with 2x4 legs I want to increase the height for a work table. I'm thinking adding 5 1/2". How to I connect the new piece onto the original leg?
I've been looking at pocket holes but didn't know if this would be strong with the wood grain.
Comment: As an alternative, how difficult would it be to just replace the legs with longer ones? 2x4s aren't exactly expensive; how much do you think your time and effort is worth?
Comment: +1 for just replacing the legs. Anything built with ordinary 2x4s for legs is not likely to be using any sort of sophisticated joinery that would make replacement a big job.
Comment: you don't even have to replace them. Cut a new 2x4 to the length you want, prop the table up, and fasten the new leg to the existing one.
Comment: How strong does the desk need to be? What's its load? Is it dynamic (e.g. do you break dance on it)?
Comment: If you're worried about appearance, you could taper one side of the existing leg so its profile flies smoothly into the added leg you've mounted alongside it. If you really insist on joining them end to end rather than side by side, plan on a long scarf joint to make the connection strong enough.
Answer: It would be helpful if you could add a picture of your desk to your question. The commenters are correct. A work table with 2x4 legs is probably not fancy, and doesn't need a fancy job to raise it. If it were my project, I would either replace the legs with longer ones, or add a 5-1/2" stub under the leg while scabbing a full length 2x4 leg to the inside of the original leg. Use 2-1/2 inch screws and horizontally screw the new leg into both the old leg and the stub. You can optionally toe screw from the original leg into the stub - just like a pocket hole, but less of a process.

How to stack 2x4 table legs?


Installing ArcGIS Web Adaptor without Windows Authentication?

Question: Is is possible to install ArcGIS Web Adaptor without Windows Authentication? I am installing ArcGIS Web Adaptor for Server and Portal. I need to enable ISS components and I realized that I do not have Windows Authentication. I am using Windows 10 Home edition. How should I go about installing Web Adaptor as the installer will not let me proceed without enabling all the ISS components requirements.
Comment: Is it a requirement that you use IIS? How about switching to tomcat (e.g) ? http://server.arcgis.com/en/web-adaptor/latest/install/java-windows/install-arcgis-web-adaptor-server.htm
Answer: Windows 10 Home edition doesn't include Windows Authentication (and a bunch of other IIS security features). However, the package with these features is sitting right there in your OS and you can manually install it.
All you need to do is open an elevated command prompt and run:

dism /online /norestart /add-package:%SystemRoot%\servicing\Packages\Microsoft-Windows-IIS-WebServer-AddOn-2-Package~31bf3856ad364e35~amd64~~10.0.16299.15.mum

Filename above may be slightly different since it's based on your system's bitness and version
Then just make your way back to:

Turn Windows features on or off > Internet Information Services > World Wide Web Services > Security

All the "pro" options under Security will be available. Simply check "Windows Authentication" and reboot.
Comment: With an entire copy paste like this, you could at least link [your source](https://stackoverflow.com/a/48197001/1203116)
Answer: No.
ArcGIS Web Adaptor requires some IIS components.
Look at the documentation Enabling IIS and required IIS components
Comment: Unless you want to go with a linux stack, in which case IIS is not the way to go.
Answer: As ylka points out, IIS is not necessary per se, but in order to run ArcGIS Server you, uh, need a server.  Now I suppose that you could try and use any old server stack you like and try to hack ArcGIS into it, but I suspect that this isn't exactly your speed.  ylka proffers Tomcat, but if you're happiest in Windows World then you can use IIS Express fo free.


A problem with understanding Time signature

Question: I'm not pretty good when doing aural analysis, but I can't seem to get the hang of time signature. My teacher said 4/4 is the most common time signature, and I could take a big gamble in writing 4/4 each time, but no. I want to understand how to identify a song ad 3/4. 5/4/ so on. But it always comes back to 4/4, they all sound like 4/4 almost. I've tried watching videos, but I can't seem to understand.
Answer: First of all, don't listen to songs by watching videos: your mind is concentrating more on the pictures than the sound. Close your eyes and listen!
Secondly, you need to train your ears (and body) to distinguish between 4/4 and other time signatures, especially 3/4 and 5/4. It would be best to listen to unambiguous examples of songs in these time signatures then compare them to "other songs". I'm a child of the '60s so my examples are very old!
Waltzes are in 3/4 time. Most music with the name "waltz" in its title will be in 3/4 although this is not necessarily foolproof. "She's leaving home" and "Norwegian Wood" by The Beatles are in 3/4 time. "Gymnopedie #1" by Eric Satie is in 3/4.
Two iconic songs in 5/4 are "Take five" by Dave Brubeck and "Living in the past" by Jethro Tull. There are many discussions about 5/4 time here; many consider that a bar of 5/4 can be subdivided into a bar of 3/4 and one of 2/4. A classical piece in 5/4 is "Mars" from the Planets suite by Gustav Holtz.
Probably the best known song in 7/4 is "Money" by Pink Floyd, although I am told that the guitar solo in the middle is played in 4/4.
Comment: You may remember Brubeck's Unsquare Dance - 7/4.
Comment: @Tim: I wanted songs with unambiguous time signatures so as to make it clear what the rhythm is. If I remember correctly, the whole point of UD was to make it sound "normal" when the sheet music shows otherwise.
Answer: The answers already here are great. Forgive me if this is covering something you're already on top of, but let me take it back to the very first step.
So time signature ("meter") is all about how beats are grouped together. That assumes that there are beats. Listen to this:

This shakuhachi performance is "unpulsed"—it doesn't organize itself around beats. It has long and short notes, but they don't come at regular intervals. Compare to this:

For the first 15 seconds we're not sure where the "beat" is, but as soon as those bass notes come in there's no doubt. Each piano note with bass drum kick is louder than the milliseconds between them—it's an emphasis—and is spaced evenly. This music is hella pulsed.
Okay, the next question becomes how these beats fall into groups. Continuing to listen to the "Gentle Rain" remix, after the first 8 introductory beats, the full drum kit gets involved* and the piano does a little pattern. But the piano still marks certain beats with a loud bass note, and the drum reinforces it with a bass kick. At this point, stop analyzing, and just stand up and bounce to the beat. (If you feel silly, you can use a fancy word and say you're practicing eurhythmics.) You'll probably find yourself moving a certain way on each beat, and probably responding to some beats more than others. Feel the "weightiness" of those bass-piano-and-drum notes, and start to notice how many beats separate them: they come along every four. This is the "downbeat," the first and strongest beat of each measure. The "gravitational" pull of this beat is like the sun in the solar system, and the rest of the beats just move in its influence. A piece of music can choose to temporarily de-emphasize a downbeat, but the idea of it is still there, or else we'd wind up hearing a different beat as the start of the group. (Perhaps this song was a bad example to choose, since there's a strong snare crack on beats 2 and 4, the "weak beats" or "off beats". The idea of emphasizing the "offbeat" is central to many musics from 20s jazz to power rock, but they're still the offbeats because there's an understanding that beat 1 is where it all starts. If the offbeats were actually the strong beats, we wouldn't get such a subversive thrill from emphasizing them. (In this track, those bass notes mark it out in black and white. It's only a rule of thumb, and isn't true 100%, but you can often find the beat by focusing on the bass.)
Now, you threw yourself a curve ball by mentioning 5/4. There isn't a lot of music with 5 beats. But listen to perhaps the best-known example:

For the first few seconds we just have a lot of drum noise. But again, focus on the bass drum: it just drops a single kick every so often. The syncopation  in the cymbals might make it hard to count, but listen to the piano as it comes in. It plays a short series of notes and repeats it several times. This repetition can also help you find where each measure starts, as it lines up with those bass kicks on the downbeat. Try to count between each downbeat, and remember that beats are all the same distance apart (see footnote below), so don't get tricked into counting in long-and-short numbers along with the rhythm that they're playing. If you get the hang of it, you'll find you're counting to five before starting over each time.
* I almost wrote, "at this point the beat comes in." This points to an important distinction between two ways the word "beat" is used. We often use the word "beat" to mean "a certain pattern of long and short notes," as in "Jay-Z laid down a beat for my new song" (I can dream!) or "that song has a samba beat." But in your question and these answers, and in a music theory class, the "beat" doesn't have to be the notes you hear; it's an idea lying under them. For an analogy: if you draw a picture on graph paper, the lines of the graph paper are "the beat." They're spaced evenly apart and lie under the picture; you then make shapes on top of them, moving through and around them. For this formal, music-theory set of definitions, those shapes are "rhythm." A rhythm can be made up of notes of different lengths, but every beat is always the same length.**
** Well, until you start warping time with slow-downs, speed-ups, pauses, and so on, but—well, you could curve the graph paper and the lines would still be there. You might not even know it's curved without the lines.
Answer: The majority of most types of music puts extra emphasis on beat 1. Knowing where beat 1 is will make the job easier. So listen to uncomplicated pop songs, and sing songs that you already know.
Tap just on the most emphasised note each time it occurs. That will be your 1. In songs, there is often an important word for that beat 1. Then tap along with the rhythm of the song - with steady, regular taps in time. Make your 1 louder, to match the music. When you're happy that you match what's played, count the 1s, and count up for the remaining beats, reverting to 1 every time it's emphasised. The highet number you reach regularly is the number of beats per bar - the top number in the time signature.
Be aware that the 1st note in a song won't necessarily be beat 1 - there's sometimes an anacrucis.
Answering 4/4 will probably get it right 60-70% of the time, but good on you for wanting to get 100%! I just wonder what your teacher is doing about your problem, though...
Comment: I agree and find tapping a finger on a table or guitar soundboard, or slapping my hand against my leg, to really help with getting the count right. Trying to count in your head is tough because of the distractions from melody and syncopated rhythms also in the mix.


Marketing Cloud show who in a data extension has unsubscribed

Question: What is the easiest way to show who from a particular data extension has unsubscribed from All Subscribers?
Answer: If you mean to check all the subscribers you have in a particular DE that contains their SubscriberKey, you can write a query to join these records on the _Subscribers data view to determine their subscription status in All Subscribers.
https://help.marketingcloud.com/en/documentation/exacttarget/interactions/activities/query_activity/data_view_subscribers/
Answer: You don't unsubscribe from a Data Extension.
You unsubscribe from a All Subscribers, a List or a Publication as defined in your Send Definition.
SFMC will automatically keeps track of subscriber status via Subscriber Key in those three places, nowhere else.
You can have some field that represents status in your DE, but you'll have to build something to update it.


Why don't electrons moving around in a orbit produce electromagnetic waves in their natural state?

Question: If moving electrons produce changing electric field, and if changing electric field produces magnetic field, every electron must produce an electromagnetic wave. This means an atom in its natural state must emit light or other waves in electromagnetic spectrum. But why doesn't this happen?
Comment: Also [Why do electrons around nucleus radiate light according to classical physics](http://physics.stackexchange.com/questions/30772/why-do-electrons-around-nucleus-radiate-light-according-to-classical-physics) which is a little newer, but has what may be a better answer.
Answer: The problem with this question is all of the assumptions that go into it. When we're taught physics, we are given analogies that help our understanding, but mislead us when we try to dig deeper.
Firstly, charged particles like electrons are always surrounded by an electromagnetic field. Changes in that field propagate through space at the speed of light and we call it "light" (informally, or "photons", more formally).
Next, electrons do not "orbit". But when their position is measured, they may be detected with certain probability within certain regions around the nucleus called "orbitals" (misleading term). Orbitals are normally not circular or spherical and do not imply the electron orbits the nucleus like a satellite.
Finally, to answer your question directly, when an electron is in the ground state in its orbital, it is in a steady-state which does not cause its electromagnetic field to change, thus no "light" is emitted. However, when an electron is in an excited state, the transition back to the ground state or a lower-energy excited state, does cause its electromagnetic field to change, and we can detect the photons that are emitted and they are contain the same amount of energy that is the difference in energy levels between the two states.
Comment: I'd like to highlight the final paragraph. The electron in the hydrogen atom is described by an energy eigenstate. This is a "stationary" state. This means that, to the extent that an electron is in a stationary state, in no sense does it "evolve." This is, of course, in complete contradistinction to the classical case.
Comment: If electrons do not orbit the nucleous, then what is role of the attraction between electrons and protons?
Answer: This was one of the questions raised during the early stages of QM. If this were to happen atom would not exists as the electron would spiral towards the nucleus. Interference effects at the atomic level are usually assumed to give rise to the stationary states as we know them. The picture of electron actually going round the nucleus has been replaced by the so called probability cloud of electrons.


Real-time convolution with Gaussian noise

Question: I have a brain activity simulator that is capable of receiving various stimuli. Both generated signals and input stimulus are causal: a single sample is created every time step. I use a sinusoidal stimulus that I would like to CONVOLVE (not superpose) with Gaussian noise ~N(1,s).
I tried to multiply the stimulus spectrum by white noise (disregarding the fact that white noise PSD is constant) and do IFFT, but it didn't seem to work (it didn't affect the brain activity output as expected).
Any ideas on how can it be done (I'm looking for the formula if there is one)? Again, both the stimulus and the random noise are generated one sample at a time.
Answer: Samples from an AWGN time domain process also have an AWGN distribution in frequency (the PSD is constant but a histogram of the real and imaginary components of the FFT for samples of AWGN will reveal that they too are Gaussian distributed, and independent over each frequency bin, thus "AWGN"). Another way to see this is to note how each bin in the DFT would be a sum of independent and identically distributed random values and thus approaching a Gaussian given the Central Limit Theorem.
That said, an approach to convolve experimental samples of AWGN in time with a waveform would be to create samples of a complex Gaussian process as the frequency bins (as demonstrated here using 'randn' in Matlab, Octave and Python numpy.random), multiply that with the FFT of the waveform of interest, and take the IFFT of that result. The result is the circular convolution in time, if that is suitable for the intended application. If linear convolution is required, additional zero padding can be done to avoid the time domain aliasing.
This post touches on related concepts of noise in time and frequency.


What is the normal rate of increase for automotive insurance premium costs?

Question: Assuming no change in driving status (i.e. no additional accidents / issues) what is the normal expected rate of increase in insurance cost for my automobile? The obvious answer would seem to be the rate of inflation but I wanted to look for additional insight.
Comment: What country are you in? If US, what state? The answer can vary widely by location.
Comment: US companies are often overseen by a state insurance regulator. A company can petition the regulator for rate increases due to increased costs/payouts/whatever. The regulator may approve the full increase or some smaller amount.
Comment: Also age.  Until you turn twenty-five, I would expect premiums to drop annually.  I'm also wondering if the answer is going to be something like:  get quotes from other insurers and see if they're cheaper.
Answer: There is no expected rate of increase - inflation is only a minor factor.  Important factors include:

How much the insurance company thinks they can get away with increasing your premium every year.
How many claims they have paid out recently.  To a large extent, their losses are for compensation to third parties, rather than to the insured's own property.  This is out of the control of the insurance company, and injury claims can be very expensive.
Your risk.  This should go down over the years as you get older and more experienced, up until the point that you're so old that you're an increased risk.  So if nothing else changes, your premiums should go down.  But see item 1 for why it doesn't.
Comment: To add anecdotally to this: My rates went up 1 year without explanation. Never had an accident, no new cars, no credit issues. I called my provider and they told me "Our corporate office raised the rates for everyone in the state. There's nothing we can do, and I personally suggest you shop around and see if others are cheaper".


MySQL Result - "Group By" removing incorrect duplicates

Question: Will do my best to describe the problem Im having :)
Each thread/topic in my forum represents one disc. Registered members of the forum use a series of checkboxes (one displayed next to each disc) to tick each disc that they have in their collection. When the form is $_POST'ed it stores the information in a table like so:
| user_id  - disc_id |
+--------------------+
|   2 -  571    |
|   2 -  603    |
|   2 -  4532   |
When the user next views the forum I have the checkboxes ticked and disabled on discs that the user owns. This is done using:
$sql = 'SELECT id, poster, subject, posted, last_post, last_post_id,
last_poster, num_views, num_replies, closed, sticky, moved_to, topicimage,
c.user_id, c.disc_id FROM topics LEFT JOIN collections AS c ON c.disc_id=id
WHERE forum_id='.$id.' ORDER BY sticky DESC;

The above grabs all of the discs, which I then display using the following (stripped down) code:
$result = $db->query($sql) or error('Unable to fetch topic list '.$sql.'', __FILE__, __LINE__, $db->error());

// If there are topics in this forum
if ($db->num_rows($result))
{

while ($cur_topic = $db->fetch_assoc($result))
     {
   // If logged in users ID matches the current discs user_id (i.e if this user owns this disc)
   if ($cur_topic['user_id']==$pun_user['id']) {
   $read = ' I own this!';
    } else {
   $read = ' I own this!';
   }
  }
    }
This works great, until a second user adds the same disc ID to his collection, eg:
| user_id  - disc_id |
+--------------------+
|   2 -  571    |
|   2 -  603    |
|   6 -  571    |
This causes a duplicate thread to appear in the forum. One is correctly ticked (because I own it), the other is not ticked, though it shares all of the same information such as topic id and image.
My first thought was to try adding GROUP BY c.disc_id to the SQL, which does successfully remove the duplicate topic - However, it is removing the wrong one. The disc that I have ticked is no longer shown, leaving only the unticked version.
Hope that makes sense. Can anyone offer any insight or ideas?
Many Thanks.
Answer: This is a guess, since I don't know your schema, but I don't see you specifying the user's ID in your WHERE clause.
What about something like the following?
  SELECT t.id, t.poster, t.subject, t.posted, t.last_post, t.last_post_id,
         t.last_poster, t.num_views, t.num_replies, t.closed, t.sticky,
         t.moved_to, t.topicimage, c.user_id, c.disc_id
    FROM topics AS t LEFT JOIN collections AS c ON c.disc_id = t.id
   WHERE forum_id = '.$id.'
     AND c.user_id = '.$user_id.'
ORDER BY t.sticky DESC;

Also, you're joining on Topic ID = Disc ID. Is that intentional?
Comment: there is no `$user_id` in his query because he want to want to fetch all threads, just not the one the user owns the disc
Answer: I can see two easy way for solving this:
first:
with two query, you group query and a second to fetch all the disc_id owned by the user
second:
with your first query:
if ($db->num_rows($result)) {
  $array = Array();
  while ($cur_topic = $db->fetch_assoc($result)) {
    $id = $cur_topic['disc_id'];
    if (!array_key_exists ($id, $array)) { // allow only result per disc_id
      $array[$id] = $cur_topic;
      $array[$id]['owned'] = false;
    }
    // If logged in users ID matches the current discs user_id (i.e if this user owns this disc)
    if ($cur_topic['user_id']==$pun_user['id']) // check if one is owned by the user
      $array['owned'] = true;
  }
  foreach ($array as $cur_topic) {
    if ($cur_topic['owned']) {
      $read = '
<input type="checkbox" disabled="disabled" checked="checked" /> I own this!';
    } else {
      $read = '
<input type="checkbox" name="discs[]" value="'.$cur_topic['id'].'" /> I own this!';
    }
  }
}


SharePoint Export only selected list items not whole list

Question: Is there a way to export only individual list or library items using powershell or any other way? I tried Export-SPWeb command with item URL but it exported whole library.
Answer: For list you can try list template. Individual items export not possible.
Still if you want you can try the long method : take list/library template for entire library --> create new library with new name --> delete unwanted list items --> create list template from this new library to get desired items.


Can a website be full amp and still have good results on seo?

Question: I am very new to development, learning just to make a project more efficient now, despite having a dream to be a developer I am too old to change from where I am.
I had some content written on wordpress and was needing more tools to make available for my readers, so I decide to remake it 100% under laravel. Since I am very noob I was looking for stuff that I wanted to add and was pushing to have some webstories on my new website and because of that I picked amp to work as the frontend.
My actual website is l96.app and the new one is running at lab.l06.app (I will delete the old one when this one is ready)
My question now is: Is it possible to have a website without a normal front end and just amp pages? Will it harm my SEO using pure amp pages or do I need normal ones also, for better indexation?
I need helps and tips about having a full amp website and optimization or exemples about how to do or do not it.
Answer: As such, SEO doesn't care about the technology you use to create the web pages. What matters is

HTML it sees and its correctness and logic
Value of some tags
Content and its relevancy


Cmos vtc characteristics

Question: Why  does the vin=vout takes place at the voltage of (vdd/2) only in the case cmos inverter characteristics? and how to estimate the value of (vout) in every case, so that we can establish  relationship between vgs and vds.
Comment: which cmos do you want to analyze and why?
Comment: Cmos inverter which is a combination of enhancement type of pmos and cmos
Answer: Well, a CMOS inverter is the only gate that has a single Vin. Life is much more complicated with multiple inputs. Inverters are also usually designed so that the PMOS and NMOS transistor have relatively equal current drive characteristics, so the switching threshold tends to be close to Vdd/2.
If you want to analyze the relationship between Vin and Vout, just write the equations for Vds vs. Vgs for both the PMOS and NMOS. Set Vgsp = Vdd - Vgsn, and set Vdsp = Vdd - Vdsn. Solve as desired.
Comment: Thank u sir but we know that vgs=vin-dd and vds=vout-vdd , how to know vout so that we  can  write any sort of equation for conditions  like  vds<vgs-vth like that
Comment: I assume you are still talking about a CMOS inverter with no load on the output. This implies that Idsn = Idsp. So, if you have equations for Ids of the PMOS and NMOS just set them equal to each other. Make the substitutions for the PMOS Vgs and Vds. You are left with an equation with two unknowns: Vgsn and Vdsn. Choose a value for Vin, which equals Vgsn, and solve for Vdsn, which equals Vout.

Cmos vtc characteristics


All shorten url redirecting to linkbucks

Question: I have seen most of shorten url like http://owl.li/w6tUx redirecting to linkbucks site. I see even google is using this service in their posts in facebook or google plus something like http://goo.gl/Z7bY5C. I am not sure why google like company is using services like linkbucks. Is this some kind of virus of something have affected my computer. Can someone please explain or please advise me what is the correct place to ask question like this?
Comment: This question appears to be off-topic because it is not **[about a website you control](http://webmasters.stackexchange.com/help/on-topic)**.
Answer: owl.li, goo.gl or any other sites are only url-shorteners. Most of them do not attach linkbucks or any other affiliate site by default, it up to the user using the service.
I believe in your case it was that whoever used owl.li pointed the URL to a linkbucks URL while Linkbucks URL was another kind of URL shortener which displays the real URL among Linkbucks ads.

To explain the steps taken:
- You have a website, say http://www.example-domain.com/some-specific-long-url-you-want-short (as you can see, this is too long for one line, pity)
- You go to a url-shortener (like owl.li) and insert the url.
- The url-shortener gives a short url back: owl.li/exmlp
- Some user clicks owl.li/exmlp and gets redirected to http://www.example-domain.com/some-specific-long-url-you-want-short
Answer: Looks like your router's been hacked into and its DNS server settings have been changed.
My advice: Reset Your Router/login to your router and remove the rogue DNS server entry, change the admin password for your router.


Theorem of Pappus

Question: Given a surface of revolution $S$ which can be parametrized by the map
$$
\mathbf x(u,v) = (f(v)\cos u,f(v)\sin u,g(v)),
$$
over the open set $U =\{(u,v) \in \mathbb R^2 \mid 0 < u < 2\pi, a < v < b\}$, I computed the area of $S$ to be
\begin{align*}
\int_a^b\int_0^{2\pi} |\mathbf x_u \times \mathbf x_v| \, du \, dv = 2\pi\int_a^b |f(v)| \sqrt{(f'(v))^2+(g'(v))^2} \, dv.
\end{align*}
If $l$ is the length of the generating curve $C$, how does one then get the area of $S$ to also be written
$$
2\pi \int_0^l \rho (s) \, ds,
$$
where $\rho=\rho(s)$ is the distance to the rotation axis of the point $C$ corresponding to $s$? I think that the arc length $s=\int_a^b |\alpha'(t)| \, dt$, where $\alpha$ is the space curve, but I'm not sure in particular how one changes the interval $[a,b]$ to $[0,l]$ when changing the variable $v$ to $s$.
Answer: Consider $
2\pi \int_0^l \rho (s) \, ds
$ We know
$s(t)=\int_{a}^t||\alpha'(z)||dz$. For regular curves this is a diffeomorphism from $(a,b)$ to $(0,l)$ where $l$ is the arclength Thus using change of variable formula rewrite the integral as $2\pi\int_a^b\rho(s(t))|s'(t)|dt=2\pi\int_a^b|f(t)|\sqrt{f'(t)^2+g'(t)^2}dt$
Answer: You need to reparametrize your curve, replacing $v$ by $s$, where
$$
s(v)=\int\limits_a^v\sqrt{f'(v)^2+g'(v)^2}\,dv
$$
hence $ds=\sqrt{f'(v)^2+g'(v)^2}\,dv$. When $v$ takes values in $[a,b]$, $s$ takes values in $[0,l]$ where $l$ is the length of the curve. Also, $|f(v)|$ is just the distance from the point to the rotation axis, so it is precisely $\rho(s)$ (you can do the computation, but I do not think there is a need for it),

Theorem of Pappus


Changing color of numbers in stock exchange AE template with expressions

Question: I just wondering if there a way to optimize the way of changing color of numbers in stock exchange template by using expressions? When I put the +before the number it turns green and if -,it turns red.
Answer: This is probably not the shortest way of doing it, but it's quick and easy:

Make a null layer with a slider
Make a text layer with green text
Link the source text in your text layer to the slider in the null layer.

You should see an expression like this:
thisComp.layer("slider null").effect("Slider Control")("Slider")

Now add an expression to the Opacity control in your text layer. This is going to make the Opacity go to 0 if the slider value is below zero, or 100 if it is zero or above:
if(thisComp.layer("slider null").effect("Slider Control")("Slider")>=0) {100} else {0};

Now duplicate the green text layer

Rename it "red text"

Change the text colour to red

Edit the expression on the red text layer's Opacity control to this:
if(thisComp.layer("slider null").effect("Slider Control")("Slider")<0) {100} else {0};

Now the red text layer should only be visible when the slider value is lower than zero.
Screenshot of the whole thing below:

If you want a leading "+" before the positive values, you could also make an "if/else" statement in the green Source text control, so you only see a "+" when the value is above zero - something like this:
if(thisComp.layer("slider null").effect("Slider Control")("Slider")>0) {"+" + thisComp.layer("slider null").effect("Slider Control")("Slider")} else {thisComp.layer("slider null").effect("Slider Control")("Slider")};

Comment: Hi! Very interesting and not obvious solution. Thank you!
Comment: please mark as answered!


What does it mean to "uplift" a supergravity solution to higher dimensions?

Question: What does it mean to "uplift" a supergravity solution to higher dimensions? This is a common term used in the literature but I cannot understand it. A very common example is "uplifting d-dimensional solution to 11-dimensional supergravity or M-theory". Is there some simple example?
Answer: An uplift is the opposite of a dimensional reduction. Take for example the relation between (the low-energy limit of) M-theory and type IIA supergravity: the former is eleven-dimensional, while the latter lives in ten dimensions. If you find a solution of M-theory, you can get its equivalent in type IIA by Kaluza-Klein reduction. For example, the eleven-dimensional metric $G_{MN}$ gives rise to the ten-dimensional metric $G_{mn}$, a gauge field $G_{m,10}$ and a scalar $\Phi=G_{10,10}$ (the dilaton). Since both descriptions are completely equivalent, one can also start in ten dimensions, solve type IIA supergravity and then construct the eleven-dimensional fields. This is referred to as "uplifting". While the details of course vary from case to case, the principle is always the same.
Comment: You're welcome! It works just the same way as the reduction. You just use the formulas the other way around. You can find them both in Polchinski I and D-Branes by Johnson.
Comment: Thanks for your answer. I do understand well how you get the fields going from 11d to 10d I am not sure how you recombine them consistently to get the uplift. Is there a reference with some worked out example maybe?
Comment: Perfect. Thanks a lot for your answer. From a quick search on Google and on the two main SUGRA texts of Freedman VanProyen and Ortin I could not find something (maybe I did not look well).


Could we detect the light of cities at night in other solar systems?

Question: Would it be possible to see electric lights on distant planets using current telescopes?
Comment: While detecting and resolving an artificial light itself may not be an option soon, an unusually skewed spectrum of a planet may be easier to detect. On the other hand, in the last years we almost abandoned sodium and mercury lamps that would create a distinct signature for our fellow alien astronomers. Modern LEDs become more and more "natural".
Answer: No.  There are very few exoplanets that can even be imaged as "dots".  There are none that can be resolved as discs and it would be well beyond current technology to see lights on the surface of an Earth-like planet.
Most exoplanets are only known from periodic dimming of a star as the planet passes in front of its star, or wobbles in a star's motion, as the planet's gravity causes the star to move forward and back.
We could see lights on Mars, if they existed as they do on Earth,  but they don't.
Comment: This answer is focused on direct imaging and ignores the possibility of spectroscopic information. We're not able to directly image the atmosphere of any exoplanet either, yet we can detect their absorptive spectroscopic influence. Theoretically characteristic emissive spectroscopic information from very large-scale illumination could similarly be detected.
Comment: @MichaelMacAskill My answer stands, If you feel you can add something please write your own answer.
Comment: You don't need to resolve a planet as a disk to observe light emitted from it.  After all, you can't resolve most stars into disks, but you can see their light without even using a telescope.
Answer: I did a few rough calculations.
Let's assume a neighbor system (4 light years), and a population of 1 billion people each transmitting 1000W of light into the night sky.
Then on Earth, a 100 square meters telescope would receive about 2 photons per minute from the electric lights. This is far beyond current technology, especially as there are much, much brighter sources in very close vicinity.
Comment: To add to this: Currently planned telescopes (such as Roman) might be able to achieve a contrast of a few parts per billion at Jupiter-like distances from a star. 1e9 people putting out 1e3 watts per person is still a contrast of 1:1e15 against our sun.
Answer: No, at least not with currently deployed telescopes. However, it is theoretically possible with current (or near future) technology. We could potentially image the lights of an exoplanet using a Solar Gravitational Lens (SGL), as is currently under consideration by the NASA Institute for Advanced Concepts as a "Phase II" program. "Phase II" is described as signifying that NASA has:

determined that much of the foundational technology exists or is in intermediate levels of readiness due to the proliferation of government and commercial smallsat programs.

The technique works the same as we normally observe gravitational lensing. That is, the light of a distant object is concentrated in a narrow region of space called a focal line by a massive object between the observer and the lensed object. This lensing dramatically increases the resolution and apparent brightness of the observed object, enabling us to see things that are too far away or too dim for us to directly observe with conventional telescopes.
A SGL mission would send probes so that they place the Sun between the probe and the exoplanet. By blocking out the light of the sun, the probe could observe the Einstein Ring of the exoplanet surrounding the Sun. This ring could be reconstructed into a traditional image to view the surface of the exoplanet, such as this simulated image.
At this resolution (estimated by NASA as being up to ~25 km-scale surface resolution for an Earth sized exoplanet at 30 pc), it would be possible to directly observe lights of an advanced alien civilization.
Comment: Of course, it takes a long time with current technology to get to the SGL focal distance of ~547.6 AU, especially if you want to remain there (and not just do a flyby). In comparison, Voyager 1 is currently ~158.5 AU from the Sun. https://voyager.jpl.nasa.gov/mission/status/
Comment: Per the wikipedia page to which you linked, the SGL was granted a NIAC Phase III award, confirmed [here](https://www.nasa.gov/directorates/spacetech/niac/2020_Phase_I_Phase_II/). That's still a smallish amount of money ($2 million), maybe 3 or 4 people at JPL working full time for two years.
Comment: Another problem is that this telescope would basically point in a single direction for all its operative lifetime, and then need to work with that. Changing the view direction would take as long time as setting up a new telescope. So this would only be able to investigate one single solar system... you better select one where you have good reason to believe it has life on it!
Comment: @DaveTheWave Not really. The converging light rays form a cone 547.6 AU long, with the Sun's disk as the base of the cone, and the apex of the cone at the SGL point. If you want to collect photons at half that distance, your circular collector has a diameter of half the Sun's diameter. That's rather large, and the photons are very diffuse, making them hard to detect.
Comment: Can't they  intercept photons closer to Earth by by using a circular array of detectors to intercept photons .
Answer: TL;DR:
We could detect but it really depends on the distance you're talking about
Long answer:
Not using current technology (if the distance is huge). The Solar Gravitational lensing mission could do detect city lights from exoplanets but a mass (like a galaxy, neutron star and blackhole) would be required (which also most probably would be available).
If the distance is too far away according to the inverse square law the light's intensity would get smaller to a limit where we can't really detect it.
Because of the Doppler shift it would be tougher because the redshift created from the effect  would be huge if the distance is huge as per Hubble law  but that is kind of manageable because we even have radio telescopes. But one of the most powerful telescopes we have ever made the JWST has the mid-infrared ranges ( 5-28.5 μm) but doppler shift could extend even farther as per the distance so it's a catch 22 situation if we want to see large distances then we would have encounter more redshift too.
We wouldn't see the lights if the planet/asteroid is in the zone of avoidance
Also since different elements (in the Periodic table) in Bulbs emit different Wavelengths of light we're not sure which wavelength to focus on like Argon, Xenon, Incandescent (Tungsten)!
The amount of light emmited is based on the energy usage given by the Karshadev scale
Hope it helps, Thanks
Answer: Here there was only sludge, microbial mats and goop for 1.5 billion years, then it was filaments, small specs and sludge for 1.5 billion years, and there has been light for 50 years, and even those look like a volcano or a reflection of moons and stars onto clouds or ice.
i.e. Venus because of it's clouds reflects more than 4 times as much incoming light than the moon, and more than twice of the Earth's.
So astronomers want to detect chemicals rather than lights, we don't know what alien light bulbs use for chemistry, however we can measure high oxygen content on another planet, which means photosynthesis. Planet Rarth's oxygen started rising about 1000 million years ago at the same time as life-form size was rising.
https://astronomy.swin.edu.au/cosmos/a/Albedo
Answer: We need hypersensitive instruments for that.
Freeman Dyson postulated an industrial society could be detected on Infrared. Like Earth looking for heat islands in urban areas.
Another would periodic spikes in infrared waves from stars because society was tapping its power.


Create a dev/test cloud on a box or two

Question: So I have a similar question to Recommended setup for a "hom dev cloud"? I want to run VM's on an old desktop basically. Everything I've seen for installing EC2 eucalyptus or openstack has been on bare metal. I tried to install on ISO on a vm, but it wouldn't install to a VM. Is it possible to have test environment on one server where I can programmatically spin up vms as I would with a public cloud?
Thanks!
Answer: Since you are interested in deploying your cloud as a VM, you should also consider Apache Cloudstack. Have a look at DevCloud for a VM image.
Answer: It appears this will work for openstack http://devstack.org/guides/single-vm.html. Is there anything similar for ec2 eucalyptus?
Answer: For eucalyptus you could take a look at eucadev:
http://sigtt.in/articles/2013/11/25/introducing-eucadev/

Create a dev/test cloud on a box or two


Why are the wires of thyristors always twisted in pairs?

Question: I have always been told that you should never untangle the wires of a thyristor or subset of thyristor (such as TRIAC and SCR). Why is this? Is this just for convenience or is there a use for the wires being twisted?
Answer:
Why are the wires of thyristors always twisted in pairs?

For the same reason that any twisted-pair cable is used: to reduce interference.
Thyristors such as that you have photographed are used in high-current circuits. The thyristor gates are relatively sensitive and an untwisted pair of wires running off to the control circuit will create a loop which will be susceptible to picking up induced currents which may trigger the thyristor.
By twisting the pairs a series of small loops are made and each one is in opposite orientation to the one before it. The result is that the induced interference is, to a very significant extent, cancelled out.
It appears that the device in your photo has four terminals: the stud and the heavy red lead for the high current circuit and the twisted pair for the control circuit. The reds are connected internally to eliminate problems trying to attach the control wire to the bolt on the large ring terminal.
Comment: Ah nice, that explains the two control terminals!
Comment: Besides convenience, a separate wire allows you to have a single point reference at the Cathode. The gate driver circuit is often an otherwise floating circuit so you want only one connection and you want that connection to be electrically as close to the Cathode as possible. If you connect the reference point to the heatsink where the big stud is attached, you could have noise spikes that could fire the SCR spuriously.
Answer: Given these wires aren't twisted for about half their length, the effect can't be that important. So, I think this is mostly a convenience / superstition thing.
However, there is good reason to twist the wires that control a high power semiconductor. It's the same as why network cables are twisted pair: Any power coupled in to one wire will couple (approximately) as much in the other, leading to common-mode noise, rather than differential noise. Common mode noise can be ignored by things that couple in capacitively. However, that is not the case for TRIACs.
Also, the picture shown is not a TRIAC, but an SCR (which is a special type of thyristor used for rectification), and I really don't know why there are two control lines here.


Openstack havana shows only one computer

Question: I have 3 computers with wich i want to build a cloud.
On the first i have installed MAAS, after that i have added the other two as nodes in the MAAS. I have installed juju bootstrap on the second computer and deployed openstack/keystone,quantum,nova-compute etc. and the openstack-dashboard/ on the third.
  When i login openstack-dashboard and go to  Hypervisors i see the components /cpu,ram,hdd/ only  of the third computer /the one with the openstack/ what should i do to see the resources of all computers and build virtual machines with all of them.
Thanks and happy new year!
Comment: Should i use add unit on the second node for all components of openstack to see it in hypervisors ?
Answer: To make the bootstrap node -- machine 0 -- available for running VMs:
<code>juju add-unit nova-compute --to 0
</code>
You can't currently use the MAAS server itself with your setup; given the limited hardware you have available, you may find it easier to use manual provisioning to create a juju environment on without involving MAAS. But that approach won't scale up very nicely; the Right Thing to do rather depends on your future plans for the environment as well as your current situation.
Comment: If you only plan to add additional hardware rarely, the burden of installing ubuntu on each new machine yourself, and then doing an explicit `juju add-machine ssh:@`, will be minimal. Manual provisioning sounds like a good answer there: you can distribute your services across the two servers as you wish, without needing a separate machine for MAAS. (That is to say: one of them will have to be the juju bootstrap node, but that shouldn't use too many resources, and you can run other services on it with --to.)
Comment: Hello and thenks for the answer! The command worked. I will use only two servers and one computer - 110gb ram, 10TB HDD, 40 CPUs. Can i use them with the limitation of juju? Thanks.


Will headless cauliflower form a head next year?

Question: I planted cauliflowers this year. None of them formed heads
I replanted the seedlings twice and I have since heard that this is bad for them so maybe this is why.
Now I have 2 rows of giant cauliflowers, still going strong despite the frost. I'm in the south of the UK.
Should I leave them and see whether they grow heads next year? Or are they likely to just take up space and produce nothing?
Answer: Caulis are grown as a cool weather crop. Either fall or spring, avoiding the summer which can spoil the heads. As with any annual, they expect to be smoothly grown quickly through the vegetative phase (leaves, stems) and then switch to fruit or flower stage which calls for a different internal chemistry. Once that stage is done they are at end of life and croak. What can happen is that the plants grow so well and luxuriantly that they don't smoothly transfer from vegetative to fruiting, so they keep producing lovely leaves and no heads.
This could be what happened in your case. They may go to sleep over winter and suddenly produce a few small heads in spring that quickly go to seed and become compost material.
However all is not lost - cauliflowers, particularly those grown in rich conditions, grow nicely edible leaves, the older ones for soups and the younger softer ones for salads. You might consider thinking in terms of delicious leaves rather than nice big heads. In order to profit from the leaves you don't have to interfere with the possibility that normal heads might appear, but I think it would be unlikely.


Can we customize/branding salesforce1 App

Question:
I require to customize salesforce1 for my org with brand logo and colors. Please let me know how can I achieve this. Whether it is possible or not.
Answer: 1) Salesforce Menu--> Mobile Administration --> Salesforce1 --> Branding.
Here, You can find the options to edit the brandlogo.

2) You can change the preferences/priority of the tabs/Custom Tabs displaying. If you don't need to use the "What I Follow" you can remove it.
Mobile Administration--> Mobile Navigation--> you can add/remove/move up/move down the tabs
3) Salesforce Menu--> Global Actions--> Publisher Layouts.
Here, you can align/add new/ remove the Quick action options.
Thanks.
Comment: Thanks for your response, Brand logo is coming on the first page as in I login, but I need it on the top blue bar as mentioned in the pic. I am unable to set it there
Comment: Hi SFDev, Logo will appear only in the first page after login but not as you request coz, while viewing in mobile it will be difficult I guess. Not Sure. Thanks.


What elements of a capacitor make it higher voltage and higher capacitance

Question: I know capacitors have 2 plates, and an insulator in between the plates. I am wondering what elements inside of a capacitor make the capacitance larger, and what makes the maximum voltage higher?
Answer: \$ C = \epsilon_0 \epsilon_r \dfrac{A}{d}\$
Where:

\$C\$ is the capacity in Farad [F];
\$\epsilon_0=8.854×10^{−12} \text{F/m}\$;
\$\epsilon_r\$ is 'relative permittivity', its value is specific for the material used as insulator. See also @rawbrawb's comment;
\$A\$ is the area of the plates that overlaps in square meters;
\$d\$ is the distance between the plates in meters.

So:

if the plate overlapping area increases, the capacity increases and
if the distance between the plates increases, the capacity decreases.

The insulator that fills the space between both plates (A×d) has a limited strength when it comes to voltage between the plates. The insulator will breakdown at a certain maximum voltage, at that point it is no longer a capacitor, but probably a short.
Comment: To add to Jippie's answer, \$\epsilon_r\$ is a "large dial" that can be turned.  Some materials have \$\epsilon_r\$ that are high, TiO2 = 100, SiO2 = 3.8 and some materials actually prevent the breakdown between the plates enabling even higher voltages.
Answer: http://en.wikipedia.org/wiki/Capacitance especially "Capacitance of simple systems": larger plate area and smaller separation will give greater capacitance.
The maximum voltage depends on the breakdown voltage of the dielectric (material between plates); the point at which it stops being an insulator. For any given dielectric, the breakdown voltage is proportional to its thickness (i.e., the plate separation).
Answer: If you want to have voltage higher, you need to have larger space among plates. But this is opposite to another request to have higher capacitance. So what you can do is to separate plates more to have higher voltage standing and to increase area of the plates in order to increase capacitance as well.


Run power supply wire through garage for security camera

Question: I need to run thin power supply wire that came with security camera through garage. I have bricks in front upper portion of garage but there is little garage eaves where I can mount the camera. I also see rubber strips running across and down the garage outside against which door sealed when closed. Could any one please help what is the best way to run wire without doing too much effort. Please refer to pictures for inside and outside of garage corner where I want to install camera. Thanks
Garage door
Comment: I cannot see the eves  that would be the best location if you are mounting the camera up there.
Comment: I will be mounting it on white wooden shed ( I don't know what to call it)...It is about 8 inch wide in the second picture.
Comment: I added a new photo with arrow pointing to location of camera. This is about 8 inch wide shade.
Answer: To help with terminology I've added some notes to one of your pictures showing the names I use for the parts. The rubber strip is a "weather seal" and the painted white wood is a "jamb."

You can drill horizontally into the jamb. You'll need a long drill bit for this; the hole may have to be 4-6 inches deep from the interior surface of the lumber on the wall. This bore is illustrated with the line segment marked "1".
Next, drill vertically up into the jamb as illustrated with line "2". If you've positioned the drill well the two holes will intersect and you'll have an L-shape passage through the wood.
The wire can be fed through. It may be necessary to feed something else through first -- a small/light gauge wire, a string, etc. Creativity is key here. For example, if you're trying to get string through the long horizontal bore but it hangs up on the rough wood, try inserting a drinking straw first and push the string through that. It'll get you to the far end of the hole where a small hook or tweezers may be able to grab the string.
Before drilling the actual door jamb tou could practice the technique on a scrap of lumber from somewhere. A home center, lumber yard, or construction site may have a piece they'll sell or give to you.
Comment: Thanks for terminology. Honestly I didn't know and it really help if you have right terms. So hole 1 should be from inside of garage that meet from the hole 2 vertically from jamb? Is that correct...Thanks.
Comment: I find fishing line handy with small holes that are not quite straight, if I can see light sometimes a piece of solid copper wire will make a gentle bend and use the line or wire as a pull. That is if the cable can't be pushed through this works quite often.


Establishing wireless comm. between PC and arduino pro micro to exchange speech and gyro data

Question: I have a client project to make a wireless head-mounted mouse. What wireless module should I use so that I can exchange data between my laptop and the arduino pro micro through the USB port like a wireless mouse? I am using an MPU6050 accelero+gyroscope sensor for cursor movement and Electrohouse Voice Recognition module V3.1 for speech recognition. To exchange such data between PC and arduino, I found a lot of options. Hence, I am confused. Please help me decide what to use so that cost efficiency and effectiveness can be acheived. Should I use bluetooth, RF shield , XBEE or any other module?
Answer: The wireless medium you choose is largely irrelevant.  The important thing to realise is that it's not (in most cases) the wireless medium that is communicating with the computer.
Most wireless mice use the nRF24L01+ (or rather the integrated SoC equivalent) to communicate. They use a USB dongle plugged into the computer for that communication. The computer has no clue what an nRF24L01+ is, but it does know what a USB mouse is. So there is a microcontroller in the dongle which receives data from the nRF24L01+ and interprets it, and sends the right instructions over USB to make the computer think it's a USB mouse.
What the data is that's sent over the wireless, and exactly what form that wireless connection takes, is completely irrelevant as far as the computer is concerned.  In general one if the SoC equivalent to the nRF24L01+ (such as the nRF52810) is chosen because it's a single chip solution with a simple to use wireless protocol, which makes for cheap and easy development and implementation.
The only exception to this general rule (and there is always an exception to every rule) is Bluetooth. This is because there is the concept (as far as the computer is concerned) of a Bluetooth mouse. So it is possible, using the right Bluetooth adaptor on your Arduino, for the computer itself to see the Arduino as a Bluetooth mouse. This can be harder to implement using small microcontrollers, but results in a potentially lower cost solution with fewer components.
The simplest solution for you, though, is probably:

One Arduino that has a native USB connection (Pro Micro, Leonardo, etc - anything ATMega32U4 based)

This will be connected directly to the computer and programmed to emulate a USB mouse

One Arduino that best suits your sensors (probably doesn't really matter what for this. Mini? Micro? Nano? Uno? They would probably all do fine).

To this you attach your sensors, your voice recognition, etc.

A pair of wireless connectivity modules of some form

I'd recommend the nRF24L01+ - simple to use, has a very convenient packet-based protocol, cheap, and there's plenty of examples and libraries out there.  These are connected to both Arduinos and are used to communicate between them.
Then it's up to you to decide what information gets sent between the Arduinos to make the one connected directly to the PC send the right mouse movements.
Comment: Is the module you mentioned suitable for sending both speech data and cursor movement data to the pc from the user arduino? I ask this because the click operations and cursor movement operations are to be sent via the user side arduino. Can the module handle sending this amount of data? Like voice commands such as select, enter , options and cursor movement .?
Comment: Your VR module handle all that data doesn't it?
Comment: Yes, everything worked nicely andd without delay through the usb cable when i spoke a command to the VR module while moving the cursor. Can the nRF24L01 module send this data without delay?
Comment: So you're not sending large amounts of data them. Just a command to click the mouse.
Comment: If the VR module is anything like the ones I have used in the past, it's "Audio -> Microphone -> VR Module -> [serial] -> Arduino -> Do whatever you want". It's the "do whatever you want" bit that is the communication over wireless. That could be a single bit in a single byte.