How do I restore new iphone settings?

Question: I plugged my new iphone into my computer and it asked if I wanted to restore my old iphone settings.  I clicked yes not realizing I would lose everything from the last 8 months since I got the new phone.  Is there any way to restore what was on the new phone?
Answer: Open iTunes preferences, there's a "Devices" tab that shows you any backups stored on that computer, but if you've never connected it in between I can hardly imagine there's an older backup.
Did you connect your phone to any computer in the last 8 months, or did you eventually use iCloud backups? You could check those as well..

How do I restore new iphone settings?


What were the two bright dots that showed up near Jupiter and vanished after seconds?

Question: I saw two bright lights near Jupiter and I'm pretty sure that it wasn't just an airplane. It had almost the same level of brightness as Jupiter, and I was wondering what it could be. Can anyone explain me what it was?
Comment: When, where, what?  When exactly did you see this.  Where exactly did you see this.  What exactly were you using to observe Jupiter?  Exactly how far from Jupiter? Jupiter does have moons, but they are not "same level of brightness".  No star has the same level of brightness as Jupiter at opposition, so this is not an astronomical observation.  I have voted to close as there are insufficient details to answer.
Comment: Were you using a telescope or just looking with your eyes? As JamesK asks, how far away were they from Jupiter? You can imagine an outstretched hand or fist as a measuring stick for example.
Answer: It's not likely anyone can provide a definitive answer (certainly not without more specific details), but I can provide some possibilities.
I have been fooled by the sun reflecting off high altitude planes before.  They appear motionless if traveling straight towards you, but were obviously planes when observed throught a scope.  Landing lights on a plane or hellicopter are another posibility.
Another possibility is a high altitude balloon.  A bit rarer than planes, the ones I have seen tend to "flare" a few minutes near sunset, but each balloon and location will be different.
The last likely possibility is a "geosynchronous flasher".  These are reflections of the Sun off of satellites in geosynchronous orbit.  Due to their distance from Earth, they can occurr well into the night.
Comment: I have downvoted, as I don't think this is a useful answer.  It doesn't identify the lights and the range of options don't match the description. The suggestions here don't explain **two** lights (except as coincidence)  The OP has already positively said "not a plane" And "geosynchronous flasher" seems unlikely given "two" and "near Jupiter", too many coincidences there.  It is much better to wait to see if the OP can give details and then give a definitive answer (if on topic) or close (if not).
Comment: It's not useful to ask the OP to provide more details unless there is an expectation that they will actually help answer the question.  As I said in my answer, it's highly unlikely a definitive answer can be given, and that's the important point to take away.
Comment: In this case I agree with JamesK, without a clear question with sufficient details, as as Stack Exchange answer this is not yet helpful. I'd recommend you delete it temporarily and wait for more details to emerge.


Where are contracts actually running?

Question: I wonder where "Smart Contracts" are actually running: Are they running on every node in the network? I rather doubt this, given the costs for running the contrat.
If my assumption is correct and the "Smart Contract" is only running on one single machine: How can the network ensure that the output of this Smart Contract is correct? Am I supposed to trust the machine that is running the Smart Contract?
Thanks for a quick reply.
Answer: Yes, they run on every node in the network.

Where are contracts actually running?


Could Ariel control Kumoko with Kin Control if Kumoko didn't have Heresy Nullification?

Question: Kin Control specifies being able to control all descendants, but I don't think Ariel ever even tried to control Kumoko. Was she not able to?
Answer: The answer to this is: she probably could have, but not anymore. The description for the Kin Control skill specifies descendants, not children (though I am going by the English version). However, controlling far removed descendants may be more difficult, and it may be a requirement that there be a living link to them. I think this because after Mother is killed, Kumoko says this, which confirms there's no longer a link between them, on page 224 of volume 4:

I successfully overthrew Mother.Consequently, the Parallel Minds that were fighting her soul have come back to me.At the same time, Mother's control over me vanishes completely, and the faint connection I felt before disappears.In other words, there's no longer anyone trying to control me, and my link to the network of spider souls that centered around Mother is gone.The Demon Lord was the real origin of this network, but since I was on the fringes, connecting to her via Mother, that means I'm cut off from the Demon Lord now.The problem is, that means I can't attack her soul with my Parallel Minds like I did with Mother.Without a connection, I can't send Parallel Minds over to her.

And when her Parallel Minds inform her that Body Brain already went over to the Demon Lord while the connection was still active:

Say what?!Wait, but isn't my connection to the Demon Lord gone now?Huh? Is former body brain going to be able to come back?[[Beats me.]]Um, I'm pretty sure she can't, right?'Cause, like, the connection is gone now.

Whatever the case for other spiders, Kumoko cannot be controlled by Ariel because there is no longer a link between them. It's unclear how much that has to do with Heresy Nullification. That being "on the fringes" of the network comment might have to do with this skill, and not just that she's not a direct descendant of Ariel. It's worth noting that of all the spiders that attacked Kumoko, only the puppet spiders were mentioned of having been directly under Ariel's control. All the other ones, probably all natives of the Great Elroe Labyrinth and probably Mother's children, were controlled by Mother. Ariel not taking direct control of any of Mother's children may either indicate she can't, and instead can only issue orders through Mother, or it could just mean nothing, and she just allows Mother to give orders because splitting the workload is the best strategy.
Additionally, there's a point at which Kumoko also comments that changing her species (through evolution) probably weakened Mother's ability to control her.
Comment: Checking fandom wiki, it does specify kin control as letting one control children, and it also mentions changing into a new species makes controlling harder, which I kind of remember Kumoko commenting on. May update if I can find these references in the books.


how to scroll a Tix ScrolledWindow

Question: Using Python, how can I programmatically scroll (not using the scrollbars) the window in a Tix ScrolledWindow? The normal way would be to call xview / yview, but those calls do not seem to be available. Googling suggest that it is not possible at all, but I hope for something better.
Answer: <code>st = tix.ScrolledText(parent)
st.text.see('end')
</code>

how to scroll a Tix ScrolledWindow


Number of free parameters in Gaussian mixture models

Question: When comparing GMM models with different number of components (i.e number of Gaussians) one penalizes the likelihood for the total number of free parameters in the mixture model. If the data is in $D$ dimension then the number of free parameters for $J$ components is given as:
$J-1$: for $J$ weights which sum to one
$D$: for each mean
$D(D+1)/2$: for each covariance matrix
My question is this: assuming that I am working in a limited space in $D$ and I do not need infinite precision, if I discretize my space into grid points instead of referring to each mean location with its coordinate vector of $D$ elements can't I just use one parameter as an index to define the location? It would work only for the mean vector but nevertheless it would be a reduction of complexity.
Answer: The grid mapping you describe is a form of index: with finite precision, there are a fixed number of values that the mean of each component can have, so you can reduce any mean vector to a scalar pointer to the index. You can do the same thing with the covariance matrices: if the values have a finite precision, then only a finite number of different matrices are possible; these can be indexed, then the $D(D+1)/2$ parameters could be replaced with a single index. In fact, with finite precision, there are only a finite number of mixture models possible, so in principle, these could be indexed, reducing all the parameters to a single scalar.
However the information contained such an index must logically be the same as in the full set of parameters, so you're not really reducing the complexity of the model. If you're comparing two models using some information criteria (AIC, BIC, MDL etc.) then reducing the precision of all the models will not change the ranking of their relative goodness-of-fit.
Nice idea though!


Is the stainless steel pot pitted by salt water a food safety problem?

Question: I added salt and cold raw eggs to cold water in an All-Clad D5 18/10 stainless steel pot before turning the burner on.  After the salt water was boiled and eggs were taken out, I saw a lot white spots on the bottom of the pot.  I tried to clean with Bar Keepers' Friend, but could not remove the white spots.  All-Clad said the white spots were pits etched by undissolved salt in cold water (i.e., I should have add salt to boiled water instead) and the pits were harmless.  Does anyone know what the white spots are chemically and if the white spots render the pot unusable according to food safety?
Comment: Questions regarding health are typically considered off-topic here (we're amateur cooks, not doctors!) but we can probably help if you want to know how to remove them. If so, I'd recommend that you use the "edit" link under your question text to add that in. Also, adding a picture might be really helpful to identify these.
Comment: Sounds strange , table salt in cold water in the pan a few hours should have no visible affect on SS.
Answer: Chemically the pits etched in your pot are the absence of the stainless steel material that makes up the pot. In other words the white spots you're seeing are where a small amount of the stainless steel has been removed from the surface of the pot, much like it had been scraped off. So the pits are completely harmless because they're not actually any kind of chemical substance.
Chemically what causes the etched pits to appear is that the chlorine from the salt attacks the passive film of chromium oxide that normally protects the surface of stainless steel. Stainless steel gets its corrosion resistant properties through the addition of chromium. When exposed to oxygen the chromium in the steel oxidizes and forms a very thin layer of chromium oxide on the surface the metal. This layer prevents oxygen from going further into the steel preventing it from further oxidation (rusting).
Normally stainless steel isn't harmed by salt dissolved in water or by the chlorine found in tap water. However things are different when a grain of salt sits at the bottom of a pot. It will dissolve into chloride ions (along with sodium ions) that are concentrated against a small spot on the surface of the pot. What exactly happens then isn't entirely clear, I've read conflicting descriptions, but the reaction seems to reinforce itself causing the chromium oxide layer at that spot to be removed. This exposes the steel underneath to damage by both chloride from the salt and oxygen dissolved in the water.
(The Chemistry Stack Exchange has a question on how chlorine attacks stainless steel if you want a more scientific explanation.)
There's really nothing you can do or need to do fix the spots at the bottom of your pot. You can't remove something that's not there. A new chromium oxide layer has already formed over the pits and your pots is as corrosion resistant as before.
Comment: Thanks Ross for explaining. However, "A new chromium oxide layer has already formed over the pits and your pots is as corrosion resistant as before." is not good enough. It will keep pitting and the chemicals will be added to what I cook.
Comment: @Aguest No, that's not true. The existing pits won't encourage further corrosion.
Comment: Existing pits, similar to under deposit and oxygen depletion , are a common problem causing  corrosion of SS for industry.
Answer: I too have seen this in my SS cookware and have tried the Barkeepers trick also. I do worry however that the aluminum cladding underneath the SS is now exposed at can/will leach into my foods. Any comments on this.  A little more research on this and I came across this; so it appears to be okay but could change somewhat the taste in acidic foods.
From: https://www.cooksillustrated.com/how_tos/6390-is-aluminum-cookware-safe

The amount of aluminum that leaches into food, however, is minimal. In lab tests, tomato sauce that we cooked in an aluminum pot for two hours and then stored in the same pot overnight was found to contain only .0024 milligrams of aluminum per cup. (A single antacid tablet may contain more than 200 milligrams of aluminum.) Our science editor reports that the consensus in the medical community is that using aluminum cookware poses no health threat.


Scaffolding Web Services in Grails

Question: I need to implement a web app, but instead of using relational database I need to use different SOAP Web Services as a back-end. An important part of application only calls web services and displays the result. Since Web Services are clearly defined in form of Operation: In parameters and Return Type it seems to me that basic GUI could be easily constructed just like in the case of scaffolding based on Domain Entities.
For example in case of SearchProducts web service operation I need to enter search parameters as input, so the search page can be constructed. Operation will return a list of products, so I need a page that will display this list in some kind of table.
Is there already some library in grails that let you achieve this. If not, how would you go about creating one?
Answer: Probably the easiest approach is to use wsimport on the WSDL files to generate the client-side stubs.  Then you can call methods in the stubs from Groovy just as you would have called them from Java.
For example, consider the WSDL file for Microsoft's TerraServer, located at http://terraservice.net/TerraService.asmx?wsdl .  Then you run something like
wsimport -d src -keep http://terraservice.net/TerraService.asmx?WSDL

which puts all the compiled stubs in the src directory.  Then you can write Groovy code like
import com.terraserver_usa.terraserver.*;

TerraServiceSoap sei = new TerraService().getTerraServiceSoap()
Place home = new Place(city:'Boston',state:'MA',country:'US')
def pt = sei.convertPlaceToLonLatPt(home)
println "$pt.lat, $pt.lon"
assert Math.abs(pt.lat - 42.360000) < 0.001
assert Math.abs(pt.lon - -71.05000) < 0.001

If you want to access a lot of web services, generate the stubs for all of them.  Or you can use dynamic proxies instead.
The bottom line, though, is to let Java do what it already does well, and use Groovy where it makes your life easier.
Answer: You should be able to use XFire or CXF Plugins.   For automatic scaffolding, modify your Controller.groovy template in scaffolding templates so it auto-generates methods you need.

Scaffolding Web Services in Grails


How to root samsung galaxy note2 n7100?

Question: I want to root my samsung galaxy note2 n7100. I saw lots of tutorials on internet. But no tutorial give me a 100% guarantee. :( can anyone help me to root my mobile?
Comment: You can never get a 100% guarantee from anywhere. You gotta try the one which is close to surety and if you run into any problem, seek help here.
Comment: See: [rooting Samsung Galaxy Note 2](http://android.stackexchange.com/q/39382/16575)
Answer: Google This exactly

CF Autoroot Note 2 "n7100" [Insert Version Os Here, IE: 4.4.2]

Also Try

Casual root "n7100" [Insert Version Os Here, IE: 4.4.2]

Match your OS version to the thread, and it should work.
Note
 1. Back up stuff, like everything will be deleted.
 2. Wipe the phone before starting it (Some software can interfere and mess it up.
To increate your od
Easiest way for Note 2, If you havent updated in a while,
As for specific thread and links - It will take some searching. I dont have one saved.
But once you find it its easy
Comment: "Google this and that" is not the kind of answers we favour on SE. You should include the essentials, and a link for references.
Comment: Useless with these models; Cause the links and its relevance will change, and theres seldom reliable statics. So I put "Google for" and [An exact keyword] because of its dynamic nature.
Comment: No problems to mention that along, but the recommended solution should be on our site still.
Answer: i suggest you, use autoroot for this phone :

download for 4.4.2

add to odin, then flash !
and finally, install last version of Super su
or use this :

How do I root my Android device?

there's not any guarantee for badmistake or other something, only you & your phone.!

How to root samsung galaxy note2 n7100?


Why is the HTC Legend Froyo ROM labelled as being for Vodafone?

Question: I am currently using Optus and would like to upgrade to this ROM, but it is labelled as being a Vodafone ROM. Is this important? Is the ROM locked to the network or are there other issues it may cause if I installed it. Would this be any different from buying a phone from Vodafone then switching networks?
Comment: Where do you live and what carrier handles your cell service?
Comment: @JonnyP: Australia and using Optus
Answer: I've done sort of the reverse -- installed a US T-Mobile ROM to my T-Mobile phone while I had it on the Canadian Rogers network.  Since the Legend is also a GSM phone like my Vibrant, I would expect yours to work just as well as mine did.  Just make sure you have your SIM card in for the whole process.
Comment: "and if you back up your apps/settings (e.g. with Titanium Backup) don't restore any data for the system apps, which might overwrite your current network's data with Vodafone data." If I backup, then install a Vodafone ROM, then restore, wouldn't my Optus settings be saved?
Comment: Good point, I was thinking too much about my case, where I switched carriers and ROMs at the same time.


Is it safe to access my home svn server over the internet?

Question: I have followed some simple instructions in setting up a SVN server on my windows server at home. It insolve installing the svn binary and setting it up as a service. In my LAN I tried access my svn server at the svn port and everything works fine. However is it safe to access my server from my office? I don't think the traffic (both the code and my password) it encypted over the network to my ssn server, is that correct?
Comment: Do you have a static IP?  That would be my initial question after reading this as if you don't, that may be worth solving first as well as how to change your firewall's configuration to allow the traffic through.
Answer: If you want a secure tunnel to your SVN server (running the svnserve daemon, not Apache) then you want to either: set up a ssh tunnel to access your home server, or set your firewall to only accept connections from known IP addresses you will be using in the office.
If you use the IP technique to block all other IPs, bear in mind the IP you see in your server might be the office NAT's IP address (ie everyone inside the office has a private IP but there is only 1 IP that is seen by the outside world, the mapping is managed by a NAT router)(this is ok if you want everyone in your office to connect too though).
Tunnelling svn over ssh is a common technique. Here's a tutorial to get it set up.
Answer: Whether or not the traffic is secure depends on if you're accessing it over HTTPS or not.
Comment: You can generate your own SSL certificate.  You don't have to buy one.
Comment: I thought I am access svn as a server, it doesn't go through a web server I don't think
Comment: it doesn't. It only goes over https if you've installed it under Apache.
Comment: Ah, true.  It's so widespread that I forget not everyone uses the Apache module.
Comment: If I install it with the apache module, does it automatically uses https? Or do I have to purchase some SSL certificate?
Answer: I have a mod_dav_svn loaded into Apache, and using AuthType Basic to authenticate against a local user/pass file.  The file is 640 with root:apache owner.  This isn't enough for real security, so I have it wrapped in SSL with SSLRequireSSL directive.  This way I can use my SVN repos either through a client (TortoiseSVN worked with a https://... connection, btw) or a SSL enabled browser.  This gives me a great flexibility while maintaining reasonably high level of security.
Answer: You can also (if it's for your only needs) encrypt the connection by create a self-generated SSL certificate
and under Apache add the following directive
SSLCertificateFile /yourfile
SSLCertificateKeyFile /yourkey
And enable the Listen 443 directive. Thus your connection will be more secure
Answer: I like Apache and ssl (just like Marcin describes),
then add a very aggressive firewall that only allows connections from a short list of ip numbers or a range of ip numbers (that you are connection from).
That way you lower the noise as well, and takes away most script kiddies....


Setup a Backup for 90k+ photos and desktop file structure

Question: I'm working for an engineer that takes about 500 pictures a month and uses Adobe Lightroom to manage them. He currently has about 2TBs of data that need to be backed up regularly. To setup a backup for him I was thinking about getting 6 1TB hard drives and then setting them up in a Software RAID 1 configuration with Ubuntu Server. Then his windows machine could regularly back up to the Ubuntu Server. But I dont know if this is the best or most effective method. Does anyone have any suggestions or methods to help me figure this out? Right now I think cost would be an issue for him with the 6 Hard drives we would probably order 8 just so we have two backups.
Comment: Backup strategies are a lot more complicated than "how many hard drives do I need?".  You need to consider what risks you're mitigating, and which ones aren't worth protecting against.
Comment: @gravyface: For extra-super-special protection against disk failure.  More seriously, I'm assuming (hoping?) the OP meant RAID-10.
Comment: Why RAID 1 with 6 disks?
Answer: I am thinking this really is overkill for what a large USB drive could handle much better while offering portability for storing offsite.
Considering what you have described of the engineer's usage pattern I am going to guess that he doesn't work with a fresh batch of 2tb every time, or your storage requirements would be much more insane.
I suggest getting a 3Tb External drive ( or two ) and keeping the data on the drive. This would be increasingly useful If the engineer is in the field with a laptop too. Keep a drive on the road and one at home if you want to be paranoid about replication.
Comment: Sounds fine, at least until you consider how excruciatingly slow it is to transfer that amount of data via USB.
Answer: If the Ubuntu server is located at the same place as the main data, you don't have a backup. IOW: Make sure you have an offsite backup.
Other than that, there are so many methods to do a backup that you can just take your pick and see what works for you. However, the server method appears to be a bit overkill just for this purpose. Have you considered a NAS instead? Works the same way from the client side but you don't need to do a lot of management with it.
Answer: I also think 1 or 2 external HDDs would be sufficient for his needs. And when he fills them up buy another (set). Something like DVD backups but on a way bigger media.
Adobe Photoshop Lightroom also have the option on import to "make a second copy" of the photos to additional destination aka the external HDD while importing them locally or on the network from the camera or CF/SD card.
After that he can sync/replicate the 2 external HDDs if he uses more than 1 for backup
Answer: I don't have as many large files as you're asking about, but I easily have a few hundred thousand files that I keep.  (Many are old and useless, but I'm a packrat...)
For personal backup, and number of schemes using external hard drives and software like rsync or one of the many commercial tools (I use Second Copy) can be devised.
I think the key thing is to come up with a scheme that works for the user of separating active files (ones that might be changed, renamed, whatever) from older, inactive ones (files that you're going to stick in a subdirectory and probably never change again).   In my case, I accumulate files every year, saving them in appropriate subdirectories (2011\personal, 2011\pictures, 2011\whatever), and on January 1st, I start a new directory (2012)
In my case, every file I've ever created (going back to the early 90s) fits easily w/in 1TB.  I have several copies of all these files on multiple hard drives that I keep in multiple locations.  With the growth of hard drives, if I ever run out of space, I'll probably just replace all of my 1TB drives with 2TB.
In your case, I'd also set up some sort of date structure and once I had something like 2TB of older, static data I'd make a few copies of that data on some hard drives and put them aside, available for reference if necessary, but not used day-to-day.


Are spot market ,regular market and ready market same in stock trading if not then what is the difference?

Question: Are spot market ,regular market and ready market same in stock trading if not then what is the difference ? and is short selling margin trading ?
Comment: @DumbCoder "ready market" is not a term I've ever seen before but I have found an SEC definition: https://www.sec.gov/divisions/marketreg/mr-noaction/2012/finra-112812.pdf  all equities are traded at "spot" too.
Comment: Source of terminologies ??
Answer: So, the term "ready market" simply means that a market exists in which there are legitimate buy/sell offers, meaning there are investors willing to own or trade in the security.
A "spot market" means that the security/commodity is being delivered immediately, rather at some predetermined date in the future (hence the term "futures market").  So if you buy oil on the spot market, you'd better be prepared to take immediate delivery, where as when you buy a futures contract, the transaction doesn't happen until some later date.  The advantage for futures contract sellers is the ability to lock in the price of what they're selling as a hedge against the possibility of a price drop between now and when they can/will deliver the commodity.  In other words, a farmer can pre-sell his grain at a set price for some future delivery date so he can know what he's going to get regardless of the price of grain at the time he delivers it.  The downside to the farmer is that if grain prices rise higher than what he sold them for as futures contracts then he loses that additional money.  That's the advantage to the buyer, who expects the price to rise so he can resell what he bought from the farmer at a profit.
When you trade on margin, you're basically borrowing the money to make a trade, whether you're trading long (buying) or short (selling) on a security.  It isn't uncommon for traders to pledge securities they already own as collateral for a margin account, and if they are unable to cover a margin call then those securities can be liquidated or confiscated to satisfy the debt.  There still may even be a balance due after such a liquidation if the pledged securities don't cover the margin call.
Most of the time you pay a fee (or interest rate) on whatever you borrow on margin, just like taking out a bank loan, so if you're going to trade on margin, you have to include those costs in your calculations as to what you need to earn from your investment to make a profit.
When I short trade, I'm selling something I don't own in the expectation I can buy it back later at a lower price and keep the difference.  For instance, if I think Apple shares are going to take a steep drop at some point soon, I can short them.  So imagine I short-sell 1000 shares of AAPL at the current price of $112.  That means my brokerage account is credited with the proceeds of the sale ($112,000), and I now owe my broker 1000 shares of AAPL stock.  If the stock drops to $100 and I "cover my short" (buy the shares back to repay the 1000 I borrowed) then I pay $100,000 for them and give them to my broker.  I keep the difference ($12,000) between what I sold them for and what I paid to buy them back, minus any brokerage fees and fees the broker may charge me for short-selling.
In conclusion, a margin trade is using someone else's money to make a trade, whether it's to buy more or to sell short.  A short trade is selling shares I don't even own because I think I can make money in the process.
I hope this helps.


Designing a filter: does the order i which we cascade the sections matter?

Question: So I am designing a 4th order lowpass filter using two biquadratic sections.
I decided to split the gain evenly between both sections.
After some calculations, one of the sections has a quality factor of 0.9 and the poles frequency is 1.65 kHz, the other has a quality factor of 4.6 and the poles frequency is 3.4 kHz.
My question is, in terms of design, is there any difference the order in which I cascade the sections? Their quality factor is so different, I wonder if I should put first the lowest or the highest quality factor? What should be the criteria here?
Comment: @TonyStewartSunnyskyguyEE75 The filter is fairly well made. All filters with passband ripple have low Q for low poles, and high Q for higher poles. If you'll plot OP's transfer function, you'll see a [classic 2 dB](https://i.stack.imgur.com/NueDt.png) ripple Chebyshev, even if the ripple is not quite stable (probably because of the one digit roundings).
Comment: @aconcernedcitizen  TY for your correct reply.  Chebychev has higher  Q latter stage ( and horrible GD distortion)   Here 0.2dB ripple https://i.stack.imgur.com/f0KwT.png
Comment: Also define your Passband ripple and error tolerances
Answer: Yes it does matter.
Your two sections are rather oddly matched, as Tony says. I presume you know you'll have quite a bit of passband ripple, and it's the right decision for your application.
If the high Q section is first, then high amplitude signals around the pole frequency will be amplified by the Q, and cause the amplifier to clip, i.e. become very non-linear.
The harmonic distortion caused by the clipping may be difficult to measure as it will be attenuated by both filter sections, but the intermodulation distortion will not. That is, tones at (say 3.3 and 3.5 kHz), both clipped, will produce a 200Hz component which will NOT be attenuated.
Put the low Q low frequency section first, and these tones will be attenuated by 12dB/octave, and they are 1 octave above its passband. That reduces their amplitude to about 1/4 before the second stage (Q = 4.6) would increase them about 4x.
So the low Q section first prevents the high Q section clipping.
Comment: Yes the ripple in the passband is intentional, I'm implementing a Chebyshev filter.This was exactly the explanation I was looking for, i did suspect it might influence the "tendency" for the Opamps to saturate (or clip as you mentioned). Thank you!
Comment: @GrangerObliviate Mathematically, it doesn't matter whether you have H1(s)*H2(s), or H2(s)*H1(s). In practice, this answer does it. (+1)
Answer:
For what it's worth, not an answer but more detail than a comment.,
If there is a signal where Q is highest, and any chance of saturation, it would be better last, as stage 1 attenuates at Qmax(f).  But in linear use , they are interchangeable as there are no loading effects between stages.
Answer: These Biquad filter sections are linear so it should not matter ?! .Most of the time it will not matter ,the overall transfer function is the same .This linearity only applies when the opamps are within their voltage swing ranges .When clipping starts you will not get your classical transfer function .Is overload a problem ? where    and how big are your unwanted signals ? think this stuff through for your application .I would put the low Q section first .


Prove that for every natural number $n$, there is a set $S$ of $n$ natural numbers such that for any two different numbers $a,b$ From $S$ the number…

Question:
Prove that for every natural number $n$, there is a set $S$ of $n$ natural numbers such that for any two different numbers $a,b$
From $S$ the number $a-b$ divides $a$ and $b$ and no another number from the group S.

I tried lots of directions. I've been trying to use the Chinese remainder theorem, Euclid's algorithm and I think I have a direction. I will write it down, but anyways if anyone solves another way I would love to hear his/her solution.

I will solve for a case where n = 3, but the idea is the same idea for any other n.
Let's start by taking a multiple of 3 different prime numbers, say, $3,5,7$. Now let's say $m = 3 * 5 * 7$. The first number will be $m / 3 = 35$. The second would be $m / 5 = 21$. And the third would be $m / 7 = 15$. Let's take the first and second and execute Euclid's algorithm on them and get their gcd, we will solve for the inverse and get: $7 = 2 * 21-35$. We will replace the first and second numbers with $35 * 1 = 35$ and $21 * 2 = 42$. Now let's do the same on the first and third and we get: $5 = 1 * 35-2 * 15$. We will replace the third with $2 * 15 = 30$ and the first one will remain the same. We will also perform this action on the second and third and we will get $84$ and $90$.Then, we multiply the last ($35$) by $90/30=3$ and we will be lucky to get ($105,90,84$) three numbers that work. Obviously this method does not work in the general case (when we replace the numbers we also change their difference with others and maybe even make them divisible by other differences) but this method gives direction and intuition to the question.
Comment: This is unhelpful, but, for n=3, your numbers are 6 times 14, 6 times 15, and then 7 times 15. Not sure if this pattern extends.
Answer: Try spamming CRT, that is what I would say.
The general way to understand this question is to start with small $n$, start constructing the set, and you gain experience when you fail. After a few failure you should see that making $a-b$ divide both $a$ and $b$ is the easier part, while $a-b$ cannot divide by other elements (let's call it the "exclusive divisibility condition") is the bottleneck.
For brevity I will write down a construction for $n = 5$, but I think you can easily extend it to the general case. Let the set to be constructed called $$\{s_1 = x, s_2 = x+a, s_3 = x+a+b, s_4 = x+a+b+c, s_5 = x+a+b+c+d\}.$$
To satisfy the "exclusive divisibility condition", the heuristics is to make all the differences $$a,b,c,d,a+b,b+c,c+d,a+b+c,b+c+d,a+b+c+d$$ "as pairwise relatively prime as possible". It is impossible to make it perfectly pairwise relatively prime (if you doubt it, you try it). The problem when $n=5$ will be at modulo $2^k$ and $3^k$.
To handle this, we make the following restrictions:
$$
\begin{aligned}
&a \equiv 2^3 \pmod{2^3}, &a \equiv 3^3 \pmod{3^3};\\
&b \equiv 2^2 \pmod{2^3}, &b \equiv 3^2 \pmod{3^3};\\
&c \equiv 2^1 \pmod{2^3}, &c \equiv 3^1 \pmod{3^3};\\
&d \equiv 2^0 \pmod{2^3}, &d \equiv 3^0 \pmod{3^3}.
\end{aligned}
$$
This is all prevents the differences to be not pairwise relatively prime. Let $P$ be the set of primes between $5$ and $\binom52$. For any $p \in P$, we also request
$$
a \equiv 0 \pmod p, \quad b,c,d \equiv 1 \pmod p.
$$
Next we construct $a$. We find $a$ satisfying the restrictions modulo $2^3$, $3^3$, and $P$. The existence is guaranteed by CRT.
Then we construct $b$. Let $D_1$ be the set of prime divisors of $a$. For all $p \in D_1$, we need $b \not\equiv 0 \pmod p$, $b+a \not\equiv 0 \pmod p$, together with the aforementioned restrictions modulo $2^3$, $3^3$, and $P$. The existence is again guaranteed by CRT.
For $c$, we do similar things. $D_2$ be the union of set of prime divisors of $a$, $b$, and $a+b$. we need $c \not\equiv 0 \pmod p$, $c+b \not\equiv 0 \pmod p$, $c+b+a \not\equiv 0 \pmod p$, together with the aforementioned restrictions modulo $2^3$, $3^3$, and $P$. The existence is again guaranteed by CRT.
Do the same for $d$. Let $D$ be the union of the set of prime divisors among all the differences. For $2$ and $3$, you need $x \equiv 0 \pmod{2^33^3}$. For other prime $p \in D$, you decide $x \pmod p$ according to where $p$ came from. For instance, if $p \ | \ b+c$, then you need $x+a \equiv x+a+b+c \equiv 0 \pmod p$. The existence of $x$ is by CRT.
You have to prove that the set we construct is legit. The divisibility condition follows from the construction, and the "exclusive divisibility" is true since all the differences  contains a unique prime divisor, and that prime divisor is only divisible by two elements in the set, guaranteed by this construction.
Answer: Fix $M$ with $M>n^3$ and perform the following algorithm:
Suppose $2\le m<n$ and we have constructed $a_1<\ldots <a_m$ with the following property:

$P(m):$ The set $ D_m:=\{\,a_j-a_i\mid 1\le i<j\le m\,\}$
  contains ${m\choose 2}$ integers $>M$, none of which is a multiple of another.

Then we can find $a_{m+1}$ such that $P(m+1)$ holds as follows:
Each of the sets $a_i+d\Bbb Z$, $1\le i\le m$, $d\in D_m$ has density $<\frac 1M$. As there are less than $M$ such sets, the density of their union is $<1$, i.e., we can pick $a_{m+1}$ with $a_{m+1}>a_m+\max D_m$ and $a_{m+1}\notin \bigcup_{i,d}(a_i+d\Bbb Z)$.
Then the $a_{m+1}-a_i$, $1\le i\le m$, are pairwise distinct, and are $>\max D_m$. Hence $D_{m+1}$ contains   $m+1\choose 2$ integers $>M$.
Assume $1\le i<j\le m+1$, $1\le i'<j'\le m+1$ and $a_j-a_i=c\cdot(a_{j'}-a_{i'})$ with some integer $c>1$.

If $j\le m$ and $j'\le m$, this contradicts $P(m)$
If $j'=m+1$ and $j\le m$, then $a_{j'}-a_{i'}>\max D_m\ge a_j-a_i$, contradiction
If $j'=j=m+1$, then $\frac{a_{j'}-a_{i'}}{a_j-a_i}\le \frac{a_{m+1}-a_1}{a_{m+1}-a_m}\le 1+\frac{a_m-a_1}{a_{m+1}-a_m}=1+\frac{\le \max D_m}{>\max D_m}<2$, contradiction
If $j=m+1$ and $j'\le m$, then $a_{m+1}=a_i+c\cdot (a_j-a_i)\in a_i+(a_j-a_i)\Bbb Z$, contradiction.

We conclude that no element of $D_{m+1}$ is a multiple of another element.
Thus by starting with $a_1=0$, $a_2=M+1$ (so that $P(2)$ holds), we finally find $a_1<\ldots <a_n$ such that $P(n)$ holds.
Now let $A_i=\operatorname{lcm}\{\,|a_j-a_i|:j\ne i\,\}$.
Then, because $a_j-a_i\mid A_i,A_j$ and hence  $a_i\equiv a_j\pmod{\gcd(A_i,A_j)}$ for $1\le  i<j\le n$, the Chinese Remainder Theorem guarantees a solution of the equations
$$x+a_i\equiv 0\pmod{A_i}\qquad i=1,\ldots,n.$$
For such a solution, let $b_i=a_i+x$ (so that $A_i\mid b_i$) and $$S=\{\, b_i\mid 1\le i\le n\,\}.$$
This $S$ has the desired property:
$b_j-b_i=a_j-a_i$ is a divisor of $A_i$ and $A_j$, hence  also of $b_i$ and $b_j$.
If it is  also a divisor of $b_k$, then also of $b_k-b_i=a_k-a_i$. By $P(n)$, this is not possible unless $k=i$ or $k=j$.


Itinerant workers, one of whom wants to be an interstellar pilot,

Question: One of the characters wants to be a lightspeed pilot.  This is an elite group that only a very few have the right physical and mental qualities.  The story is about that character's obsession.  Another character has a crystal globe with a self contained ecosystem.
Comment: What is your question? Are you wanting to know the title and author of the story? Is it a novel or a short story? How old is it, when did you read it?
Comment: This could be almost anything. I think it was a trope in the 70s, 80s (maybe earlier) that FTL pilots had to be psychic, have brain implants, or take special drugs. Or all of the above.
Comment: For example https://www.kirkusreviews.com/book-reviews/vonda-n-mcintyre-5/superluminal-3/
Answer: This might possibly be Samuel R. Delany's novella "The Star Pit" (1967), readable online at archive.org.  Two of the main characters, the protagonist Vyme and Ratlit, have knocked around the galaxy before settling at the Star Pit.  Only a small group of people, called "golden", can travel outside the galaxy; others all go insane:

But as a ship leaves the galactic rim, 'reality'  beaks down and causes insanity and eventual death for any crew ... Some few of us whose sense of reality has been shattered by infantile, childhood, or prenatal trauma, whose physiological and psychological orientation makes life in our interstellar society painful or impossible — not all, but a few of these golden . . ." at which point there was static, or the gentleman coughed, ". . . can make the crossing and return."
The name golden, sans noun, stuck.

Ratlit envies the relative freedom of the golden:

"Oh, Vyme, the places he's been!  The things he done, the landscapes he's starved in, the hells where he's had to lie down and go to sleep he was that tired, or the heavens he's soared through screaming!..."

The globular ecosystem also appears, as well as other self-contained ecosystems:

Some blue liquid, a fairly large air bubble and a glob of black-speckled jelly in a transparent globe, the size of an eyeball; it was set in two metal rings, one within the other, pivoted so the globe turned in all directions.  Mounted on the outside ring was a curved tongue of metal at the tip of which was a small tube with a pin-sized lens.  The tube was threaded into a bushing, and I guess you used it to look at what was going on in the sphere.
"Self-contained," explained An.  "The only thing needed to keep the whole thing going is light.  Just about any frequency will do, except way up on the blue end.  And the shell cuts that out."


Quantum transport in device (Transiesta code)

Question: I want to understand how the current (or electron) is normally transported in a device like a graphene,  under the Transiesta code. It is based on which principle: a gate is applied, or there is a difference in potential between two electrodes is applied?
Comment: +1 but your second question has been commented out since it's different. You can ask that separately. Also why did you write "current vs voltage" in your title, when the quesion asks how the current (not voltage!) is transported in graphene?
Comment: In order to have a current-voltage or transport, you don't need a gate. With the gate you have more control on the mains channel carrier concentration.
Comment: Thank you ^^ 'Camps'
Answer: I guess this is more of a physics question than it is specific to TranSIESTA.
I will provide an answer that can help you get a general picture but it is by no means a formal explanation of how transport takes place. For that I suggest you to find resources that explain it in depth (I suggest some at the end).
In transport devices you have a situation like the following:

where the voltage window is the voltage you "apply" between the two electrodes. From this you can already see that there are some electrons in the left electrode that are at a very high energy and would like to go to the empty states of the right electrode at lower energies. However, to go there, they need some electronic state in between that they can use to move from left to right. Certainly, in this specific situation, there are no states in the device at the energies where the electrons would like to move. So basically there is no transport of electrons.
The bottomline is that in order for transport to take place, there must be some states in the device that are inside the voltage window. So, as long as you can put some states in that window you will have transport. The way you get states in the window is specific to your own system and device, but there are two general, easy to understand, approaches:

Increasing the voltage. This makes the voltage window larger and therefore you are likely to include more states. This strategy is pictured below:

Applying a gate. A gate makes electrons in the device feel "more comfortable" (lower energy) or "less comfortable" (higher energy). Therefore it induces a shift in all the energies of the device's states. In this way you might make some of the states enter the voltage window. This is pictured below:

As I said, you should check resources to understand the issue more in depth. This whole playlist on nanoelectronics I would say is a good start: https://www.youtube.com/watch?v=p5nsWUKiG9k&list=PLtkeUZItwHK6lvGu8kFKBdhz3XaIZQDFj
Comment: Thank you very much , So Increasing the voltage lead to including more states and *also can increase the gap Transmission T(E)*


No solutions to functional equations

Question: I have found that $f(-2)=\frac{-1}{3}$ and that $f(-2)=0$. But that means that $\frac{-1}{3}=0$. But this is clearly false. Does this means that there is no solution to the function? Is it enough to conclude?
Comment: It might help if you give the original problem.
Answer: I'm not sure if "no solution" is the term you're looking for. If you get $f(-2) = \frac{-1}{3} = 0$ then this contradicts the very definition of what a function is. So, you can conclude that your function is not defined.
Comment: Yea, so there is no solution for the function $f(x)$, no?
Comment: what are you trying to solve? you usually only talk about something having "no solution" when you're trying to solve a system, etc. If you found that $f(x)$ equals two different values, for the same $x$, then your function is *not defined*. This could imply that the system you're trying to solve has no solution, but we'd have to know more.
Comment: OK, that was what I were searching. Thanks +1
Answer: Depends on the conditions imposed on $f(x)$. If $f(x)$ is a multi-valued or many-valued function, then there is no problem with the above statement.
In the strict sense , however, a well-defined function associates one, and only one, output to any particular input. The term multi-valued function is, therefore, a misnomer because functions are single-valued. Multi-valued functions often arise as inverses of functions that are not injective.

No solutions to functional equations


Finding a Taylor series and using it to evaluate a complex integral

Question: I have a problem with a few parts (possibly related to each other) that I'm not sure about:

Show that $f(z) = z/(z^2 - 4z +1)^2$ is holomorphic except at two points, $\alpha$ and $\beta$ with $|\alpha| < 1 < |\beta|$

This part I'm OK with, since you just find the two roots of the polynomial on the bottom, no problem.

Show that the coefficients $c_n$ of the Taylor expansion of $g(z) = z/(z-\beta)^2$ about $\alpha$ are:
  $$c_n = \frac{\alpha + n\beta}{(\beta-\alpha)^{n+2}}$$

This part is not too difficult either, I think, since I can just use partial fractions and observe that all of the terms are slightly modified geometric series, the answer falls out after some work.
The next part is giving me trouble:

With reference only to Taylor's theorem, evaluate
  $$ \int_\gamma \frac{z\;dz}{(z^2 - 4z +1)^2}$$
  (where $\gamma$ denotes the unit circle centre at 0)
  and hence show that
  $$\int^{2\pi}_0 \frac{d\theta}{(2-\cos \theta)^2} = \frac{4\pi}{3\sqrt3}$$

The emphasis is mine. I guess it means it wants us to use the series we just worked out. I can't see how to use the result to calculate the integral. I can sort of see one way to do it using integration by parts and Cauchy's formula:
\begin{align}
 \int_\gamma \frac{z\;dz}{(z^2 - 4z +1)^2} &= \int_\gamma g(z) \frac{1}{(\alpha-z)^2} dz \\
&= \int_\gamma g(z) \left(\frac{d}{dz}\frac{1}{\alpha-z}\right) dz \\
&= -\int_\gamma g'(z) \frac{1}{\alpha-z} dz \;\;\mbox{(this is by parts)} \\
&= \int_\gamma \frac{g'(z)}{z-\alpha} dz \\
&= 2\pi i g'(\alpha) \;\;\mbox{(this is by Cauchy's formula)} \\
&= \frac{4\pi i}{\sqrt3}
\end{align}
Are all of these steps valid? I think so, since $g(z)$ is holomorphic inside $\gamma$, so I can't see any failed condition. But my problem here is that I haven't used the earlier part at all.
I realise for the second part, I'm probably supposed to use the substitution $z = e^{i\theta}$ and put it through the first integral, but I'm having trouble putting it through since I can't see anywhere I'll be able to pull out $1/3$ to relate it to my previous answer.
I would appreciate if someone pointed out my mistakes.
Comment: the taylor expansion you have calculated, around which point is it?
Comment: Sorry, it's about $\alpha$. I just edited it in.
Answer: Write
$$\frac{z}{(z^2-4z+1)^2}=\frac{z}{(z-\alpha)^2(z-\beta)^2}.$$
The radius of convergence of the taylor series of $\frac{z}{(z-\beta)^2}$ about $\alpha$ is the distance between $\alpha$ and $\beta$. If the ball $B(\alpha, |\alpha-\beta|)$ contains $\gamma$ entirely(this can be checked by explicitly calculating $\alpha$ and $\beta$), then one can write, with help of the taylor series, and by the fact that the sequence of functions $(\sum_{k=0}^n c_k(z-\alpha)^{k-2})$ converges uniformly on $B(\alpha, |\alpha-\beta|)-\{\alpha\}$, we have
$$\int_\gamma \frac{z}{(z-\alpha)^2(z-\beta)^2} dz=\int_{\gamma}\frac{1}{(z-\alpha)^2} \sum_{k=0}^{\infty} c_k (z-\alpha)^k dz=\int_{\gamma} \sum_{k=0}^{\infty}c_k(z-\alpha)^{k-2}dz=\sum_{k=0}^{\infty} \int_{\gamma}c_k(z-\alpha)^{k-2}dz=c_12\pi i,$$
since all other terms have a primitive function on $\mathbb{C}-\{\alpha\}$. I hope this helps.


Is consistent hashing required for sharding?

Question: I am reading about scaling of database and came to know about sharding technique. But I also read about consistent hashing technique. So how practically sharding is implemented? Do we arrange nodes in ring like consistent hashing and then assign servers to rings and then data to servers? Because as I see if my number of shards changes at run time, and if consistent hashing technique is not there, then it will mess up a lot of stuff. Can someone please throw some light on this?
Answer: Consider sharding as a form of distributed hash table, or distributed range table.
Now it depends on which one the above the sharding is doing.

For a distributed hash table, for each new piece of data added, it hashes the data and based on that hash directs the data to that machine/set of machines for persistence.
When a query comes in it is sent to all servers, and the results are combined, and depending on how complex the query is some post-processing may occur (because each machine must be over selective as query data may be split between two shards) before sending back to the user.
In this scheme you don't need perfect hashing, because every database is being asked. However you might want to optimise some queries like select * from X where id = '123'. If you don't have perfect hashing you must ask all shards the question, as while the hash might not point at them now, it might have when the data was added.

For a distributed range table, for each new piece of data added, it is sent to a machine/set of machine based on which part of the range it is in. For example 1-15 -> shard A 16-22 -> shard B. Shard might become unbalanced using this method and its not uncommon to have a background process splitting large shards into smaller shards and relocating a portion to a less utilised set of machines. In this sense a set of machines may be responsible for numerous sub sections of the range.
When a query comes in it is decomposed into simpler queries, and those simpler queries are directed to only those machines how could possibly have matching data. But instead of sending the results back to the co-ordinator, those machines might be directed to send results to each other so that then next subquery can be run on the proper shard. At the end of this the final queries data can be directly streamed back to the user.
In this scheme I would not call the partitioning function a Hash. For those properties that are part of partition, then it is possible to identify the exact shard/s that the value/s might be in, if it exists at all. But for those properties not in the partition all shards must be checked.

Of course real life databases are much more complicated than this. This is just a bed time story to help in the understanding of what's going on. A real system has to do this while also managing transactions, synchronisation, networks, etc.., and be fast.
Comment: so for hash based method 1 you explained, we need to arrange them in form of ring as in consistent hashing and then allocate ranges to each nodes,am i correct?
Comment: Not sure I can parse your question. In method 1, the hash points to the machine/machine set its located on. When the number of machine/machine sets change in the database it can change to which machine/machine set the same hashed value points to. You could make each shard independent of a machine/machine set with a cross-walk table, but if that is the case you are better to follow method 2, and partition the data instead.
Comment: method 2 can can have unbalanced partitions. What i asked was our hash fxn will be of form hash(key)%n, and now if n changes by adding or deletion of db nodes, it will effect all mappings, as new has fxn will be hash(key)%(n+1) ,assume a new db server is added, how can we make sure we get min. change in existing mappings by change of hash fxn. IS consistent hashing is the answer to this?
Comment: Method 2: yes, the reason for having a background process break/merge/load balancing them. Method 1: Yes the reason why every shard has to be checked. There is no way to perform consistent hashing because there is no way to obtain a consistent list, except by fiat. And if you are this far, go to method 2.
Comment: I think we are on different track.What do you mean by "consistent list",If i want to scale my server count up/down later, I would need min. keys movement, so somehow i think strategy like consistent hashing  might help. By consistent hashing i mean, servers are arranged in a ring by hash fxn and then keys are also arranged in similar way by going in clockwise direction if no server at hashed location.
Comment: So which server is server 1? What happens when server 3 of 5 is momentarily disconnected from the network? What happens when you permanently remove a server? what happens when you permanently add a server? You have no stable and consistent list of buckets across which to hash. The only way to maintain such a system is to rearrange which physical boxes holds which logical bucket. Now there is a consistent list of buckets across which a stable hash can function. But you will need to have a Bucket<->machine mapping and quite likely need a load balancing process. So on balance method 2 is better.


Microsoft Web Protection Library doesn't encode XSS on ASP.NET 4.0 Webforms gridview

Question: I've got an ASP.NET 4.0 webforms app that uses some gridviews. I'm trying to get the MS Web Protection Library to correctly encode data in the gridview so that it protects against cross-site-scripting issues.
I've added v4.2.1 of the WPL library via NuGet and have added the following to my Web.config file:
<httpRuntime encoderType="Microsoft.Security.Application.AntiXssEncoder, AntiXssLibrary" executionTimeout="240" maxRequestLength="20480" requestValidationMode="2.0" />

Unfortunately, this doesn't seem to work. The string hi there isn't correctly coded when outputted from a database to a gridview.
I've done this in the past using a dll called AntiXssModule.dll, but I can't now find any reference to this, and everything seems to point to the WPL instead.
Have I missed something obvious?
Answer: This reply may be one year too late, but here is what I found when having a similar problem:
The combination of requestValidationMode = 2.0 and encoderType = AntiXssLibrary does not work, I had to change the value of requestValidationMode to 4.0. However, this may cause other problems.
/simon/


Android - Controlling a listview inside a fragment, with buttons

Question: I'm building a tabbed application using Fragments and the compatibility support.
In one of the tabs, I want to have a listview. In this same tab, I have to button which would change the listview items (lets say each button would have an a string array assigned).
I'm not figuring out how to do this. I already built the layout and clicklisteners for the buttons (which are working because I tested it with toast messages).
Can you give me an hint? Where would I put the listview code? On the OnClick? On OnCreateView?
Sorry, I dont have much experience with android.
This is my code for the fragment.
<code>public class TabFragment6 extends ListFragment {
/** (non-Javadoc)
 * @see android.support.v4.app.Fragment#onCreateView(android.view.LayoutInflater, android.view.ViewGroup, android.os.Bundle)
 */
public View onCreateView(LayoutInflater inflater, ViewGroup container,
        Bundle savedInstanceState) {
    if (container == null) {
        // We have different layouts, and in one of them this
        // fragment's containing frame doesn't exist.  The fragment
        // may still be created from its saved state, but there is
        // no reason to try to create its view hierarchy because it
        // won't be displayed.  Note this is not needed -- we could
        // just run the code below, where we would create and return
        // the view hierarchy; it would just never be used.
        return null;
    }

    LinearLayout theLayout = (LinearLayout)inflater.inflate(R.layout.tab_frag6_layout, container, false);

    // Register for the Button.OnClick event GUITARRA
    Button bShopGuit = (Button)theLayout.findViewById(R.id.buttonshopguit);
    bShopGuit.setOnClickListener(new View.OnClickListener() {           //abre setonclicklistener(
        @Override
        public void onClick(View v) {
            Toast.makeText(TabFragment6.this.getActivity(), "GUITAR button clicked", Toast.LENGTH_LONG).show();

        }
    });                                                                 //fecha )

    // Register for the Button.OnClick event BAIXO
            Button bShopBass = (Button)theLayout.findViewById(R.id.buttonshopbass);
            bShopBass.setOnClickListener(new View.OnClickListener() {           //abre setonclicklistener(
                @Override
                public void onClick(View v) {
                    Toast.makeText(TabFragment6.this.getActivity(), "BASS button clicked", Toast.LENGTH_LONG).show();
                }
            });                                                                 //fecha )

    return theLayout;
}
</code>
}
Answer: ???
First you have fragment. In it you have ListFragment with Adapter. In my projects im using AsyncTask to do the work for data and in it you can update list. Of cource adapter do this and you must notify it about data change.
This will help you How to update listview after calling Asynctask to call webservice , i think,


What are possible side reactions for the generation of hydrogen via electrolysis?

Question: I recently completed making a simple water electrolysis setup to generate hydrogen which uses two graphite rods from a standard AA battery. The power source is a $24~\mathrm{V}$ $6~\mathrm{A}$ adapter. I am using salt water as electrolyte (The salt is iodized). Strangely, a minute or so after running, a black precipitate starts to form on the negative terminal.
Also, besides the hydrogen, another gas is generated which smells sour, not very sour, but somewhat like lemonade. I have no idea what is causing this.
I thoroughly cleaned the graphite rods before using them. Has anybody an idea about what reaction might be happening here?
Comment: 24 V is way more than you need and is the source of some of the additional reactions. You only need 2 V for the electrolysis. Since you are using $NaCl$, one of the additional reactions produces chlorine gas (on the anode). The production of chlorine gas needs about 3 V. It would be better to use baking soda and vinegar as your electrolytes (unless you want to use sodium hydroxide). http://en.wikipedia.org/wiki/Electrolysis_of_water
Answer: First of all, check again your electrodes to see if this 'black precipitate' is formed at the negative electrode as you state; I predict it's actually happening at the positive electrode for the following reason:
Since you're using two graphite electrodes, it isn't a black precipitate that's forming, but is indeed a side reaction as you state. I suggest what you're actually making is oxygen gas at the positive terminal (as one would predict) which then reacts with the graphite electrode surface to generate $\ce{CO2}$. To verify this,take a look at your electrode—it should have started to break up, now having a non-uniform surface. Perhaps even a bit crumbly.
As LDC3 points out in his comment, you're forming $\ce{Cl2}$ as well as $\ce{O2}$ which is the characteristic smell you're noticing. To understand this we need to look at the standard electrode potential for each of these reactions. Forming $\ce{O2}$ from water at constant $\mathrm{pH}$ (compared to the standard hydrogen electrode) requires a potential difference of $-1.23~\mathrm{V}$ (this value is negative since this is the reverse of the tabulated version). Chlorine evolution on the other hand requires a p.d. of $-1.36~\mathrm{V}$. Remember that the larger (the less negative in this case) the reduction potential, the higher the tendency for reduction. So since $\ce{Cl-}$ reduction potential is more negative, it's less likely to undergo reduction and hence more likely to be oxidised (lose electrons) than water, which agrees with our chemical intuition.
So what we say here is that $\ce{Cl-}$ is preferentially oxidised over water, and as a consequence $\ce{Cl2}$ is formed preferentially over $\ce{O2}$. The reason why you have any $\ce{O2}$ forming at all is due to the electrolyte being the limiting reagent. Your supporting solvent (water) is in such abundance, essentially completely surrounding the electrode, that the system simply has to oxidise some water molecules some of the time.
Of course, experiment should rule the day, so revise your experiment to provide evidence for/refute my theoretical framework. Replace your positive terminal with a high purity metal electrode (copper should work and be readily available at high purity). As for the choice of electrolyte, test a couple of salts whose reduction potentials are less negative than water. Hint: perhaps look at sulphate salts and try and find a further reason why these are very useful in electrochemistry.
Comment: The other thing is that overpotentials are different for different materials, so you wouldn't necessarily be able to transfer your results to carbon electrodes. e.g. Hydrogen is produced very easily on platinum electrodes, but may need more than a volt more negative on a bismuth electrode.
Comment: Actually, using metal anode is a bad idea, unless it is a special metal. Metal anodes are readily dissolved. Carbon anodes may also be destroyed in some circumstances. Common choices for anodes are lead oxide electrodes (lead electrodes passivated by layer of lead oxide), platinum and in some cases titan (passivated by layer of dioxide).
Comment: @permeakra, I understand your point, but I think that this is just a home experiment. I want AvZ to understand the general principles first, as we all did when we learnt this, but your additional info is invaluable so thanks.I forgot to mention about overpotentials so thanks to Michael also!
Comment: Hello. Do you know a modern reference to Theoretical Electrochemistry? I only know the book of Vetter.


Removing the number in a category slug

Question: I have a category that ends with -2, and there's no way I can change it back to the plain word. I know there are problems with numeric slugs, but this is just a word. I also know that a common answer is to look in the trash, but there's no trash for categories as far as I'm aware
Answer: You probably have a tag with the same slug. You can't have any taxonomies with duplicate slugs. Either delete that other taxonomy, rename/change its slug, or change/rename this category.
EDIT
Ok, it turns out you can do this, if you don't mind programming the fix or directly executing the SQL or messing with PHPMyAdmin. What you need to do is add a new row in wp_term_taxonomy that uses the term with the slug you want to use as the term_id and the new taxonomy (category in this case) as the taxonomy. This is necessary because, if the slug already exists, WP creates a new term rather than using the same term with a different term_taxonomy relationship.
Comment: Ok, looked into it. It sounds like Rarst used the category/tag converter. That uses the established set of terms (from either categories or tags) and doesn't recreate the term, only creates a new term_taxonomy and duplicates the term_relationships that exist. So Rarst, your terms aren't duplicated, they have two term_relationships.
Comment: Great, I didn't realize tags and categories shared the same space
Comment: Huh? All categories at my blog are duplicated as tags with exactly same name and slug. I need to get rid of tags some time, but works just fine.
Comment: @Rarst That's actually not possible. The slug field in the terms table of the database requires unique information: http://codex.wordpress.org/Database_Description#Table:_wp_terms I don't know the specifics of your site, but my guess is that your site is using some term_taxonomy magic to pull that one off.
Comment: Ehm, never converted anything, never knew there even was a restriction on names/slugs... http://www.rarst.net/category/software/ http://www.rarst.net/tag/software/ My only guess it wasn't required in earlier versions and my structure was grandfathered, it's >2 years old.
Comment: Yeah, looks like 2.3 used wp_terms, wp_term_taxonomy, and wp_term_relationships to replace wp_categories, post2cat, and link2cat tables. I'm not sure how those worked, but I'm guessing the upgrade from 2.2 to 2.3 would have done that for you.
Comment: **DISCLAIMER for later readers:** If you want to hack the DB [for a reason like »I don't like the way this slug looks like«](http://wordpress.stackexchange.com/questions/45101/i-use-same-slug-name-for-category-and-page), then you're running straight into a mine field. Make sure that you really, really(!) know what you're doing and that you have a damn good reason to do it.
Answer: Maybe there you used such category name before as subcategory or category and then deleted it. When you created second time category with such name- it got -2.
I had a similar problem. Just removed a new category with -2 slug, then created category in subcategory directory where I deleted it. Then just changed parent- made it parent category.
Comment: As John explained, it can be any term from any post object taxonomy.

Removing the number in a category slug


Slow JavaScript animation in Chrome

Question: i have a problem with the style manipulation of an HTML object in Chrome.
Here is an example:
var a = document.createElement('div');

a.style.position = 'absolute';
a.style.display = 'block';
a.style.top = '300px';
a.style.left = '50px';
a.style.height = '100px';
a.style.width = '10px';
a.style.backgroundColor = '#000000';
a.style.zIndex = '200';

a.aW = 10;

var a2 = document.createElement('div');

a2.style.position = 'absolute';
a2.style.display = 'block';
a2.style.top = '200px';
a2.style.left = '50px';
a2.style.height = '100px';
a2.style.width = '10px';
a2.style.backgroundColor = '#000000';
a2.style.zIndex = '200';
a2.id = 'a';

a2.aW = 10;

document.getElementsByTagName('body')[0].appendChild(a);
document.getElementsByTagName('body')[0].appendChild(a2);

var b = window.setInterval(function () {
    a.aW += 10;
    if (a.aW > 1600) {
        window.clearInterval(b);
    }
    a.style.width = a.aW + 'px';
}, 13);

$('#a').animate({
    width: '1600'
}, 2000, 'linear');

The object which is animated through the setInterval Function is sometimes working slowly if it is run on a normal website.
The strange thing is, that the Object animated by jQuery runs smoothly oO.
(Sorry for my bad English).
Answer: First of all, interval timers are not guaranteed to run exactly at the time you set them for, particularly if the time is a very short interval.  In many browsers, there is a minimum time value allowed for setInterval().  So, if that minimum time is greater than 13ms or if many of the interval calls come in longer than 13ms, your animation that has a fixed number of steps will take longer and go slower.
Second of all, any reliable animation must use a tweening algorithm where it calculates the steps it wants to use and then upon each step, it re-evaluates (by comparing the system time with the expected system time for this step number) whether it's behind schedule or ahead of schedule and adjusts the future step size accordingly so that it will complete on time and appear to be going the appropriate speed.  That's what jQuery's animation does.  That's what your setInterval() animation does not do.
Here is a reference article on self-adjusting timers for animations that run a predictable amount of time and another article on minimum times for timers.
Here's an article and code on tweening and another piece of code that does tweening.
Also, for simplicity's sake, please change this:
document.getElementsByTagName('body')[0]

to this:
document.body

Comment: Sorry for not accepting the answer, i completely forgot about it.
Answer: Your timer will execute many many times a second. I would suggest that it is too fast which could be causing browser lag. The jQuery animate function interval is 50ms I believe.
Take a look at this question which talks about interval browser performance and consider raising your interval time.

Slow JavaScript animation in Chrome


Can anyone explain use of Driver Factory and its implementation to get parallel browser at same time?

Question: When do we need to create a Driver Factory ? What advantages do we get over regular initialisation of driver when we use driver factory approach.
Also how to initiate parallel browser testing using Driver factory.
Answer: The main idea of running Selenium test in parallel is ensuring that there are no clashes and race conditions between WebDriver instances. The common practice is implementing Thread Local Storage pattern in order to isolate WebDrivers and other data which is not thread-safe
WebDriver by design is not thread safe so if you intend to have several threads to run different webdriver instances you need to wrap them into ThreadLocal and most probably the "DriverFactory" you're talking about is a helper class which initializes webdriver puts it to ThreadLocal.
Check out Parallel Tests - Best Practices for comprehensive information, tips, tricks and sample projects.
Answer: DriverFactory (different implementations can be found here and here, or here for Katalon Studio version) acts like a switch statement when you are working with multiple browsers.
It is just like the regular initialization, just more flexible, since you can tell your test where the driver is located / which driver is being used.


Detect discontinuities in Windows clock in Java

Question: Please review the code below, which detects discontinuities in Windows system clock in long-running programs.
<code>/*
 * Created on Apr 16, 2015
 *
 * The purpose of this class is to periodically check to see if the time of the Thread.sleep() agrees with the system clock.
 * If it does not, we need to send an interrupt to the ***.
 *
 * This is because after Windows 7, Thread.sleep does not count down in S3 or S4 mode.
 * http://stackoverflow.com/questions/29394222/java-thread-sleep-on-windows-10-stops-in-s3-sleep-status
 *
 */
package com.sengsational.clockchecker;

import java.io.IOException;
import java.net.Socket;
import java.util.Date;

public class ClockChecker implements Runnable{

    private static boolean runFlag = false;
    private static Thread runningThread;
    private static ClockChecker singleton;
    private static Thread runThread;
    private static boolean mSimulateClockProblem;
    public static long pollIntervalMs = 15000;
    public static final int ACCURACY_MS = 1000;

    public static ClockChecker getInstance(){
        if (singleton == null) {
            singleton = new ClockChecker();
        }
        return singleton;
    }

    private ClockChecker(){
        runningThread = new Thread(this);
        runningThread.start();
        try {Thread.sleep(100);} catch (Throwable t){};
    }

    @Override
    public void run() {
        if (isRunning()) {
            System.out.println(new Date() + " ERROR: ClockChecker should only have one run thread.");
            return;
        } else {
            System.out.println(new Date() + " ClockChecker run() is starting.");
            setRunning(true);
        }
        long wakePoint = 0;
        long msAccuracy = 0;
        ClockChecker.runThread = Thread.currentThread();
        while (isRunning()) {
            try {
                wakePoint = ((new Date().getTime() + pollIntervalMs));
                Thread.sleep(pollIntervalMs); // Blocks
                if(ClockChecker.mSimulateClockProblem && Math.random() < 0.2d){
                    wakePoint = wakePoint - 2000;
                   System.out.println(new Date() + " Simulating a clock problem.");
                }
                msAccuracy = Math.abs(new Date().getTime() - wakePoint);
                if (msAccuracy > ACCURACY_MS) {
                    System.out.println(new Date() + " ClockChecker has detected a clock accuracy issue of " + msAccuracy + "ms.");
                    System.out.println(new Date() + " >> Here is where you alert your waiting tasks that depend upon wall-clock accuacy <<");
                }
            } catch (InterruptedException e) {
                System.out.println(new Date() + " ClockChecker run() has been interrupted.");
                setRunning(false);
            }
        }
        System.out.println(new Date() + " ClockChecker run() is ending.");
        setRunning(false);
    }

    public synchronized boolean isRunning(){
        return runFlag;
    }

    public synchronized void setRunning(boolean running){
        ClockChecker.runFlag = running;
    }

    private static void setSimulateClockProblem(boolean simulateClockProblem) {
        mSimulateClockProblem = simulateClockProblem;
    }

    public static void shutDown() {
        runThread.interrupt();
        try {Thread.sleep(100);} catch (Throwable t){}
    }

    public static void main(String[] args) throws InterruptedException {

        System.out.println("\nMAIN: Simulate starting the main app.");
        ClockChecker.getInstance();
        ClockChecker.setSimulateClockProblem(false);  // Set to true on Windows 7 to have a roughly 40% chance of simulating a clock discontinuity.
        System.out.println("\nMAIN: Now we have a ClockChecker object. Put Win10 machine into S3 sleep mode NOW!" +
                           "\n      (you have fewer than 30 seconds to do so).  Leave in S3 for 1 or more minutes.");
        Thread.sleep(30 * 1000);
        System.out.println("\nMAIN: Examine the above messages (if any) about clock accuracy after S3 sleep.");
        System.out.println("\nMAIN: We will now shutdown.");
        ClockChecker.shutDown();
        System.out.println(new Date() + " ClockChecker main() ending.");
    }
}
</code>
By way of background, when running on Windows versions 8 and 10, but not earlier versions, a Java Thread.sleep(X) will sleep for X milliseconds, plus the number of milliseconds the machine has been in S3 or S4 sleep.  In other words, when Windows is awake again, it will act as if no time has passed, thus any program requiring a linkage to wall clock time will need a fix.  I would like to understand if there are any ideas to improve the above work-around to this problem.
Answer: Welcome to codereview.se and thanks for sharing your code.
Here is what I think about it. Please keep in mind, that this is my personal view on it.
Do not use the Java Singelton pattern.
The singelton pattern is just another name for a global variable, which we consider harmful and bad coding since the early days of programming.
Also the pattern is not that easy to implement correctly and so even your approach is not thread safe.
For more on this an the static access the singelton pattern requires read: https://williamdurand.fr/2013/07/30/from-stupid-to-solid-code/
Do not do any work in constructors
Constructors should only assign its parameters to member variables. Any validation on the parameters should be done  before calling the constructor in the first place.
Also do not instantiate other classes inside the constructor since this is another bad case of static access which makes your code hard to extend, reuse and test.
Especially the constructor should not pass the the current object to any other method since the object is not fully configured yet until the constructor finished.
Do not have top level classes implementing simple (functional) interfaces.
This habit vanishes the possibility to separate glue code from the actual business code.


Pressing tab doesn't expand autocompleted chat @names in Opera

Question: When using chat, if I start typing someone's name preceded by an @ I see the autocomplete suggestions pop up above the input box as I would expect, but pressing Tab shifts focus from the text box to the "Send" button instead of expanding the name. I have to either type the name out in its entirety or click on the autocomplete suggestion to get it to expand, which is much slower. This only appears to be happening in Opera (latest stable); Chrome works as expected.
Answer: Oh, Opera...Chat special cases Opera when binding the handler used to catch the tab key because historically Opera would not allow a tab to be cancelled on keydown, so keypress had to be used instead.
Now, Opera apparently doesn't even fire the keypress event in the input field because it switches focus to the button on keydown. On the flip side, cancelling the tab key in keydown now seems to work correctly in Opera, so chat could stop special-casing the handler binding...the only downside being that I don't see a particularly clean way to support both the current and historic behaviours, so Opera users who haven't upgraded recently would likely be out of luck.
Incidentally it looks like this was already done for the comment tab completer on the full site, although someone missed the change in the unbind:
j && j.unbind($.browser.opera ? "keypress" : "keydown", e).unbind("keyup click", h);

Comment: @random - when did Opera start making a browser? There's a bug machine they've deployed for years but wasn't aware they entered the browser market.
Comment: **Opera** is a fine browser. Except for bowing to allow webkit prefixes. That was shameful.
Comment: Opera is just a pile of add-ons and features that other browsers eventually roll in years after the fact like brand new Frankenstein fingers @nic
Comment: Why we support this damn "browser" is beyond me
Comment: Yes, expanding usernames in comments works fine as far as I can tell.
Comment: @NickCraver Simply because everyone enjoys random's company, I think (or at least I remember him randomly being an Opera user (no pun intended))
Comment: Funny, Opera is what I use when I want to hear my fans kick up and down, and by waving my mouse inside the chrome I can even make it sound like a singer lives in my case. A virtual theremin as it were. I'm not sure who thought that theremin's should parse HTML however.


How common are low MTU links (<1492) in the public internet?

Question: Are there any kind of statistics how common are low MTU links (MTU is below 1492) in the common Internet?
Comment: @Cown IPv6 has a (minimum) MTU of 1280 bytes, IPv4 has a (minimum) MTU of 68 bytes. In Ethernet-based networks the MTU is 1500 but not all connections in the internet are Ethernet-based.
Comment: The Internet uses a MTU size of 1500 bytes.
Comment: The question looks factual to me: what are the statistics? I've given an answer from a recent conference paper with results, and this looks like useful professional networking information to me: I've voted to reopen.
Answer: Perhaps this paper and its references are what you need, it includes graphs of found sizes and links to datasets.  They report that 98.4% of reachable servers in their survey have a PMTU >= 1500, and have other details for various sizes and metrics.

Custura, A., Fairhurst, G., & Learmonth, I. (Accepted/In press). Exploring usable Path MTU in the Internet. In Network Traffic Measurement and Analysis Conference, TMA 2018 IFIP Open Digital Library.

http://tma.ifip.org/2018/wp-content/uploads/sites/3/2018/06/tma2018_paper57.pdf
Comment: From the same paper: "Google data analysing
UDP traversal [36] suggests that up to 64% of access networks
fail to carry 1500 byte UDP packets with the DF flag set"


Targeted Region of Interest Classification in eCognition

Question: Is there a method of targeting only specific areas for classification in eCognition? Say, maybe using pixel coordinate constraints?
Answer: To generally subset your data at the initial step, when you load in your data, in the top right corner, there will be the option to select a spatial subset.
Through that, you can either choose it based on pixel coordinates, projected coordinates, or simply draw a box.
If you wish to work within a smaller area of an existing classification, you can assign the objects to a new class, or even transfer them to a different level using a simple Assign Class approach.
For this, the use of temporary classification classes are recommended.
Comment: I was thinking more along the lines of, after having completed a classification, targeting an area for further classification. Any ideas? Is there a way of bringing up the coordinates as you pan around on the screen?


Step-by-step guide to finding the phase constant in simple harmonic motion

Question: Working on some simple harmonic motion problems involving an oscillating spring/mass system ... the usual. I never really understood exactly how to find the phase constant for the $$x(t)=A\cos(\omega t+\text{phase constant}).$$ Is there a way to go about doing this that is systematic and step-by-step way, one that I can use for any problem involving simple harmonic motion?
Comment: I see that both answers presume that you start from $A cos + B sin$. Is that true? Or are you asking for something simpler? You should tell us what you know (What level is this?). Can you give us an example of a problem you don't understand?
Comment: Sure! To clarify, I'm taking a course called "Optics, Waves, and Modern physics" at the second CEGEP level... so I guess that would be something you'd do in grade 12 in the States? An example of a typical problem would be, you're given some initial conditions (say: period and amplitude of the oscillator) and asked to find the equation x(t)= Acos(ωt+φ) using what you already know. For the most part it's okay, just using formulas, but when it comes to solving for φ I just can't do it! Also, we usually use only cos, there is no sin formula as far as I know.
Comment: Well, I see you've already chosen best answer. Anyway, amplitude and period means giving $A$ and $\omega$. That's usually enough because $\phi$ is usually irrelevant. But if you want $\phi$, you **need** extra data. For example "at $t=0$, the value is $x=0$. Then you'd replace $0=A\cdot\cos (\omega \cdot 0 + \phi)\ \Rightarrow \ \ 0=\cos (\phi)$.
Answer: According to the comments, in particular:

Sure! To clarify, I'm taking a course called "Optics, Waves, and Modern physics" at the second CEGEP level... so I guess that would be something you'd do in grade 12 in the States? An example of a typical problem would be, you're given some initial conditions (say: period and amplitude of the oscillator) and asked to find the equation x(t)= Acos(ωt+φ) using what you already know. For the most part it's okay, just using formulas, but when it comes to solving for φ I just can't do it! Also, we usually use only cos, there is no sin formula as far as I know.

I assume that the level is previous to University and you haven't studied differential equations.
So, altough you might have not derived the equation mathematically, you must know that the basic equation is
$$x=A\cdot \cos(\omega\cdot t + \phi)$$
So you have to start the problem writing that equation.
Once you have written it, it is all about finding the values of $A$, $\omega$ and $\phi$. $A$ is probably given in the instructions. It can also be found from a graph, if the problem gives you a graph.
The second thing is the angualr frequency $\omega$. This is usually found by means of the period or the "true" frequency:
$$ \omega=\frac{2\pi}{T} = 2\pi\nu$$
Again, it is also usual that you must read the period from a Graph.

Now, regarding the initial phase, $\phi$.
In real life, this parameter is sometimes irrelevant. That's because the frequency is high enough, and the system oscillates so fast that you don't care where it exactly started. After all, you're just watching oscillations, and you have to re-decide where to measure again.
Nevertheless, $\phi$ must be found in problems. If the instructions ask you for $\phi$, then you must give it as well.
And how do you do it? Well, as I said, you need extra data. You cannot know $\phi$ with $A$ and $T$. You need what is known as boundary condition. That is, the position for a given time. For example:
at t=2s, x=1m

Then, you go back to the equation and replace:
$$x=A\cdot \cos(\omega\cdot t + \phi)\quad \Rightarrow \quad 1m=A\cdot \cos(\omega\cdot 2s + \phi)$$
Check that both $A$ and $\omega$ are already known. That's why I started with them. You must calculate $A$ and $\omega$ first. Then you can do this replacement.
The boundary condition is especially easy if it gives you the instant $t=0$. This is called initial condition.
At t=0, x=0.

Then you'd substitute and find $\phi$:
$$0=A\cdot \cos(\omega\cdot 0 + \phi)\quad \Rightarrow \quad \phi=acos(0)=\pi/2$$
And that's how it works.

But wait, you might say: there are more solutions. And you're right. IT could also be $acos(0)=3\pi/2$. How can you tell?
Well, you can't tell with that data. You need one more fact. The extra fact is usually related to velocity. They might say
At t=0, x=0 and the particle is increasing its position.

Increase position is the same as saying "possitive velocity". So you also need to work with the velocity formula, which is the time derivative of the position:
$$v=\frac{d}{dt}x=A\cdot\omega\cdot\sin(\omega\cdot t+\phi)$$
So you'd have to check both solutions: $\pi/2$ and $3\pi/2$. You'll see that $\pi/2$ makes velocity possitive, so that one is the actual solution, and not $3\pi/2$.
So that's it: you must be able to find $A$ and $\omega$. Otherwise, the instructions are incomplete.
And, if they ask for $\phi$, you need two more data (not only one). The information you need is position and velocity for a given time.
Why is this so? If you're interested: that's because Newton's laws tell us about acceleration, and the equation $x=A\cdot\cos(\omega\cdot t+\phi)$ is found using Newton's laws. But they say nothing about velocity and position. We must find them separately, having just one piece of information about them. One point is enough.
Answer: The Simple Harmonic Oscillator ODE reads as following-
$$\ddot{x}(t)=-\omega^2x(t)$$
Solution can be found by substitution-
$$x(t) = e^{\lambda t}$$
yielding
$$\lambda_{1,2} = \pm i\omega$$
The general solution is superposition of the two results, with coefficients that depend on initial conditions -
$$x(t)=a e^{i\omega t}+b e^{-i\omega t}$$
which by Euler identity ($e^{ix}=\cos(x)+i\sin(x)$) also can be represented as
$$x(t) = A \cos(\omega t) + B \sin(\omega t)$$
and by using trigonometric identities (mainly  $\cos(x+ y)=\cos(x)\cos(y)-\sin(x)\sin(y)$) can be shown equivalent to
$$x(t) = \alpha \cos(\omega t+\beta)$$
By applying initial conditions $x(0) = x_0$ and $x'(0) = v_0$ we get -
$$x_0 = a+b=A=\alpha \cos(\beta)$$
$$v_0 = i\omega (a-b)= \omega B = -\omega \alpha\sin(\beta)$$
Solving the system of equations, for whatever representation yields -
$a = \frac{1}{2}(x_0-i\frac{v_0}{\omega})$ and $b = \frac{1}{2}(x_0+i\frac{v_0}{\omega})$
$A = x_0$ and $B = \frac{v_0}{\omega}$
$\alpha = \frac{1}{\omega}\sqrt{v_0^2+(\omega x_0)^2}$ and $\beta= \arctan(-\frac{v_0}{\omega x_0})$
You can also solve the system of equations abovefor change of representations, such as $A(\alpha,\beta)$, $B(\alpha,\beta)$ and so on.
Answer: Well, it depends on what information you already have. Let's start with the desired goal. You want a function for position over time in the form
$x(t)=C\cos{(\omega t-\phi)}$

Assume you already have your equation of the form

$x(t)=A\cos{(\omega t)}+B\sin{(\omega t)}$
Well, we can use our trig. knowledge to rewrite our first form and set it equal to the second realizing that cosine and sine are independent functions so their coefficients must be equivalent.
$x(t)=C\cos{(\omega t-\phi)}$
$\implies x(t)=C\cos{(\omega t)}\cos{(\phi)}+C\sin{(\omega t)}\sin{(\phi)}$
$ \implies C=\frac{A}{\cos{(\phi)}}=\frac{B}{\sin{(\phi)}} $
$\implies \tan{(\phi)}=\frac{B}{A}$
$\implies \phi=\tan^{-1}(\frac{B}{A})$

Say you have some initial condition $x_0$ and $v_0$ for position and velocity at time $t=0$. Well, we know $A=x_0$ and $B=\frac{v_0}{\omega}$ from a fairly basic deduction if we are working with the form in (1). Then, applying the above result,

$\phi=\tan^{-1}(\frac{v_0}{\omega x_0})$
Hope that helped!


Best Sites for Simplified Instructions in Taking Wedding Photos

Question: Does anybody have any recommendations for Photography Sites that give you some basic yet good instructions on shooting weddings?
Answer: Most important tip: if your friends did ask you to take photos of their wedding and you are entirely new to this kind of photography: DO NOT DO IT.
Really. Spare yourself and your friends (possibly they are not your friends anymore) the disappointment. Hire a professional (they are not this expensive) and take photos along with him (ask him beforehands, he'll tell you when not to distract the people/couple). Look at his style, learn from his style ... and then start looking at websites for the third or fourth wedding that you'll shoot on your own.
Comment: Interesting related article: common ways to make a first wedding a disaster http://www.lensrentals.com/news/2010.07.25/fwigtew-and-other-first-wedding-acronymss
Comment: Disappointment depends entirely on expectations. If these are sufficiently low there's no reason to expect they'll be disappointed!
Answer: I have found the Digital Photography School site fairly decent for some tutorials and tips, here is a basic set of tips for wedding photography ... http://www.digital-photography-school.com/wedding-photography-tips-to-get-you-started
Answer: Have a look at these ideas from photographer Moshe Zusman:
http://www.bhinsights.com/content/5-tips-create-drama-your-wedding-portraits.html
Comment: awesome article.  thanks for posting the link.  +1


Create a bookmark to a site in the dock

Question: Is it possible to have an icon in the dock which is a link to some specific site and opens it in Chrome when clicked?
I'd like to put Trello in the Dock so that to quickly access it when needed.
Comment: Is Chrome your _default_ Browser?
Answer: Yes it is. If Google Chrome is your default browser.
Procedure

Go to Trello.com in Chrome
Drag the text in the URL field to the desktop. This will create a document that ends in .webloc. EG "Trello.webloc"
Drag that icon into the right side of the dock (it's a document and has to be to the right of the divider bar)

I had forgotten that you could drag the bookmark out of the URL bar directly into the dock. Do it that way if it suits you, either works.
Now when you click on that icon trello.com (or any .webloc document) will open in your default browser.
(This works in Safari and I don't have Chrome handy on this Mac to test. I am assuming that Chrome for Mac behaves the same as Safari in this respect)
Comment: It can be dragged directly to the right side of the Dock Separator, there is no required need to place it on the Desktop first.
Answer: Since the inception of OS X, one should be able to drag a URL snippet and pin it directly to the right side of the Dock, next to pinned folders (later joined by "Stacks") and the Trash.
To open it with your preferred browser, why not create a simple scriptable program? For Safari, for example, I would open Terminal and write something like this:
<code>cd Desktop && echo "#!/bin/bash
/Applications/Safari.app/Contents/MacOS/Safari http://www.google.com"
> pager && chmod +x $(pwd)/pager
</code>
Of course, Google and Safari can be interchanged with what you desire, and pager could be renamed whatever you want. You can then just pin "pager" to the Dock, (and if you want to beautify it a bit, you could just open Get Info from another file or app and also click Get Info for pager. Click the icon you want to copy and click Copy. Then, click pager's 'exec' icon and click Paste to replace it.)
Or, if you really just don't like Safari, you can switch default browsers entirely. Start by going to Safari -> Preferences and choose Chrome as the default. In Chrome, choose it as the default if it hasn't been applied already. If the pinned URL still opens in Safari after making these changes, switch to the Finder and find a webpage, or another Safari badged file. Either by right-clicking or with the Action menu in the Finder, click Get Info. Under "Open With" choose Chrome. Of course, to switch it back to Safari, repeat the above. With 10.10, you might want to head to General preferences and Extensions as well just in case. But it really isn't that hard to do, and just one of the above ought to do it!
Answer: There are two sides to the Dock, the one to the left of the Separator is for the Dock Tiles for launching Applications that are set to Keep in Dock and Dock Tiles for open applications not already set to Keep in Dock and the one to the right of the Separator is for Stacks, the Trash, minimized Application windows and things like a shortcut, if one wants.
You can drag and drop, grabbing the icon in the Address field of the Browser to the right side of the Dock Separator however that will open in the default Browser that is set to open "http" and or "https" URLs depending on what the handler for those type URLs are. (I'm mentioning that in this particular way because while normally both "http" and or "https" URLs, by default, open in the same Browser, they don't on my system.  I've set "http" URLs to open in one Browser and "https" URLs to open in a different Browser.)
If Chrome is not your default Browser or is not set to open "http" and or "https" URLs then the one that is will be the one that the Dock Tile for the target URL is going to open in.
If you want the Dock Tile for the target URL to be on the left side of the Dock Separator then it will need to be an application and this can be an AppleScript application that opens a given URL in the default and or a given Browser.
If you want it on the left side of the Dock Separator let me know, I'll add instructions on creating the AppleScript App that can open the target URL.

Create a bookmark to a site in the dock


What size rim do I need for a 26 X 1.95 tire?

Question: I have a mountain bike with a 26 X 1.95 tire.  I need a replacement front rim for the tire.  What size rim do I need?
Comment: Aside - What happened to your rim such that the tyre is still okay ?
Answer: Presuming you want to rebuild the existing wheel with a new rim:
You need a 26" rim with the same spoke count as the old one.  The number of spokes will probably be one of 28/32/36.
If you had rim brakes, the new rim needs a rim brake track.  Modern disk brake bikes don't need a track for brakes around the edge.
The BSD (Bead Seat Diameter) needs to be 559mm unless your tyre has a subtly different number written on the sidewall.  There are a bunch of different 26" sizes, but 559 represents the vast majority.
If you're lucky, the existing spokes+nipples are all undamaged and reusable.  AND they are a suitable length for the new rim.  Otherwise you will need to replace all the spokes too.

Pricewise it may be better to simply purchase a complete replacement front wheel.  The requirements that carry over inclide a rim-brake track or a disk rotor mount to suit your existing, but the number of spokes may be different.
You will need to make sure the axle mounting method is the same.  For a 26" wheel it will be either a Quick Release or threadded on axle nuts.  A "Through Axle" is unlikely to fit your existing fork dropouts.

Aside - What happened to your rim such that the tyre is still okay ?
Answer: (Note that this info will get you the correct rim, but if you are replacing the whole wheel, there a few other considerations to make to ensure compatibility with your bike, such as brake and axle type)
Bike tire sizes can be a bit complicated. When we hear tire sizes like 26" or 29" what that's really referring to is the approximate outer diameter of the tire overall. What you really need to know to make sure your tire will fit on a rim is the bead seat diameter (BSD) which is the diameter of the part of the tire where it actually mounts on the rim.
There are many different rim diameters out there, though there are a few common standards that are used much more prevalently than the others. Fortunately this information is printed right on the tire in an ISO notation of {tire width}-{bead seat diameter}. Your tire says "26x1.95" on the side, but somewhere more subtly, perhaps next to the tire pressure recommendation, there should be something printed that says something like 50-559 meaning it can only be mounted on a rim with a diameter of 559mm. If you need to replace the whole wheel and tire because it was stolen, you can reference the back tire, assuming your front and back wheels are the same size (as they are almost always, looking at you, Terry Bikes).
When matching a tire with a rim, you must also consider width -- if you put a tire on a rim that is too narrow or too wide, the tire may pinch, blow off, or otherwise not handle properly. There are general guidelines about the proper tire width/rim width ratio, but it's best to check with the manufacturer. Also worth noting that while matching the diameter of the tire/rim is absolutely necessary, there is a range of widths which will be suitable for a given tire. For example, looking at Schwalbe's spec a 1.95" (50mm) tire should be mounted on rims from 17 to 30mm with 23mm falling right in the center of that range.
For a standard 26x1.95" tire (it says 50-599 on the side), you would need a 599mm diameter rim, with 23mm being the sweet spot for width.
More about tire sizing at Sheldon Brown's website