summary
stringlengths 15
147
| text
stringlengths 1
19.3k
| answer
stringlengths 32
22.6k
| labels
float64 0.33
1
| answer_summary
stringlengths 5
164
|
---|---|---|---|---|
How to solve this stochastic integrals? | how can I solve these two stochastic integrals?
$$\int_0^T B_t\,dB_t$$
$$\int_0^T f(B_t)\,dB_t$$
where B_t is the BM.
Thank you very very much!
| Since by Ito's lemma you have for $\phi(t,x) \in \mathcal C ^{1,2}$
$$ \phi(t, X_t) = \phi(o,X_0) + \int _0 ^t (\partial_t +b\partial_x +\frac{\sigma^2}{2}\partial^2_{xx})\phi(s,X_s) ~ ds + \int_0^t\partial_x\phi(s,X_s) ~dB_s$$
if $X$ is a Ito's diffusion
$$ X_t = X_0 + \int _0 ^t b~ ds + \int_0^t\sigma ~dB_s$$
you must search for the simples $\phi$ such that $\partial_x \phi =x $ with $X =B$ ( so $b=0$ and $\sigma =1$) for the first integral and $\partial_x \phi =f $ for the second one also with $X =B$ .
Indeed,
$$ \int_0^T B_s ~dB_s=\frac{1}{2}(B^2_T-B^2_0 -T)$$
and
$$ \int_0^T f(B_s) ~dB_s=F(B_T)-F(B_0) -\frac{1}{2}\int_0^T\partial_x f (B_s) ~ds$$
where $F$ is a primitive of $f$.
| 0.777778 | By Ito's lemma you have $phi(t,x) |
Can we represent this sequence as a function of n? | I have this sequence :
4,12,24,48,240,720,....
I order to find nth term of this sequence , can we represent this sequence as a function of n.
| This is the unique minimum degree interpolated polynomial:
$$
-\frac{23}{15}n^5+\frac{175}{6}n^4-\frac{572}{3}n^3+\frac{3329}{6}n^2-\frac{3559}{5}n+324
$$
whose values at $1,2,\ldots,6$ are $4,12,24,48,240,720$.
This can be found using GAP via:
InterpolatedPolynomial(Integers,[1,2,3,4,5,6],[4,12,24,48,240,720]);
While this is unlikely the answer you are looking for (since it has a negative leading coefficient and is of the maximum degree possible; moreover, your sequence appears to grow around $O(n!)$, whereas this polynomial grows as $O(n^5)$), you're probably not going to get a better answer without explaining what the sequence actually is.
| 0.888889 | Interpolated polynomial: $O(n!)$ |
What table tools/packages do you use? | Making tables in LaTeX can be painful. All you need is a semi complex table with cells that have to span multiple rows/columns. What tools do you use to get around this complexity? Tabular? Tabularx? Are there others?
| External Tools
I find that a lot of the pain involved in creating LaTeX tables comes simply from laying them out- it's tough to make a table markup syntax that isn't tedious to type and modify. Because of this, I use other programs to help me deal with some of the work involved in creating tables:
If my LaTeX editor has a table wizard, I use it to create the table.
If my data is in a spreadsheet, I use a plugin to export it to LaTeX. For Excel, I use excel2latex and for OpenOffice I use calc2latex.
If my data is in R, I use the xtable package.
I find these tools take care of 80-95% of the work required to create a table- I then go through and refine some of the stylistic choices. The only problem with this approach is that the tools aren't of much use if a table requires a substantial update or re-write or needs to be generated automatically from an arbitrary dataset.
LaTeX Packages
Personally, I use the Memoir class for the majority of my documents. Memoir integrates the functionality of a ton of table packages such as booktabs and tabularx and integrates them in a sane way so your document doesn't end up with a list of \usepackage{}s that is a mile long. See Chapter 11: Rows and Columns of the Memoir manual for a description of the support provided by the class for tabular material.
In addition to Memoir, I often augment it's capabilities with the following two packages:
The longtable package for laying out tables that flow across more than one page. Longtable's handling of table headers and footers is extremely nice for putting things like "Continued on the next page..." exactly where they are supposed to be.
The siunitx package- this package is all about typesetting units and numbers. The sinuitx package adds the S column descriptor which can be used to perform all kinds of advanced formatting for table columns that contain numbers such as:
Alignment of separators such as commas and decimal points.
Automatic rounding, truncation or conversion to scientific notation.
| 1 | LaTeX tables aren't easy to type and modify |
Does Parallels Desktop support hardware virtualization for the client VM? | I have a new MacBook pro (I just switched from PC), and an older scanner (a Mustek A3 USB).
The scanner comes with drivers for OS 9 (I assume that's a non-starter on OS X), and Windows XP.
I have Parallels Desktop 6 running a Windows 7 installation on my MacBook.
Windows 7 comes with "Windows XP mode", a Virtual Machine running XP. This is what I used to run my scanner previously, on my PC.
However, Windows XP mode refuses to start inside the Parallels-powered Windows 7, complaining that the host machine (ie. Windows 7) doesn't have hardware-supported Virtualization. Whichis Parallels Desktop's "fault" as it's providing the virtual, simulated hardware.
Is there any way I can get Windows XP running on Windows 7 inside Parallels Desktop? Is there some setting I can change?
I guess simply creating a second Parallels VM running XP directly would be a workaround, but I don't have a separate copy of XP handy, and would like to avoid having to buy one.
| As the comments have suggested, Parallels does not support Windows XP Mode in Windows 7 directly.
Parallels Knowledge-base article
However, the VMware knowledge-base does list a pair of patches from Microsoft (x86 patch and x64 patch) that remove the requirement for the hardware virtualisation on XP mode which should allow Parallels to also run the XP mode.
VMware Knowledge-base article
| 1 | Parallels does not support Windows XP Mode directly |
Android- R.java file not found | While working with an android project .I'm stuck with R.java file which is not found even I clean the project(project---->clean).But that file still not found .Even I create a new project the same problem occurs .
what I need to do ? I'm expecting the valuable replies from which I could overcome this problem
| R.java is missing implicate that your resource folder is having some issues. please try to look at your resource files(layout,drawable etc). and after that clean the project. it will solve the problem for sure.
| 0.555556 | R.java is missing implicate that your resource folder is having some issues |
Setting up a food pantry/orphanage? | I can't find much on how to set up any kind of establishments that are for charity. HOw would I go about this? Acquiring a building, a few volunteers, how much to run it per day, ect? Anyone have any experience in this? My character is a NG Druid, who had never been to a city and saw the poverty and lack of food and housing for people. He wants to help! But I have no idea on how to establish a continual act of help. Buying food for the town and stuff, one time is easy to figure out. How many people * ammount of food needed is the price. But for bigger acts of continual charity, who knows?
EDIT:
So, it was suggested that I make an eco orphanage in a forest. I accidently doomed the continent with demons, so that won't work. (Wish spell to get rid of orcs, things went horribly wrong) NO one knows it was me though! :D
I don't want the leadership feat cause I need my 6th level feat for a prestige class.
Also, I don't want to donate to the churches in this city, I'm finding a lot of corruption in some of these churches, especially this city, so I want something more controllable by me.
| Focus on efforts outside of the city. Your spells are more powerful than your money.
You possess three crucial spells:
Goodberry
Tree Shape
Plant Growth
I'm going to skip over silly solutions like magic traps of create food and water for in-character solutions possible immediately.
You're a druid, and so overpopulation is a fact of nature. You're a good druid, so just killing the excess populace is distasteful. Instead, you can create suburbs in local forest via tree shape. Thereby, you can provide environmentally friendly housing to local orphans and people who take care of them. Untrained hirelings are 1sp per day, and you can purchase mouldy food and fix it via purify food and drink (my recommendation is to negotiate a deal with various innkeepers: you'll cast this on mouldy food stores. They keep half, and they transport the rest to your little suburb.)
You can use many castings of goodberry to make 2d4 servings per meal. (If you want to make this work when you're not there, make sure someone with craft wondrous is nearby, and enchant the spell into a command-word activated bowl for 1800 gold).
You can also use Plant Growth to enhance the productivity of surrounding fields. Make sure to enhance the productivity of both freeholds and sharecroppers, as annoying local lords by ignoring their money-generating resources is bad for your health, but improving other productivity should actually pass on lower prices to the city in terms of its food supply.
| 0.888889 | You're a good druid, and so killing excess populace is distasteful |
Resize shape with text in Word 2010 | I pasted a drawing from PowerPoint to Word that has shapes with text. The drawing is much too large; but when I make it smaller, the text remains the same size and ruins the layout. Is there a way of reducing a shape along with the text it contains?
| In PowerPoint you could do following, that would allow you to auto scale the text with object size.
If you copy objects from PowerPoint to Word, there is no such option in Word.
In that case just paste the object as Picture, using the paste special command.
Now when you re-size the picture the text will re-size automatically.
| 1 | Copy objects from PowerPoint to Word with object size |
What are the limits of glamered armor? | From Dungeon Master's Guide
Glamered: A suit of armor with this ability appears normal. Upon
command, the armor changes shape and form to assume the appearance of
a normal set of clothing. The armor retains all its properties
(including weight) when glamered. Only a true seeing spell or similar
magic reveals the true nature of the armor when disguised
Would this imply the armor has the ability to appear as a single specific outfit, or could it be made to resemble any form of clothing other than what it actually is?
| Ambiguous. The RAW simply doesn't specify, so all you can do is get a ruling from the GM.
| 1 | The RAW doesn't specify the RAW . |
Mark: outstanding (as in: not yet known) | I’m updating my tabular CV for an application and I’d like to include my master thesis even though it’s not yet finished (soon!) and marked. So I’d like to write that the mark is still outstanding but I fear that if I simply write
Master thesis: ‹topic›
Supervisor: ‹supervisor›
Mark: outstanding
this could be misconstrued to mean that the result is in, and that it’s outstanding (as in: spectacular). What can I say here instead? It should be as salient as possible, single word preferred. I specifically want to avoid writing half a sentence.
| To be received, or to be decided?
This fits into a pattern of common phrases: to be confirmed, to be announced, to be decided, which are standard enough that in many institutions they are given just as tbc, tba, tbd. To be received is less standard than these, but should be well-understood since it clearly invokes this well-known template.
| 0.888889 | To be received, or to be decided? |
Mixed number fractions class | I'm looking for bugs. I tried to test all functionality in a variety of ways.
#by JB0x2D1
from decimal import Decimal
import math
import numbers
import operator
from fractions import Fraction
class Mixed(Fraction):
"""This class implements Fraction, which implements rational numbers."""
# We're immutable, so use __new__ not __init__
def __new__(cls, whole=0, numerator=None, denominator=None):
"""Constructs a Rational.
Takes a string like '-1 2/3' or '1.5', another Rational instance, a
numerator/denominator pair, a float, or a whole number/numerator/
denominator set. If one or more non-zero arguments is negative,
all are treated as negative and the result is negative.
General behavior: whole number + (numerator / denominator)
Examples
--------
>>> Mixed(Mixed(-1,1,2), Mixed(0,1,2), Mixed(0,1,2))
Mixed(-2, 1, 2)
Note: The above call is similar to:
>>> Fraction(-3,2) + Fraction(Fraction(-1,2), Fraction(1,2))
Fraction(-5, 2)
>>> Mixed('-1 2/3')
Mixed(-1, 2, 3)
>>> Mixed(10,-8)
Mixed(-1, 1, 4)
>>> Mixed(Fraction(1,7), 5)
Mixed(0, 1, 35)
>>> Mixed(Mixed(1, 7), Fraction(2, 3))
Mixed(0, 3, 14)
>>> Mixed(Mixed(0, 3, 2), Fraction(2, 3), 2)
Mixed(1, 5, 6)
>>> Mixed('314')
Mixed(314, 0, 1)
>>> Mixed('-35/4')
Mixed(-8, 3, 4)
>>> Mixed('3.1415')
Mixed(3, 283, 2000)
>>> Mixed('-47e-2')
Mixed(0, -47, 100)
>>> Mixed(1.47)
Mixed(1, 2116691824864133, 4503599627370496)
>>> Mixed(2.25)
Mixed(2, 1, 4)
>>> Mixed(Decimal('1.47'))
Mixed(1, 47, 100)
"""
self = super(Fraction, cls).__new__(cls)
if (numerator is None) and (denominator is None): #single argument
if isinstance(whole, numbers.Rational) or \
isinstance(whole, float) or \
isinstance(whole, Decimal):
if type(whole) == Mixed:
return whole
f = Fraction(whole)
whole = 0
elif isinstance(whole, str):
# Handle construction from strings.
arg = whole
fail = False
try:
f = Fraction(whole)
whole = 0
except ValueError:
n = whole.split()
if (len(n) == 2):
try:
whole = Fraction(n[0])
f = Fraction(n[1])
except ValueError:
fail = True
else:
fail = True
if fail:
raise ValueError('Invalid literal for Mixed: %r' %
arg)
else:
raise TypeError("argument should be a string "
"or a Rational instance")
elif (isinstance(numerator, numbers.Rational) and #two arguments
isinstance(whole, numbers.Rational) and (denominator is None)):
#here whole is treated as numerator and numerator as denominator
if numerator == 0:
raise ZeroDivisionError('Mixed(%s, 0)' % whole)
f = Fraction(whole, numerator)
whole = 0
elif (isinstance(whole, numbers.Rational) and #three arguments
isinstance(numerator, numbers.Rational) and
isinstance(denominator, numbers.Rational)):
if denominator == 0:
raise ZeroDivisionError('Mixed(%s, %s, 0)' % whole, numerator)
whole = Fraction(whole)
f = Fraction(numerator, denominator)
else:
raise TypeError("all three arguments should be "
"Rational instances")
#handle negative values and convert improper to mixed number fraction
if (whole < 0) and (f > 0):
f = -f + whole
elif (whole > 0) and (f < 0):
f += -whole
else:
f += whole
numerator = f.numerator
denominator = f.denominator
if numerator < 0:
whole = -(-numerator // denominator)
numerator = -numerator % denominator
else:
whole = numerator // denominator
numerator %= denominator
self._whole = whole
self._numerator = numerator
self._denominator = denominator
return self
def __repr__(self):
"""repr(self)"""
return ('Mixed(%s, %s, %s)' % (self._whole, self._numerator,
self._denominator))
def __str__(self):
"""str(self)"""
if self._numerator == 0:
return str(self._whole)
elif self._whole != 0:
return '%s %s/%s' % (self._whole, self._numerator,
self._denominator)
else:
return '%s/%s' % (self._numerator, self._denominator)
def to_fraction(self):
n = self._numerator
if self._whole != 0:
if self._whole < 0:
n *= -1
n += self._whole * self._denominator
return Fraction(n, self._denominator)
def limit_denominator(self, max_denominator=1000000):
"""Closest Fraction to self with denominator at most max_denominator.
>>> Mixed('3.141592653589793').limit_denominator(10)
Mixed(3, 1, 7)
>>> Mixed('3.141592653589793').limit_denominator(100)
Mixed(3, 14, 99)
>>> Mixed(4321, 8765).limit_denominator(10000)
Mixed(0, 4321, 8765)
"""
return Mixed(self.to_fraction().limit_denominator(max_denominator))
@property
def numerator(a):
return a.to_fraction().numerator
@property
def denominator(a):
return a._denominator
@property
def whole(a):
"""returns the whole number only (a % 1)
>>> Mixed(10,3).whole
3
"""
return a._whole
@property
def fnumerator(a):
""" returns the fractional portion's numerator.
>>> Mixed('1 3/4').fnumerator
3
"""
return a._numerator
def _add(a, b):
"""a + b"""
return Mixed(a.numerator * b.denominator +
b.numerator * a.denominator,
a.denominator * b.denominator)
__add__, __radd__ = Fraction._operator_fallbacks(_add, operator.add)
def _sub(a, b):
"""a - b"""
return Mixed(a.numerator * b.denominator -
b.numerator * a.denominator,
a.denominator * b.denominator)
__sub__, __rsub__ = Fraction._operator_fallbacks(_sub, operator.sub)
def _mul(a, b):
"""a * b"""
return Mixed(a.numerator * b.numerator, a.denominator * b.denominator)
__mul__, __rmul__ = Fraction._operator_fallbacks(_mul, operator.mul)
def _div(a, b):
"""a / b"""
return Mixed(a.numerator * b.denominator,
a.denominator * b.numerator)
__truediv__, __rtruediv__ = Fraction._operator_fallbacks(_div, operator.truediv)
def __pow__(a, b):
"""a ** b
If b is not an integer, the result will be a float or complex
since roots are generally irrational. If b is an integer, the
result will be rational.
"""
if isinstance(b, numbers.Rational):
if b.denominator == 1:
return Mixed(Fraction(a) ** b)
else:
# A fractional power will generally produce an
# irrational number.
return float(a) ** float(b)
else:
return float(a) ** b
def __rpow__(b, a):
"""a ** b"""
if b._denominator == 1 and b._numerator >= 0:
# If a is an int, keep it that way if possible.
return a ** b.numerator
if isinstance(a, numbers.Rational):
return Mixed(a.numerator, a.denominator) ** b
if b._denominator == 1:
return a ** b.numerator
return a ** float(b)
def __pos__(a):
"""+a: Coerces a subclass instance to Fraction"""
return Mixed(a.numerator, a.denominator)
def __neg__(a):
"""-a"""
return Mixed(-a.numerator, a.denominator)
def __abs__(a):
"""abs(a)"""
return Mixed(abs(a.numerator), a.denominator)
def __trunc__(a):
"""trunc(a)"""
if a.numerator < 0:
return -(-a.numerator // a.denominator)
else:
return a.numerator // a.denominator
def __hash__(self):
"""hash(self)"""
return self.to_fraction().__hash__()
def __eq__(a, b):
"""a == b"""
return Fraction(a) == b
def _richcmp(self, other, op):
"""Helper for comparison operators, for internal use only.
Implement comparison between a Rational instance `self`, and
either another Rational instance or a float `other`. If
`other` is not a Rational instance or a float, return
NotImplemented. `op` should be one of the six standard
comparison operators.
"""
return self.to_fraction()._richcmp(other, op)
def __reduce__(self):
return (self.__class__, (str(self),))
def __copy__(self):
if type(self) == Mixed:
return self # I'm immutable; therefore I am my own clone
return self.__class__(self.numerator, self.denominator)
def __deepcopy__(self, memo):
if type(self) == Mixed:
return self # My components are also immutable
return self.__class__(self.numerator, self.denominator)
Latest version download here.
| Don't ever reinvent the wheel. Fraction is decently cooperative class, you should never have to write basic operations from scratch. Use the inherited stuff. Here is the solution for basic arithmetic, shouldn't be hard to adapt for many other protocols. Also, it doesn't handle negative numbers because I'm lazy, I trust you can add support for that too.
from fractions import Fraction
class Mixed(Fraction):
def __new__(cls, a, b, c):
return super().__new__(cls, a*c + b, c)
def __str__(self):
return '{} {}'.format(*divmod(Fraction(self), 1))
def inject(name, *, namespace = locals()):
name = '__{}__'.format(name)
def method(*args):
result = getattr(Fraction, name)(*args)
return Fraction.__new__(Mixed, result)
namespace[name] = method
for name in 'add sub mul truediv'.split():
inject(name)
inject('r' + name)
for name in 'abs pos neg'.split():
inject(name)
del name, inject
print(Fraction(122,3) / Mixed(4,5,6) + 5) # 13 12/29
| 0.666667 | Fraction is decently cooperative class, you should never have to write basic operations from scratch |
On the definition of weakly compact cardinals | I am reading in Jech's Set Theory the chapter about large cardinals. After discussing measurable cardinals he moves on to weakly-compact cardinals, which have been discussed far earlier in the book.
I went back to the chapter dealing with weakly-compact cardinals and began retracing the definition.
Eventually, it came into this:
We denote $[k]^n = \{X \subseteq \kappa\mid |X| = n\}$. If $\lambda$ is a cardinal, we denote $\kappa \to (\lambda)^2$ when for every partition of $[\kappa]^2$ into $2$ we have $H \subseteq \kappa$ that is of cardinality $\lambda$, and for which $[H]^2$ is strictly in one part.
And we say that $\kappa$ is weakly-compact if it satisfies the property $\kappa \to (\kappa)^2$.
The problem is that I'm a bit lost in all those definitions, and not even sure about the $\kappa \to (\lambda)^2$ notation.
My questions are, if so, can someone help me make some sense into those definitions, and is there an equivalent definition for weakly-compact cardinals which can help me understand their properties better?
| Let me add to Ivan's answer another equivalent
characterization of weak compactness, which might appeal to
you, as it makes them resemble miniature measurable
cardinals.
Namely, if $\kappa$ is a cardinal and
$\kappa^{<\kappa}=\kappa$, then $\kappa$ is weakly compact
if and only if for every transitive set $M$ of size
$\kappa$ with $\kappa\in M$, there is another transitive
set $N$ and an elementary embedding $j:M\to N$ having
critical point $\kappa$.
This embedding characterization admits myriad forms. For
example, one can insist that $M\models ZF^-$ or even
$M\models ZFC$, and that $M^{<\kappa}\subset M$, or that
every $A\subset \kappa$ can be placed into such an $M$, and so
on. One can even insist that $j\in N$, a property known as
the Hauser property.
These various embedding formulations of weak compactness
allow one to borrow many of the methods and techniques from
much larger large cardinals, which are most often described
in terms of embeddings, and apply them with weakly compact
cardinals. For example, using Easton support forcing
iterations, one can control the value of $2^\kappa$ while
preserving the weak compactness of $\kappa$.
| 0.777778 | Ivan's embedding characterization of weak compactness |
What is a word for somebody who lies to themselves | I feel like the fact that people lie to themselves about things can tell you a lot about that person but I just can't put my finger on a single word that I'd use to describe them. In fact, not just describe them, but truly convey that they lie to themselves.
Example of a person who lies to themself: "I will do all my work
tomorrow, I swear."
| Another way to say it is that person is in denial.
| 1 | How to say that person is in denial? |
Is it possible to get a popup to ignore MenuDropAlignment in a WPF / Touch app? | As a bit of background - Windows has a facility for Touch/TabletPCs whereby it shifts the position of popups/menus depending on your "handedness" (to prevent the menu appearing under your hand).
Essentially what this does is if you are set to "right handed" (which it seems to default to once you've connected a touch device), every popup you open is artificially kicked to the left - this causes massive layout issues where we try and line up a popup with the item it "popped up from" :
Tablet PC Settings set to Left handed - no artificial correction from Windows
Tablet PC Settings set to Right handed - Windows artificially adjusts our positioning
We can detect what this setting is set to with SystemParameters.MenuDropAlignment, and for trivial popups we can adjust this using the actual width of the popup - but for dynamic popups and when we throw right to left support into the mix, this just doesn't work.
Currently it's looking more likely that we are going to have to go through every popup, manually work out a value to adjust the kick, and add something like this to every one:
<MultiDataTrigger>
<MultiDataTrigger.Conditions>
<Condition Binding="{Binding Source={x:Static SystemParameters.MenuDropAlignment}}" Value="True"/>
<Condition Binding="{Binding RelativeSource={RelativeSource Mode=Self}, Path=FlowDirection}" Value="RightToLeft"/>
</MultiDataTrigger.Conditions>
<MultiDataTrigger.Setters>
<Setter Property="HorizontalOffset" Value="-50"/> <!-- Set to arbitrary value to test -->
</MultiDataTrigger.Setters>
</MultiDataTrigger>
So.. back to the question :-) Does anyone know of a way to stop a WPF popup looking at this setting at all?
For those that don't have a touch device you can access the Tablet PC settings by running:
C:\Windows\explorer.exe shell:::{80F3F1D5-FECA-45F3-BC32-752C152E456E}
And see the mess it makes for yourself :-)
| Set it to regular mode for your whole application:
FieldInfo fi = typeof(SystemParameters).GetField("_menuDropAlignment",
BindingFlags.NonPublic | BindingFlags.Static);
fi.SetValue(null, false);
| 0.777778 | Set it to regular mode for whole application |
How do I opt-out of the Social Security system? | How do I opt-out of the Social Security system and give up my Social Security Number? If I do this, am I then exempt from paying Social Security income tax?
| To give up your Social Security number, you would probably have to renounce your citizenship, since merely leaving the United States, becoming a permanent expatriate, etc. wouldn't be enough.
Paying Social Security taxes is mandatory, however. Even if your income exceeds the means testing limits, you are still required to pay Social security (FICA) taxes on the income that falls beneath it.
That being said, there are several groups that are exempt from paying Social Security taxes, based on what I can scrounge up through online searching.
College students who work under the Federal Work Study program. 1
State or local government workers (like teachers, city workers, police, firefighters, etc.) hired before March 31, 1986 and who participate in their employers' alternative retirement systems.
Self-employed workers with with yearly net earnings less than $400
Ministers, members of certain religious orders, and Christian Science practitioners may file IRS Form 4361 to exempt themselves from self-employment taxes, including FICA taxes. The picture is more complicated than this, however (see below).
All members of certain religious groups, like the Amish, Mennonites, etc. 2
Election workers earning $1,000 or less a year.
Minor children with earnings from household work but for whom household work is not their principal occupation.
If you aren't part of one of these groups or you joined them after already being enrolled in the Social Security system (i.e. paid FICA taxes, etc.), you don't have to take Social Security payments, but you are not exempt from FICA payroll taxes. This means that you can't simply become Amish and be exempt if you've already paid into the system.
Many of these answers were listed here, but the only stated source is "Wikipedia," so take it with a grain of salt. I've tried to provide other sources where I could.
Ministers/religious officials
I mentioned that the situation with ministers and/or religious officials is more complicated. Among other things, these officials need to certify that they are religiously opposed to receiving public insurance benefits and they have to file by a certain deadline soon after earning a certain amount as a minister. Furthermore, if you file this exemption and choose/chose to revoke it later on, e.g. by filing IRS Form 2031, during the short time windows when this is possible, you're no longer eligible to file for another exemption. Once you revoke your exemption, you won't get another one.
Also note that this opt-out only applies to income earned as part of your ministry. For non-ministerial income, you're still required to pay FICA taxes even if you follow the procedure(s) above.
If you do opt-out
Clearly, opting out of the Social Security isn't easy, or even feasible, for many people, but if you are outside the system, common sense dictates that you should insure yourself against risks that would usually be covered, at least in part, by Social Security. Dave Ramsey maintains a list of such investments that he recommends ministers and religious officials who opt out of the Social Security system should purchase, but the rationale applies to anyone who isn't part of the system.
Term life insurance that covers 10x your annual income. Normally, your spouse or dependents will receive a Social Security death benefit upon your death, but if you opt-out, your family doesn't have this option. Since the death benefit is a pittance ($255), however, you may want life insurance regardless of your participation in Social Security.
Long-term disability insurance. If you become disabled, you won't receive disability benefits, so you'll may want insurance to cover this risk.
Long-term care insurance. Similar to disability insurance, you may want additional income to cover you in case you require long-term care, and Medicaid isn't enough.
Other retirement savings. If you're not going to be paying money into Social Security, it makes sense to invest that money in some form of tax-advantaged or tax-sheltered retirement account to ensure that you still have some income in retirement. You won't be receiving Social Security checks, but you'll still need income.
Depending on your circumstances, it's may be a good idea to invest in some or all of these instruments anyway (especially tax-advantaged/tax-sheltered retirement accounts), because Social Security doesn't cover 100% of the risks you'll face, but that decision is highly specific to each person/family.
| 1 | Paying Social Security taxes is mandatory, however . |
Why do objects fall at the same acceleration? | I read these two posts and now I am more confused.
Do heavier objects fall faster?
Don't heavier objects actually fall faster because they exert their own gravity?
I was going to ask: if mass is an objects tendency to resist acceleration then why do two objects of different masses fall to the Earth at the same acceleration?
Then I read those posts and it seems that even though it is very small, the more massive object falls faster. Okay I understand, both objects attract each other.
If two cars of different masses collide doesn't the car with less mass accelerate more even though both cars received the same Force. Then that implies you need more force to accelerate a large mass than to accelerate a small mass. Because that is how I see it, the Moon attracts the Earth with the same Force as the Earth attracts the Moon but the Earth accelerates less due to its larger mass.
So then how is mass an object's tendency to resist acceleration? I am aware of $F_1 = F_2 = GMm/r^2$. So should we not really be able to see the difference in acceleration when dropping a massive object?
| The difference is very minute, however the difference is there.. the difference is actually the amount that said object pulls on the Earth itself. so the difference between a 1 pound weight pulling on the Earth vs a 12 lbs bowling ball. Considering the Earth weighs in at a massive $1.317 \times 10^{25}$ lbs you could get a rough estimate by saying the Earth exerts 1g, So a 1 pound weight would exert $1/1.317 \times 10^{25}$ of that force, where the 12 pound bowling ball would exert $12/1.317 \times 10^{25}$ g. Hence the 12 pound bowling ball pulls the Earth to itself quicker than the 1 pound weight. So what is the difference? It's so small that it is almost immeasurable, but the difference is there none-the-less.
| 1 | Difference between a 1 pound weight pulling on the Earth vs a 12 lbs bowling ball |
Matrix Manipulation Question | Given that A $\begin{bmatrix}1\\-2\\1\end{bmatrix}=\begin{bmatrix}2\\-3\\-5\end{bmatrix}$ and A $\begin{bmatrix}1\\4\\-2\end{bmatrix}=\begin{bmatrix}0\\2\\-1\end{bmatrix}$ find A $\begin{bmatrix}1 && 1\\-2 && 4\\1 && -2\end{bmatrix}$
Not really sure how to approach this question. Help would be much appreciated :)
| To get more intuition for working with matrices, it might also help to consider a $n$ x $m$ matrix A as a representation of a linear transformation from an m-dimensional vector space $V$ to an n-dimensional vector space $W$, see: http://en.wikipedia.org/wiki/Linear_transformation
A is not just a table of numbers with related operations; it produces elements of $W$ when fed with elements of $V$.
If you feed A with one $V$ element, it produces one $W$ element; if you feed it with two, it produces two. Also note that the linearity of the transformation implies (and is defined by) that for $v_1, v_2 \in V$ and $\lambda, \mu$ scalars, A fed with $\lambda v_1 + \mu v_2$ will produce $\lambda Av_1 + \mu Av_2$, thus: $A(\lambda v_1 + \mu v_2) = \lambda A(v_1) + \mu A(v_2)$
| 0.5 | a $n$ x $m$ matrix A represents a linear transformation from an m-dimensional vector space $V$ to |
Paying for mortgage points vs investing that money | First time home buyer here.
So I've been reading about points and how an up-front payment can save you money in the long term. At first, the numbers seem pretty convincing. For example, pay $5000 upfront for a whopping saving of $20,000 over 30 years.
... But if you took that $5000 and invested it, wouldn't you get a lot more than that over 30 years, even at a modest return rate of 6-7%? Suddenly points seem worthless.
Is my math wrong? Is there some other advantage regarding points that I'm missing?
| Your math is not wrong. That's why banks want these points. They did the same math too.
There may be some immediate tax advantages for points though, in that case you can get return of your tax rate for the year of the points (which may make it worth it, if you don't want to keep the mortgage for more than, say, 10 years). Check here for details.
| 0.888889 | You can get return of your tax rate for the year of the points |
Equal elements in SubArray | I have an array containing N elements and I need to find the distance between the index of equal elements in a subarray; which we will get in form of query (L R) where L is starting index of subarray and R in ending index.
Total No. of array elements can be N<=10^5 and Queries Q<=10^5.
ex:
7
0 4 0 8 0 32 0
2
0 2
0 5
//answer for 1st query will be 2 (index 2-0)
//answer for 2nd query will be 8 (index (2-0) + (4-2) + (4-0))
Edit: I am not expecting code (though it would be really helpful) general idea to solve will be a great help.
| Create a map whose key are the elements of the array and values are lists of the position they appear in (your example would become {0: [0, 2, 4, 6], 8: [3], 4: [1], 32: [5]}). These groups form unrelated problems. One way finding the answer is to see them as maximum flow problems where each index form two vertices.
Each index is connected to all the indexes following it and all the indexes preceding it are connected to it. The weight of the edges is the distance of the elements in the array, i.e. the difference between the two indexes. All the "source" vertices are connected to an infinite source and all the "destination" vertices are connected to a sink.
The sum of the values of the maximum flows for all the problems is the sum you are looking for.
As an example, let's use the indexes for the item 0:
+-------- 0 ----------+ 0 --------+
| | |
| | |
Source ----+-------- 2 -------+ +----> 2 --------+---- Sink
| | | |
| | | |
+-------- 4 ----+ +--+----> 4 --------+
| | | | |
| | | | |
+-------- 6 +--+--+----> 6 --------+
Weight of arc (u, v) = v - u
Note that the number of edges grows as V^2 because every edge corresponds to a difference you have to do in order to compute the result, which are between each index and all its successors. This makes the complexity of the solution O(n^3) which is even worse than the naive algorithm, it's just a nice way of viewing things from another perspective :)
| 0.5 | Maximum flow problems where each index form two vertices |
Why the use of resistors when pulling something up or down? | When pulling something up or down why is a resistor used and it not just connected straight to the +V or 0V rail?
| Another reason is that it makes it very easy to alter the input - just connect it to the positive supply if it is pulled down, for instance, rather than rewiring the connection. A couple of pins for a jumper are all that is required. A typical example is pin P0.14 on an NXP ARM chip, which determines whether it boots from a serial input or from internal flash memory.
| 0.888889 | Pin P0.14 on an NXP ARM chip |
Easiest way to persist data on a PHP page | I a web application that I am developing (being developed in PHP) when a user posts any request for service the user has to fill in a very length form.
Once user fills in the form and submits it another page (confirmation page) is loaded in which all values filled in by user are show. I must point out that at this stage the data is not saved to MySQL yet. Now on this page the user can either save the service request or go back.
My problem starts here. When the user goes back. All data filled in is lost. BTW User tend to use Browsers Back button instead of the back button provided on the confirmation page.
How can is persist data filled in by user so that user can edit/make changes to data and again submit changed data.
| Every once in a while someone comes up with a good solution. This is that time.
HTML 5 offline storage is supported now in all major browsers since IE8. With that in mind, I decided to tackle form state once and for all so all scripting languages and even HTML pages can keep form state. No cookies needed, no memory-hogging sessions needed, no server-side programming needed and you can partially fill the form out go where you want to whatever URL, come back and the form is there where you left off. Just drop some small script and you are done.
Here it is for free -> http://www.jasonsebring.com/dumbFormState
Let me know what you think.
| 0.777778 | HTML 5 offline storage is supported in all major browsers since IE8 |
Lyx citation problem | I'm trying to get citations working with LyX but I've found that I'm getting the entire citation listed. So where it should say [1] I am getting Example(John Tosh…) ect. My document preamble is:
\usepackage{nag}
\usepackage[style=british]{csquotes}
\usepackage{fancyhdr}
\usepackage{microtype}
\usepackage[T1]{fontenc}
\usepackage{pslatex}
\usepackage[style=oscola,
natbib=true]{biblatex}
\bibliography{/Users/jamie/Documents/Law and History}
Is there a way to resolve this?
MWE:
\documentclass[british]{article}
\usepackage{mathpazo}
\usepackage[OT1]{fontenc}
\usepackage[latin9]{inputenc}
\makeatletter
\@ifundefined{date}{}{\date{}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
\usepackage[natbib=true,
style=numeric,
style=oscola]{biblatex}
\bibliography{/Users/jamie/Documents/Law and History}
\usepackage{babel}
\begin{document}
THE QUICK BROWN FOX JUMPED OVER THE LAZY DOG\citet{Tosh:2010aa} dfdasfads
\citep{Tosh:2010aa}
\printbibliography
\end{document}
With that document I am getting: THE QUICK BROWN FOX JUMPED OVER THE LAZY DOG\footciteref Tosh dfdasfads (ibid)' instead ofthe quick brown fox jumped over the lazy dog. [1]
| Here is a partial, possible solution. I'm not sure if this will work for you or not because it depends a great deal on what else is going on in your document. This reformats footnote markers so that they conform to the requirements of the citation style.
I've used a sample bib entry from the example file provided by the package and some of the code you originally posted. I've also noted a couple of other things I think you could improve easily in terms of options you are using.
\documentclass[british]{article}
\usepackage{babel}
\usepackage[T1]{fontenc}% much better than OT1
\usepackage{mathpazo}
\usepackage[utf8]{inputenc}% much better to switch to utf8 if you can
\usepackage[style=british]{csquotes}
\usepackage[style=oscola,natbib=true]{biblatex}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@legislation{gorchymyn,
title = {Gorchymyn Mesur Teithio gan Ddysgwyr (Cymru) (Cychwyn Rhif 2)\nopunct},
number = {SI 2009\slash 2819},
pagination = {regulation},
keywords = {cy},
userb = {Cy 245},
entrysubtype = {secondary},
language = {welsh},
}% entry from oscola documentation
\end{filecontents}
\bibliography{\jobname}
\let\citet\footcite% horrible kludge
\makeatletter
\def\@makefnmark{\hbox{\normalfont[\@thefnmark]}}% this redefines the way footnote markers are formatted. It will affect *all* footnotes - not just citations.
\makeatother
\begin{document}
THE QUICK BROWN FOX JUMPED OVER THE LAZY DOG\citet{gorchymyn} dfdasfads
\printbibliography
\end{document}
\citet does not seem to work without a kludge (above) but \citep does.
| 0.888889 | Using a bib entry from a package |
Possible Genotypes of 4 Alleles of Adh | There are four alleles of Adh which are Adh-1, Adh-2, Adh-3 and Adh-4. Their respective frequencies are 0.11, 0.84, 0.01 and 0.04. What are the Hardy-Weinberg frequencies of the possible 10 genotypes?
My Attempt: First I thought that there were more than 10 genotypes (4*3*2*1) = 24. I've never done HWE with 4 genotypes so im not sure how to use $p+q=1$ or $p^2+2pq+q^2=1$.
| Those Hardy-Weinberg equations are the general case, used for only two alleles. This question is basically answered here, for three alleles; you've got a situation of four alleles. That means you need to have:
$(p+q+r+s)^2=1$
Where $p$, $q$, $r$, and $s$ are the frequencies of your respective alleles. This expands out to the rather unwieldy:
$p^2+2pq+2pr+2ps+q^2+2qr+2qs+r^2+2rs+s^2=1$
Now it becomes a plug 'n chug assignment; simply assign the frequencies and calculate.
Assuming $p$ is Adh-1, $q$ is Adh-2, etc., $p^2=0.0121$, $2pq=0.1848$, and so on.
| 0.777778 | Hardy-Weinberg equations are the general case for only two alleles |
Embed .Net C# In Web Page? | I would like to embed some C# .Net code that does some simple Encryption/Decryption functions into a web page. This will be an internal web page so users will be implicitly trusted. Is there any way to do this? I will need to hit user's Windows-MY key store (via CAPI) to pull out the keys for decryption and hit an LDAP server to grab public keys for encryption.
| Define what you mean by "into a web page"? Web pages are run by browsers, which usually only know Javascript (and Java).
You could do it as a Silverlight application.
| 0.666667 | Define what you mean by "into a web page" |
Combined ADC scaling and offset with variable input voltage ranges | I am trying to create a circuit which will allow me to scale and offset a voltage (be it AC or DC) to within the range of the Arduino ADC.
The voltage could be anything between + and - 250V, but I also need to have good sensitivity over lower voltage ranges too.
To this end I am looking at a circuit whereby you can vary the voltage range that it expects the input to be and amplify/attenuate it accordingly. How I will be making the decision and setting the different gains is for another topic for now. I am only interested in the scaling and offsetting at the moment.
So far I have come up with this circuit:
Which appears to do just what I want for the +/- 250V range. I don't know how "safe" this circuit is, and if I am endangering any of the components with the 250V or not. The graphs at the bottom are (left to right) the input voltage, the power consumption of the bottom 10M resistor, the voltage across the 100M resistor (which is simulating the Arduino ADC input) and the power consumption of the upper 10M resistor.
Now, if I drop the input voltage to just +/- 2.5V and tweak the op-amp feedback resistor accordingly, for some reason the offset voltage the op-amp is adding jumps right up. I don't know for sure if this is the fault of the simulator I am using, or if it is really what will happen, as I haven't yet breadboarded this circuit (I guess that's the next stage).
This is the output from the 2.5V version:
You can see how the offset has jumped up and the output is clipping massively.
If I drop the lower 10K resistor to the virtual ground offset voltage divider to just 3.3K it compensates, but that's not nice - I would like to just vary the one resistor.
The op-amp is (will be) a 5V single supply rail-to-rail I/O one.
The two diodes are to protect the input of the op-amp against over voltage - I don't know if this circuit strictly needs them, but I guess it doesn't hurt to have them there.
Also, I don't know if the resistor values are quite what I want - I chose them to keep the power consumption right down and the impedance right up. I don't want them to impact the frequency response of the circuit more than I can help - the input waveform could be anything from DC up to around 500KHz or so, and I need that reproducing at the ADC end as faithfully as I can. (I know the Arduino can only really sample at lower speeds than that, but the Arduino is just for experimenting - the final system will use a dsPIC with 1.1Msps ADC).
So, what can I do to A) get a more stable offset, B) allow the varying of the input sensitivity without nuking either the op-amp or the ADC, and C) make the circuit safe to connect to, for example, a European mains voltage?
| The offset voltage is increasing as you have increased the gain and you have the non inverting input set above "mid point".
With the top circuit there is actually attenuation, so the opamp doesn't have to drive it's output very hard to keep the inverting input at 2.5V.
When you increase Rf to 10Meg, the output has to drive it's output to the necessary voltage to match the input current and keep the inverting input at 2.5V.
For example, with 0V on the input, then the output must swing to 5V to keep the inverting input at 2.5V. Basically if you have Rin the same as Rf, and you know the input voltage (0V) the midpoint voltage at -IN (2.5V) then it's easy to work out what the top of the voltage divider (opamp OUT) should be (5V)
If your signal is swinging around a different point (0v) than the opamp midpoint (2.5V) then when you change the gain you will also alter the effect the DC offset (e.g. 2.5V) has.
EDIT - If you are happy to use as many opamps as necessary, then the easiest way would be to have a fixed input voltage divider followed by a non inverting unity gain buffer and then a few opamps with different gains. You can also use a few "taps" on the input voltage divider then use e.g. a couple of OptoMOS to route the signal appropriately (these are useful for AC/DC setting to bypass the capacitor too)
As Olin mentions any parasitic capacitance will create a low pass filter which may have quite a low cutoff, so you have to be aware of this when designing for your highest frequencies a couple of pF will make a big difference with 10 Megaohms (I would stick to <= 1 Megaohm) The input impedance will also need to be very high (>100 Megaohm) to prevent attenuation so a FET input opamp would be best.
As far as dual rails go they can make life easier here if you need DC coupling, a charge pump can be used (the rails don't need to be symmetrical) followed by some filtering, or of course a switching regulator. You have the signal swinging round 0V up to the (opamp before the) ADC then level shift.
I would look at a a few input stages for oscilloscopes, as this seems to have much the same requirements. There are plenty out there, check some of the service manuals for commercial scopes out, and also stuff like Bitscope and DSO Nano/Quad.
Probably wouldn't hurt to pick up a good book on opamps too if you haven't got one - a decent freely available one is Opamps for Everyone.
IIRC it goes into great detail on the simultaneous equations involved in calculating the straight line equation constants (as Olin goes into a little with the resistor divider) so if you want to keep a single supply Olin's advice combined with the first couple of chapters would be good reading.
Personally I would go with the dual rail as it makes things like maintaining a constant DC -> AC input impedance easier and prevents issues with midpoint bias when you switch from 1x to 10x probe setting, effectively altering R1 in Olin's example.
The goal of 500kHz should make things a bit easier as you don't have to worry as much about high speed problems. You may want to have a filter rolling off a fair bit before 500kHz though for anti-aliasing purposes - I'd say around 350kHz to keep filtering reasonably easy.
I assume you'll want quite a few division settings, (down to say 100mV/div) and also you want to divide the screen into 10. I'll also assume you will be using a probe with a 10x setting.
So on the maximum division setting:
500/10x probe = 50V, divided by 1:10 input voltage divider = 5V.
For a typical scope input impedance of 1 Megaohm, this would equate to 900k and 100k for the divider.
For the lowest range of 100mV/div, you would need a gain of 50 from input to ADC. 1V input divided by 10 = 100mV, times 50 equals 5V.
Splitting the gain over a couple of opamps will make the other gain settings easier, and maintain a decent bandwidth (higher gain = lower opamp bandwidth)
Say one opamp with e.g. selectable gains of (something like) 1, 2 and 5 feeding another with gains of 1, 2 and 10 (using standard CMOS multiplexers like 74HC4051/2) gives you a few options from 1 to 50.
Then a final level shifting ADC buffer opamp, and you can do it all with a quad (FET input) opamp package.
| 0.777778 | Inverting input at 2.5V is increasing as the offset voltage is increasing . |
Google Fonts loading on desktop, but not on mobile? | Per Google PageSpeed's recommendation, I inlined much of my CSS. Previously, I had minified all of my CSS through W3 Total Cache, but now I inlined much of my CSS, plus all of the CSS that controls Google Fonts.
Now Google Fonts aren't appearing on mobile devices, but they do appear on desktops. Any reason why this is the case? The mobile screen cap here shows the fonts not loading.
<style>@font-face{font-family:'Pathway Gothic One';font-style:normal;font-weight:400;src:local('Pathway Gothic One'),local(PathwayGothicOne-Regular),url(https://fonts.gstatic.com/s/pathwaygothicone/v4/Lqv9ztoTUV8Q0FmQZzPqaA6LSHyyJAN5JIFgwWnj0Az3rGVtsTkPsbDajuO5ueQw.woff2) format("woff2");unicode-range:U+0100-024F,U+1E00-1EFF,U+20A0-20AB,U+20AD-20CF,U+2C60-2C7F,U+A720-A7FF}@font-face{font-family:'Pathway Gothic One';font-style:normal;font-weight:400;src:local('Pathway Gothic One'),local(PathwayGothicOne-Regular),url(https://fonts.gstatic.com/s/pathwaygothicone/v4/Lqv9ztoTUV8Q0FmQZzPqaHT0-GP0evTJPrdxn7U7ioo.woff2) format("woff2");unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02C6,U+02DA,U+02DC,U+2000-206F,U+2074,U+20AC,U+2212,U+2215,U+E0FF,U+EFFD,U+F000}@font-face{font-family:'Quicksand';font-style:normal;font-weight:400;src:local('Quicksand Regular'),local(Quicksand-Regular),url(https://fonts.gstatic.com/s/quicksand/v5/sKd0EMYPAh5PYCRKSryvW5Bw1xU1rKptJj_0jans920.woff2) format("woff2");unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02C6,U+02DA,U+02DC,U+2000-206F,U+2074,U+20AC,U+2212,U+2215,U+E0FF,U+EFFD,U+F000}@font-face{font-family:'Roboto Condensed';font-style:normal;font-weight:400;src:local('Roboto Condensed'),local(RobotoCondensed-Regular),url(https://fonts.gstatic.com/s/robotocondensed/v13/Zd2E9abXLFGSr9G3YK2MsIPxuqWfQuZGbz5Rz4Zu1gk.woff2) format("woff2");unicode-range:U+0460-052F,U+20B4,U+2DE0-2DFF,U+A640-A69F}@font-face{font-family:'Roboto Condensed';font-style:normal;font-weight:400;src:local('Roboto Condensed'),local(RobotoCondensed-Regular),url(https://fonts.gstatic.com/s/robotocondensed/v13/Zd2E9abXLFGSr9G3YK2MsENRpQQ4njX3CLaCqI4awdk.woff2) format("woff2");unicode-range:U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116}@font-face{font-family:'Roboto Condensed';font-style:normal;font-weight:400;src:local('Roboto Condensed'),local(RobotoCondensed-Regular),url(https://fonts.gstatic.com/s/robotocondensed/v13/Zd2E9abXLFGSr9G3YK2MsET2KMEyTWEzJqg9U8VS8XM.woff2) format("woff2");unicode-range:U+1F00-1FFF}@font-face{font-family:'Roboto Condensed';font-style:normal;font-weight:400;src:local('Roboto Condensed'),local(RobotoCondensed-Regular),url(https://fonts.gstatic.com/s/robotocondensed/v13/Zd2E9abXLFGSr9G3YK2MsMH5J2QbmuFthYTFOnnSRco.woff2) format("woff2");unicode-range:U+0370-03FF}@font-face{font-family:'Roboto Condensed';font-style:normal;font-weight:400;src:local('Roboto Condensed'),local(RobotoCondensed-Regular),url(https://fonts.gstatic.com/s/robotocondensed/v13/Zd2E9abXLFGSr9G3YK2MsDcCYxVKuOcslAgPRMZ8RJE.woff2) format("woff2");unicode-range:U+0102-0103,U+1EA0-1EF1,U+20AB}@font-face{font-family:'Roboto Condensed';font-style:normal;font-weight:400;src:local('Roboto Condensed'),local(RobotoCondensed-Regular),url(https://fonts.gstatic.com/s/robotocondensed/v13/Zd2E9abXLFGSr9G3YK2MsNKDSU5nPdoBdru70FiVyb0.woff2) format("woff2");unicode-range:U+0100-024F,U+1E00-1EFF,U+20A0-20AB,U+20AD-20CF,U+2C60-2C7F,U+A720-A7FF}@font-face{font-family:'Roboto Condensed';font-style:normal;font-weight:400;src:local('Roboto Condensed'),local(RobotoCondensed-Regular),url(https://fonts.gstatic.com/s/robotocondensed/v13/Zd2E9abXLFGSr9G3YK2MsH4vxAoi6d67T_UKWi0EoHQ.woff2) format("woff2");unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02C6,U+02DA,U+02DC,U+2000-206F,U+2074,U+20AC,U+2212,U+2215,U+E0FF,U+EFFD,U+F000}@font-face{font-family:'Roboto Condensed';font-style:normal;font-weight:700;src:local('Roboto Condensed Bold'),local(RobotoCondensed-Bold),url(https://fonts.gstatic.com/s/robotocondensed/v13/b9QBgL0iMZfDSpmcXcE8nBYyuMfI6pbvLqniwcbLofP2Ot9t5h1GRSTIE78Whtoh.woff2) format("woff2");unicode-range:U+0460-052F,U+20B4,U+2DE0-2DFF,U+A640-A69F}@font-face{font-family:'Roboto Condensed';font-style:normal;font-weight:700;src:local('Roboto Condensed Bold'),local(RobotoCondensed-Bold),url(https://fonts.gstatic.com/s/robotocondensed/v13/b9QBgL0iMZfDSpmcXcE8nIT75Viso9fCesWUO0IzDUX2Ot9t5h1GRSTIE78Whtoh.woff2) format("woff2");unicode-range:U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116}@font-face{font-family:'Roboto Condensed';font-style:normal;font-weight:700;src:local('Roboto Condensed Bold'),local(RobotoCondensed-Bold),url(https://fonts.gstatic.com/s/robotocondensed/v13/b9QBgL0iMZfDSpmcXcE8nL8EBb1YR1F8PhofwHtObrz2Ot9t5h1GRSTIE78Whtoh.woff2) format("woff2");unicode-range:U+1F00-1FFF}@font-face{font-family:'Roboto Condensed';font-style:normal;font-weight:700;src:local('Roboto Condensed Bold'),local(RobotoCondensed-Bold),url(https://fonts.gstatic.com/s/robotocondensed/v13/b9QBgL0iMZfDSpmcXcE8nAro84VToOve-uw23YSmBS72Ot9t5h1GRSTIE78Whtoh.woff2) format("woff2");unicode-range:U+0370-03FF}@font-face{font-family:'Roboto Condensed';font-style:normal;font-weight:700;src:local('Roboto Condensed Bold'),local(RobotoCondensed-Bold),url(https://fonts.gstatic.com/s/robotocondensed/v13/b9QBgL0iMZfDSpmcXcE8nACS0ZgDg4kY8EFPTGlvyHP2Ot9t5h1GRSTIE78Whtoh.woff2) format("woff2");unicode-range:U+0102-0103,U+1EA0-1EF1,U+20AB}@font-face{font-family:'Roboto Condensed';font-style:normal;font-weight:700;src:local('Roboto Condensed Bold'),local(RobotoCondensed-Bold),url(https://fonts.gstatic.com/s/robotocondensed/v13/b9QBgL0iMZfDSpmcXcE8nGPMCwzADhgEiQ8LZ-01G1L2Ot9t5h1GRSTIE78Whtoh.woff2) format("woff2");unicode-range:U+0100-024F,U+1E00-1EFF,U+20A0-20AB,U+20AD-20CF,U+2C60-2C7F,U+A720-A7FF}@font-face{font-family:'Roboto Condensed';font-style:normal;font-weight:700;src:local('Roboto Condensed Bold'),local(RobotoCondensed-Bold),url(https://fonts.gstatic.com/s/robotocondensed/v13/b9QBgL0iMZfDSpmcXcE8nPX2or14QGUHgbhSBV1Go0E.woff2) format("woff2");unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02C6,U+02DA,U+02DC,U+2000-206F,U+2074,U+20AC,U+2212,U+2215,U+E0FF,U+EFFD,U+F000}</style>
Can be seen here.
| What mobile browser are you using?
It may be because some browsers require eot/woff/otf files to load. Could you host these font files?
read about webfont and @font-face syntax here: http://www.paulirish.com/2009/bulletproof-font-face-implementation-syntax/
also maybe a similar problem: @font-face not embedding on mobile Safari (iPhone/iPad)
| 1 | What mobile browser are you using? |
Do you have to move backwards with a 10 in Sorry? | If you are unable to move forward when drawing a 10, do you have to move backwards 1?
| Yes,
From the rules are on Wikipedia.
10 - Move a pawn 10 spaces forward or 1 space backward. If a player cannot go forward ten spaces, he must go back one space.
| 1 | 10 - Move a pawn 10 spaces forward or 1 space backward |
Are there any good, free introductory Dungeon World adventures for a DM used to D&D? | I have been playing & GMing for some time, mostly in various versions of D&D, and other 80s-90s systems. And most of my GMing has been with published adventure modules.
I want to try Dungeon World, so have been looking for a free adventure that would work as an introduction to the system (for both the players and myself). But most of what I can find are "Dungeon Starters":
Dungeon Starters are a form of GM prep for running the first session of a Dungeon World game. Dungeon Starters don’t dictate plot, they’re not Fronts (you write those after the first session), and they don’t replace the GM playbook. They are for those times when you want to just sit down and start a game right then. Dungeon Starters provide a unified flavor to your prep but, when you get down to it, they are really just an unordered cloud of blanks and hooks with some appropriate moving parts to make sure the players don’t catch you with nothing interesting to say. Dungeon Starters are made up of questions, impressions, custom moves, items and services, spells, and monsters (among other things).
Are there any free adventures with a level of detail closer to a D&D module?
| The only one I am aware of was produced for one of the 'Free RPG Day' a couple of years ago as a demonstration game. It was called The Slave-Pit of Drazhu, and is intended to run for approximately 2 hours.
Having played through it with a DM who didn't really know what they were doing, it was extremely clear how having a good grip on the principle of the rules really was. I've since run it once with some success, although the fact that it is pre-planned to a large extent kind of misses the main point of the way Dungeon World is supposed to work. The reason for this is because stories within the system are intended to be emergent, with players having as much control about what happens next as the DM. Planning everything in advance completely shortcuts this, which is a shame, but I can see how it might help provide a way in for GMs who have no previous experience with this type of system.
| 0.833333 | The Slave-Pit of Drazhu is intended to run for approximately 2 hours . |
php regular expession convert to python code | i have this code written in php , and i want to convert it into python code
$title_regex = "/<title>(.+)<\/title>/i";
preg_match_all($title_regex, $string, $title, PREG_PATTERN_ORDER);
$url_title = $title[1];
/// fecth decription
$tags = get_meta_tags($url);
// fetch images
$image_regex = '/<img[^>]*'.'src=[\"|\'](.*)[\"|\']/Ui';
preg_match_all($image_regex, $string, $img, PREG_PATTERN_ORDER);
$images_array = $img[1];
i have tried this .. but it give me errors in pics part
import re
out=Data #web site html page ..
title_regex = "/<title>(.+)<\/title>/i" #no need for this .. un used
m = re.search("<title>(.+)<\/title>", out)
print "title",m.group(1)
#for pics i have tried this but it give me error ..
pics = re.match(r"/<img[^>]*'.'src=[\"|\'](.*)[\"|\']/Ui", out)#the conversion is not correct
print "grop",pics.group(1)
my full code
import re
import urllib
print "Start"
url="http://www.deviantart.com"
data=urllib.urlopen(url)
out=data.read()
print
title_regex = "/<title>(.+)<\/title>/i"
m = re.search("<title>(.+)<\/title>", out)
print "first",m
print "title=",m.group(1)
title_regex = "/<title>(.+)<\/title>/i"
pics = re.match(r"/<img[^>]*src=[\"|\'](.*)[\"|\']/Ui", out)
print "pics>>",pics.group(1)
how i can convert a php re>>"/]*'.'src=\"|\'[\"|\']/Ui" to a python re ?
| Working version .. display all images from a given web site using tag IMG src >
code:
import re
import urllib
print "Start"
url="http://www.deviantart.com"
data=urllib.urlopen(url)
out=data.read()
print
title_regex = "/<title>(.+)<\/title>/i"
m = re.search("<title>(.+)<\/title>", out)
print "first",m
print "grop",m.group(1)
title_regex = "/<title>(.+)<\/title>/i"
pics = re.compile(r"<IMG[^>]*src=([^>]*[^/])")#Change IMG tag
allpics=pics.findall(out)
print "found",pics
for mypic in allpics:
print "< IMG src=",mypic
thanks all
| 0.888889 | tag IMG src display all images from a given web site |
Continuous Dice rolls | A dice is being rolled continuously. Suppose you roll a 3 ( or any number ). What is the probability that you will get the next "3" exactly after n rolls?
| I will interpret "after $n$ rolls" as meaning that we want the probability that our next $n-1$ rolls do not yield a $3$, but the $n$-th roll does give a $3$..
The probability of a non-$3$ on any toss is $\frac{5}{6}$. So the probability of $n-1$ consecutive non-$3$'s followed by a $3$ is
$$\left(\frac{5}{6}\right)^{n-1}\frac{1}{6}.$$
The reason that we simply multiply is that the results on successive tosses of the die are independent. The die does not remember what results it has come up with in the past.
We can also get the result by using a counting argument. Imagine tossing a die $n$ times, and recording the results. So a record of $4$ tosses might read $4,5,4,1$.
There are $6^n$ possible records of the results of $n$ tosses, all equally likely. There are $5^{n-1}$ records in which the first $n-1$ results are a non-$3$ and the last result is a $3$. So our probability is
$$\frac{5^{n-1}}{6^n}.$$
| 1 | The probability of a non-$3$ on any toss is $frac56$ . |
Persistent session cookies: remember session even after closing the browser | I would like to store anonymous users $_SESSION in a cookie so that their cart and other custom information is still available even after closing the browser.
I found this interesting post which tells me I should add this to my local.settings.php:
ini_set('session.cookie_lifetime', 60 * 60 * 24 * 7);
ini_set('session.gc_maxlifetime', 60 * 60 * 24 * 7);
ini_set('session.save_path', '/home/yoursite/sessions');
So that session cookie would be available for a week.
But it also stands that we should use session_regenerate_id() elseway the cookie lifetime is not updated.
I could not find session_regenerate_idin Drupal 7 source code, but I believe Drupal might already handle this from what I read in the code comments.
My questions are:
is this a good approach to have persistent cookie sessions?
do I need to add to my local.settings.php session_regenerate_id() too?
Thank you very much for your advises
| Hi you could use javascript for this.
Using these 3 functions.
its properly the best way and then you wont have problems if your are using Varnish
function createCookie(name,value,days) {
if (days) {
var date = new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
var expires = "; expires="+date.toGMTString();
}
else var expires = "";
document.cookie = name+"="+value+expires+"; path=/";
}
function readCookie(name) {
var nameEQ = name + "=";
var ca = document.cookie.split(';');
for(var i=0;i < ca.length;i++) {
var c = ca[i];
while (c.charAt(0)==' ') c = c.substring(1,c.length);
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
}
return null;
}
function eraseCookie(name) {
createCookie(name,"",-1);
}
| 0.777778 | Varnish function createCookie(name,value,days) |
How do I ward properly in DotA 2? | I finally got my DotA 2 Beta invite. Now to learn the game I read it's a good start to play support heros (like I already loved to do in League of Legends). Even though I'm still pretty new to the game I suspect it's mostly the supports job to buy and set up wards.
I am therefore interested in learning how to ward effectively.
What are good/important spots for wards?
How do I time wards? When should I leave the lane?
And if there there different types of wards like in LoL: when to use which one?
| On the following image I additionally marked wards i use on regular basis in above average MMR (~3700).Works on AP mode on public matchmaking where counterwarding is less common.
Read full guide here for more detailed explanations about the marked colors and places.
For average skill games with low warding and no counterwards,you should focus mainly on red dots especially 2 hills near the runes with the priority of upper one in early game and lower one later when killing roshan becomes more likely.
Having at least one ward near the rune will eliminate the chance of
going the wrong side when timing runes
the hills will give you more vision than placing wards on the ground
easily prevent ganks since the river is most common way for ganking
seeing enemy team attacking roshan is huge advantage
also it reveals path near secret shop and neutral camp
Wards should be placed as early as it gets and replaced just a bit before they expire(you can see the timer),it is the best if you can go grab a rune and place new ward at the same time so you don't lose much "lane time",if it is on opposite lane you could port there and combine it with a gank or push attempt.
There are 2 types of wards Observer wards and Sentry wards the ones you need are observer ones the other is used to reveal invisible enemies and is placed directly on the line near combat(pink)
If you want more advanced video guides you should check XV Rogues channel
| 0.777778 | Observer and Sentry wards are used to reveal invisible enemies . |
How do you prepare for out of memory conditions? | This can be easy for games with well defined scope, but the question is about sandbox games, where the player is allowed to create and build anything.
Possible techniques:
Use memory pools with upper limit.
Delete objects that are no longer needed periodically.
Allocate extra amount of memory at the beginning so it can be freed
later as a recovery mechanism. I would say around 2-4 MBs.
This is more likely to happen in mobile/console platforms where memory is usually limited unlike your 16 GB PC. I am assuming you have full control over memory allocation/deallocation and no garbage collection involved. That's why am tagging this as C++.
Please note that I am not talking about Effective C++ Item 7 "Be prepared for out-of-memory conditions", even though it's relevant, I would like to see an answer more related to game development, where you usually have more control over what's happening.
To summarize the question , how do you prepare for out of memory conditions for sandbox games, when you are targeting a platform with limited memory console/mobile ?
| Generally, you don't handle out-of-memory. The only sane option in software as large and complex as a game is to just crash/assert/terminate in your memory allocator as soon as possible (especially in debug builds). Out-of-memory conditions are tested for and handled in some core system software or server software in some cases but not usually elsewhere.
When you have an upper memory cap you instead just ensure that you never need more than that amount of memory. You can keep a maximum number of allowed NPCs at a time, for instance, and simply stop spawning new non-essential NPCs once that cap is hit. For essential NPCs you can either have them replace non-essential ones or have a separate pool/cap for essential NPCs that your designers know to design around (e.g. if you can only have 3 essential NPCsa, the designers will not put more than 3 in an area/chunk - good tools will help designers do this properly and testing is essential of course).
A really good streaming system is also important especially for sandbox games. You don't need to keep all NPCs and items in memory. As you move through chunks of the world new chunks will be streamed in and old chunks streamed out. These will generally include NPCs and items as well as terrain. Design and engineering caps on item limits need to be set with this system in mind, knowing that at most X old chunks will be kept around and pro-actively loaded Y new chunks will be loaded, so the game needs to have space to keep all the data of X+Y+1 chunks in memory.
Some games do attempt to handle out-of-memory situations with a two-pass approach. Keeping in mind that most games have a lot of technically unnecessary cached data (say, the old chunks mentioned above) and a memory allocation might do something like:
allocate(bytes):
if can_allocate(bytes):
return internal_allocate(bytes)
else:
warning(LOW_MEMORY)
tell_systems_to_dump_caches()
if can_allocate(bytes):
return internal_allocate(bytes)
else:
fatal_error(OUT_OF_MEMORY)
This is a last-stop measure to deal with unexpected situations in release but during debugging and testing you should probably just immediately crash. You don't want to have to rely on this kind of stuff (especially because dumping the caches may have some serious performance consequences).
You might also consider dumping high-res copies of some data, for instance you might dump the higher-resolution mipmap levels of textures if you are running low on GPU memory (or any memory in a shared-memory architecture). This usually requires a lot of architectural work to make worth it, though.
Note that some very unlimited sandbox games can be rather easily just crashed, even on PC (remember that the common 32-bit apps have a limit of 2-3GB of address space even if you have a PC with 128GB of RAM; a 64-bit OS and hardware allows more 32-bit apps to run simultaneously but can't do anything to make a 32-bit binary have a larger address space). In the end, you either have a very flexible game world that will need unbounded memory space to run in every case or you have a very limited and controlled world that always works perfectly in bounded memory (or something somewhere in between).
| 0.777778 | Out-of-memory conditions are tested for and handled in some core software but not elsewhere . |
How to get Javadoc to include documentation for a sub-project? | I have two projects in Netbeans that are closely linked. They are separate projects because one of the projects is a util package that could be used in the future for another project. Is there a way to configure Netbeans so that the Javadoc generated for the main project will include links to the objects defined in the util project instead of listing the full package path?
Edit: I have found how to do it. In Project Properties > Build > Documenting you can set Additional Javadoc Options. The option to use is -link and then the URL of the documentation directory. However, I can only get it to work with an absolute link and am having trouble getting the relative link to work.
-link file:///A:\B\C\Util\dist\javadoc //this works
-link file: ..\..\..\Util\dist\javadoc //this doesn't works
Both project folders are in directory C, so I think that should be the correct relative path based on the documentation.
| I realize that this suggestion lies outside of the implied constraints of your question, but it might be better to use an SCM tool (and not your IDE) to publish javadoc that covers dependent projects. For example, Maven has a plugin specifically designed to publish javadoc for modular projects.
| 1 | SCM tool to publish javadoc for modules |
If statement in QML | Completely new to QT and QML. I'm trying to set the color of a rectangle based on the relationship between the two propery doubles "callValue" and "handRaiseXBB", but I get the error "unexpected token if" and ""expected a qualified name id"
Could anyone tell me what I'm doing wrong? Thanks!
import QtQuick 2.0
Item{
id: hand
property double callValue: 0.0
property double handRaiseXBB: 100
property string handCallColor: "green"
property string handFoldColor: "grey"
Rectangle {
anchors.fill: hand
if(hand.callValue >= hand.handRaiseXBB){
color: hand.handFoldColor
}
else {
color: hand.handCallColor
}
}
}
| Another form to slove this is
Rectangle {
...
color: {
color = hand.handCallColor
if(hand.callValue >= hand.handRaiseXBB)
color = hand.handFoldColor
}
...
}
But the form with ternary operator is a better form!
QML is "based" in javascript, then i belive that all itens are javascript objects, how to:
var Rectangle: {
color: "red",
id: "id",
//then we can do this
setColor: function(_color) {this.color = _color}
}
| 0.777778 | Rectangle color = hand.handCallColor |
Batik - put SVG on top of image | I have an image file (jpg, etc.) and some svg drawings (svg tag copied from the site, as Java String). The svg drawing is of the same resolution as the image file. I want to put svg drawings on top of the image and save it as one file. My approach, of which I'm not proud of, but works, is to:
use Batik's JPEGTranscoder to transcode svg into image with this svg drawings and white background, save this image
put the image with svg drawings on top of my image file by perfoming low level operations on each pixel
I would like to be able to put the svg drawings on top of my image in one step.
| Using an SVG pattern would solve your problem.
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
width="200" height="200">
<defs>
<pattern id="image" x="0" y="0" patternUnits="userSpaceOnUse" height="200" width="200">
<image x="0" y="0" width="200" height="200"
xlink:href="http://cdn.sstatic.net/stackexchange/img/logos/so/so-logo.png"/>
</pattern>
</defs>
<rect width="200" height="200" fill="url(#image)"/>
<circle cx="100" cy="100" r="50"/>
</svg>
Fiddle available here.
I pulled the SVG above through the batik rasterizer, and it was correctly rasterized.
Update
As noted in the comments, you could just as well include the image directly in your SVG, without the use of a pattern.
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
width="200" height="200">
<image x="0" y="0" width="200" height="200"
xlink:href="http://cdn.sstatic.net/stackexchange/img/logos/so/so-logo.png"/>
<circle cx="100" cy="100" r="50"/>
</svg>
Fiddle available here.
| 0.555556 | Using an SVG pattern would solve your problem |
Slow queries related to subqueries using aggregation | Here's a simplified version of the queries I am running:
select
...
from
editions
join edition_events on edition_events.edition_id = editions.id
join events on events.id = edition_events.event_id
join (
select
event_id,
array_agg(date_start),
array_agg(date_end)
from
event_dates
group by
event_id
) as dates on dates.event_id = events.id
WHERE
editions.id = ?;
These queries ran great with my test data (~1500 events). Now that I'm starting to use a copy of the real data (~400,000 events, ~500,000 event_dates), my application is timing out before I get results back from the database. I have added indexes on all relevant columns, which only helped a little bit. I've narrowed down the problem to the subqueries that use aggregation.
Now the real version of these subqueries does things like time zone manipulation or a count instead of array_agg, so using a trigger to update a counter column is not practical in many instances. The dates associated with events must be individual rows rather than stored as an array since they have a foreign key relationship with other tables.
What would be my best bet for improving performance here? I understand that the subquery is being evaluated first, but I don't know which dates I actually need to look at until I've done the joins. I have looked at lateral joins, but I am uncertain if they would help here (and most information I can find is along the lines of "look, new feature!"). Since I am still using 9.2, I don't want to ask to upgrade to 9.3+ if it won't actually solve my problem.
| Your approach ("aggregate first, join later") generally performs best when you need to retrieve the whole table or large parts of it - or as long as the aggregated table is small.
For only a few rows in the result, this gets disproportionately expensive for big tables, since the whole table (event_dates in your case) has to be processed. In these cases, it's better to revert the paradigm to "join first, aggregate later". The equivalent query would then be:
SELECT e.id
,array_agg(ed.date_start) AS starts
,array_agg(ed.date_end) AS ends
,...
FROM editions e
JOIN edition_events ee ON ee.edition_id = e.id
JOIN events ev ON ev.id = ee.event_id
JOIN event_dates ed ON ed.event_id = e.id
WHERE e.id = ?
GROUP BY e.id;
This should help with any version of Postgres.
Also using table aliases to simplify the syntax.
I don't see how LATERAL (Postgres 9.3+) could help this query. You would use it to reference a column from the left side of the join tree that you couldn't access on the same query level otherwise, often to produce multiple rows to join to. Neither is the case here. What you are thinking of can be implemented with plain old correlated subqueries, but those typically perform worse.
Don't take my word for it. Run a quick test with EXPLAIN ANALYZE for your case (with your real life data), then you know for sure.
| 0.777778 | How to revert the paradigm to "join first, aggregate later" |
Another instructor is pushing me out of the classroom right after my class ends | I am a graduate student in math in my final year, and for several years have been teaching at my department as a lecturer. This semester, in the same lecture hall there is another lecture that starts 20 minutes after my class ends. It's taught by another instructor from my department. I usually have many students coming to office hours and there are also students asking questions immediately after lecture. Due to other activities, I cannot have office hours right after the lecture this semester and can only stay for about 15 minutes to answer questions.
Many times in the past I had a similar situation and never had any issues with it. This semester the instructor who is teaching right after often arrives 20-15 minutes before her class starts and tells me immediately that I have to go with my students somewhere else.
I make sure to leave the blackboard clean and take all my stuff away from the instructor's desk before she arrives, but I do believe that I have a right to stay in the classroom after my lecture for at least 5-10 minutes. There is no vacant classroom around, and I don't have time to go with students to my office, which is in a different building.
Last time the instructor told me in front of my students that I don't understand "simple things" and that I am "playing games". When I was talking to one of my students, she stood very close to us and clearly demonstrated that she wanted us out. I tried to explain her that I couldn't go anywhere else due to my time constraints, but she didn't want to listen to me. I really don't understand what "simple" things she meant and what "games" I am playing.
We leave the board clean. She doesn't need to set up a projector. She can still talk to her students before her class starts, if she wants to (even though it seems like her students don't ask her any questions before their class). So, I don't see how I cause any disruption.
I had met this woman many times before this semester, but we never talked. I didn't see her talking to other instructors/students much, and she seems to be quite reserved and a bit neurotic. She doesn't want to have any conversation with me regarding the issue.
I felt really offended after last class when she said those things to me in front of my students. What would you do in my case?
Added later: There are no official rules regarding classroom occupancy between classes. Instructors are supposed to use common sense and be reasonable. For me using 50% of the break time seems reasonable to answer questions after lecture seems reasonable. I agree that for some people it may not.
I don't block the entrance to the classroom. A few students from the next class who come earlier always go ahead and take their seats as soon as my students start leaving the room. I also had one of the students from the next class listening to my explanation to one of those after-class questions and asking me further questions before their class (which is the same class as I am teaching, just a different section). Maybe the instructor got jealous, I don't know.
The entrance to the classroom is from its front (not back), so I do stay in the front. But it is a big lecture hall, and there is a plenty of space in front of the room (the board itself consists of 8 huge panels).
Also, during my career as a grad.student who is also teaching for the department, I have had several observations from experienced professors who are considered to be great teachers at the department and are in charge of undergraduate teaching policy. In my evaluations the fact that there are always several students approaching me with questions after class considered as very positive, meaning that students find me approachable.
Thank you everyone for answers.
| I would like to provide two suggestions. The first one directly refers to your discussions with students:
There is no vacant classroom around, and I don't have time to go with students to my office, which is in a different building.
If the questions really need to be answered immediately, you could simply take the discussion outside into the hallway. Surely, most of the students have to or want to leave, anyway, I presume, as they might have to move to different buildings themselves (?)
For anything else, you do not have to "have office hours right after the lecture", and you do not have to "go with students to [your] office". They are adults. Surely, your students can find out where your office is on their own and come there when you are free.
My second suggestion is related to whether you may stay around in the lecture room after your class:
It generally seems like the most corteous and natural thing to me that once the class has ended, one should try and leave the room as quickly as possible. Unless otherwise regulated by your organisation, I see no basis for the fundamental belief
I have a right to stay in the classroom after my lecture for at least 5-10 minutes
... unless your departure actually takes that long (e.g. because you have to pack some elaborate experimental setups for a while). At the same time, however, I wouldn't concede the other lecturer any basic right to arrive in the classroom at least 5 - 10 minutes before the next lecture starts, unless some elaborate setup needs to be prepared for that lecture.
In other words: If you are entitled to stay for at least 5 to 10 minutes after your lecture has ended, I would argue that the next lecturer is just as entitled to claim the room for themselves at least 5 to 10 minutes before the next lecture starts.
With that said, it is usually well possible to stay around to answer such questions, though that does neither mean that the room will be reserved for you (the next lecture may already be under preparation), nor are you automatically the "main party" (in that you may block the "lecturer's desk" or any such central device, rather than cluster your discussion in a corner of the room to give the next people space).
| 1 | How do you stay in the lecture room after your class? |
How to view the detailed debug log of the change set validation in production | I pushed a changeset from stage (sandbox) to production. Everything worked fine in stage but in production it didnt. It just says "Test Coverage of Selected Apex Trigger is 0%, at least 1% test coverage is required".
Both the production and stage code are same.
I know its data, but to dig into the details, I would like to view the detailed debug log which was executed during changeset validation.
Even If I give run test for the test class in production it says that trigger has 0% code coverage after running the test class. (The test class passed though).
I enabled the debug log for my user id and viewed the logs after that particular test class executed in production. It said Maximum debug log size reached. FYI, I have even set debug log filters
Can some one help me here to debug and find where the issue is?
| Possibility#1
If a trigger is not firing, then the insert/update/delete of the SObject is failing before the trigger is being invoked. For example, an after insert/update trigger will not fire if there are validation rule errors during the insert/update. Or, if the before insert/update triggers execute an add.error to prevent the DML from committing.
Given that it works in stage but not PROD, you need to verify that Stage mirrors PROD in terms of validation rules and workflow field updates.
Possibility#2
Another thing to check is that if the stage testmethod uses @isTest(SeeAllData=true) it is highly likely to have different behavior in PROD than in Stage where the dataset size will be different.
Debug logs
As for debug log levels, start off by just running with Validation and Database logging and turn off Apex code and System logging to see why Possibility #1 (the DML operation is not committing) thus preventing the trigger from executing.
If you need to see Apex code logs and you're exceeding max debug log, see this post for suggestions http://salesforce.stackexchange.com/a/11251/2602
| 1 | Possibility#1 If a trigger is not firing, then the insert/update/delete of the SObject is failing |
What's the play event on a video html5 element? | I have a video html5 tag embedded on page. I need to trigger an action when the user clicks the "Play Button". But I can't find how to bind that to my action. Is there an event for what I need? I'm using jQuery...
Thanks!
| Does this W3C demo page help? http://www.w3.org/2010/05/video/mediaevents.html It appears the play event is simply 'play'.
For example:
$('video').bind('play', function (e) {
// do something
});
or
$('video').on('play', function (e) {
// do something
});
| 1 | Does this W3C demo page help? |
How to export a single huge table from SQL Server? | I'm given the task to export the content of a huge table from a production database and to import the data into a database at a remote location.
The Table has about 45,000,000 rows. using about 4 GB space in the database.
Its 10 Columns are of type int, datetime and varchar(n) <= 255, but some of the varchar fields contain newlines and the usual field separators used by bulkcopy.
I guess export to Excel is no option due to the number of rows.
Export with SSIS to Flatfile is possible (took about 30 minutes), but reimport is not automatic, since some fields where spitted.
My current idea is
create a new database on the production server (using same
collations as the production database)
Set its recovery mode to simple
copy the data with
Select * into copy_of_table from prod_db..big_table
Detach mdf file from this new database and ship it to the other
location
Drop adhoc database
I assume that inserting into a database with simple recovery model generates only minimal logging on the new database and this way is one of the fastest possible to export the data and the impact to the production database is the least possible.
| I'd of thought BCP, with a format file rather than defaults, would be your best bet.
Creating a format file
| 1 | BCP with format file rather than default |
Very simple particle filters algorithm (sequential monte carlo method) implementation | I'm interested in the simple algorithm for particles filter given here. It seems very simple but I have no idea on how to do it practically. Any idea on how to implement it (just to better understand how it works) ?
Edit:
This is a great simple example that explain how it works. I've tried to implement it in C++: see my code here, but I'm note sure if I do it the right way. Can you please check if I understood it well, or there are some misunderstanding according to my code ?
| The CRAN package RcppSMC implements three simple models from the literature.
| 0.888889 | CRAN package RcppSMC implements three simple models from literature |
Why did Voldemort assume that no-one knew about Room of Hidden Things? | Voldemort hid one of his Horcruxes inside Hogwarts. It seemed to be relying on security through obscurity as far as protecting it. But as we know, it ended up not being so secure because it wasn't so obscure - Harry Potter knew about the Room of Hidden Things.
My question is, the way Rowling describes this hints at the fact that Riddle had an assumption that very few people would ever stumble upon that room. *WHY???
First, let's show Harry's theory on what Voldemort was thinking, how and why:
Here's Harry understanding Voldemort's thinking in HP7 once he figured out where the Diadem was (bold emphasis mine):
Tom Riddle, who confided in no one and operated alone, might have been arrogant
enough to assume that he, and only he, had penetrated the deepest mysteries of
Hogwarts Castle. Of course, Dumbledore and Flitwick, those model pupils, had never
set foot in that particular place, but he, Harry, had strayed off the beaten track in his
time at school – here at least was a secret area he and Voldemort knew, that
Dumbledore had never discovered –
...and later on, with Harry explains the location to Ron/Hermione:
“He hid it exactly where I had my old Potions book, where everyone’s been hiding stuff for centuries. He thought he was the only one to find it. Come on.”
“And he never realized anyone could get in?” said Ron, his voice echoing in the silence.
“He thought he was the only one,” said Harry.
.
Yet, from available evidence, that seems to be a completely wrong assumption, even at Voldemort's time.
Let's examine that last quote again, with emphasis on other info available:
“He hid it exactly where I had my old Potions book, where everyone’s been hiding stuff for centuries.” ...
...
“And he never realized anyone could get in?” said Ron, his voice echoing in the silence.
“He thought he was the only one,” said Harry. “Too bad for him I’ve had to hide stuff in
my time... this way,” he added. “I think it’s down here... “
They sped off up adjacent aisles; Harry could hear the others’ footsteps echoing through the towering piles of junk, of bottles, hats, crates, chairs, books, weapons, broomsticks, bats...
.
OK, so if there's a truckload (or train-load, by the description) of stuff in that room, isn't the only reasonable conclusion: "the room is a fairly popular destination with plenty of people who've found their way there in the past, and therefore, likely, plenty who will in the future"?
Doesn't matter what your arrogance level is, the evidence seems to point to only one conclusion - it's quite fine as a place to temporarily bury your dirt so teachers won't tag you for your misdeeds, but this is NOT the place to hide something that you want permanently safe!
So why did Voldemort make such a moronic mistake?
| Voldemort knew other people knew about the room, he must have, considering it is written in the book the history of Hogwarts, which Hermione points out. He knew this, and so used the room to hide the horcrux. Like someone said earlier, how many people are going to accidentally find the room of requirement, accidentally find the diadem and accidentally destroy it? Not many, I'm guessing.
Also, as Cho points out, the diadem has been lost for centuries, and no living person has seen it (which isn't technically correct, as Voldemort had seen it, but anyway...). This means that even if someone saw it, they wouldn't think it was the lost diadem.
The 'truck load' of stuff in the room may not have necessarily been hidden by students. Someone needs a place to hide their stuff, you are hardly going to be shown a plain room, with nothing to hide the object in. All the other items have probably been created by the room to help the student hide the item.
| 1 | How many people are going to accidentally find the room of requirement and destroy it? |
What does a singular simplex with real coefficient mean | For an $n$-dimensional orientable closed manifold $M$, the simplicial volume is the infimum of the $l^1$-norm of the elements $\sum a_i \sigma_i$ ($a_i \in \mathbb{R}$) which represent the fundamental class. My question is: since $\sigma_i$ is a continuous map from the $n$-dimensional simplex to $M$, what does $a_i \sigma_i$ mean? Is it the same kind of map? I don't know how to make sense of this expression.
| As Lee suggests, you should look at Allen Hatcher's book. In particular, chapter 2 and section 3.3.
In practice, you can often think of $\sum a_{i}\sigma_{i}$ as coming from the following procedure. Let $\phi:X\rightarrow M$ be a degree $d$ map of $n$-manifolds. Then any singular cocycle (with integer coefficients) $\alpha$ representing the fundamental class of $X$ will push forward to a singular cocycle $\phi_{\ast}\alpha$ representing $d$ times the fundamental class of $M$. Thus, $\frac{1}{d}\phi_{\ast}\alpha$ will be a cocycle (with rational coefficients) representing the fundamental class of $M$.
The prototypical examples are as follows:
If $M$ is a torus, then there are covering maps $\phi: M\rightarrow M$ of arbitrarily high degree, hence $M$ has no simplicial volume. (We can iterate the above procedure, starting with any cocycle $\alpha$ representing the fundamental class of $M$, getting representatives $\alpha,\frac{1}{d}\phi_{\ast}(\alpha),\frac{1}{d^{2}}\phi_{\ast}^{2}(\alpha),\ldots$ with volume going to $0$.)
On the other hand, if $M$ is a higher genus surface, then this strategy is obstructed by Euler characteristic. Namely, if $\phi:Y\rightarrow M$ is a degree $d$ covering map, then $\chi(Y)=d\chi(X)$, so the genus of $Y$ grows linearly with $d$. In fact, you can show that $X$ has nontrivial simplicial volume using hyperbolic geometry.
| 1 | if a torus is a genus surface, then a single cocycle is obstructed |
Intersection of lists of disjoint intervals | Here is my problem: I have two very large lists of intervals (stored as many couples in the form {{"start point", "end point"}, ..., {"start point", "end point"}), and I want the result of the intersection of those lists.
Here is an example :
intervalsA = {{1, 2}, {3, 4}, {5, 7}, {8, 8.5}};
intervalsB = {{1.5, 3.5}, {4.1, 6}, {9, 10}};
The expected result is: overlap = {{1.5, 2}, {3, 3.5}, {5, 6}};
I tried using Interval, IntervalUnion and IntervalIntersection, but nothing worked. The only working method that I found uses Piecewise functions where each interval is set as 1. By multiplying the two piecewise functions, I have something similar to the intersection, but the solution is very inefficient.
I hope I am clear and precise enough.
| intervalsA = {{1, 2}, {3, 4}, {5, 7}, {8, 8.5}};
intervalsB = {{1.5, 3.5}, {4.1, 6}, {9, 10}};
IntervalIntersection @@ Interval @@@ {intervalsA, intervalsB}
Interval[{1.5, 2}, {3, 3.5}, {5, 6}]
| 0.888889 | intervalsA = 1, 2, 3, 4, 5, 7, 88, 8.5 |
Passing a string as function argument | I would like to use a string as argument of a function in order to use this string for the plotting of the result, but R plots the argument variable name instead of its string value.
I tried different solutions (diparse, as.character...) but still no solution. Do you have any idea?
mcnemar_test <- function (c1,c2,class1, class2)
{
name1=label(class1)
name2=deparse(substitute(class2))
v1 = c1$encerts
v2 = c2$encerts
e00 = sum(ifelse(v1+v2==0,1,0)) #bad classification for both
e01 = sum(ifelse(v1<v2,1,0)) #bad classification for 1
e10 = sum(ifelse(v1>v2,1,0)) #bad classification for 2
e11 = sum(ifelse(v1+v2==2,1,0)) #good classification for both
matriu <- matrix(c(e00,e01,e10,e11),nrow = 2,
dimnames = list(name1 = c("Disapprove", "Approve"),
name2 = c("Disapprove", "Approve")))
print (matriu)
t <- mcnemar.test(matriu)
return (t)
}
mcnemar_test(classifiers.NaiveBayes,classifiers.CART,"aa","bb")
I would like to see "aa" and "bb" but see "name1 and name2
| R thinks you want the names to be "name1" and "name2", just like if I were to create a list with names "a" and "b":
my.list <- list(a=1, b=2)
Try using structure and passing the names as a character vector:
matriu <- matrix(c(e00,e01,e10,e11),nrow = 2,
dimnames = structure(list(c("Disapprove", "Approve"),
c("Disapprove", "Approve")),
names=c(class1, class2)))
Or setting the names of the elements after you create the list:
matriu <- matrix(c(e00,e01,e10,e11),nrow = 2,
dimnames = list(c("Disapprove", "Approve"),
c("Disapprove", "Approve")))
names(dimnames(matriu)) <- c(class1, class2)
| 1 | Using structure and passing names as character vector |
Show UILabel with complete text or hide it | I have a UI label say "ABCDEFGH". In iPhone 6 etc wider devices I can show the complete text. In small screen devices like iPhone 5, I see text as "ABCD...". I want the following:
if(complete text can be shown)
{
// show UILabel with text
} else // if text can not fit in, "ABCD..." case
{
// hide the UILabel
}
How can I do this?
| As i mentioned in comment to use adjustsFontSizeToFitWidth = YES but it seems to be not good fit for your scenario. I will suggest you to check the screen sizes and set UILabel according to that.
CGSize deviceScreenSize = [[UIScreen mainScreen] bounds].size;
if(deviceScreenSize.height == 480){ //iPhone 4,4s Screen Size
// Write your code for UILabel Here.
}
if(deviceScreenSize.height == 568){ //iPhone 5,5s Screen Size
// Write your code for UILabel Here.
}
if(deviceScreenSize.height == 667){ //iPhone 6 Screen Size
// Write your code for UILabel Here.
}
if(deviceScreenSize.height == 736){ //iPhone 6s Screen Size
// Write your code for UILabel Here.
}
There might be some better way to do so.But i know this one only.
| 1 | AdjustsFontSizeToFitWidth = YES |
Graphic Design - Video games -- events, seminars, workshops, etc | My daughter loves drawing - using pencil. She wants to be a Graphic Designer - mainly for video games area. We got her a drawing tablet, but she is more comfortable using the pencil. I have not idea if GD is the best thing for her, &/or how I can help her. Are there any events, seminars, she could attend to? She is in 10th grade now... I want to make sure this is really what she wants to do. I don't want her to realize later on, it is not really what she thought she was going into.
Thank you
B
| If it works out, get her into a quality art school. The first few years she'll get plenty of introduction to a wide range of art professions, along with getting her generals out of the way as well.
In the interim, if she's really into the idea of game design and if she has even a bit of interest in it--suggest she start taking some computer science classes if they are offered in highschool. You don't have to be a programmer to be a game designer, but if the aptitude and interest is there, it's going to be a skill that will only benefit her.
| 1 | If it works out, get her into a quality art school . |
Why not have the gears inside the bottom bracket? | Looking into an IGH it seems the biggest disadvantage is having a huge amount of rotating mass. I've seen one handmade bike where the IGH sits above the bracket, inside a carbon fibre shroud around the place some bikes have rear suspension. There are two chains, one driving the IGH and another to drive the rear wheel.
Why not have an internally geared bottom bracket where the cranks drive the input shaft and the crank ring rotates at a ratio selectable by the gear lever?
Then the rear wheel could have a single drive wheel driven by a chain or belt and a lightweight hub just solid enough to mount the spokes and disc. Then you could have mud-free gearing while reducing rotating mass even below what you have with a conventional cassette... and given that you have thrown out the bottom bracket the overall weight gain would be less.
Quite a job for the home builder to adapt an existing hub I guess but it should be possible.
| There actually is a 18-Speed IG drive that is on the market: the pinion drive.
Only a few framebuilders incorporate this in their frames, but they do exist...
| 0.777778 | 18-Speed IG pinion drive |
How can I learn how to lay out an "evidence scene"? | I feel like I'm particularly bad at any kind of scene where I want to drop clues. I'm hesitant to use the term "crime scene" because it's not always being investigated by "police", and some of these times there isn't any kind of typical evidence.
I'm not even 100% sure that my problem is just the scene, but rather creating enough evidence to begin with. Other aspects I struggle with is witnesses - both witnesses with knowledge, and how to reveal it. Having useless witnesses for flavor, etc. I keep feeling that in general I give too little in these scenes, and everything I give is important.
Since I suspect this is a rather broad problem, I'd like to know if there are any Role Playing resources (sections of books, site, etc) that are specifically geared at teaching this portion of RPG storytelling?
I'm currently playing in the "new" World of Darkness 2.0, but I want answers on this not tied to the game system's rules.
| "Just the facts" just isn't enough
Plan more flavor and context into your scenes, and your story. WoD games often lend themselves to strong thematic overtones, so don't skimp. Small side stories, or a growing tapestry of NPCs can both add a feeling of depth to the play experience. As you write later scene, call back to those "useless" or "flavor" elements from earlier.
These threads don't support the factual investigation story, but they support the emotional investment the players should develop. Recurring NPCs, even if they are unimportant people, are characters the player can start to get attached to, or develop other feelings towards like pity, anger, or curiosity. Less "important" people can also illustrate the human impact of what the antagonist(s) and PCs are doing in the world.
Add enough grit and detail to create a solid emotional journey, and the story will feel more meaty.
More facts don't hurt, either
That said, writing a good story/mystery can be ten times harder for most of us than telling it back during play. I've fallen into the trap of carefully coming up with some scheme for the players to learn about, thinking it was great because I spent so long on it and put so much effort into it. Then, they quickly gobbled it up and were ready for more... that I didn't have!
Try just adding more facets to the story and clue details to found.
| 1 | "Just the facts" isn't enough Plan more context into your scenes and your story |
What does the inspector mean by "Hot and Neutral are not separated"? | In an inspection report on my house, the inspector said "hot and neutral" are not separated. I think he meant "neutral and ground" are not separated. I've attached the picture, is that the case?
| It would help if you told us where you are, and what you are showing us a picture of.
If it's a main panel, neutral and ground and bonded together. If it's a sub-panel, neutral and ground must be kept separate.
| 1 | If it's a main panel, neutral and ground and bonded together |
How can you update the current relative coordinate in TikZ without adding an element? | Is it possible to update the current relative coordinate in TikZ without actually adding anything to the picture? For instance,
\node at ++(1, 0) (node1) {...};
will update the current x coordinate by incrementing it by 1, but how can I do this without actually adding a node? Also, it is possible to increment the position within a loop (i.e. to keep the new value between the iterations)?
| As mentioned by others in the comments, you an use \path to update the current relative position. ++(…) is relative to the last saved position within a particular path, but the start of a path is relative to (0,0). Consider the following example:
\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\node at (0,0) {O};% label the origin
\node at ++(1, 0) [orange] {A};% this is relative to (0,0)
\node at ++(2, 0) [green] {B};% still relative to (0,0)
\path ++(2, 0) ++ (1,0) node [blue] {C};% start relative to (0,0), go to (2,0) and then relative to this end up at (3,0)
\path ++(5,0) ++ (1,0) node [red] {D};
\end{tikzpicture}
\end{document}
The lines starting with \node at ++(1, 0) and \node at ++(2, 0), are both relative to (0,0). The subsequent lines starting with \path ++(2, 0) ... starts the path relative to (0,0), and moves to (2,0), and the subsequent ++ (1,0) is relative to the last point and hence the C is placed at (3,0). Note that that nothing was placed at (2,0) during this path.
Just to be sure, the last \path sets the current coordinate to (5,0) and nothing is added to the picture there, only at (6,0) do we see D.
| 1 | Use path to update current relative position |
Why did they choose Barabbas? | John 19:38 - 40 (NLT)
38 “What is truth?” Pilate asked. Then he went out again to the people
and told them, “He is not guilty of any crime. 39 But you have a
custom of asking me to release one prisoner each year at Passover.
Would you like me to release this ‘King of the Jews’?”
40 But they shouted back, “No! Not this man. We want Barabbas!”
(Barabbas was a revolutionary.)
Why were they so messed up that they would choose the rebellious, murderous Barabbas over the innocent Son of God?
| They were persuaded by the chief priests and elders:
But the chief priests and the elders persuaded the crowd to ask for Barabbas and to have Jesus executed.
Matthew 27:20
They (chief priests and elders) had enormous power over the people since the synagogues and temple were the way people could stay in relations with other people (it was the heart of the community) and, they thought, with God. Perhaps the crowd felt threatened with losing their livelihoods and eternity with God.
But that is speculation - the text simply says that they persuaded the crowd.
| 1 | The chief priests and elders persuaded the crowd to ask for Barabbas and to have Jesus executed |
Litvaks/Yeshivish and Shulchan Aruch | I understand that non-Chasidic (Ashkenaz) haredim follow the Mishnah Berurah when it comes to Orach Chayim part of Shulchan Aruch. But Mishnah Berurah is only for Orach Chayim. What they do with other parts of S"A (Yoreh De'ah, Even Ha-Ezer, Chosen Mishpat) do they just follow Rema or later commentaries printed in standard S"A?
I mean, Chabad Chasidim have S"A Baal HaTanya which contains Yoreh De'ah and Chosen Mishpat.
I can recapitulate my question: do Litvaks/Yeshivish learn Mishnah Berurah and then Shulchan Aruch with commentaries for other parts of halacha?
| Actually the non-Chasidic (Ashkenaz) haredim follow the Shulchan Aruch with the Rema's additions, as do other Ashkenazim.
When more clarification is needed, they (and all frum Jews) will consult the Nosei Keilim (commentaries) printed on the page and the back of the volume.
A deeper understanding of how the Halacha came to be, would require opening the Tur (of which the Shulchan Aruch is essentially a summary) and the Rambam, after learning the relevant Gemara with Rif, Ran and Rosh.
If that fails - or they want a shortcut - they may consult popular classic works that use the Shulchan Aruch as a basis. Popular ones are:
The Mishnah Berura on Orach Chaim
The Aruch Hashulchan on all 4 parts of Shulchan Aruch (with some omissions, some apparently got lost as it was originally published as small booklets.)
The Shulchan Aruch HaRav (from the Ba'al HaTanya)
Alternately - or if the above doesn't solve their specific problem - they will consult compendiums like the Chayei Adam or Kitzur Shulchan Aruch, or more recent works as described in an earlier answer.
Nowadays you can find Sefarim that deal exclusively with almost any topic, and they usually highlight Ashkenazi/Hassidich/Sefardi differences, when they exist.
| 0.777778 | The Shulchan Aruch HaRav (from the Ba'al HaTanya) |
making reusable text object | I want to simulate a multi-agent system with Blender. It's almost done, but I experience a problem.
System agents speak to each other by passing messages, and I want to pass messages between them. I considered a text object as container of these messages. There is no constraint on the number of agents.
I want to create one (or some) text object and reuse it many times, by only changing source and destination locations and body texts.
After some search, I realized, that there is no data_path that supports keyframe_insert() to change the body text. Beside that I found dynamic text, but my context is extremely different with that method's context.
I want to change text on every keyframe, and it depends on my simulation's input.
| An application handler could be used to read subtitle data from your simulation module and display it by editing a text object.
import bpy
from bpy.app.handlers import persistent
@persistent
def frame_change(arg):
print("Load Handler:", bpy.data.filepath)
t = bpy.data.objects["Text"]
# here get the text you want to display
label = ("Frame # %d" % bpy.context.scene.frame_current)
t.data.body = label
bpy.app.handlers.frame_change_pre.append(frame_change)
| 0.777778 | Application handler to read subtitle data from simulation module |
does every right-angled coxeter group have a right-angled artin group as a subgroup of finite index? | I thought that I read a paper making this claim a few months ago, but now I can't find it. If the answer is yes, is there a nice way to go from the presentation of the right-angled coxeter group to a presentation of its right-angled artin subgroup? Thanks.
| You might be thinking of this paper:
Michael W. Davis and Tadeusz Januszkiewicz, Right-angled Artin groups are commensurable with right-angled Coxeter groups, J. Pure Applied Algebra, 153, No. 3 (2000), 229-235.
| 0.777778 | Right-angled Artin groups are commensurable with right-angled Coxeter groups |
Log out user to change home dir and then re login - Linux | I'm trying to change git user's home directory using:
sudo usermod -d /home/git git
However, the response I receive is: "user git is currently logged in".
How can I logout that user, change the home directory and then login it again?
Thanks
| You can edit the account database directly, using vipw. The file format is described in passwd(5).
| 0.888889 | You can edit the account database directly using vipw |
How to track malloc and free? |
Possible Duplicate:
Simple C implementation to track memory malloc/free?
I need to know how much memory I have used till now in a C program and here is the pseudo code
#include <stdio.h>
int usedMemory =0;
void *MyMalloc(int size){
usedMemory = usedMemory +size ;
return malloc(size);
}
void MyFree(void *pointer){
/*****************what should i write here????*************/
}
int main(int argc, char *argv[])
{
char *temp1= (char *)MyMalloc(100);
char *temp2= (char *)MyMalloc(100);
/*......other operations.........*/
MyFree(temp1);
MyFree(temp2);
return 0;
}
Can anyone tell me what to write in the MyFree method(which decrements the amount of memory freed from usedMemory.
| You need to manage a list of all malloc() you have done with pointer + size. Then you can search for the size in that list, and decrement it in free().
Check for example in that example how they are doing:
http://developers.sun.com/solaris/articles/lib_interposers_code.html#malloc_interposer.c
You might have other possibilities to track memory, like:
Valgrind with massif tool for tracking memory usage over time. You can even generate png output graphics
Interposed libraries. You can found some libraries that you can use by LD_PRELOAD=thelib.so ./yourprogram, and they will output some statistics like jemalloc
(A side note, please accept some answers to your question !)
| 0.777778 | How to manage a list of all malloc() with pointer + size? |
SQL Help in Access – Looking for the Absence of Data | I am trying to find the fastest way to find all of the records in a parent table that do not have certain records in a child table. For example, I want the query to return all of the family records where there are no male children or no children at all.
Example 1
This is painfully slow:
SELECT * FROM Families
WHERE Families.FamilyID NOT IN(SELECT FamilyID FROM Children WHERE Children.Gender="m")
Example 2
This is faster:
SELECT * FROM Families
WHERE NOT EXISTS(SELECT * FROM Children WHERE Children.Gender="m" AND Children.FamilyID = Families.FamilyID)
Example 3
This is the fastest, but I'm worried about investing in it because I can't find any documentation on it. I don't even know what it's called. For want of a better term, we have been calling it an "anonymous query".
SELECT * FROM Families
LEFT JOIN
[SELECT * FROM Children WHERE Gender="m"]. AS AliasChildren
ON Families.FamilyID=AliasChildren.FamilyID
WHERE AliasChildren.FamilyID IS NULL
So my question is this:
What is this thing called in example 3?
Is it a "mainstream" feature of Access that
will be supported in the future?
Where can I find documentation on
it (this might be easier once I know what it's called)?
Thanks!
| Example 3 is termed a derived table, but you can simplify the query to this:
SELECT * FROM Families
LEFT JOIN
Children ON Families.FamilyID = Children.FamilyID AND Children.Gender="m"
WHERE Children.FamilyID IS NULL
| 1 | SELECT * FROM Families JOIN Children ON Families.FamilyID |
Why are PSTN lines not encrypted? | While reading this article: Does Skype use encryption?
I came to know that PSTN do not have encryption.
Why it is like that? More so since we have our PSTN phones now more powerful (in terms of hardware) and cheaper. Why not write a encryption application at the transmitter and receiver end?
| Telephones are not encrypted because back in the late 1800s, when telephone systems were being developed, any sort of encryption was far beyond the capability of the hardware, even if it had been something that people would have thought important. Since then, compatibility with existing hardware has been considered more valuable than protection against eavesdropping -- listening in on a PSTN conversation requires physical access to the wires involved, and is difficult for anybody other than the phone company to do.
That said, there are encryption-like devices for telephones known as scramblers, originally developed around the time of World War II. Modern scramblers are every bit as good as other encryption systems.
| 0.888889 | encryption-like devices for telephones known as scramblers are as good as other encryption systems |
Without using dowels, how do I join 2x4s edge to edge to be 1.5" x 7"? | I am trying to join a 2x4 supporting a workbench tabletop to another to make a backsplash of sorts. Any ideas how to do this without dowels? (No, I can't use 2x8)
| Strapping
You could use some form of strapping on the back side.
With this option, you can extend the strapping and use it to attach the whole bit to the workbench.
Bored Holes
You could bore holes on the edge of the top or bottom piece to about half the width of the board, then use screws to fasten the two boards together.
You'll likely want to use a drill press to bore the holes.
Glue
Since it's not going to be structural, you could simply glue the two boards together using wood glue.
Sliding Dovetail
If you want to get real fancy, a sliding dovetail would work.
Though with this joint, you'll loose a bit of overall height.
| 1 | Sliding Dovetail |
Can you use Divine Bond (Weapon) with Magic Weapon Spell? | Can a Paladin use his Divine Bond (Weapon) on a weapon where Magic Weapon has been caste and does this count as a +1 for the purpose of adding a magic weapon feature?
| According to the Pathfinder SRD site,
These bonuses can be added to the weapon, stacking with existing weapon bonuses to a maximum of +5
So you can take the +1 weapon after the Magic Weapon spell, and add up to +4 worth of bonus to it from the Bond. So you won't supercede the bonus until level 17, where I imagine you'll have much better than just a level 1 Magic Weapon spell.
EDIT: I forgot to address the DR question. In which case I reference:
Any weapon with at least a +1 magical enhancement bonus on attack and damage rolls overcomes the damage reduction of these monsters.
Also just to have the full ability written out:
At 5th level, this spirit grants the weapon a +1 enhancement bonus. For every three levels beyond 5th, the weapon gains another +1 enhancement bonus, to a maximum of +6 at 20th level. These bonuses can be added to the weapon, stacking with existing weapon bonuses to a maximum of +5, or they can be used to add any of the following weapon properties: axiomatic, brilliant energy, defending, disruption, flaming, flaming burst, holy, keen, merciful, and speed. Adding these properties consumes an amount of bonus equal to the property's cost (see Table: Melee Weapon Special Abilities). These bonuses are added to any properties the weapon already has, but duplicate abilities do not stack. If the weapon is not magical, at least a +1 enhancement bonus must be added before any other properties can be added.
Therefore, whatever the final +X bonus comes out to be is the DR bypass.
| 0.777778 | Add up to +4 worth of bonus from the Bond |
Story about Big-Brother-like society where everybody wears a controlling wristwatch | A future Big-Brother society where people wore wristwatches which both monitored their movements and kept them informed about their role in society.
I don't remember whether the story was located on Earth or a fictional planet.
The book was read late 60's or early 70's. I only read a small number of authors (max 10) so I would immediately recognise the author's name if the storyline was identified.
Possibilities:
Brian Aldiss,
Piers Anthony,
Isaac Asimov,
Ray Bradbury,
Arthur C. Clarke,
Robert Heinlein,
Frank Herbert,
Ursula K. Le Guin,
Theodore Sturgeon,
Kurt Vonnegut Jr.
What I'm thinking now is how uncannily like the Apple Watch and similar products this was. This is the only story I remember that foresaw the wireless/digital age.
| To me, this sounds somewhat similar to the story "Criminal in Utopia" by Mack Reynolds. (A google search for that title turns up at least one link to the text online, but it isn't clear whether this is legal or not, so the link is not included here.)
| 0.888889 | "Criminal in Utopia" by Mack Reynolds |
Preventing a specific CSS file from getting loaded in Yii | I am coding in Yii.
I have registered the main.css file in my main.php layout file like so :
Yii::app()->clientScript->registerCssFile($this->assetsBase.'/css/main.css');
Now this script is being registered in all the pages. However, say I don't want that script to be registered on a specific page.
I know that using :
Yii::app()->clientScript->reset();
would remove all the CSS files, however I want only few CSS files to be unregistered.
Is there a way to do it?
| I would suggest either:
Using a separate layout for that page like main_no-css.php
or
Adding a condition before registering the script (like if controller != xxx and action != yyy), but this would cause the condition to be checked on every other page.
I would definitely go for a separate layout.
| 1 | Using a separate layout for that page |
Very simple particle filters algorithm (sequential monte carlo method) implementation | I'm interested in the simple algorithm for particles filter given here. It seems very simple but I have no idea on how to do it practically. Any idea on how to implement it (just to better understand how it works) ?
Edit:
This is a great simple example that explain how it works. I've tried to implement it in C++: see my code here, but I'm note sure if I do it the right way. Can you please check if I understood it well, or there are some misunderstanding according to my code ?
| What that sentence means is you should generate $x_t^{(i)}$ from the distribution of $p(x_t|x^{(i)}_{t−1})$.
For an alternative introduction to particle filters I recommend An Overview of Existing Methods and Recent Advances in Sequential Monte Carlo
MATLAB has numerous toolboxes on particle filters. If you are working in C++, here is an implementation you can use to compare your code with.
| 0.777778 | How to generate $x_t(i)$ from distribution of $p |
Forwarding mail to different mail system in Postfix | I have an e-mail server powered by Postfix. Aside from traditional e-mail accounts on my server, I want to maintain some accounts whose only role is to forward all incoming mail to differnet address on different mail system.
For example. I own domain example.com and I set account with address [email protected] on my server. And I want this one account to forward all incoming messages to mailbox in different mail system, in domain that does not belong to me [email protected].
I know, that i can add an entry in in my virtual_alias_maps lookup table.
[email protected] [email protected]
But I'm worried that to deliver message, Postfix will use original envelope sender address. It's okay if sender is from domain example.com that belongs to me, but otherwise stranger.net server may classify this message as a spam.
Is there some way, to alter envelope sender on delivery ?
Are smtp_generic_maps ment for this ?
If so, is it okay, that my server sends an e-mail using specific envelope sender, and then something else in message being forwarded ?
How else to deal with such problem ?
| Your concern was valid because the existence of SPF checker. If
you forward an email comes from a domain with proper SPF record
your IP doesn't listed in their sender SPF record
the receiver use SPF record as a factor to identifying spam
then yes, you may have error message SPF fail and the email end up in Spam Folder.
SPF community acknowledge this problem, and they propose Sender Rewriting Scheme (SRS) to workaround this problem. Basically it will rewrite the original sender domain to your domain before forwarding it alias address. For postfix, you can use postsrsd (Postfix Sender Rewriting Scheme daemon) by roehling to implement SRS.
| 0.888889 | Sender Rewriting Scheme (SRS) |
Using a time to set XY chart axis scaling as in Excel 2003 | In Excel 2003, when you created a XY chart using time as an axis, you could set the scaling of the axis by typing in the date. In Excel 2007, you have to use the decimal version of the time (eg. How many days since some arbitrary earlier date).
A developer posted on a blog that this issue would be fixed in a future release, but all versions of Excel 2007 I have tried have not resolved this issue. The relevant quote:
Those of you familiar with this technique of converting time to a decimal may recall that Excel 2003 allowed you to enter a date and time like “1/1/07 11:00 AM” directly in the axis option min/max fields and Excel would calculate the appropriate decimal representation. This currently does not work in Excel 2007 but will be fixed in a subsequent release.
I was wondering if there was a way to avoid having to make such a calculation?
| I have just copied the data from that blog post into Excel 2010, and typing 11:00 and 17:00 as the minimum and maximum for the x-axis, does gives an axis running between those times as one would expect.
| 0.888889 | x-axis axis running between the times as one would expect |
How much of the English language comes from each of its influences? | I was watching a video linked in this answer and it made the following claim:
[...] like most words in English is derived from German.
That got me thinking. While I know that Germanic languages have greatly influenced English, so have the Latin and Celtic ones (and various others to a greater or lesser degree). Is it true that more than 50% of the English vocabulary is derived from Germanic roots?
More generally, can someone point me to data on this? I imagine attempts have been made to quantify the contribution of different languages to English; what were the results? What percentage of the language comes from each source?
Ideally I would like to see this expressed in terms of % of words but I am aware that, at least to some linguists, attempting to quantify vocabulary is anathema (to give a simple reason, all languages that allow number construction have an infinite vocabulary by definition), so alternative approaches to quantifying this are also welcome.
| The question is: Is the English language a Germanic or Romance language, and what criteria will you use to determine the answer? One could argue that the History of England is similar to that of. the other five Romance languages in that the Romans conquered France, Spain, Portugal, Romania, and Italy. The presence of the Romans in England lasted approx. 400 years. Then the French invaded and they added many new words. The scientific revolution added also. Therefore, if the preponderance of the words are derived from Latin and uses the above comments, the conclusion is: that English is a Romance language.
| 1 | Is the English language a Germanic or Romance language? |
Can an untapped creature "become untapped?" | If an untapped creature is targeted with an "untap target creature" spell or ability, will it be considered becoming untapped?
| No. There must be a transition. As per the English definition, "to become untapped" is "to begin to be untapped".
In fact, the ability you mentioned won't even try to untap it. It's impossible untap a permanent that's already untapped. That's why you can't activate an ability with the untap symbol ({Q}) in its cost if the source of the ability is already untapped.
Similarly, it's impossible to tap a permanent that's already tapped. That's why you can't activate an ability with the tap symbol ({T}) in its cost if the source of the ability is already tapped.
This wouldn't stop you from casting a spell that would try to do these impossible actions. The spell will simply do as much as possible, and skip over the impossible instruction. e.g. Gerrad's Command on an untapped creature would effectively become "Target creature gets +3/+3 until end of turn.", and Crippling Chill on tapped creature would effectively become "Target creature doesn't untap during its controller's next untap step."
| 0.888889 | "to become untapped" is "to begin to be untapped". |
Solubility, pressure and Henry's law | Im trying to do my chem homework and I'm stumped.
Determine the solubility of $\ce{N2}$ in water exposed to air at 25°C, if the
atmospheric pressure is 1.2 atm, assume that the mole fraction of
nitrogen is 0.78 in air and the Henry's Law constant for nitrogen in
water at this temperature is $6.1 × 10^{-4} M/atm$.
I have the answer, but i want to know how to solve for it. I've been reading through my notes and the book trying to find a reference through which to approach this problem and i have found none. If anyone can guide me in the right direction that would suffice
| Henry's law is given by the formula $p$=$K_h$$x$. Here $p$ is partial pressure of the gas $K_h$ is henry's constant for that gas and $x$ is mole fraction.Using this you can find it.
| 0.888889 | Henry's law is given by the formula $p$=$K_h$$x$ |
What should I look for in a recording microphone for personal use? | I was browsing through mics on Amazon and quickly realized I was out of my depth. There are a couple closely related questions I am wondering about:
Are there different types of mics for (1) singing into at a concert, (2) singing into in a quiet room, and (3) picking up sound at more of a distance (e.g., singing and playing guitar and having both recorded with the one mic)? What are they?
I'm most interested in a mic for case (3). This is obviously not professional, I just want something with passable quality and not too much noise considering I'll be in a random room in a house or apartment. What kind of things should I look for in a mic to achieve that? What are the factors that most depend on price? (If it's feasible I'd like to try to fit it into my $50 contest reward.)
There are a few terms I saw like "moving coil", "condenser", and "dynamic" that I saw used to describe mics. If you could touch on these and any other relevant terminology that would be awesome.
| Guitar-and-vocal studio and live micing has been studied heavily, yet while there are a lot of recommendations, perhaps the foremost among them is "experiment". Now, that advice is generally aimed at the professional recording engineer or home studio enthusiast, with a locker full of microphones to choose from. Someone looking to buy their first mike, like yourself, is going to need a good way forward, so the mikes you buy will be well-suited to the task.
Probably the most common technique for studio recording of a guitar, because it's very simple, is to take one large-diaphragm side-address cardioid condenser microphone, like an AT4040 (about $300, well-known and respected among pros), and position it between 6 inches and a foot away from the guitar, pointed somewhere between the neck/body joint and the octave marker on the fretboard:
This is a single "close-mic" approach; it'll get you a bit of everything, from the actual strings' brightness to the deep resonance of the body chamber, to the sounds of you actually playing the thing, moving your hands and fingers around. You can experiment with exactly where the mic is; in the image, it's moved up in the direction of the neck, but still pointed at the neck/body joint. This gets the mic out of the way of the performer and anyone who may be watching his hands.
You can do the same thing with a small-diaphragm condenser as well, but the large-diaphragm will be more sensitive, so you can back it away and reduce the proximity effect and the amount of string noise, while still getting a sound that fills your ear instead of sounding like the microphone's all the way across the room.
Another very common technique is the XY-pair. This approach is designed to mimic the way your ears would hear the guitar if you stood in front of it. Same basic placement, but instead of one large-diaphragm condenser, use two small-diaphragm "cigar mikes", like Rode NT5s ($430 for a matched pair; generally well-liked in their price range though there are many others to choose from), arranged at 90* to each other and 45* offset from whatever you're pointing it at:
This arrangement is the most straightforward way to get a stereo recording of just about anything; one mike is your left ear, the other is your right, and there will be a natural amount of crossover between the two, which you can play with using the channels' pan knobs on the mixer to create a "wide" ("left" mic panned hard left, "right" mic panned hard right) or "narrow" ( both mics close to center) stereo image.
The nice thing about either of these setups is that these mikes are just as good for the human voice as they are for guitar; they need to capture all the same frequencies in about the same overall balance, at about the same dynamic levels. So, once you have the mikes positioned well for the guitar, just start singing, and make minute adjustments as needed to get more or less of your voice.
You can provide another condenser of just about any type (side-address, handheld, cigar) specifically for vocals. However, caveat soundman; first, the more mikes you have, the more effort you spend and the less success you have isolating their sound sources (the vocal mike will pick up some guitar and the guitar mike will pick up some vocals). Second, more mikes == more $$$. I'm recommending mikes that are expensive but a good value; you want these mikes, and not their cheaper lookalikes, but the money will mean that you get fewer of them, so I'm encouraging you to use fewer mikes for more purposes, instead of buying a cheap-sounding mike to point at everything you might ever want to record separately.
There are other, slightly more esoteric setups for micing. You may hear of the "mid-side" setup; it's one cardioid cigar mike pointed at the neck joint, with a second side-address mic with a "figure-8" pattern right underneath or behind it, with the travel of the diaphragm positioned parallel to the fretboard. The figure-8 pattern mic's signal is then split into two channels, one out-of-phase with the other, and when you bring it all back together in the mixer, the result is a stereo image that you can "narrow" or "widen" by adjusting the out-of-phase channel's fader. Other setups find "sweet spots" on the surface of the guitar's soundboard and close-mic them with cigar mikes, or seek to capture what the guitarist hears from his/her instrument with an "over-the-shoulder" mic (hey, if the guitar didn't sound good to you while you played it in the store, you wouldn't have bought it, right?), all very similar to approaches seen for other instruments.
Exactly what you want to do will determine the mics you will want to use to do it. Personally, I would go with a pair of cigar mikes, because they're extremely versatile; they can go places a larger mike can't, and you can point them at almost anything and get a good sound. Most of the common mic setups use at least one cigar mic. In addition, they're commonly used for all sorts of acoustic instrument recording, from guitars to solo strings and winds, and they also work well for drums.
The side-address condenser would have many of the same purposes, but with only one mic, you're recording in mono; however, that same single mike would be better than the cigar mikes for solo voice in a studio environment, and many side-address mikes can be set to different response patterns such as cardioid, figure-8 or omni. So, if you want one single do-it-all for home recording, I'd choose a side-address.
Now, for live amplification, these same techniques won't be as useful; they may still work if you're careful, but a sensitive studio condenser mic will start giving you problems when you put it in the same room as the speakers hooked up to the mixer. Such is the nature of live sound; your subject is no longer sitting in an isolated, reverb-dampened booth, but on an open stage, with main and monitor speakers, and the walls of the venue, sending his sound right back at him. In these situations, usually a sound engineer's primary concern is getting the volume he needs out of the mains without feedback, and that means rejecting "off-axis" sound sources using narrower mic response patterns like cardioid/supercardioid, or less sensitive microphones like dynamic mikes or small-diaphragm condensers as compared to side-address mikes.
| 1 | Guitar-and-vocal studio and live micing is the most common technique for recording a guitar |
Can a malfunctioning relay in an amp cause or allow a speaker to crackle when turning the vol potentiometer? | Ok, so this question has several layers, I admit it.
I recently acquired a Lepai 2020A+ amp. It is, I believe, the latest version PCB because it has the two relays for speaker protection instead of just the one.
I'm new to electronics, so please excuse my total lack of knowledge.
What I understand is that the function of these relays is to delay the power output to the speakers when the device is turned on; to avoid any pop that may damage the former. It may also work when turning off the device, to avoid a thump... but of this I'm not sure. It's a cheap amp with cheap components.
Anyway, I received it and I noticed the left channel had a slight crackle when I turned the vol pot. It started right when I brought it out of 0 percent. But then it started crackling at around 20, then 50. I assumed it was rust or just the protective film flaking off of the cheap pot. So I sprayed it with some contact cleaner. After much caring for it, I've been able to reduce the crackling back to the original crackling I heard when I first turned the pot. If the amp has been off several hours, then it will slightly crackle when turning the pot up from 0. If I turn the pot a couple of times before turning on the device, then there's no audible issue.
All the time, this is only happening on the left channel. The right one is 100 percent clean. Other than this, the amp works as expected.
However, the other day the amp was off and I turned the pot and heard a slight crackle. I did notice, when I first received the amp through the mail, that if turned off and disconnected, the circuit still retains some power: first thing I did; right out of the box, I switched it on without connecting it and that intensely unnerving blue light the Lepai has around the vol control came on and fade off for a couple of seconds.
So I'm still trying to make sense of this issue. Trying to know if it's a faulty, old pot that's seeing its last days on the left channel and, therefore, I should just invest in a better pot and change it (because the rest of the amp modestly rocks) or if it's more complicated than that... perhaps an issue with the left channel relay, etc., and I'd better change the device entirely.
I probably am shooting way off the mark here but the first thing I thought when I heard that crackle when the amp was off was that perhaps the speaker-protection relay for the left channel is not working. But does a relay like this only work during on and off? Or does it still work throughout the process? And, if so, does it have the ability to "filter" these noises?
I'm thinking that even if some "filter" component (not necessarily the relay; if any of you knows the Lepai maybe you know if it has any filter incorporated) is not working like it should, that horrible noise must be coming from the vol pot. Am I wrong to think that? And to think that if the right channel is completely clean, then it must be an issue with the side of the pot that outputs to the left channel?
And finally, could this noise be digital and coming from deeper in the circuitry or does it necessarily have to be analog and coming from the pot?
I know this is a layered question but I've been looking for individual answers all over the net and can't find any, so I'm hoping somebody out there can help me out by guiding me into electronics though this, my first mod project.
Thanks a lot in advance!
| In addition to a possibly dud pot, it can be caused by DC applied across the pot, possibly from a leaky coupling capacitor. Measure the DC voltage across each channel of the pot - you may find the noisy channel has some DC while the other channel has much less or none.
DC in the presence of slight variations in the track resistance will generate intermittent AC signals as you adjust the volume, which sound like crackles or thumps.
| 0.666667 | DC in the presence of slight variations in the track resistance |
Reflection across the plane | Let $T: \Bbb R^3 \rightarrow \Bbb R^3$ be the linear transformation given by reflecting across the plane $S=\{x:-x_1+x_2+x_3=0\}$ (...)
Then, $S=\gen[(1,1,0),(1,0,1)]\$
But how can I get the matrix $R_v$ such that reflects across $S$?
Thanks!
| The matrix that reflects across the plane through the origin with unit normal $\mathbf{N} = (a,b,c)$ is:
$$
\mathbf{I} - 2\mathbf{N}^T\mathbf{N} =
\begin{bmatrix}
{1- 2a^2} & {-2ab} & {-2ac} \\
{-2ab} & {1-2b^2} & {-2bc} \\
{-2ac} & {-2bc} & {1-2c^2}
\end{bmatrix}
$$
See here for reference. A normal of your plane is $\mathbf{N} = (-1,1,1)$, so plug in $a=-1/\sqrt{3}$, $b=1\sqrt{3}$, $c=1\sqrt{3}$.
| 0.777778 | A normal of your plane is $mathbfN = (-1,1,1)$ |
SCCM - what is required to prepare an installer | I've been asked by a client if it is possible to prepare our product for deployment via SSCM. Currently we produce an msi installer; is that what SCCM would need or do we need to do something to the msi package to make it SCCM friendly?
| They're most likely asking you to make sure your product can be installed without any user interaction required. Since it's already an msi, you've got nothing to worry about unless you've done a very poor job at making the msi and included custom actions that popup separate dialogs that can't be turned off.
Basically, if you can install your msi with silent options like /qn or /qb and not be required to touch it before it's done installing, you're golden.
*Edit: I just thought of another caveat. If your application requires activation, ideally that activation should have the option of being included as part of the install process. At a worst case, it should at least be doable by limited-rights end-users. Essentially, everything that your application needs elevated access to do should have the ability to be automated during the install process.
| 1 | Installing an msi without any user interaction |
lxc-create hangs and finally fails | I was trying to place some juju charms on linux containers and the containers failed to start. To debug the issue I sshed into the node where this happened and tried creating an LXC container manually like
ubuntu@slot13:~$ sudo lxc-create -t ubuntu -n pavan
Checking cache download in /var/cache/lxc/trusty/rootfs-amd64 ...
Installing packages in template: ssh,vim,language-pack-en
Downloading ubuntu trusty minimal ...
I: Retrieving Release
It isn't making any progress at all. Its stuck here for a long long time. After a really long time it says,
ERROR: Unable to fetch GPG key from keyserver
and continues to hang. Finally after 20-30 mins, it gives up like
E: Failed getting release file http://archive.ubuntu.com/ubuntu/dists/trusty/Release
Where are the log files corresponding to lxc-create command? How can I debug this issue?
EDIT: I figured out how to see the debug logs and hence ran the below command a few times
sudo lxc-create -t ubuntu -n pavan --logfile=test.txt --logpriority=DEBUG
test.txt contains only this
lxc-create 1414897265.204 ERROR lxc_container - Error: pavan creation was not completed
lxc-create 1414897407.757 ERROR lxc_container - Error: pavan creation was not completed
lxc-create 1414897407.759 WARN lxc_log - lxc_log_init called with log already initialized
But still it hangs and the debug logs aren't offering much help.
| Actually juju uses the 'ubuntu-cloud' template to grab an image, the command executed to create the template in my system running trusty is:
lxc-create -n juju-trusty-lxc-template \
-t ubuntu-cloud \
-f /var/lib/juju/containers/juju-trusty-lxc-template/lxc.conf \
-- --debug \
--userdata /var/lib/juju/containers/juju-trusty-lxc-template/cloud-init \
--hostid juju-trusty-lxc-template
-r trusty
I suggest you to run something like that and see what error gives you.
| 0.333333 | juju uses the 'ubuntu-cloud' template to grab an image |
How can I organise photos on a network storage device, and what software can help me? | I have a recently bought a NAS and am in the process of transferring my photo collection onto it. I probably have over 300GB of pictures (many in various RAW formats). At the moment these are just organized in “old fashioned” file structures but I have am hoping to improve this to a some sort of cross referenced tagging system. So far though I am running into a few problems and any help would be appreciated. I have tried using the following software:
Windows photo gallery - and this appears to rapidly retrieve photos from the NAS based on chose tag words. The main down side that I have found so far is that the windows camera codec does not yet support my S95 RAW files and so they are not visible.
Picasa – this looks as though it might work well on a local drive (and certainly get good reviews) but I am finding it very slow when scanning the photo library on the NAS (even when left for a number of hours the scan in only approx. 5% complete!). I can live with a bit of a delay when using the NAS but this is unworkable - am I getting something wrong?
Various other photo viewers - Although they allow me to see my RAW files do not appear to support tagging and the development of a cross referenced library.
I am also considering looking at getting Lightroom but don’t want to shell out the money only to find it is as slow as Picasa.
Finally, my ideal would be to have different layers of tags so for example I could tag all my pictures from the “Lake District” but then also have the option of sub dividing within this category based on the valley etc. Without different levels of tagging I risk winding up with an unwieldy list of tag words. I do not know if this is possible/normal but if anyone has any points about what software packages support this arrangement that would also be appreciated.
| For Linux users, I would recommend Digikam. http://www.digikam.org
works with NAS
Tag support is great.
Raw is supported. After having used it for a while, I'd say it is okay but not the best. (I don't like that I don't get instant preview.)
| 1 | Digikam works with NAS Tag support. |
Weil's Riemann Hypothesis for dummies? | Weil's Riemann Hypothesis is a deep result that I don't fully understand, but it has understandable corollaries which interest me. For example:
(a) For any projective curve $X$ satisfying certain conditions, the number $N$ of points in $X$ with coordinates in $\mathrm{GF}(q)$ satisfies $|N-(q+1)|\leq\mathrm{const}\cdot\sqrt{q}$. (The deviation is $0$ when $X$ is a projective line.)
(b) For any nontrivial multiplicative character $\chi$ on $\mathrm{GF}(q)$ and any polynomial $f$ of degree $n$ satisfying certain conditions, we have
$$\bigg|\sum_{x\in\mathrm{GF}(q)}\chi(f(x))\bigg|\leq(n-1)\sqrt{q}.$$
Questions:
Is there a reference (legible to an English-speaking non-expert in the field) which gives the rigorous statements of these corollaries? In particular, I would like conditions which one can verify without a background in algebraic geometry.
Are there other corollaries of Weil's Riemann Hypothesis which are also widely understandable? EDIT: I'm mostly interested in the Riemann Hypothesis, but I'm also happy to learn understandable consequences of the other Weil conjectures and related results.
| Here are the statements from Schmidt's book (as pointed to in my comment).
(a) Suppose $f(x,y)$ is a polynomial of total degree $d$, with coefficients in the field of $q$ elements and with $N$ zeros with coordinates in that field. Suppose $f(x,y)$ is absolutely irreducible, that is, irreducible not only over the field of $q$ elements, but also over every algebraic extension thereof. Then $$|N-q|\le2g\sqrt q+c_1(d)$$ where $g$ is the genus of the curve $f(x,y)=0$.
I am not up to explaining "genus" without algebraic geometry, but it is known that $g\le(d-1)(d-2)/2$, so if you are willing to settle for $$|N-q|\le(d-1)(d-2)\sqrt q+c_1(d)$$ then I think you have what you are after.
(b) Let $\chi$ be a multiplicative character of order $d>1$. Suppose that $f(x)$, a polynomial in one variable over the field of $q$ elements, has $m$ distinct zeros, and is not a $d$th power. Then $$\Bigl|\sum_{x\in{\bf F}_q}\chi(f(x))\Bigr|\le(m-1)\sqrt q$$
| 1 | Suppose $f(x,y)$ is a polynomial of total degree $d$ . |
LINQ with Group, Join and Where Easy in SQL not in LINQ? | I have trouble understand how to translate SQL into LINQ. I would like to do the following but can't figure out how to get the Group By to work
var query = from s in Supplier
join o in Offers on s.Supp_ID equals o.Supp_ID
join p in Product on o.Prod_ID equals p.Prod_ID
where s.City == "Chicago"
group s by s.City into Results
select new { Name = Results.Name };
I just need to do something simple like display the product name of this simple query, how does the group by work with joins and a where?
| You could try this:
var query = from s in Supplier
join o in Offers on s.Supp_ID equals o.Supp_ID
join p in Product on o.Prod_ID equals p.Prod_ID
where s.City == "Chicago"
group s
by new {s.City, s.Name} //added this
into Results
select new { Name = Results.Key.Name };
| 0.666667 | var query = from s in Supplier join o in Offers on s.Supp_ID equals o. |
How does OpenDNS work? | Looking at signing up for http://www.opendns.com/start/ but was hoping someone who has used it can shed some light.
Basically, where privacy is concered, OpenDNS will know each and every website you go to correct?
Do they have access to all the data that is transfered also or just the domain/ip's you visit?
| DNS is a little like a phone book - you use it for lookups, but your data does not pass through them. So it would just be the latter. There's a load of decent public DNS servers as an alternative, or you could run our own- the main advantage of OpenDNS is their filtering system IMO
| 1 | OpenDNS filtering system IMO |
Good travel games for two players, especially for playing on trains? | I would be interested to hear if anyone had recommendations for 2-player games that are particularly suitable for playing while travelling on trains. (I ask this as someone who mostly enjoys games like Carcassonne, Power Grid, Agricola, Pandemic, etc. around the table at home.) To be specific, the things that I think are important properties for these games are:
Needing minimal table space. Most trains have a small table you could use, but not much more.
Being quiet to play, so that other passengers won't be disturbed. For example, I imagine that games that involve repeatedly rolling dice wouldn't be appreciated.
Packing down small, so that they don't take up much luggage space.
Not requiring batteries or a power socket. (I appreciate that an iPhone or a Nintendo DS for each player might be a good solution more generally, but it's not what I'm after in this case.)
Not being so delicate to arrange that motion from the train will unduly disrupt the play.
I think it would be best to recommend one game (or class of games) per answer, if that's appropriate, and explain why you think it's particularly suitable. (Incidentally, I've read the guidance on good questions about game recommendations and hope this question meets the criteria.)
Update: Thanks for so many excellent suggestions - we certainly won't be short of games for our next long train journey :)
Update 2: Unfortunately, I can't really playtest this many great games in any reasonable time period, so I'm going to accept the top-voted answer (Cribbage) and try out the others as soon as I can. Thanks again...
| blokus
I haven't been on a ton of trains, but blokus should meet your requirements pretty well. The pieces stay well enough on the board you should be fine even with a bumpier ride.
| 1 | blokus should meet your requirements pretty well |
Should I use cement board or green board behind the walls of a neo angle shower? | I purchased a neo angle shower and I am installing it on the second floor of my house. I have the pan down and I am ready to drywall. which is safer to use, cement board or green board behind the shower panels?
| Always use cement board in a wet area. Green board in the rest of the bathroom.
If you're using plastic or fiberglass panels you can use green board, but I would paint it with a waterproof membrane to insure the longevity.
You can search on the internet for names of membranes
| 1 | Always use cement board in the bathroom |
What does "flattens" mean in this context? | I have an assignment for Programming Fundamentals (we are using Python 3.4), and some questions are sometimes not really obvious to understand, maybe because my English is not so good.
Two of the introductory questions of our last assignment were:
Write a function that “flattens” its input list.
Write a function that accepts a list that contains nested lists and returns the “depth”
of the list.
Sincerely I am not understanding exactly what they are asking. Can someone explain me?
| Guessing a bit, as I'm not a programmer...
"Flatten the list"
Two possibilities, so I would really check with the test setter...
Empty the list, ready to start the task (most likely)
Take the nested lists & concatenate them into one list (less likely)
"depth of the list"
Again, I see two possibilities & I have no idea as to which may be more appropriate ...
Calculate the total number of list lines, including all nested lists
Calculate the number of levels used in the nesting.
A coder might know better.
| 1 | "Flatten the list" |
How to construct a closed, filled, path made of semi-circles and attach annotations to it with TikZ? | I have very limited LaTeX knowledge. I am trying to plot the following figure using "tikz" and I appreciate if anyone can help me to finish plotting my figure. I did the following so far:
\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\draw (0,0) arc (0:180:6);
\draw (-12,0) - -(0,0);
\draw (-8,0) arc (0:180:2);
\draw (0,0) arc (0:180:4);
\draw (-6,-0.1) - - (-6,0.1);
\end{tikzpicture}
\end{document}
There is a BIG semi-circle and two inner SMALL semi-circles. I want to label the right endpoint of the BIG semi-circle by "A" and the left endpoint of the BIG semi-circle by "B". I want to label the center of the BIG semi-circle by "O", and I want to label the point where the two SMALL semicircles meet by "P". I also want to shade the area inside the BIG semi-circle and outside the two SMALL semi-circles. I also want to mention on the figure that the radius of the big circle is: 6. and the distance between the point "O" and the point "P" is "x"
Any help is much appreciated
| Here is a quick attempt:
\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\draw[fill=blue] (0,0)node[below]{$A$} arc (0:180:6) node[below]{$B$};
\draw (-12,0) - -(0,0);
\draw[fill=white] (-8,0) arc (0:180:2);
\draw[fill=white] (0,0) arc (0:180:4)node[below]{$P$};
\draw (-6,-0.1) -- node[below]{$O$} (-6,0.1);
\draw[<->](-8,-0.6)--node[below]{$x$}(-6,-0.6);
\draw[<->](-6,-0.6)--node[below]{$6$}(0,-0.6);
\end{tikzpicture}
\end{document}
This produces:
Note that colouring/filling is cumulative: you can fill one region with a colour and then fill another overlapping region with a different colour, or white to remove the colour. The last colour in any given region wins.
| 0.777778 | usepackagetikzpicture enddocument |
What is it called when a music has two concurrent tempos | I've recently watched a BBC documentary about the history of music and recall an episode where they talk about music that has two distinct tempos (and possibly time signatures) at the same time for different sets of instruments.
Still, I can't remember how this is called and who are the famous composers that composed that way (Stravinsky?).
| There is both polymeter and polyrhythm.
Polymeter is sometimes referred to as "tactus-preserving polymeter." The measure size differs, the beat is the same. Since the beat is the same, the various meters eventually agree.
https://en.wikipedia.org/wiki/Meter_%28music%29#Polymeter
A good example of polymeter is the Tala which is an extream form of complex time.
Polyrhythm is the simultaneous use of two or more conflicting rhythms, that are not readily perceived as deriving from one another, or as simple manifestations of the same meter. The rhythmic conflict may be the basis of an entire piece of music (cross-rhythm), or a momentary disruption. Polyrhythms can be distinguished from irrational rhythms, which can occur within the context of a single part; polyrhythms require at least two rhythms to be played concurrently, one of which is typically an irrational rhythm.
https://en.wikipedia.org/wiki/Polyrhythm
Commonly used in modren Jazz. See: Mongo Santamaria and Elvin Jones.
| 1 | Polymeter and polyrhythm |
The deceitful spirit sent by God |
1 Kings 22:19-28
19 Micaiah continued, “Therefore hear the word of the Lord: I saw the Lord sitting on his throne with all the multitudes of heaven standing around him on his right and on his left. 20 And the Lord said, ‘Who will entice Ahab into attacking Ramoth Gilead and going to his death there?’
“One suggested this, and another that. 21 Finally, a spirit came forward, stood before the Lord and said, ‘I will entice him.’
22 “‘By what means?’ the Lord asked.
“‘I will go out and be a deceiving spirit in the mouths of all his prophets,’ he said.
“‘You will succeed in enticing him,’ said the Lord. ‘Go and do it.’
23 “So now the Lord has put a deceiving spirit in the mouths of all these prophets of yours. The Lord has decreed disaster for you.”
24 Then Zedekiah son of Kenaanah went up and slapped Micaiah in the face. “Which way did the spirit from[a] the Lord go when he went from me to speak to you?” he asked.
25 Micaiah replied, “You will find out on the day you go to hide in an inner room.”
26 The king of Israel then ordered, “Take Micaiah and send him back to Amon the ruler of the city and to Joash the king’s son 27 and say, ‘This is what the king says: Put this fellow in prison and give him nothing but bread and water until I return safely.’”
28 Micaiah declared, “If you ever return safely, the Lord has not spoken through me.” Then he added, “Mark my words, all you people!”
So God sends a spirit enticing Ahab in order to attack Ramoth Gilead. If I may dare ask, why does God feel the need to send a deceiving spirit? Would this not go against the Commandments God has given? And why was such a spirit even within the close proximity in the presence of the Lord in the first place? I wish to know how to reconciling this text with others.
| The deceitful spirit sent by God. God wraps himself in darkness.
Then Solomon said, "The LORD has said that he would dwell in a dark cloud (1 Kings 8:12, 2 Chronicles 6:1)
So God sends a spirit enticing Ahab in order to attack Ramoth Gilead. God has also sent Satan.
The Lord said to Satan, “Very well, then, everything he has is in your power, but on the man himself do not lay a finger.” Then Satan went out from the presence of the Lord. (Job 1:12)
If I may dare ask, why does God feel the need to send a deceiving spirit? Notice the deceiving spirit asked. (Ref: 1 Kings 22:21). You must also understand a spirit is a personality. So he has given the prophets a desire to lie. We are faced with temptations to prove to God that we are true.
Would this not go against the Commandments God has given? No.
And why was such a spirit even within the close proximity in the presence of the Lord in the first place? Notice God invited the answer. (Ref: 1 Kings 22:20)
I wish to know how to reconciling this text with others. Hope the others are soon reconciled.
| 1 | Why was such a spirit even within the close proximity in the presence of the Lord? |
What's wrong with my launchctl config? | I'm trying to auto-run SickBeard on login
python /Applications/Sick-Beard/Sickbeard.py
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC -//Apple Computer//DTD PLIST 1.0//EN http://www.apple.com/DTDs/PropertyList-1.0.dtd >
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.sickbeard.sickbeard</string>
<key>ProgramArguments</key>
<array>
<string>/usr/bin/python</string>
<string>/Applications/Sick-Beard/SickBeard.py</string>
<string>-q</string>
<string>-d</string>
</array>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>
When I run launchctl com.sickbeard.sickbeard.plist it gives me the message:
launchctl load com.sickbeard.sickbeard.plist launchctl: no plist was
returned for: com.sickbeard.sickbeard.plist launchctl: no plist was
returned for: com.sickbeard.sickbeard.plist nothing found to load
| As I discovered the hard way, you must execute the command using sudo as well as passing the full path of the .plist file as follows (in your case):
sudo launchctl load /Library/LaunchDaemons/com.sickbeard.sickbeard.plist
The path may be different for you, but you must locate the file to find out its location and pass it as I quoted to the launchctl command.
| 0.888889 | sudo launchctl load /Library/LaunchDaemons |
Adding lines to /etc/profile with puppet? | I use puppet to install a current JDK and tomcat.
package {
[ "openjdk-6-jdk", "openjdk-6-doc", "openjdk-6-jre",
"tomcat6", "tomcat6-admin", "tomcat6-common", "tomcat6-docs",
"tomcat6-user" ]:
ensure => present,
}
Now I'd like to add
JAVA_HOME="/usr/lib/java"
export JAVA_HOME
to /etc/profile, just to get this out of the way. I haven't found a straightforward answer in the docs, yet. Is there a recommended way to do this?
In general, how do I tell puppet to place this file there or modify that file? I'm using puppet for a single node (in standalone mode) just to try it out and to keep a log of the server setup.
| Add a file to /etc/profile.d/ with the suffix .sh. It will be sourced as part of /etc/profile in Red Hat and Debian and derivatives, can't say on other distros. Generally speaking, if at all possible, it's better to add snippets rather than replace distributed files as it tends to be more future safe.
So in puppet, the following would do:
file { "/etc/profile.d/set_java_home.sh":
ensure => present,
source => ...[whatever's appropriate for your setup]...,
...
}
This what you're looking for or do you need more detail?
| 0.888889 | Add a file to /etc/profile.d/ with the suffix .sh |
How do I install mupen64plus? | I'm new to Ubuntu and Linux and I just downloaded mupen64plus 1.99.5 and it came as a *.tar.gz file. I found some guides about how to install a .tar.gz file with the terminal but it doesn't work. How can I install it?
| You can install it from the Ubuntu Software Center by clicking the button below:
You can then open a terminal via Ctrl-Alt-T and run it by typing mupen64plus and then the name of the ROM you want to run. See the manpage for the instructions.
| 0.833333 | Install Ubuntu from the Ubuntu Software Center |
grails run-app throws NoClassDefFoundError for domain class | I'm trying to run a Grails app inherited from another developer. It has just one domain class, which we'll call foopackage.DomainObject. When I compile it, a .class file turns up in target/classes just as I'd expect. However, when I try grails run-app, I get
org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'pluginManager' defined in ServletContext
resource [/WEB-INF/applicationContext.xml]: Invocation of init method
failed; nested exception is java.lang.NoClassDefFoundError: Could not
initialize class foopackage.DomainObject
At first I thought this might be because DomainObject was trying to talk to a nonexistent database in a broken static initializer, so I reduced it down to just
package foopackage
class DomainObject {}
And I still get the same error. Maybe there's some underlying configuration/GORM problem, but it's not showing up with --stacktrace. Any hints?
| All right, it turns out it was the static initializer after all, and when I thought I'd ruled that out I was editing the wrong file.
| 0.888889 | Editing the wrong initializer |
event horizons are untraversable by observers far from the collapse? | Consider this a followup question of this one
In the classical schwarszchild solution with an eternal black hole, the user falls through the event horizon in finite local time, but this event does take place for distant observers in the infinite future. As Leonard Susskind explains, measurements of objects near the horizon are subject to large uncertainties, since all the radiation used to see them is largely red-shifted and received in increasingly large intervals in the future. This is why in some still vaguely defined sense, the effective event horizon grows, even if no matter has actually yet crossed the original event horizon (the stable event horizon after the black hole collapse period)
But when the event horizon radiates, the event horizon must recede faster than any infalling observer. Any infalling matter will probably be still stir-fried by the hawking radiation over the eons the evaporation takes (which in the observer frame is intensely blue shifted). The only matter that ever gets to be inside the formal event horizon (not the effective horizon) before the final evaporation is the matter that was already in the original collapsing star, around which the event horizon formed
Is there still any room to say otherwise? can still be argued that matter will fall in the event horizon in finite time for distant observers (faster than the evaporation will shrink the event horizon)?
| It's key to remember that the observer outside of the black hole will never see you fall into the black hole. However, this observer can jump into the black hole himself, and see what happened to you. Outside of the black hole, since he is unable to receive light signals from you, he may say that you have stopped at the event horizon. But since he can go in and see you (assuming you haven't been crushed by the singularity yet), it is a matter of philosophy of whether the infalling observer actually fell in or if he 'froze' at the event horizon.
Analogy: If you are accelerating in a rocket, you don't have to believe that time on earth slowed to a stop corresponding to your Rindler horizon. If you wish, you can conclude no such thing. However, it is indisputable that no signals from earth past a certain time will reach you as long as you continue accelerating. But you can stop accelerating and then see what you missed. Similarly, you can 'stop accelerating away from the SC horizon' - i.e. fall into it - and then see all the history of infaller's you missed.
You should read the entry on the Usenet Physics FAQ:
http://math.ucr.edu/home/baez/physics/Relativity/BlackHoles/fall_in.html
| 0.666667 | Infalling observer 'froze' at event horizon . |
Is there a way to automatically run scripts based on conditions on PC/Mac/Linux, like Tasker for Android? | I'm not thinking about pure scheduled tasks, but rather things where a daemon in the background will automatically trigger a script when certain conditions are met.
For those who have used Tasker on Android, you probably have an idea of what I'm talking about already. For those who don't, this would include things like:
automatically triggering scripts when a Macbook is plugged in or unplugged; or
having the computer automatically go into sleep mode when it gets a certain message (via an open port, or email, or whatever), and similarly wake up again; or
automatically opening a connection to a file server on the same network at a certain time of day; and so on.
I've seen assorted software tools to do this kind of thing piecemeal, but I'd be extremely curious in finding any mostly-integrated way, premade or homebrew, to accomplish the same kind of flexibility in automation that I've gotten used to on my phone.
I also figure this question will be most helpful if applied across the range of OSes rather than more limited.
| A Mac solution that I discovered myself recently is ControlPlane.
A very useful application developed as a fork of the MarcoPolo project. MarcoPolo brings context-aware computing to your portable Mac computer.
It allows your computer to determine its context through gathering evidence from your environment (evidence sources), using flexible rule-based fuzzy matching to make an educated guess (rules), and then performing arbitrary actions upon changing context (actions).
The concept of contexts is a generalisation of a location, and encompasses more than just where your computer is. A context might represent what you are doing, or what else is going on around you.
It quietly stays in the status bar at the top of your screen (right-hand side of the menu bar), from where it can be configured to your own needs.
| 1 | ControlPlane provides context-aware computing to your portable Mac computer |
Are some tires safer than others? | I bought a Bell Road tire from Walmart. Since I haven't exactly had great luck with Walmart bicycle products, I looked up the reviews... not so great.
In their defense, they are 1.375, not 1.25, but still, the things couldn't stay on my bike... in a sharp, low-speed turn with minimal leaning from me, the bead just popped off!
Then there is the Continental Gatorskin tire with a much better set of review on amazon. But, does it matter?
I know I'm being a little specific, but what I want to know is how do I minimize my chances of my tires trying to kill me?
I realize this may look like a shopping question, but I have to purchase tires that I use!
I'd appreciate any advice from guys who actually have enough experience to really comment on tires.
| One of the reviews has something interesting to say
These 27" and 26" tires are made to fit older 10 speed/english racer
type bikes. You should remember that the 26"x1-3/8" size predates the
MTB era by at least three decades, they came first. If you have an old
Raleigh three speed or a 1970s Peugeot then these are the tires you
need in the appropriate rim size. In general, if you have a Mountain
bike or your bike is less then 20 years old, these are probably the
wrong tires for you
According to Sheldon, mountain bikes use "decimal" sizes, such as 26x1.75 and some older road bikes from the 70s use "fractional" sizes like 26x1-3/4.
Although it appears you bought 1.375 which is a decimal size, so it should fit modern bikes. However 1.375 = 1-3/8 which is the size the review is talking about. According to Sheldon, 26x1-3/8 would have a BSD of 597mm or 590mm while newer 26 inch bikes have a BSD of 559mm, making the old sized tired too big for modern rims.
| 1 | These 27" and 26" tires are made to fit older 10 speed/english racer type bikes |
Where was the Scottish Skyfall scene filmed? | I know Scotland very well and have several theories of my own but can anyone tell me where this iconic shot was taken?
Ideally I'm after as accurate a location as possible as I'm fairly sure I can narrow it to one of two valleys (bonus points for a streetview link!)
| Hi the exact location you will find here location with streetview
| 1 | Location with streetview location with street view |
Would a meta-answer be a good idea? | One of the stated goals of the site was the have one comprehensive answer to each question. I think we can definitively say that it hasn't worked out that way. I think the reason is reputation. If one person answer the question with 40% of the information that a comprehensive answer would contain, and another with another 40% with 20% scattered among three other answers. Who's answer will get edited with the combined information and get the further upvotes? It just doesn't happen. People don't want to edit questions and mess with someone else's reputation (quite rightly, IMO - how would you feel getting a downvote for something added to your answer that you didn't write?).
One idea to get towards that goal would be to have a community answer on each question, with say a small reputation bump (2 points?) for participating in making it. To prevent reputation inflation, you can only get the 2 points from a given question one time, with a daily limit (say 10 points) for doing it on questions asked by others.
Then when the question is seen for posterity, it will be the first answer.
The issue is what to do with the accepted answer? One possibility is to only open the community answer once there is an accepted answer and pre-fill it with that answer.
Does any of this make sense to anyone else?
| My goodness, what fortuitous timing. I'd been thinking about asking about this very thing.
Besides parsing HTML and working with datetimes, the most frequent question in php seems to be about the mail function. For the uninitiated, the built-in mailing function is terribly unreliable and provides no feedback when things go wrong. Combine this with the average quality of shared hosting, and it's no wonder why we get so many questions about sending mail through PHP.
Thankfully there is a known, finite set of solutions to these mailing problems. Many are solved by the various anti-spam techniques documented on Jeff Atwood's well-known blog post about mail deliverability. Many are solved by using one of a handful of modern third-party mailing libraries instead of the built-in function.
Because there are so many duplicates, it's hard to actually find a good enough duplicate to suggest a closure. So I was thinking that writing a definitive guide covering the most frequent problems might serve a worthwhile purpose.
Such things have been tried before, like "Reference - What does this symbol mean in PHP?", but with mixed success.
I think that spreading the word that such a resource exists might be problematic, followed closely by making sure that questions actually get closed as duplicates when they fit the pattern. While knowledge would spread slowly throughout frequent contributors, I'm actually far more worried about dupe closures. Some users don't care for having their questions closed as dupes, and some users think that they are special snowflakes that are totally asking a different question for which the answer is still the same. (The answer being that mail() sucks and you shouldn't use it except as a last resort.)
| 0.777778 | Most frequent questions in php seem to be about the mail function |
Write a python script that goes through the links on a page recursively | I'm doing a project for my school in which I would like to compare scam mails. I found this website: http://www.419scam.org/emails/
Now what I would like to do is to save every scam in apart documents then later on I can analyse them.
Here is my code so far:
import BeautifulSoup, urllib2
address='http://www.419scam.org/emails/'
html = urllib2.urlopen(address).read()
f = open('test.txt', 'wb')
f.write(html)
f.close()
This saves me the whole html file in a text format, now I would like to strip the file and save the content of the html links to the scams:
<a href="2011-12/01/index.htm">01</a>
<a href="2011-12/02/index.htm">02</a>
<a href="2011-12/03/index.htm">03</a>
etc.
If i get that, I would still need to go a step further and open save another href. Any idea how do I do it in one python code?
Thank you!
| You picked the right tool in BeautifulSoup. Technically you could do it all do it in one script, but you might want to segment it, because it looks like you'll be dealing with tens of thousands of e-mails, all of which are seperate requests - and that will take a while.
This page is gonna help you a lot, but here's just a little code snippet to get you started. This gets all of the html tags that are index pages for the e-mails, extracts their href links and appends a bit to the front of the url so they can be accessed directly.
from bs4 import BeautifulSoup
import re
import urllib2
soup = BeautifulSoup(urllib2.urlopen("http://www.419scam.org/emails/"))
tags = soup.find_all(href=re.compile("20......../index\.htm")
links = []
for t in tags:
links.append("http://www.419scam.org/emails/" + t['href'])
're' is a Python's regular expressions module. In the fifth line, I told BeautifulSoup to find all the tags in the soup whose href attribute match that regular expression. I chose this regular expression to get only the e-mail index pages rather than all of the href links on that page. I noticed that the index page links had that pattern for all of their URLs.
Having all the proper 'a' tags, I then looped through them, extracting the string from the href attribute by doing t['href'] and appending the rest of the URL to the front of the string, to get raw string URLs.
Reading through that documentation, you should get an idea of how to expand these techniques to grab the individual e-mails.
| 0.888889 | How to extract html tags from a regular expression in BeautifulSoup |
Blender - Set blending mode(Porter-Duff) for a material | I am using Blender as the 3d asset creation suite for my projects.
I have an exporter that is able to export mesh, materials, animations and skeletons.
In my home-grown engine, I want to render some materials with alpha blending.
Specifically, I with to be able to set one of the Porter/Duff operators to the materials.
Is there a way I can set this from within Blender?
All I can see is a tranlucency adjustment under material properties.
Is there a settings for alpha Blending mode?
Or should I use custom property?
Thanks in Advance,
-Valyannan.
| The Blend Mode in the material settings is only available when Render is set the to Blender Game:
For textures there are Blend types which are also available in the internal renderer.
I'm not sure whether you can map these properties to the required operators defined by Porter-Duff, thus custom properties could be a good alternative.
| 0.888889 | The Blend Mode in the material settings is only available when Render is set |
Hyperlink + Javascript = One click? | Is it possible to integrate a javascript into a hyperlink? Or make it into some sort of batch script or whatnot, so when the page has loaded it calls the javascript which is a button on the page?
To explain it further:
We have this page:
http://work.acceptance.XXXX.com/XXXX_Raffle/Lists/Raffle/overview.aspx
The sharepoint page has a survey on it.
To get the "popup" window to show, so you can answer a question in the survey, you need to press a button which calls this script:
javascript:__doPostBack('ctl00$m$g_e999ab40_719f_42fb_bd61_d986f232bdd5$ctl01$ctl00$toolBarTbl$RptControls$ctl00$diidIONewItem','');
So, is it possible to somehow combine the page + the javascript, so all they have to do is press one link or alternatively, a hyperlink which goes to a file on a server which triggers all this, so they instantly get to the page + the javascript automatically pops so they dont have to press the button?
Keep in mind, when I say "hyperlink" I mean the kind of hyperlink you would see in an email. A simple link to a website or a server location.
I'm not very good at everything that has to do with programming and webdesign, but I do have access to the sharepoint, though I'd need serious guiding in how to add anything there other than simple webparts. It's SharePoint Server 2010.
Here is a picture of the button and what happens when you press it.
http://i.stack.imgur.com/gKCG5.jpg
| Add an onload event to the page to get it to show the popup:
<script type="text/javascript">
window.onload = showPopup();
function showPopup() {
__doPostBack('ctl00$m$g_e999ab40_719f_42fb_bd61_d986f232bdd5$ctl01$ctl00$toolBarTbl$RptControls$ctl00$diidIONewItem','');
}
</script>
This needs to go on the page that you're linking to so that the link takes you to this page which then fires this onload. Put it before the closing tag on the page.
| 0.888889 | Add an onload event to the page to show popup |
Why do we soak and squeeze gelatine? | I can only assume we use gelatine with liquids (or at least the majority of time it's to set a liquid - unless anyone uses it for other reasons?) - so why soak it first? And why do we then squeeze it? I would assume it's to get rid of something but my searches return no results.
| Gelatin sheets are soaked in cold-to-room-temp water in order to soften and rehydrate them slightly before stirring them into the (often hot) food. If you were to try to stir a sheet of gelatin directly into hot liquid, you'd find that it behaves a lot like cornstarch. It clumps up immediately and produces unpleasant-to-eat chunks that only a blender and a chinois have a hope of removing.
You squeeze it after soaking to remove excess (unflavored) water from the exterior. Otherwise, each sheet might bring along quite a bit of water, which will seriously affect the consistency of a product you expect to set up, and might affect the taste of even something like a braise to which you are adding the gelatin just for body.
| 1 | Gelatin sheets are soaked in cold-to-room-temp water in order to soften and rehydrate them slightly before stirring them |
c# parsing json: error reading json object | I'm having some issues with fetching json values in c#.
http://i.stack.imgur.com/Uxn8e.png
Here is the code in question:
var json2 = new WebClient().DownloadString("http://fetch.json.url.here" + Input_Textbox.Text);
JObject o2 = JObject.Parse(json2);
string he_ident = (string)o2["he_ident"];
string le_ident = (string)o2["le_ident"];
Console.WriteLine(he_ident);
Console.WriteLine(le_ident);
Line 204 is: JObject o2 = JObject.Parse(json2);
The json is this: [{"le_ident":"06L","he_ident":"24R"},{"le_ident":"06R","he_ident":"24L"},{"le_ident":"07L","he_ident":"25R"},{"le_ident":"07R","he_ident":"25L"}]
I've also tried with just one set of le_ident and he_ident, such as [{"le_ident":"06L","he_ident":"24R"}] but it sill throws the same error.
Any ideas?
| Personally, the cleanest approach to take is to define a class for the object signature you're expecting to take in:
class Entity {
public he_ident { get;set; }
public le_ident { get;set; }
}
Then just call DeserializeObject() into a collection:
var entities = JsonConvert.DeserializeObject<List<Entity>>(json2);
You should be able to access that then just like any C# object:
foreach(var entity in entities) {
Console.WriteLine(entity.he_ident);
Console.WriteLine(entity.le_ident);
}
This won't work if your JSON signature is dynamic though (or will be a bit tedious, as you'd have to define classes for each of your signatures).
But personally, I find that this approach does away with the muckiness that stuff like ArrayList had, and introduces strict typing into your code, which I find to generally lend itself to stronger, cleaner structure in a C# environment.
| 0.666667 | The cleanest approach to take is to define a class for a C# object signature |
Nitration of pyrrole | Would 2,5-dinitropyrrole be a product of nitration of pyrrole with $\ce{H2SO4/HNO3}$ ? It seems from this paper that it is not formed using acetic anhydride/nitric acid. Is this just because of the mild conditions used or does this reflect the pyrrole ring being more deactivated by nitro-substitution than a benzene ring would be?
|
Would 2,5-dinitropyrrole be a product of nitration of pyrrole with $\ce{H2SO4/HNO3}$?
I doubt it and would rather expect a lot of tar to be formed here. Pyrrole tends to undergo acid-catalyzed polymerization!
For decades, acetyl nitrate, formed by addition of fuming nitric acid to acetic anhydride, is the reagent of choice.
Mononitration of pyrrole predominantly gives 2-nitropyrrole, accompanied by minor amounts of 3-nitropyrrole. (K.J. Morgan and D.P. Morrey, Tetrahedron, 1966, 22, 57-62. DOI).
In the case of 1-methylpyrrole, the yield of the 3-nitropyrole is somewhat larger (H.J. Anderson, Canad. J. Chem, 1957, 35, 23-29). In you want even more of the 3-nitro isomer, a more bulky alkyl substituent (t-Bu) or N-silylation with $\ce{((CH3)CH)2SiCl}$ is a viable approach.
Nitration of 2-nitropyrrole at -15 °C with nitric acid in acetic anhydride furnishes a 4:1 mixture of 2,4- and 2,5-dinitropyrrole with a total yield of 61%. (R. Alan Jones, Gerritt P. Bean, The Chemistry of Pyrroles: Organic Chemistry: A Series of Monographs, Vol. 34, Academic Press, p. 124)
| 0.888889 | acetyl nitrate, formed by addition of fuming nitric acid to acetic anhydride, |
Direction of Tefillin Winding | Why do some people have the custom to wind the Tefillin-Shel-Yad towards themselves, while others wind it away from themselves? What is the reason behind these two customs, and which sects of Judaism generally follow which method?
| It's pretty much a question of which eida you come from:
Ashkenazim wind inwards, Sfaradim wind outwards.
(And, confusingly, right-handed ashkenazi using left-handed ashkenazi tfillin would also be winding backwards...)
The link that @jake posted in comments illustrates this very nicely - it depends on which eida's minhag you use.
(Sorry, I don't know the reasoning behind the different minhagim - though I find it likely that each do it that way, because thats the way they do it...)
| 1 | Which eida you come from: Ashkenazim wind inwards, Sfaradim wind outwards |
Subsets and Splits