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 use "sous vide" in a sentence | First, I'm not sure if sous vide is a trademark or just a cooking method like boil or fry.
How should I use sous vide in a sentence when writing a recipe?
| It can be a trade mark:
Set the temperature of the Sous-vide Pro to 65C
Place the sealed bag in the water....
It can be just a pan of water
Prepare a sous-vide by heating a pan of water to 65C
Place the sealed bag in the water....
| 1 | Temperature of Sous-vide Pro |
How should I design a table with nested categories for users? | I am really confused with user interface design of the website.
I want to design the Detailed view of the student.
So on the page there will be information about the students like name , class roll number etc.
Then i will have many rows for his smemesters , then each semester will have many subjects , then each subject will have many assignments.
Now i am not able to figure out how can i design the layout of the page.
can anyone give me idea or show me something on , how should i go
| From your description, I've taken the liberty to make a mockup to give you something to work on. It is a simple suggestion on how you can organize elements in groups and subgroups regarding a students life (at the university).
On the Semesters tab I suggest an accordion control to interact with the different courses in terms of assignments, reports, project and of course a link to course info.
download bmml source – Wireframes created with Balsamiq Mockups
Feel free to make comments and suggestions and I'll do my best to get your project moving forward.
| 0.777778 | How to organize elements in groups and subgroups regarding a student life? |
Patch OpenSSL CVE-2014-0160 on ubuntu 12.04? | NO, this is not a duplicate of How to patch the Heartbleed bug (CVE-2014-0160) in OpenSSL?. So, read on.
I am seeing conflicting information with respect to Ubuntu 12.04:
The Heartbleed page claims Ubuntu 12.04 to be affected and needs to be patched with 1.0.1g
The Ubuntu Security Notice USN-2165-1 claims that version 1.0.1-4ubuntu5.12 for the package libssl1.0.0 should fix the issue on Ubuntu 12.04.
Now I do have these packages installed:
# dpkg -l | grep ssl
ii libssl1.0.0 1.0.1-4ubuntu5.10 SSL shared libraries
ii openssl 1.0.1-4ubuntu5.10 Secure Socket Layer (SSL) binary and related cryptographic tools
# lsb_release -a | grep -i description
Description: Ubuntu 12.04.3 LTS
So, If I consider above two points, I am not sure which one is true.
Besides, this Heartbleed test page says that my machine is vulnerable.
Has anyone yet been able to fix this issue successfully on Ubuntu 12.04? If yes, then could you provide me the steps you have taken?
| Ubuntu has released a patch, you just need to update and upgrade.
sudo apt-get update
sudo apt-get upgrade
To check if you have the latest and patched version, run:
openssl version -a
OpenSSL 1.0.1e 11 Feb 2013
built on: Mon Apr 7 20:33:19 UTC 2014
platform: debian-amd64
Check the "built on:" item, it should be build Apr 7.
| 0.666667 | sudo apt-get update and upgrade |
How can I change the order of suggested contacts in GMail app? | I regularly send email to a specific contact with the same first name as nearly a dozen other contacts, and he's always at the VERY BOTTOM of the list, which is annoying. Is there something I can do to get him to rise higher up the list so that he's the first suggestion instead of near the bottom?
| Gmail automatically sorts all the contacts based on your most frequent uses. But if you don't find that name at top, then you might consider saving a new contact.
To view a complete list of your most frequently mailed contacts, click Gmail at the top-left corner of your Gmail page, then choose Contacts. Next, click Most Contacted.
When you’re composing or replying to a message, hover over a contact’s name to see the email address associated with it, and double-click a contact’s name to edit it. If you have multiple email addresses linked to a contact, you’ll see your contact’s email address as well as name.
| 1 | Gmail automatically sorts all the contacts based on your most frequent uses . |
Computing best subset of predictors for linear regression | For the selection of predictors in multivariate linear regression with $p$ suitable predictors, what methods are available to find an 'optimal' subset of the predictors without explicitly testing all $2^p$ subsets? In 'Applied Survival Analysis,' Hosmer & Lemeshow make reference to Kuk's method, but I cannot find the original paper. Can anyone describe this method, or, even better, a more modern technique? One may assume normally distributed errors.
| This is a huge topic. As previously mentioned, Hastie, Tibshirani and Friedman give a good intro in Ch3 of Elements of Statistical Learning.
A few points.
1) What do you mean by "best" or "optimal"? What is best in one sense may not be best in another. Two common criteria are predictive accuracy (predicting the outcome variable) and producing unbiased estimators of the coefficients. Some methods, such as Lasso & Ridge Regression inevitably produce biased coefficient estimators.
2) The phrase "best subsets" itself can be used in two separate senses. Generally to refer to the best subset among all predictors which optimises some model building criteria. More specifically it can refer to Furnival and Wilson's efficient algorithm for finding that subset among moderate (~50) numbers of linear predictors (Regressions by Leaps and Bounds. Technometrics, Vol. 16, No. 4 (Nov., 1974), pp. 499-51)
http://www.jstor.org/stable/1267601
| 1 | What is best in one sense may not be best in another? |
Important non-technical course for programmers? | What kind of non-technical training course do you suggest for a programmer? Example could be public speaking course, presentation skill, English, business writing, or anything not related to programming or software engineering itself.
| Assertiveness Skills -
To note here that "Assertion" does NOT in any way relate to "Aggression".
While this comes under the general gamut of "soft skills", I have found this training to be greatly beneficial especially when it comes to programmers.
Atleast in my experience, i have just come across too many programmers who would rather avoid a confrontation with someone about topics which they may even be better informed about due to their nature and this is detrimental to the team overall.
Such a course mainly focuses on people making their point heard and giving them some basic tips about how to ensure that your viewpoints / opinions do not get snowed over just because of some big mouth on the team who may be better than others at putting his point across.
| 1 | "Assertion" does NOT relate to "Aggression" |
Cannot shutdown Tomcat - transport Error | I am using Tomcat6.0.29. When I try to close Tomcat using shutdown.bat, it is not shutting down tomcat and also I don't see any update in log file for what happened. If I try to use "catalina stop" at the command prompt, I get the following error.
__Error: transport error 02: bind failed: address already in use
error: JDWP Transport dt_socket failed to initialize. Transport_Init<510>
JDWP exit error AGENT_ERROR_TRANSPORT_INT<197>: No transport initialized{../../..src/
sare/back/debugInit.c:690}
FATAL ERROR in native method: JDWP No transports initialized, jvmtiError=AGENT_ERROR_TRANSPORT_INIT<197>__
Please let me know what should I do to fix this error. Thanks in advance
| This problem appears to be because port-specific options (typically for debugging purposes) should be specified in CATALINA_OPTS instead of JAVA_OPTS. On shutdown, any port options in JAVA_OPTS will apply to the shutdown JVM, hence the "address already in use" error and shutdown failing. Please see http://stackoverflow.com/a/8216921/571357 - Jaan has provided a more complete answer.
| 0.888889 | Port-specific options should be specified in CATALINA_OPTS instead of JAVA_OPT |
Google maps marker show only icon | I want to display markers on google maps (android)
I used this code (like in the example in android developer):
The location, name and descripion are valid (I checked them via debug mode)
It shows me the icon on the desired location, however without the marker or the description and snippets. The following line
mMap.addMarker(MarkerOptions().position(location)
.title(poi.getName()).snippet(poi.getDescription())
.icon(BitmapDescriptorFactory.fromBitmap(image_item));
shows me only the icon without the title or snippest.
Thanks a lot
| Did you follow the examples from the documentation? Also, the sample code bundled with the Google Play services SDK?
Edit: You can show an info window programmatically by calling showInfoWindow() on the target marker:
Marker marker = mMap.addMarker(new MarkerOptions()
.position(location)
.title(poi.getName())
.snippet(poi.getDescription())
.icon(BitmapDescriptorFactory.fromBitmap(image_item));
marker.showInfoWindow();
However, bear in mind that only one info window can be displayed at a time. If a user clicks on another marker, the current window will be hidden and the new info window will be displayed.
| 1 | How to show an info window programmatically by calling showInfoWindow() |
Should I always hibernate instead of shutting down? | I'm using Windows XP and I hate the long start up time when I shut down and then turn on my laptop. However if I hibernate instead of shutting down it starts up much faster. Are there any harmful effects / disadvantages if I always hibernate whenever I'm done for the day instead of shutting down?
| Under XP, the OS will slow down over time, and eventually get unstable, but that can take upwards of a week depending on how much you use your OS. Reboot every so often, there's no real harm in hibernating over short periods. In a laptop, most components should be built with hibernation in mind, and HDD space is cheap, so the hibernation file shouldn't be a big deal (If it is, it's 2010! Get an external HDD, 1.5TB is the best GB/$ right now, and they're pretty cheap!)
In Vista/Win7, I can't honestly reccomend shutting down unless you have a good reason.
| 1 | Reboot every so often, there's no real harm in hibernating over short periods . |
Around the Clock | I want to produce with Mathematica something like this
Or this
12 hours should be arranged in a pleasing ("rotated") style around / within a rectangle. I don't ask for the hands - depending on numerical input - but only for a Graphics to begin with.
"Have you tried anything ?"
"Sure, but with non-presentable results."
| I think that the main problem here is the characteristic deformations of the numbers due to the square clock.
Here is my attempt to reproduce the shape of the "XI" in the first square clock !
First some initialisation :
num = Text[ Style["XI", FontFamily -> "Times New Roman", FontWeight -> Bold, FontSize -> 120]];
gnum = Rasterize[num, RasterSize -> 400];
then my interactive tool :
Manipulate[FindGeometricTransform[{{0, 0}, {1, 0}, {1, 1}, {0, 1}},
{{c1, 0}, {c2, 0}, {c3, h}, {c4, h}}, TransformationClass -> "Perspective"] //
ImageTransformation[gnum, #[[2]], 300, Padding -> padcolor] &,
{{c1,0.346}, 0., 0.9}, {{c2, 0.882}, 0.50, 1}, {{c3, 0.75}, 0., 1}, {{c4, 0}, 0.0, 1},
{{h, 0.875}, -1, 2}, {padcolor, {0, 1}}]
You can play with the slider to change the shape.
You just need to modify the initialisation to try with some other number.
| 0.666667 | How to reproduce the shape of "XI" in the first square clock |
Eclipse&Maven - The import org.hibernate.boot.cannot be resolved | I am building an Maven&Spring&Hibernate&JSF project on Eclipse.While compiling the program I have
StandardServiceRegistryBuilder cannot be resolved to a type
The import org.hibernate.boot.cannot be resolved
errors.
Main class is as follows:
package com.test;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
import org.hibernate.cfg.Configuration;
import com.hibernate.data.Person;
public class Main {
public static void main(String [] args){
Configuration configuration = new Configuration();
System.out.println("CFG and hbm files loaded successfully.");//just to test
configuration.configure("hibernate.cfg.xml");
SessionFactory factory = configuration.buildSessionFactory(new StandardServiceRegistryBuilder().configure().build());
Session session = factory.openSession();
Transaction tx = session.getTransaction();
tx.begin();
System.out.println("Transaction began");//just to test
Person newPerson = new Person();
newPerson.setFirstName("aa");
newPerson.setLastName("bbb");
newPerson.setGender("Male");
newPerson.setAge(2);
session.save(newPerson);
session.flush();
tx.commit();
session.close();
System.out.println("aaa");//just to test
}
}
pom.xml file is as follows:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>Spring-Hibernate-JSF-MySQL-Example</groupId>
<artifactId>Spring-Hibernate-JSF-MySQL-Example</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<properties>
<!-- Generic properties -->
<java.version>1.6</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<!-- Spring -->
<spring-framework.version>4.1.6.RELEASE</spring-framework.version>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifest>
<mainClass>com.test.Main</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.4</version>
<configuration>
<warSourceDirectory>WebContent</warSourceDirectory>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<configuration>
<mainClass>com.test.Main</mainClass>
</configuration>
</plugin>
</plugins>
</build>
<url>http://maven.apache.org</url>
<repositories>
<repository>
<id>prime-repo</id>
<name>PrimeFaces Maven Repository</name>
<url>http://repository.primefaces.org</url>
<layout>default</layout>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.primefaces</groupId>
<artifactId>primefaces</artifactId>
<version>5.0</version>
</dependency>
<dependency>
<groupId>org.primefaces.themes</groupId>
<artifactId>blitzer</artifactId>
<version>1.0.10</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.9</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>4.1.6.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>4.1.6.RELEASE</version>
</dependency>
<dependency>
<groupId>commons-dbcp</groupId>
<artifactId>commons-dbcp</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>org.javassist</groupId>
<artifactId>javassist</artifactId>
<version>3.18.1-GA</version>
</dependency>
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
<version>3.1</version>
</dependency>
<dependency>
<groupId>javax.transaction</groupId>
<artifactId>jta</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<type>maven-plugin</type>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.12</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>4.1.6.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
<version>4.1.6.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>4.1.6.RELEASE</version>
</dependency>
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>2.2.10</version>
</dependency>
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-impl</artifactId>
<version>2.2.10</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>3.6.8.Final</version>
</dependency>
</dependencies>
</project>
| You're missing a Hibernate library - looks like Hibernate 4 provides this.
| 0.5 | You're missing a Hibernate library |
numpy.array boolean to binary? | I am trying to rewrite a matlab code in python27. There is a matlab line as follows:
vector_C = vector_A > vector_B;
If I try to write this in python using numpy it will be the same, but the result will be an array of booleans instead of binaries. I want the result to be in binaries. Is there a way to make it return binary or should I convert manually each time? Is there a quick way of converting it? I am new to python. Thanks.
| Even though vector_C may have dtype=bool, you can still do operations such as the following:
In [1]: vector_A = scipy.randn(4)
In [2]: vector_B = scipy.zeros(4)
In [3]: vector_A
Out[3]: array([ 0.12515902, -0.53244222, -0.67717936, -0.74164708])
In [4]: vector_B
Out[4]: array([ 0., 0., 0., 0.])
In [5]: vector_C = vector_A > vector_B
In [6]: vector_C
Out[6]: array([ True, False, False, False], dtype=bool)
In [7]: vector_C.sum()
Out[7]: 1
In [8]: vector_C.mean()
Out[8]: 0.25
In [9]: 3 - vector_C
Out[9]: array([2, 3, 3, 3])
So, in short, you probably don't have to do anything extra.
But if you must do a conversion, you may use astype:
In [10]: vector_C.astype(int)
Out[10]: array([1, 0, 0, 0])
In [11]: vector_C.astype(float)
Out[11]: array([ 1., 0., 0., 0.])
| 0.777778 | Astype: In [10]: vector_C.astype(int) Out[10] |
Python Condensing Code | My code is pretty long and I need help condensing it to make it more convenient. The code I have is suppose to do the set of instructions I commanded it to do on a fluke robot. I am using python. The robot is suppose to do the following code using it sensors. I need help condensing it.
EDIT:
My code:
from Myro import *
from Graphics import *
init('/dev/tty.IPRE6-366079-DevB')
def markYellow(pic):
for pix in getPixels(pic):
r = getRed(pix)
g = getGreen(pix)
b = getBlue(pix)
if r > 200 and b < 90 and g > 150:
setRed(pix,255)
setGreen(pix,255)
setBlue(pix,255)
else:
setRed(pix,0)
setGreen(pix,0)
setBlue(pix,0)
def pctMarked(pic):
totalPixels = 0
whitePixels = 0
for pix in getPixels(pic):
if getRed(pix) == 255:
whitePixels = whitePixels + 1
totalPixels = totalPixels + 1
result = whitePixels / float(totalPixels)
return result
def findAvgX(pic):
pixelCount = 0
totalXCount = 0
for pix in getPixels(pic):
if getRed(pix) == 255:
x = getX(pix)
totalXCount = totalXCount + x
pixelCount = pixelCount + 1
avgX = totalXCount / float( pixelCount)
return avgX
def turn():
findAvgX(pic)
if wallLocation <= 85:
turnLeft(1,0.25)
elif ballLocation >= 170:
turnRight(1,0.25)
def celebrate():
move(0.25,1)
beep(1,800)
beep(1,1600)
beep(1,800)
stop()
def main():
p = takePicture()
markYellow(p)
pctMarked(p)
while pctMarked(pic) < 0.2:
rotate(1,1)
p = takePicture()
markYellow(p)
pctMarked(p)
turn()
while getObstacle('center')> 1000: # I'm not sure about the number. We can test it tomorrow
forward(1,1)
celebrate()
| # helper functions
def getRGB(pix):
return getRed(pix), getGreen(pix), getBlue(pix)
def setRGB(pix, r, g, b):
setRed(pix,r)
setGreen(pix,g)
setBlue(pix,b)
def markYellow(pic):
for pix in getPixels(pic):
r, g, b = getRGB(pix)
if r > 200 and b < 90 and g > 150:
setRGB(pix, 255, 255, 255)
else:
setRGB(pix, 0, 0, 0)
def pctMarked(pic):
# is there a more direct way to get the totalPixels?
# totalPixels = len(pic) # perhaps?
totalPixels = sum(1 for pix in getPixels(pic))
whitePixels = sum(getRGB(pix) == (255, 255, 255) for pix in getPixels(pic))
return whitePixels / float(totalPixels)
| 0.888889 | How to get the totalPixels? |
Making sure that you have comprehended a concept | Hi,
I have a question that I've been thinking about for a long time.
How can you assure yourself that you've fully comprehended a concept or the true meaning of a theorem in mathematics?
I mean how can you realize that you totally get the concept and it's time to move on to the next pages of the book you're reading?
Thanks in advance for your responses.
| Although we all want to "understand the concepts", I would encourage you to measure how well you are learning mathematics not by whether you "understand a concept" or not (because this is in the end too vaguely defined) but by whether you can use what you have learned to do something useful. For students, this usually means doing the problems at the end of the section or chapter. For those using mathematics as a tool (like Steve Huntsman), it means writing software that uses the mathematics learned. For both students and professionals, it also often means working out the details usually via computations of examples that illustrate what you have just learned. And, of course, if you are or are striving to be a pure mathematician, it can also mean using what you learned to prove other mathematical statements you want or need.
If you are able to do any of these things with what you have just learned, then you should definitely move along to the next thing. Because, as others have already advised you, you might want to move along, even if you can't do anything useful yet. When learning mathematics, you should definitely try to be able to do something useful (e.g., work out examples and/or solve problems) with most of what you are learning. However, everybody runs into things that just don't sink in despite intensive effort. As long as you're learning most of everything else, it is often advisable to just move ahead and return later after you know more and are more experienced. Everything gets easier, if not on the second try, usually by the tenth.
| 1 | How well you are learning mathematics is measured by whether you can "understand concepts" |
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!
| To get all links on the page you could use BeautifulSoup. Take a look at this page, it can help. It actually tells how to do exactly what you need.
To save all pages, you could do the same as what you do in your current code, but within a loop that would iterate over all links you'll have extracted and stored, say, in a list.
| 1 | How to get all links on the page? |
What does 'liberal to' mean here? |
Any state
that makes its choices after most others do will find itself playing in the
late innings of a game, as the West Virginia Supreme Court found in a
case about whether car makers were responsible if their vehicles failed to
protect people who negligently got into accidents:
...[I]n some world other than the one in which we live, where this Court
were called upon to make national policy, we might very well take a meat
ax to some current product liability rules. Therefore, we do not claim that
our adoption of rules liberal to plaintiffs comports[,] necessarily, with some
Platonic ideal of perfect justice.
Source: p 124, The Legal Analyst, Ward Farnsworth
My guess is Definition 1.1 below. Yet is this use right?
Favourable to or respectful of individual rights and freedoms:
The definition concerns 'right and freedoms', while the context is individuals (as plaintiffs)
| from http://dictionary.reference.com/browse/liberal
Synonyms
progressive. 7. broad-minded, unprejudiced. 9. beneficent, charitable, openhanded, munificent, unstinting, lavish. See generous. 10. See ample.
http://dictionary.reference.com/browse/generous
1.
liberal in giving or sharing; unselfish:
http://dictionary.reference.com/browse/charitable
1.
generous in donations or gifts ...
2.
kindly or lenient in judging people, acts, etc.
I'm going to have to go with definition 4 (with implications of 3 as well):
3 (Especially of an interpretation of a law) broadly construed or understood; not strictly literal: they could have given the 1968 Act a more liberal interpretation
4 Given, used, or occurring in generous amounts: liberal amounts of wine had been consumed
The judge is saying, "Just because, with these rules, I'm giving the plaintiffs almost everything they're asking for by broadly construing rules in their favor, that doesn't mean I think it's a good idea. I don't get to make the law, I have to apply the law that's given to me via precedent."
Now exactly what the word "comports" means, as a plural noun, is another question. I can't find a relevant definition. It seems to have a specific legal meaning of like "demands".
| 0.888889 | What the word "comports" means as a plural noun? |
A concise term for staking territorial claims | I'm looking for a word or phrase specifically used to refer to the act of placing a flag to claim new territory. I'm specifically referring to claiming land in the name of some sovereign, though a more general term will do.
| One might annex a piece of land or territory, which would tend to mean claim in a legalistic way or seize by coup-de-main rather than wage war for it.
| 1 | annex a piece of land or territory, which would mean claim in a legalistic way or seize by coup-de- |
Linearity of push forward $F_*$ | How can I prove the linearity of $F_*$? What does $F_*$ eat?
If $N$ is smooth manifolds and $F: M \to N$ is a smooth map, for each $p \in M$ we define a map $F_*: T_pM \to T_{F(p)}N$, called the push-forward associated with $F$, by
$$(F_*X)(f) = X(f \circ F).$$
| It follows from the definition of a directional derivative. If $F_*$ is linear then
$$F_*(\lambda X + \mu Y) = \lambda (F_*X) + \mu (F_*Y)$$
If we apply the definition that $(F_*X)(\operatorname{f}) := X(\operatorname{f} \circ F)$ then we find that
$$[F_*(\lambda X + \mu Y)](\operatorname{f}) = (\lambda X + \mu Y)(\operatorname{f} \circ F)$$
Any definition of a connection involves linearity. In otherwords, the fact that
$$(\lambda X + \mu Y)(\operatorname{f} \circ F) = \lambda [X(\operatorname{f}\circ F)] + \mu [Y(\operatorname{f} \circ F)] $$
is part of the definition of a connection. Again, applying the definition, we have
$$\lambda [X(\operatorname{f}\circ F)] + \mu [Y(\operatorname{f} \circ F)] = \lambda (F_*X) + \mu (F_*Y)$$
Have a quick look at this article for the general definition of a connection.
| 0.777778 | The definition of directional derivative |
What kind of diagram is best to represent the flow of a registration process? | For planning What is the best way to visually represent a typical registration flow where a user registers on a registration page, there is then a confirmation page followed by validation email and welcome email, etc?
| Flowchart is the most intuitive way to visualize a process. It is common solution any step-by-step instructions. It also allows to highlight important details: main sequence (path), final steps, etc.
By the way, this is a standard approach. Unified Modeling Language defines several diagram types, including Activity diagram:
Activity diagrams are graphical representations of workflows of
stepwise activities and actions1 with support for choice, iteration
and concurrency. In the Unified Modeling Language, activity diagrams
can be used to describe the business and operational step-by-step
workflows of components in a system.
Some useful guidelines:
| 1 | Flowchart is the most intuitive way to visualize a process |
ASIFormDataRequest inside requestFinished method | I use an ASIFormDataRequest to log into the server, managing the response inside requestFinished method. If the response is ok, I need to launch another request to the server to download a JSON. Where should I manage the response (since I am launching the second request from the requestFinished method...)? Should make the second request synchronous? (if i am right, that would get the response from the server without a requestFinished method)
Any advise? Thank you.
| You can do it like this:
ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url];
[request setDelegate:self];
[request setDidFinishSelector:@selector(requestDone:)];
[request setDidFailSelector:@selector(requestWentWrong:)];
You basically define the success/failure selectors. The ASIHTTPRequest "How to use" section.
Update 1.0
- (void)requestFinished:(ASIHTTPRequest *)request
This is the default handler for the request finished. I think you will receive it as well with the "custom" selectors.
| 0.777778 | ASIHTTPRequest *request |
PostGIS to GeoJSON with GDAL: how to get lat/longs? | I'm trying to convert line features from PostGIS to GeoJSON files, as follows:
from psycopg2 import *
from subprocess import call
conn = connect(dbname='gis')
cur=conn.cursor()
cur.execute("SELECT distinct osm_id,route_name from planet_osm_line where route_name like '%Rail Trail' and network='rcn';")
for record in cur:
print "%s" % record[1]
call (["ogr2ogr", "-f", "GeoJSON", record[1] + ".json", 'PG:dbname=\'gis\'', "-sql", 'SELECT route_name,osm_id,tags::hstore->\'state\' as state,way from planet_osm_line where osm_id=%d' % record[0]])
That is, ultimately ogr2ogr gets called like this:
ogr2ogr -f GeoJSON blah.json "PG:dbname='gis'" -sql 'SELECT route_name,osm_id,tags::hstore->\'state\' as state,way from planet_osm_line where osm_id=-12345'
The GeoJSON files that get created have coordinates that look like this [ 16153119.78, -4561568.23 ]:
{ "type": "Feature", "properties": { "route_name": "Waverley Rail Trail", "osm_id": -64660, "state": null }, "geometry": { "type": "LineString", "coordinates": [ [ 16153119.78, -4561568.23 ], [ 16153117.1, -4561567.48 ], [ 16153114.81, -4561565.86 ], [ 16153113.24, -4561563.55 ], [ 16153112.64, -4561561.63 ], [ 16153112.64, -4561558.82 ], [ 16153113.6, -4561556.2 ], [ 16153115.39, -4561554.05 ], [ 16153117.82, -4561552.66 ], [ 16153119.98, -4561552.2 ], [ 16153122.76, -4561552.48 ], [ 16153125.28, -4561553.69 ], [ 16153127.35, -4561555.88 ], [ 16153128.43, -4561558.46 ], [ 16153128.62, -4561560.38 ], [ 16153128.08, -4561563.13 ], [ 16153126.64, -4561565.51 ], [ 16153124.47, -4561567.26 ], [ 16153121.82, -4561568.17 ], [ 16153119.78, -4561568.23 ] ] } }
Please forgive my ignorance, but what am I doing wrong here? I assume what is being written is some kind of projected value rather than the raw lat/long - so how do I get those?
I've tried using t_srs=ESPG:3857 but that didn't fix it.
| Gene's answer pointed me in the right direction. The simple answer seems to be that the data in PostGIS is in Web Mercator (EPSG 3786) and so if I want lat/long it needs to be re-projected (or de-projected...), with an SRID like EPSG 4326.
call (["ogr2ogr", "-f", "GeoJSON", record[1] + ".json", 'PG:dbname=\'gis\'', "-sql", 'SELECT route_name,osm_id,tags::hstore->\'state\' as state,way from planet_osm_line where osm_id=%d' % record[0], "-t_srs", "EPSG: 4326"])
EDIT
Turns out you need to explicitly state the source SRS as well:
call (["ogr2ogr", "-f", "GeoJSON", record[1] + ".json", 'PG:dbname=\'gis\'', "-sql", 'SELECT ...', "-t_srs", "EPSG: 4326", "-s_srs", "EPSG:3857"])
| 0.666667 | Gene's answer is that the data in PostGIS is in Web Mercator |
Is it awkward to say "Good morning" to roommate every day? | I know it is a bit weird to ask this question, yet in the country I am staying, China, people love to say "Good morning" to everyone every morning.
I have never been to other countries except China and I am going to study abroad in America.
Is this social etiquette the same in America and American people say "Good morning" to their roommate every day?
|
Is this social etiquette the same in America and American people say
"Good morning" to their roommate everyday?
It depends. Some people aren't morning people at all. They usually don't care for good mornings because it makes them upset that they are awake and still not sleeping.
However, as long as the roommates aren't totally awkward with each other, I'd say it's OK.
Remember the rule that "what words you say generally don't matter, it's HOW you say it, and how it makes people feel that matter".
So use a good, polite, energetic (but not fake enthusiastic) tone when saying good morning.
Sometimes a person may just be unhappy in general, like having depression, which is very common in America. Do not worry about this though. Still be polite, happy, and real to them and say what you want. Use good tone and manners. In time, they will hopefully be able to become happy again, and be glad it's a new morning.
| 1 | Is this social etiquette the same in America and American people say "Good morning" to their roommate? |
Variance of nominal variable? | Note that the only measure of location in nominal variable is mode.
Is there also any measure of variance?
Obviously, some nominal features are more different than other (color of eyes vs. presence of some rare disease).
| There is no measure of the variance exactly in nominal data. There are measures of diffusion. Kader provides a good discussion.
| 0.555556 | No measure of the variance exactly in nominal data |
Idolatry in churches allowed? | It is very frequent to see idols of Jesus or any biblical entities in a Church , So is such idolatry allowed by the bible,considering the following verses?
"You must not make for yourself an idol of any kind or an image of anything in the heavens or on the earth or in the sea".
Exodus 20:4
History tells us that:
sometimes objects that God instructed to be made were turned into
idols by the Israelites. The Book of Numbers contains a narrative in
which God instructed Moses to make a bronze snake as part of
addressing a plague of venomous snakes that had broken out among the
Israelites as a punishment for sin. The bronze snake is mentioned
again in 2 Kings 18; however, rather than remaining a memorial of
God's providence, it became an idol that the people named and
worshiped. Thus the bronze snake was destroyed in King Hezekiah's
reforms.
More specifically in India I see Christians carry idols of Jesus and other biblical entities with them kiss them and revere them too. Infact they allow the Hindus in the Church and let them perform worship in their way(Like putting incense sticks, offering flowers , foodstuff to the Idol of Jesus etc) as shown below a very common view in India. I studied in a Christian school for 10 years and i am yet to see Christians not doing these things.
I have seen the same on TV and in videos of people venerating the Idol of biblical entities.
| You're operating under a misconception that these are idols. Most Christians don't worship these images, statues, etc. Instead, they are considered art, something that we create because we love the subject, not the work of art.
Asking your question is like asking if looking at a painting of my wife means that I am allowed to cheat on her by devoting my affection to an image of her. I love her, not the painting of her. Christians love Jesus, not the statues of Him.
So, the answer id no, idolatry isn't allowed in Churches.
Addressing the updates to the question, the things that people are "venerating" are likely "Sacrementals".
Sacramentals are material objects, things or actions (sacramentalia) set apart or blessed by the Roman and Eastern Catholic
Churches, the Eastern and Oriental Orthodox Churches, the Church of
the East, the Anglican Churches, the Independent and Old Catholic
Churches, and the Lutheran Churches to manifest the respect due to the
sacraments, and so to excite good thoughts and to increase devotion,
and through these movements of the heart to remit venial sin,
according to the Council of Trent (Session XXII, 15).
In Roman Catholicism, sacramentals such as Holy water, the crucifix or
the Saint Benedict Medal are recommended as a means of protection
against evil.
Again, the devotion is not to these things, but to the God they represent. There are, those that do worship them like idols, and many view the idea that these could protect us from evil as superstitious, the point remains that officially, these aren't idols. They aren't to be worshiped. They are reminders of the one we should be worshiping.
| 0.888889 | Idolatry isn't allowed in Churches |
jqGrid Group summary not showing total sum with paging | This is my first post in this forum, so please, be patient with me.
I need to set my summary to show the sum of all rows in my grid, even the rows that are inside other pages - the absolute sum of values.
I was searching for it, and I saw a lot of people with this problem, so I don't think it is a problem with my code. It sounds more like a design in the grouping mechanism itself, otherwise I don't know.
But, to be clear, I think I need to make a call to server side to get the sum from there, is this possible? If so, how should I do it with json?
I was thinking about using the formatter option, but then it is triggered line by line, and I don't think this is the idea because the sum will come entire in the first call.
Any suggestions?
Thanks !!!
| You can define a custom summaryType function to display your sum. According to the documentation for summaryType:
The option can be defined as function. If defined we pass three parameters to it - the current value, the name and the record object. The function should return value. Note that this value will be used again for the group value until it changes.
For example, you could retrieve a totalSumRecord when the page is loaded - it would be a bad idea to make an AJAX call directly from the formatter - and then just display the appropriate value in the formatter:
function myCustomSummary(val, name, record) {
return totalSumRecord[name];
}
jQuery("#grid").jqGrid({
...
colModel : [
{..},
{name:'myColumn',
index:'myColumn',
width:80,
align:"right",
sorttype:'number',
formatter:'number',
summaryType:myCustomSummary},
...
],
...
});
Update
There is a bug in jqGrid 4.4 where functions are not allowed as a summary type. If this affects you, here is the fix.
| 0.888889 | How to define a custom summaryType function? |
Would magic 'weapons' make the monk more balanced? | The monk in D&D 3.5 (and, to a lesser extent, in Pathfinder) is generally considered underpowered.
Would adding magic 'weapons' that could add enhancement bonuses and magic weapon effects to a monk's unarmed strikes be sufficient to re-balance them? Would they then be over-balanced?
To be specific I'm thinking of something like hand wraps that are a zero-cost weapon having no mundane effect on combat (the wielder counts as unarmed) but that can be enchanted in the same way and at the same cost as a normal magic weapon.
Update:
Thanks to @mxyzplk, I see that Gauntlets would effectively fulfill this effect. Odd that I haven't seen this in any of the discussions on monk optimisation!
Regarding assessing balance, I'll judge this based on how well it addresses the issues in @KRyan's answer in the above-linked question. Obviously if anyone doesn't agree with his analysis then this question is moot, although I would like to see those competing opinions.
| Necessary but insufficient
It would help. It would more than help; I have a hard time imagining them being functional without it. The necklace of natural attacks or scorpion kama are generally necessary for Monks. That said, the necklace of natural attacks does exist (as do similar items in Pathfinder), and it’s not nearly enough to make the Monks good.
The Monk’s problems are problems of design: the people who wrote it evidently had no clear idea of what a Monk was or should do. Thus it receives a mish-mash of random abilities that do not synergize (and frequently contradict one another, see Flurry of Blows and Fast Movement).
To “fix” the Monk, one must first come up with a clear vision of what the Monk is supposed to be and do, and then most likely rebuild it from the ground up focused on that vision.
Or simply use one of the many classes that can effectively model one or more possible visions of what a “monk” should do, without any levels in the “Monk” class. The Cleric and Psychic Warrior are both Open Game Content and quite capable of fulfilling most roles you could imagine for the Monk, for instance. I’d argue that it’s entirely reasonable to treat a Barbarian’s Rage as “Zen Focus” and waive the non-lawful requirement (which I’d further argue is dumb to begin with). Such a “Barbarian” multiclassed with Fighter for combat maneuver mastery and perhaps taking Improved Unarmed Strike would make a decent monk. And if you have Tome of Battle, the Swordsage also does an excellent job.
| 1 | The necklace of natural attacks or scorpion kama are generally necessary for Monks . |
A way to limit the number of categories with `exp:channel:categories`? | Is it possible to limit the number of categories that are returned by the {exp:channel:categories} tag? If not is there an alternative (or dare I say add-on :P)
Obviously I could just use an SQL query for this, but if possible I would prefer to use one of the more standard built-in tags for this if possible.
Use Case:
Categories have been manually ordered using the control panel.
Only want the first 10 to be displayed.
| The {exp:channel:categories} sadly does not have a limit parameter. GW Code Categories does have a limit parameter though (along with many other useful features when working with categories).
| 0.777778 | GW Code Categories does not have a limit parameter |
Is the number 1 a unit? | In dimensionless analysis, coefficients of quantities which have the same unit for numerator and denominator are said to be dimensionless. I feel the word dimensionless is actually wrong and should be replaced by "of dimension number". For example, the Mach number is of dimension one.
Many people write, for this case:
Mach-Number | Dimension: "-" | Unit: "1"
As mentioned before, I would say 'Dimension: "1"' in this place. But what about the unit? $\text m/\text s$ divided by $\text m/\text s$ is equal to one. But is the number one a unit by definition? Or should one say that the Mach number has no unit and therefore 'Unit: "-"'?
| If $6$ and $7$ each have units $1$, and if this unit behaves like other units, then $6\times 7=42$ would have units $1^2$. My height is measured in metres, but half my height is in $\mathrm{m}1^{-1}$. If you multiply this by two you get back my height in metres, but if you add it to itself you get a quantity that's numerically equal to my height, but has units $\mathrm{m}1^{-1}$.
I think it would be rather difficult to make this consistent, so we have to conclude that if $1$ is a unit, it behaves rather differently from other units. And if that's so, why should we call it a unit at all?
To clarify: I do actually think it's fine to say the units of a quantity are $1$. This answer is only referring to the part of the question that says "is the number $1$ a unit by definition", which I took to mean "is it a base unit, like $\mathrm{m}$ or $\mathrm{K}$?"
| 0.666667 | Why should we call it a unit at all? |
What are the pitfalls of buying a used car after an accident? | I have the option to buy a car that has been in an accident. There are alternatives, but within my budget the alternatives are usually older/have higher mileage. The seller is a local mechanic who did the restoration work and also showed pictures of the car before restoration. The damage was done to one of the front headlights and to the surrounding bits. The mechanic has convinced me that no damage was done to the internal carrying structure. He fixed the lights and did some paintwork restoration.
Problem: I read that people advice not to buy cars after the accident. This is my first car, so my experience is nonexistent.
Question: What are the cons against buying a car after the accident?
About the car: Opel Astra 2007 1.4 Petrol Manual Hatchback priced £2200, 1 prev owner, chain, 66K miles, 1 year MOT, 6 month tax
| One indicator in this case could be the airbags. In a frontal accident they deploy if the impact was strong enough. So I'd consider the car if the airbags are still the originals. Too big of a chance of structural damage if the airbags deployed and were replaced. Better to steer clear…
| 1 | In frontal accident they deploy if the impact was strong enough |
users and usermeta table | Is it mandatory for each user to have entries in usermeta table as well or it's optional? Recently, I came across a wordpress database which has thousands of users in user table however only a few of them have entries in usermeta table.
I am wondering in what scenario this could have happened as it doesn't look like those entries were manually removed from database.
| install a fresh wordpress setup on your local machine and then have a look at wp_usersmeta table . It contains meta(additional) information for each user.You (admin) can also make data entry specific to any user by this function update_user_meta() in usermeta table. and retrive the same using get_user_meta() funciton.
All fields for all users are not necessary. meta keys can be user specific also.
defaults meta key entries for admin in wordpress 3.6 --
first_name
last_name
nickname
description
rich_editing
comment_shortcuts
admin_color
use_ssl
show_admin_bar_front
wp_capabilities
wp_user_level
dismissed_wp_pointers
show_welcome_panel
wp_dashboard_quick_press_last_post_id
managenav-menuscolumnshidden
metaboxhidden_nav-menus
nav_menu_recently_edited
closedpostboxes_page
metaboxhidden_page
metaboxhidden_page
wp_user-settings wp_user-settings-time
| 1 | wp_usersmeta table contains meta(additional) information . |
How can I resend an application on Careers? | I applied for a job a year ago, and things didn't pan out then and I didn't hear back.
I'd like to resubmit my application as the job has been reposted and my skillset has become broader, but Careers doesn't let me send an application again, it just says "You applied for this position on {date last year}. Good luck!" with no "apply now" button.
In my Messages section, I can view the application but there's no way to withdraw the application or anything, and I can't even post a comment to it as I have a message saying "You must wait until the employer responds to your application." It's been a year; I don't think they are going to respond to the old application after so long, but I'm left with no way to resubmit my information to them.
It seems counter-intuitive and unlike other job sites that you basically get only one chance to apply to a job, even if said job gets reposted at a later date. There should either be a way to resubmit an application, withdraw an application, or the system should allow reapplying after some arbitrary amount of time has passed so you aren't left seeing a job that you're a good fit for this time around but with no way to apply for it since you already applied once before.
| Right now there's no way to resubmit an application. This is probably an oversight on our part considering a job listing can be re-posted years later. I'll add this our ever growing feature request Trello board.
Nevermind, the devs are already looking into how to fix it as we speak.
| 1 | No way to resubmit an application |
Render displaying frame 1 of cloth simulation instead of baked result visible in the 3D view | I have baked a 995 frame cloth simulation but when I go to render a still frame at frame 995 (tried 990) it displays frame 1. How do I render the final frame of the simulation instead?
| Sounds like the cloth modifier is disabled in the render.
Make sure the camera icon is selected in Properties > Physics:
| 0.888889 | Make sure the camera icon is selected in Properties > Physics |
Jewish Leap Year | Why when we add an additional month to the year do we only add it in Adar? Why not have a second Chesvon or a second Shevat, etc.?
| Adar is the last month in the year. So from a simple technical standpoint it's the easiest to add a month then. Especially if you want all the other months' numbers to remain like they should be (and more importantly - compatible with what the Torah calls them)
| 0.666667 | Adar is the last month in the year - the easiest to add a month |
.htaccess remove index.php sort of works, but not the first time after browser cache is cleared | I don't know if this is a new thing or if it's been an issue all along, but the client just noticed and i recreated the issue myself. If I clear my browser cache and then visit my client's site at a URL like http://www.example.com/product/product1 it will redirect to http://www.example.com/index.php/product/product1. The page looks fine. After refreshing or visiting that URL again the URL will pull up correctly at http://www.example.com/product/product1. If I clear my browser cache again it will redirect to the index.php url again.
Here's my .htaccess file, any ideas why this might be happening? Thanks for any ideas!
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
RewriteCond $1 !(^index\.php|(\.(gif|jpe?g|png|css|js)))$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1 [L]
Redirect 301 /helpdesk http://helpdesk.example.com
Redirect 301 /splash http://example.com
Redirect 301 /webmail http://mail.example.com:32000
Redirect 301 /email http://mail.example.com:32000
Redirect 301 /timeclock http://timeclock.example.com:62345
Redirect 301 /signature http://signature.example.com
EDIT: I modified my .htaccess file to the recommended one from EllisLab and that seems to have fixed the index.php from showing up. Something is still a little wonky though. When I clear the browser cache and visit a url with a hash tag at the end (http://www.example.com/product/product1#tab3), the redirect removes the hash tag and the rest of the url after it. If I refresh the page it will work as expected. it only has issues with the first time visiting the url after a clean browser cache. Any ideas?
RewriteEngine On
RewriteBase /
# Removes index.php from ExpressionEngine URLs
RewriteCond %{THE_REQUEST} ^GET.*index\.php [NC]
RewriteCond %{REQUEST_URI} !/system/.* [NC]
RewriteRule (.*?)index\.php/*(.*) /$1$2 [R=301,NE,L]
# Directs all EE web requests through the site index file
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1 [L]
| On further investigation, it appears that this redirect is coming from inside that template.
See the attached image
All of your header assets are being loaded just fine until something else triggers the redirect, in this example it happened after the server already responded to 15 gets from the generated page. What kind of addons does this template use? Try investigating that.
EDIT: To be clear, anchor tags are never even sent to the server. If it is the .htaccess setup, there is no way it's rewriting anything based on anchors.
| 0.888889 | What kind of addons does this template use? |
How suddenly does lactose-intolerance onset? | How quickly can the loss of lactose tolerance onset in an adult?
Such as being able to process lactose normally to having notice symptoms associated with the inability to process lactose.
I am not asking how long it takes to digest food, but rather how long it takes for lactose intolerance to become noticeable (hours, days, weeks, months, years).
| Disclaimer: I am not medically qualified, and this answer must not be construed as being medical advice of any kind.
Primary adult hypolactasia is the most common cause of lactose intolerance. The majority of the world's population have this phenotype.
In these individuals, at weaning, there is a reduction in the level of the enzyme lactase, which is responsible for digesting lactose to galactose and glucose in the small intestine. Undigested lactose can create symptoms via osmotic effects (causing diarrhoea) and because it is metabolised by bacteria in the colon, producing gas and thus abdominal bloating.
About 35% of adults have a genetic variant in an region upstream of the lactase gene which results in the expression of lactase continuing into adult life. These individuals are lactose tolerant. This trait is most common in Northern Europe.
According to references cited in
Ingram, CJE et al. (2009) Lactose digestion and the evolutionary genetics of lactase persistence Hum Genet (2009) 124:579–591
(I have removed citations from the passage for clarity.)
"most lactase non-persistent individuals can tolerate small amounts of lactose (as in tea or coffee), and some can consume a lot without ill effects. Variation in the composition of the gut flora between individuals, as well as a psychosomatic component may account for some of the interindividual variation in symptoms."
The clear implication is that there is a lot of variation in the tolerance of lactose amongst those lacking the lactase persistence trait. Given the contribution of the gut flora to the symptoms these could presumably vary as a result of, for example, antibiotic treatment. Also I imagine that the effects of undigested lactose could be synergistic with some other gut disturbance.
Added in response to comment from the OP:
In someone with the (common) genotype that corresponds to 'no persistence of lactase' the possibility of showing symptoms will be present from a young age. Apparently there is a lot of variation in the severity of symptoms. If an adult suddenly exhibits symptoms then I am suggesting that this could be due to an interaction of non-persistence with some other gut disturbance - I imagine this could happen quite quickly. Alternatively I suppose that a change in diet could trigger symptoms.
| 1 | Primary adult hypolactasia is the most common cause of lactose intolerance |
Nexus 4 does not wake up from Sleep randomly | I have a Nexus 4 running stock rom kit kat 4.4.2. There were few instances, in which when the phone goes to sleep, I see the notification light blinking indicating a new email/message, but it doesn't wake up when I press the power button. I have to soft reboot the phone {press the power button for 5 seconds to turn it off, then turn on}to use it again. This happens more frequently on some days, and some times it doesn't happen for weeks.I tried calling the phone from my land line when it is in this state, I could hear it ringing on the landline, but the phone doesn't actually ring. After rebooting, it doesn't even show a missed call. When I reboot it, the phone's battery is substantially less (down by about 10%). It started happening only since 4.3 JB update, it was fine till then.
I tried a full factory reset, and minimal apps, it worked fine. Once I installed all my apps back, this started happening again. I am thinking one of my apps is causing this and it could be an application or a bug in Kit kat/JB itself.
Is there any known bug in kitkat 4.4.2 (or >= 4.3 ) or is there any application known to cause this?
Is there any way I can look at the logs to see if any specific application is causing this.
Force wake up the phone without having to reboot it ?
| You might wish to run adb logcat for investigation. But that might only be helpful if you know how to trigger the issue.
Another approach would be, as you already indicated:
start with a factory reset. You know that with a "fresh device" the issue does not happen, as described by your question
install back only a part of your apps (the ones you feel most essential), but not more than ~50%. See if the issue still happens.
Yes: the problematic app was in this batch
No: the problematic app was not in this batch
start over at 1., this time with the other half. Does the issue show up again?
If 2. + 3. are answered "No", it might as well be a combination of apps. If the issue shows up only in either 2. or 3. (but not in both cases), start narrowing down. I will assume here it was part of 3., switch items if it was the other way around:
starting over with factory-reset and installing the first half of your apps.
split the other half in two again, and repeat as above
This procedure should help you finding the culprit, while still being able to use your device and as much of your apps as possible. Of course, you could also start with factory-reset and then install each app one-by-one (which might be the safer approach) – but as the issue might not show up immediately (may even take a day or more), the above might be more practical.
| 1 | Install back only a part of your apps |
Forward slashes: are they acceptable in Commonwealth English prose? | In Commonwealth English is it acceptable to write this in a magazine article:
If there are there any nearby towns/villages …
| Using a forward slash is acceptable as a typographical symbol in place of "or". Overuse has the unfortunate consequence of reduced flow and/or writer appearing unsure of himself/herself.
| 1 | Using forward slash is acceptable as a typographical symbol in place of "or" |
Is it possible to create your own server on the Xbox 360? | Is it possible to create your own server on the Xbox 360?
| No. There is nothing in place (unless I've missed it) to host a game of BF3 on your own server. This is for the best as hosting one's own server opens up the potential for great abuse.
| 1 | Host a game of BF3 on your own server |
Other ways to increment a variable in JavaScript |
Possible Duplicate:
Why avoid increment (“++”) and decrement (“--”) operators in JavaScript?
I'm a big fan of Douglas Crockford and his excellent book, JavaScript: The Good Parts. I also use his JSLint tool on an hourly basis before checking in any code to our repository, as is good sense.
One thing I've noticed when running code through JSLint is its insistence that the ++ increment operator is somehow evil. I know I can turn certain rules off, but that's cheating ;). Crockford mentions his dislike on page 112 of JS: TGP...
In my own practice, I observed that when I used ++ and --, my code tended to be too tight, too tricky, too cryptic. So, as a matter of discipline, I don't use them any more. I think that as a result, my coding style has become cleaner.
That's all very lovely, but he doesn't give any examples of the way he codes them now. I assume he's doing something like...
var i;
i = 0;
i = i + 1;
Again, great, but I've got a few basic 'for loops' in my JS code, as I imagine many people have, and I've always used the standard syntax...
for (i = 0; i < myArray.length; i++) {
// Loop Stuff
}
Am I missing something? What's the cleanest and/or best way to increment/decrement?
| The only tricky thing I see in autoincrement/decrement operators (and I'm quite surprised that no one here pointed that out) is the difference between prefix (++i) and postfix (i++) versions. I also believe that autoincrement/decrement operators are slightly more efficient, in general. Besides this, I think the choice is based mainly on aesthetics, especially in javascript.
| 0.777778 | difference between prefix (++i) and postfix (i++) versions |
Reverse iteration from a given map iterator | I want to find an element in the map using map::find(key), and then iterate the map in reverse order from the point where I found the element, till the beginning (i.e. until map::rend()).
However, I get a compile error when I try to assign my iterator to a reverse_iterator. How do I solve this?
| Converting an iterator to a reverse iterator via the constructor should work fine, e.g. std::map<K, V>::reverse_iterator rit(mypos).
A minimal example using std::vector:
#include <vector>
#include <iostream>
#include <algorithm>
int main() {
typedef std::vector<int> intVec;
intVec vec;
for(int i = 0; i < 20; ++i) vec.push_back(i);
for(intVec::reverse_iterator it(std::find(vec.begin(), vec.end(), 10));
it != vec.rend(); it++)
std::cout << *it;
}
| 1 | Converting a reverse iterator via the constructor should work fine |
How do I counter support Zyra? | I main support, usually opting for poke supports such as Lulu and Sona or aggressive supports such as Blitzcrank and Leona. Since the various Regional Finals, however, I've begun to encounter support Zyras in my bot lane.
This is a very difficult lane for me. I can't establish lane dominance, since Zyra just sits in her bush and puts seeds in mine. I've tried a rune page with flat MR for when I play against Zyra to counter some of her harass, but it doesn't help against her cc.
How can I effectively counter a support Zyra?
| There seems to be a lot of misleading information in the other answers here. I play Zyra as support at Diamond 1. The thing with Zyra is that she is more of a high risk/high reward support. She can beat anyone, but strong engages is the best chance you have at beating her. The best counters to Zyra are champions that can force hard engages on her and holder her stunned/cced for a long amount of time. Short list of these would be (Leona, Thresh, Blitzcrank)
As a hard engage champion, you have 2 ways to force a fight.
1) Bait out her E so that she cannot root you as you try to run up to her.
2) Dodge her E or get close enough that even if you get hit by it you still can lock her down.
You need to then focus her down because she will often be much more squishy than the adc. Also a little known fact is that at level 3 onward, she does far more damage than the adc in these fights also. For this reason you need to try to kill her before she can unload on your adc. As a tanky support you can often live through her damage and her adcs combined (use all defensive quints/marks in addition to your normal defensive glyphs/seals and 0/9/21 or 0/21/9 masteries).
Even if you counter Zyra with these hard engages, if she gets too far ahead she will easily kill you and your adc over and over again. You need to get ahead before level 6 because it increases her burst substantially.
Alternatively, Vel'Koz actually can do great vs her. He has a much longer poke and also can stun. (Lux doesn't work as well because if they try to hard engage on you, the snare doesn't do much to stop them from getting their combo off) Never engage this fight and focus on poking safely until you force her back or she does a sloppy engage if she gets desperate.
Why don't a lot of the other answers work?
Janna: Other's stated that you can simply shield your adc every time Zyra tries to damage them. Unfortionately, Zyra's abilities do FAR more damage than Janna can shield for. Zyra's poke can be used to easily zone your ADC out of lane if you are a support Janna since you have no way to counter her damage and engage on her.
Taric: Sure he has a targeted stun, but it moves extremely slowly. This gives her plenty of time to react to the stun with a root + seed before it hits her and so the only thing taric gets off is a stun. He can't follow up to finish Zyra off and if Zyra ignored taric and managed to get a burst off on the adc, the adc will quickly die from the damage zyra just output with her abilities/plants combined with her own adcs damage.
Soraka: Her heal has such a high CD she can't heal the damage Zyra does before she can get another round of her abilities off. Also, she can safely get her abilities off before she can get silenced by soraka. Soraka will never be able to be in range for her Q to do damage until the fight is over.
Sona: She just gets destroyed by Zyra. Shorter ranged poke, not enough sustain to sustain past Zyra's damage.
| 1 | Zyra is more of a high risk/high reward support . |
Is Microsoft's fopen commit mode flag broken on Windows 7? | I write the engine for our company's products, which are designed to run on our clients kiosks. This includes code to commit file writes to disk.
We have no control over the client's choice of hardware or OS, and for the first time we've been given Windows 7 Embedded to work with. Suddenly, our secure writes have started failing if power is lost immediately after the flush.
Although including commode.obj causes fflush to commit, even on Win7, I've always preferred to use the MS-specific commit mode flag ("c") on Windows (the Linux version uses a completely different method), because as I write the library not the products, I can never be sure that commode.obj has actually been included, so I can't throw an error.
FILE* p_f = fopen("foo.dat", "wbc");
fwrite(p_important_stuff, 1, size, p_f);
fflush(p_f);
So my question is: Is the commit mode flag broken on Win7, and if so is there a way I can guarantee commode.obj is included, or is there some other way I can change the state of the global commit flag?
| There are most likely other issues than those exposed by the C file interfaces. I'm thinking about OS and filesystem decisions to delay writes, and HDD caching, which may explain the behavior you see.
ASide from that, you should be able to always include the commode.obj simply by linking your library as a DLL instead of a static library.
| 1 | commode.obj should always be a DLL instead of static library |
Visual Studio keeps changing resx files | I'm working on a VB.Net project and using SVN. I noticed that every time I open my main form, Visual studio slightly modifies my .resx file, which means that I keep having to re-commit it, which is quite annoying.
Has anybody experienced such problems? A diff file demonstrating the problem can be seen at http://synchronicity.svn.sourceforge.net/viewvc/synchronicity/trunk/Create%20Synchronicity/MainForm.resx?r1=272&r2=359&pathrev=359
Thanks,
CFP.
| Bit late, but this sounds like a problem I raised with Microsoft around Image Lists:https://connect.microsoft.com/VisualStudio/feedback/details/428868/png-files-corrupted-in-an-imagelist-when-opening-and-closing-a-form
| 0.888889 | Problem with Image Lists |
Can the term "jack/jerk off" be used for female masturbation? | I apologize for this potentially obscene question.
Can the terms jack off or jerk off be used for female masturbation? If not (which is my intuition), what would be the not too poetic vulgar slang equivalent? By too poetic I refer to expressions such as spank the monkey, choke the chicken, etc.
I checked online dictionaries, and most of them don't expand on the usage, and some of the definitions in the Urban Dictionary imply that jack off primarily refers to male masturbation, but do not provide the female counterpart.
| I'm not sure how widespread it is but jill off (a reference to Jack and Jill) is sometimes used.
| 1 | jill off (Jill and Jill) |
How do I change the MySQL database directory? | I am using CentOS with cPanel. On my server, all MySQL databases save at /var/lib/mysql. Now /var is 100% full and MySQL has stopped working. How can I move the databases to a new directory like /home/mysql especially considering that this server is managed with cPanel?
| if you want to change mysql data directory, you should do edit the mysql config file and change datadir value.
datadir = /home/user/data
Your new data directory MUST be owned by mysql and has proper security context.
chown -R mysql.mysql /home/user/data
chcon -R -t mysqld_db_t /home/user/data
restart mysql server
/etc/init.d/mysqld restart
| 0.888889 | change mysql data directory value |
Can the catalytic converter from a 2005 VW Beetle be used in a 2004 VW Jetta? | Someone I know just seriously damaged their 2005 VW Beetle and it may not be worth fixing (drove over a divider and at least broke the transmission). The car has approximately 34k miles on it, if I remember correctly.
My mechanic recently told me that the catalytic converter in my 2.0 L 2004 VW Jetta is starting to get clogged, judging by the 80'C temperature drop between input and output and that he thinks the performance is not good enough for a 2L engine. The Jetta has about 92k miles on it.
Is the cat converter from the Beetle compatible with my car? If it is, would it be worth the effort of trying so salvage it from the Beetle, assuming it isn't damaged, and what would be a fair price to offer?
| Looking it up on RockAuto.com, it shows for the 2.0l SOHC engine (they do not list an option for a 2.0L DOHC in the Beetle), the catalytic convertor which is offered there is a direct fit for 2001-2005 Beetle and for the 2002-2006 Jetta (as well as the 2001-2005 Golf and some even have it for a Mercedes model ... argh). This would seem to me to mean the cat in the Beetle should fit over to your Jetta without the need for modification. I think there is a flex pipe at the head (where the cat pipe connects to the turbo), so any small variance should not be an issue.
As far as cost of a new one, examples from rockauto are in the $250 range. Just throwing that out there.
| 1 | RockAuto.com shows a 2.0l SOHC engine in the Beetle . |
How can I typeset the following symbol for beep in multimeter (code)? | How can I typeset the following symbol for beep in multimeter?
| If you just need some circular waves, you may want to use expanding waves here:
% arara: pdflatex
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{decorations.pathreplacing}
\tikzset{radiation/.style={decorate,decoration={expanding waves,segment length=3pt},thick}}
\begin{document}
Beep: \tikz[baseline=-.5ex]{\draw[radiation,decoration={angle=30}] (0,0) -- (.5,0);}
\end{document}
| 1 | Expanding waves: pdflatex |
Creating Excel document is very slow | Attached is a generic code I wrote to create an Excel file with x number of worksheets.
The problem I am having is that it's pretty slow, like 5 seconds a sheet. It was my understanding that using a for loop when creating the tables was ideal, but the issue seems to be with tables containing over a thousand or so records... still wouldn't think it should take this long.
Any pointers would be appreciated, also, if I am completely left field with this code let me know, up-to-date Excel code resources seem to be hard to find.
public static string Export(string excelFileName,
string[] excelWorksheetName,
string tableStyle,
params System.Data.DataTable[] dt)
{
Application xls = new Application();
xls.SheetsInNewWorkbook = dt.Length;
// Create our new excel application and add our workbooks/worksheets
Workbooks workbooks = xls.Workbooks;
Workbook workbook = workbooks.Add();
// Hide our excel object if it's visible.
xls.Visible = false;
// Turn off calculations if set to automatic; this can help prevent memory leaks.
xls.Calculation = xls.Calculation == XlCalculation.xlCalculationAutomatic ? XlCalculation.xlCalculationManual : XlCalculation.xlCalculationManual;
// Turn off screen updating so our export will process more quickly.
xls.ScreenUpdating = false;
// Create an excel table and fill it will our query table.
int iterator = dt.Length - 1;
for (int i = 0; i <= iterator; i++)
{
// Turn off calculations if set to automatic; this can help prevent memory leaks.
Worksheet worksheet = (Worksheet)xls.Worksheets[i + 1];
worksheet.Name = excelWorksheetName[i];
worksheet.Select();
if (dt[i].Rows.Count > 0)
{
// Format this information as a table.
Range tblRange = worksheet.get_Range("$A$1");//string.Format("$A$1", dt[i].Rows.Count + 1));
tblRange.Worksheet.ListObjects.Add(XlListObjectSourceType.xlSrcRange,
tblRange,
System.Type.Missing,
XlYesNoGuess.xlYes,
System.Type.Missing).Name = excelWorksheetName[i];
tblRange.Select();
tblRange.Worksheet.ListObjects[excelWorksheetName[i]].TableStyle = tableStyle;
// Create a row with our column headers.
for (int column = 0; column < dt[i].Columns.Count; column++)
{
worksheet.Cells[1, column + 1] = dt[i].Columns[column].ColumnName;
}
// Export our data table information to excel.
for (int row = 0; row < dt[i].Rows.Count; row++)
{
for (int column = 0; column < dt[i].Columns.Count; column++)
{
worksheet.Cells[row + 2, column + 1] = (dt[i].Rows[row][column].ToString());
}
}
}
// Freeze our column headers.
xls.Application.Range["2:2"].Select();
xls.ActiveWindow.FreezePanes = true;
xls.ActiveWindow.DisplayGridlines = false;
// Auto fit our rows and columns.
xls.Application.Cells.EntireColumn.AutoFit();
xls.Application.Cells.EntireRow.AutoFit();
// Select the first cell in the worksheet.
xls.Application.Range["$A$2"].Select();
// Turn off alerts to prevent asking for 'overwrite existing' and 'save changes' messages.
xls.DisplayAlerts = false;
}
string SaveFilePath = string.Format(@"{0}.xls", excelFileName);
workbook.SaveAs(SaveFilePath, XlFileFormat.xlWorkbookNormal, Type.Missing, Type.Missing, Type.Missing, Type.Missing, XlSaveAsAccessMode.xlExclusive, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing);
workbook.Close();
// Release our resources.
Marshal.ReleaseComObject(workbook);
Marshal.ReleaseComObject(workbooks);
Marshal.ReleaseComObject(xls);
Marshal.FinalReleaseComObject(xls);
return SaveFilePath;
}
| Comments
Your code has way too many comments, mostly redundant ones - some are even obsolete!
Good comments should say why, not what.
// Create our new excel application and add our workbooks/worksheets
Workbooks workbooks = xls.Workbooks;
Workbook workbook = workbooks.Add();
This comment says what the code is doing, and it's lying - you're not creating a new Excel application, you're using an existing instance. Remove it.
// Hide our excel object if it's visible.
xls.Visible = false;
This comment adds no value, and is lying to a certain extent: you don't actually care whether it's already visible or not. Better just remove it.
// Turn off calculations if set to automatic; this can help prevent memory leaks.
xls.Calculation = xls.Calculation == XlCalculation.xlCalculationAutomatic ? XlCalculation.xlCalculationManual : XlCalculation.xlCalculationManual;
This one is accurate and informative - it says why you're turning off automatic calculations.. but it also says what the code is doing. Better rephrase it:
// turning off automatic calculations improves performance and can help prevent memory leaks.
xls.Calculation = (xls.Calculation == XlCalculation.xlCalculationAutomatic)
? XlCalculation.xlCalculationManual
: XlCalculation.xlCalculationManual;
Notice how readability is improved by splitting the ternary operation into 3 lines. It appears the condition is moot, since both ends produce the same assignation. The instruction should be rewritten as simply:
xls.Calculation = XlCalculation.xlCalculationManual;
// Turn off screen updating so our export will process more quickly.
xls.ScreenUpdating = false;
Again, says what - the why makes it closely related to the previous statement. Thus:
// turning off automatic calculations and screen updating
// improves performance and can help prevent memory leaks.
xls.Calculation = XlCalculation.xlCalculationManual;
xls.ScreenUpdating = false;
// Create an excel table and fill it will our query table.
Remove. This one adds no value.
for (int i = 0; i <= iterator; i++)
{
// Turn off calculations if set to automatic; this can help prevent memory leaks.
Worksheet worksheet = (Worksheet)xls.Worksheets[i + 1];
worksheet.Name = excelWorksheetName[i];
worksheet.Select();
Apparently the code under that comment was moved, but the comment remained.
As for performance, @Will's comment is accurate - COM interop is hurting you here. What's slowing it down is the many calls to the Excel object model (COM interop in itself incurs a performance penalty, but Excel interop somehow makes it even worse). The only way is to limit the number of times you're accessing the Excel object model.
An alternative approach could be to write the data in a .csv file, and use the Excel object model to import the .csv data all in one shot (rather than looping into rows and columns to write the data "manually"), and then to format the workbook and save it in .xlsx format.
| 1 | How do you turn off automatic calculations? |
Powershell script to find permissions for a specific user | what am i doing wrong
user.ps1
$user = "sp2010\systemsacct"
$site = $gc | Get-SPSite sp2010
$site | Get-SPWeb -Limit All | Get-SPUserEffectivePermissions $user Out-GridView -Title "Web Permissions for $user"
| Found this PowerShell script which scans these areas to to retrieve a specific user's access rights:
Farm Administrator's Group
Central Administration Web Application Policies
Site Collection Administrators
Scans the all Site collections and Sub-sites with Unique Permissions
Scans all Lists and Libraries with unique permissions
Scans all Groups which has permissions on sites and Lists
After executing the script, it generates a CSV file (Tab Separated, In fact!) with details: URL, Site/List, Title, Permission Type, Permissions as in the below screenshot.
Refer: SharePoint Permission Report: Check Access Rights for a Specific User
http://www.sharepointdiary.com/2013/01/permission-report-for-specific-user.html
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
Function GetUserAccessReport($WebAppURL, $SearchUser)
{
#Get All Site Collections of the WebApp
$SiteCollections = Get-SPSite -WebApplication $WebAppURL -Limit All
#Write CSV- TAB Separated File) Header
"URL `t Site/List `t Title `t PermissionType `t Permissions" | out-file UserAccessReport.csv
#Check Whether the Search Users is a Farm Administrator
$AdminWebApp= Get-SPwebapplication -includecentraladministration | where {$_.IsAdministrationWebApplication}
$AdminSite = Get-SPweb($AdminWebApp.Url)
$AdminGroupName = $AdminSite.AssociatedOwnerGroup
$FarmAdminGroup = $AdminSite.SiteGroups[$AdminGroupName]
foreach ($user in $FarmAdminGroup.users)
{
if($user.LoginName -eq $SearchUser)
{
"$($AdminWebApp.URL) `t Farm `t $($AdminSite.Title)`t Farm Administrator `t Farm Administrator" | Out-File UserAccessReport.csv -Append
}
}
#Check Web Application Policies
$WebApp= Get-SPWebApplication $WebAppURL
foreach ($Policy in $WebApp.Policies)
{
#Check if the search users is member of the group
if($Policy.UserName -eq $SearchUser)
{
#Write-Host $Policy.UserName
$PolicyRoles=@()
foreach($Role in $Policy.PolicyRoleBindings)
{
$PolicyRoles+= $Role.Name +";"
}
#Write-Host "Permissions: " $PolicyRoles
"$($AdminWebApp.URL) `t Web Application `t $($AdminSite.Title)`t Web Application Policy `t $($PolicyRoles)" | Out-File UserAccessReport.csv -Append
}
}
#Loop through all site collections
foreach($Site in $SiteCollections)
{
#Check Whether the Search User is a Site Collection Administrator
foreach($SiteCollAdmin in $Site.RootWeb.SiteAdministrators)
{
if($SiteCollAdmin.LoginName -eq $SearchUser)
{
"$($Site.RootWeb.Url) `t Site `t $($Site.RootWeb.Title)`t Site Collection Administrator `t Site Collection Administrator" | Out-File UserAccessReport.csv -Append
}
}
#Loop throuh all Sub Sites
foreach($Web in $Site.AllWebs)
{
if($Web.HasUniqueRoleAssignments -eq $True)
{
#Get all the users granted permissions to the list
foreach($WebRoleAssignment in $Web.RoleAssignments )
{
#Is it a User Account?
if($WebRoleAssignment.Member.userlogin)
{
#Is the current user is the user we search for?
if($WebRoleAssignment.Member.LoginName -eq $SearchUser)
{
#Write-Host $SearchUser has direct permissions to site $Web.Url
#Get the Permissions assigned to user
$WebUserPermissions=@()
foreach ($RoleDefinition in $WebRoleAssignment.RoleDefinitionBindings)
{
$WebUserPermissions += $RoleDefinition.Name +";"
}
#write-host "with these permissions: " $WebUserPermissions
#Send the Data to Log file
"$($Web.Url) `t Site `t $($Web.Title)`t Direct Permission `t $($WebUserPermissions)" | Out-File UserAccessReport.csv -Append
}
}
#Its a SharePoint Group, So search inside the group and check if the user is member of that group
else
{
foreach($user in $WebRoleAssignment.member.users)
{
#Check if the search users is member of the group
if($user.LoginName -eq $SearchUser)
{
#Write-Host "$SearchUser is Member of " $WebRoleAssignment.Member.Name "Group"
#Get the Group's Permissions on site
$WebGroupPermissions=@()
foreach ($RoleDefinition in $WebRoleAssignment.RoleDefinitionBindings)
{
$WebGroupPermissions += $RoleDefinition.Name +";"
}
#write-host "Group has these permissions: " $WebGroupPermissions
#Send the Data to Log file
"$($Web.Url) `t Site `t $($Web.Title)`t Member of $($WebRoleAssignment.Member.Name) Group `t $($WebGroupPermissions)" | Out-File UserAccessReport.csv -Append
}
}
}
}
}
#******** Check Lists with Unique Permissions ********/
foreach($List in $Web.lists)
{
if($List.HasUniqueRoleAssignments -eq $True -and ($List.Hidden -eq $false))
{
#Get all the users granted permissions to the list
foreach($ListRoleAssignment in $List.RoleAssignments )
{
#Is it a User Account?
if($ListRoleAssignment.Member.userlogin)
{
#Is the current user is the user we search for?
if($ListRoleAssignment.Member.LoginName -eq $SearchUser)
{
#Write-Host $SearchUser has direct permissions to List ($List.ParentWeb.Url)/($List.RootFolder.Url)
#Get the Permissions assigned to user
$ListUserPermissions=@()
foreach ($RoleDefinition in $ListRoleAssignment.RoleDefinitionBindings)
{
$ListUserPermissions += $RoleDefinition.Name +";"
}
#write-host "with these permissions: " $ListUserPermissions
#Send the Data to Log file
"$($List.ParentWeb.Url)/$($List.RootFolder.Url) `t List `t $($List.Title)`t Direct Permissions `t $($ListUserPermissions)" | Out-File UserAccessReport.csv -Append
}
}
#Its a SharePoint Group, So search inside the group and check if the user is member of that group
else
{
foreach($user in $ListRoleAssignment.member.users)
{
if($user.LoginName -eq $SearchUser)
{
#Write-Host "$SearchUser is Member of " $ListRoleAssignment.Member.Name "Group"
#Get the Group's Permissions on site
$ListGroupPermissions=@()
foreach ($RoleDefinition in $ListRoleAssignment.RoleDefinitionBindings)
{
$ListGroupPermissions += $RoleDefinition.Name +";"
}
#write-host "Group has these permissions: " $ListGroupPermissions
#Send the Data to Log file
"$($Web.Url) `t Site `t $($List.Title)`t Member of $($ListRoleAssignment.Member.Name) Group `t $($ListGroupPermissions)" | Out-File UserAccessReport.csv -Append
}
}
}
}
}
}
}
}
}
#Call the function to Check User Access
GetUserAccessReport "http://sharepoint.crescent.com" "Global\Salaudeen"
Read more: http://www.sharepointdiary.com/2013/01/permission-report-for-specific-user.html#ixzz2macjy36a
| 0.888889 | SharePoint Permission Report: Check Access Rights for a User |
Best CMS for review-type sites | Is there an ideal CMS for making a review site? By review site, I mean like a restaurant review site where you have each entry belonging to different major categories like Cuisine and City. Then users can browse and filter by each or by combination (Chinese Food in Los Angeles, with suggestions of other Chinese restaurants in LA, etc). Furthermore, I'd want it to support other fields like price, parking, kid-friendliness, etc. And to have users be able to filter by those criteria.
I've been told that with a combination of custom taxonomies, plug-ins and many clever little queries, that Wordpress 3.x can handle this. But I'm having a heck of a time with it getting into the nitty gritty, and that's where I find the community support is lacking. The sort of stuff you'd think would work in WP, like making one parent category for Cuisine and one for City, don't really work once you get further in and start trying to pull it all together. Then you find these blog posts where people say, "This example shows that one could create a huge movie review site using custom taxonomies..." but when you go and try it you hit all sorts of challenges and oddities that point a big long finger at Wordpress being in fact a blogging platform. The best I came up with was one category for the cuisine and one tag for the city, then I created a couple of custom tag-like taxonomies for the other features. It's quite a mess to try to figure out how to assemble all of that into a natural, intuitive site. I expect a few versions down the road WP will be able to do these sorts of sites out of the box.
So I thought I'd take a step back before I run back into the Wordpress fray and find out if maybe there is another platform better suited to this sort of relational content site. Directory scripts in some ways offer many of the features I'm looking for, but I need something more flexible and, hopefully, interactive (comments, reviews). I'm especially looking for feedback from people who've crafted sites like this. Thanks!
| When WordPress started it was a blogging platform. Now it has evolved into a more complete CMS. More and more website owners are using WordPress for purposes other than simply blogging, and premium themes are being used in many of these cases.
With the affordability of great premium themes, WordPress seems like it will continue to grow even more popular among these types of sites. I believe that this growth will increase the need for more complex plugins.
| 0.666667 | WordPress has evolved into a more complete CMS |
Exit Google Chrome from terminal | Is there a way to cause google-chrome to quit, from the terminal, besides using killall google-chrome?
I would like to be able to close it from a script without killing it.
| This command exits the chrome process tree gracefully, in all window managers:
pkill --oldest chrome
or if you prefer:
/usr/bin/pkill --oldest --signal TERM -f chrome
Details:
gracefully means: avoid seeing “Google Chrome didn't shut down correctly. To repoen ...” next time chrome starts
chrome browser (e.g. version 39.0.2171.95) traps and gracefully handles SIGTERM
signal a single process, the root of chrome’s process tree, hence --oldest
SIGTERM is the same as signal 15, hence --signal TERM, or just leave it out since SIGTERM is the default signal
wmctrl works with Unity and some others but it does not work with all window managers
wmctrl -c closes one window at a time so to close all chrome windows you would need something like while wmctrl -c 'Google Chrome'; do sleep 0.2; done
| 0.777778 | SIGTERM is the default signal wmctrl works with Unity and some others |
Why do read links turn purple? | Today I saw a post on Facebook that had this pun:
Clicked links turn purple because blue + "read" equals purple
Is there any specific reason why a link is blue and when it is clicked/read, it turns to purple?
Do these colors have any meaning?
| I can't say if this is the actual reason it was chosen, but a reason why purple is a good choice is that, other than red, it has the lowest relative luminocity of any hue.
So, a purple will tend to appear darker than an equivalent blue. Assuming the background is white and the text is black, and assuming we expect people to be more interested in pages they haven't already read, visited links will stand out less from a block of black text than unvisited links, but will still be noticeable.
Red isn't an ideal choice because in many cultures, it's associated with warnings and alarm.
Purple's low relative luminosity is consistent across the two most common forms of colour blindness (which are shown in this chart from wikipedia which shows them, somewhat ironically, with red and green lines... standard vision is barely visible behind red (deuteranopic, to green's protanopic) on the right in yellow):
Did they decide by studying a chart of relative luminosity? Probably not. But the fact purples appear dark could be the reason, for example a discussion could easily have gone like this:
"We need a colour for visited links. It should look darker so they
stand out less."
"Dark blue?"
"No, people might not be able to tell if a link was dark or light blue if it was the only link on a page."
"How about purple? Purple is, you know, dark, it's not a bright colour like yellow or green."
"Yeah, looks good to me."
| 1 | Why is purple a good choice? |
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.
|
God wraps himself in darkness. Hebrews 12;29 Our God is a consuming fire. Leviticus 16;2 And the LORD said to Moses, Speak unto Aaron thy brother, that he come not at all times into the holy place within the veil before the mercy seat, which is upon the ark; that he die not: for I will appear in the cloud upon the mercy seat. 2. Spirit enticing Ahab. Ezekiel 18;21-23 But if the wicked will turn from all his sins that he hath committed, and keep all my statues, and do that which is lawful and right, he shall surely live he shall not die. All his transgressions that he hath committed, they shall not be mentioned unto him; in his righteouness that he hath done he shall live. Have I any pleasure at all that the wicked should die? saith the LORD God: and not that he should return from his ways and live? God allows man free will. 2 Thessalonians 2;11-12 And for this cause God shall send them strong delusion, that they should believe a lie. That they all might be damned who believe not the truth, but had pleasure in unrighteouness. Proverbs 1;24-31 Because I have called, and ye refused, I have stretched out my hand, and no man regarded; But have set at nought all my counsel, and would none of my reproof; I also will laugh at your calamity; I will mock when your fear cometh; When your fear cometh as desolation, and your destruction cometh as a whirlwind; when distress and anguish cometh upon you. Then shall they call upon me, but I will not answer; they shall seek me early, but they shall not find me: For that they hated knowledge, and did not choose the fear of the LORD: they would none of my counsel: they despised all my reproof. Therefore shall they eat of the fruit of their own way, and be filled with their own devices. Psalms 33;13-15 The LORD looketh from heaven; he beholdeth all the sons of men. From the place of his habitation he looketh upon all the inhabitants of the earth. He fashioneth their hearts alike; he considereth all their works.
| 0.777778 | God allows man free will. |
"Find ten apples and oranges" Do I find 10 or 20? | If I read the sentence
Find ten apples and oranges.
Do I need to find ten or twenty pieces of fruit?
| I think its ambiguous. If the question was:
"Find ten apples and ten oranges." this is no ambiguity.
It is the writer's responsibility to communicate clearly and without ambiguity.
If you have to struggle to determine which of three or four possible questions is actually being asked, it's not YOUR fault, it's his.
| 1 | "Find ten apples and ten oranges" |
Does Spider-Man shoot spider silk? | In the comics, Spider-Man shoots synthetic 'webbing' that he created from wrist devices called web-shooters. Is this the same (but scaled up) as spider silk, or is it stronger/different in anyway?
| The Marvel Wiki entry on Spider-Man's Web-Shooters says this about the web fluid:
The web fluid is a shear-thinning liquid (virtually solid until a shearing force is applied to it, rendering it fluid) whose exact formula is as yet unknown, but is related to nylon. On contact with air, the long-chain polymer knits and forms an extremely tough, flexible fiber with extraordinary adhesive properties. The web fluid's adhesive quality diminishes rapidly with exposure to air. (Where it does not make contact with air, such as the attachment disk of the web-shooter, it remains very adhesive.) After about one to two hours, certain imbibed esters cause the solid form of the web fluid to dissolve into a powder. Because the fluid almost instantly sublimates from solid to liquid when under shear pressure, and is not adhesive in its anaerobic liquid/solid phase transition point, there is no clogging of the web-shooter's parts.
The Marvel Directory entry on Spider-Man says that Peter Parker intended to imitate spider's silk.
Parker used equipment borrowed from his high school to fabricate a fluid that imitated a spider's silk web, and spinneret devices to project that fluid from his wrists in the form of a web strand.
| 1 | Spider-Man's Web-Shooters is a shear-thinning liquid whose exact formula is unknown . |
Unprotect a Word Document |
Possible Duplicate:
Can’t edit a specific document in Word 2007
How do I remove the password protection (unprotect) on a Word document if I don't know the password? (i.e. The protection provided by Tools > Unprotect Document)
| One possible solution. I think there are others as well.
Open a protected document in MS Word
Save as "Web Page (*.htm; *.html)", close Word
Open html-document in any Text-Editor
Search <w:UnprotectPassword> tag, the line reads something like that: <w:UnprotectPassword>ABCDEF01</w:UnprotectPassword> (password is already in hex-format)
Keep the "password" in mind
Open original document (.doc) with any hex-editor
Search for hex-values of the password, which is stored in reverse order. (e.g. If password is 0xAB 0xCD 0xEF 0x01. Then the password is in the .doc file as 0x01 0xEF 0xCD 0xAB)
Overwrite all 4 double-bytes with 0x00, Save, Close
Open document with MS Word, Select "Tools / Unprotect Document" (password is blank)
| 1 | Open a protected document in MS Word Save as "Web Page (*.htm; *.html)" |
Removal of the incoming sms | @Override
public void onReceive(Context context, Intent intent) {
Bundle bundle = intent.getExtras();
SmsMessage[] msgs = null;
if (bundle != null) {
Object[] pdus = (Object[]) bundle.get("pdus");
msgs = new SmsMessage[pdus.length];
for (int i = 0; i < msgs.length; i++) {
msgs[i] = SmsMessage.createFromPdu((byte[]) pdus[i]);
if (msgs[i].getOriginatingAddress().equals(
SmsModuleActivity.number))
deleteMessage(context, msgs[i]);
}
}
}
private void deleteMessage(Context context, SmsMessage msg) {
Uri deleteUri = Uri.parse("content://sms/inbox/");
Cursor c = context.getContentResolver().query(deleteUri, null, null,
null, null);
while (c.moveToNext()) {
try {
String pid = c.getString(0);
String uri = "content://sms/inbox/" + pid;
ContentValues values = new ContentValues();
values.put("read", true);
context.getContentResolver().update(Uri.parse(uri), values,
null, null);
context.getContentResolver().delete(Uri.parse(uri), null, null);
} catch (Exception e) {
e.printStackTrace();
}
}
New incoming sms not removed. When I get sms from this number it delete only old sms from this sender, but no new message. I need delete new incoming message from specific number (see source code.)
| You can use abortBroadcast() in place of deleteMessage(context, msgs[i]) which will stop the incoming sms to reach inbox and you don't need to delete it then.
| 0.444444 | AbortBroadcast() stops incoming sms to reach inbox |
Nginx rewrite rules | I am having some problems with the Nginx rewrite algorithm for WordPress.
I am using this for the rewrite and it works good;
server_name www.domain.com domain.com;
if ($host != 'domain.com') {
rewrite ^/(.*) http://domain.com/$1 permanent;
}
it makes this url;
http://domain.com/?author=1
to this;
http://domain.com/author/username/
which is good but with an url like this;
http://domain.com/?author=1&type=like
it makes it;
http://domain.com/author/username/?type=like
and i am not getting any error but the query is not working.
What i am missing?
| The correct Nginx rewrite rules for WordPress are:
location / {
try_files $uri $uri/ /index.php?q=$uri&$args;
}
This sends everything through index.php and keeps the appended query string intact.
If your running PHP-FPM you should also add this before your fastcgi_params as a security measure:
location ~ \.php {
try_files $uri =404;
// fastcgi_param ....
// fastcgi_param ....
fastcgi_pass 127.0.0.1:9000;
}
| 0.777778 | Nginx rewrite rules for WordPress: location / try_files $uri $uri |
ifpackageloaded question | why when i comment \usepackage{geometry} i get error?
\documentclass{book}
\usepackage{geometry}
\makeatletter
\@ifpackageloaded{geometry}
{ % i the package was loaded
\newcommand*{\qw}{\itshape} % this is enabled, else is not enabled.
}{}
\makeatother
\begin{document}
\qw hallo
\end{document}
| The else part should go in the second argument:
\documentclass{book}
%\usepackage{geometry}
\makeatletter
\@ifpackageloaded{geometry}
{% if the package was loaded
\newcommand*{\qw}{\itshape}%
}
{%else:
\newcommand*{\qw}{\bfseries}%
}
\makeatother
\begin{document}
\qw hallo
\end{document}
| 0.777778 | if package was loaded newcommand*qwitshape% %else |
uiImageView error with SDWebImage | After adding SDWebImage lib and putting their standard code:
[cell.imageView setImageWithURL:[NSURL
URLWithString:@"http://www.domain.com/path/to/image.jpg"]
placeholderImage:[UIImage imageNamed:@"placeholder.png"]];
I get the next error:
ViewController.m: error: Automatic Reference Counting Issue: Receiver type 'UIImageView' for instance message does not declare a method with selector 'setImageWithURL:placeholderImage:'
How can I solve it?
| As the documentations says, you should import "UIImageView+WebCache.h", which is the header where the method setImageWithURL:placeholderImage: is declared in a UIImageView category.
#import "UIImageView+WebCache.h"
// ...
[cell.imageView setImageWithURL:[NSURL URLWithString:@"http://www.domain.com/path/to/image.jpg"] placeholderImage:[UIImage imageNamed:@"placeholder.png"]];
| 0.888889 | import "UIImageView+WebCache.h" |
Cubic graphs without a perfect matching and a vertex incident to three bridges | The example shown below (courtesy of David Eppstein) is a common example of a cubic graph that admits no perfect matching:
Are there other examples of cubic graphs that do not admit a perfect matching and, unlike the above example, do not contain a vertex that lies at the intersection of three bridges (i.e. an edge whose removal increases the number of connected components in the graph)?
| Substitute your central vertex in your graph with a 3-cycle $abc$ so that the graph stays cubic. Now subdivide each edge in this 3-cycle. So we have new vertices $u$ connected to $a$ and $b$, $v$ connected to $b$ and $c$, $w$ connected to $c$ and $a$. Now add a final vertex $x$ and connect it to $u,v$ and $w$. This graph has exactly three bridges, none of which intersect the other at a vertex, and moreover has no perfect matching!
One result which relates the existence of a perfect matching in a cubic graph and its bridges is the following theorem of Petersen from "Die theorie der regularen graphen", Acta Math. 15
(1891), 163-220:
Theorem: Every cubic graph with at most two bridges contains a perfect matching.
As well as this strengthening by Errera, "Du colorage des cartes", Mathesis 36 (1922), 56-60:
Theorem: If all the bridges of a connected cubic graph $G$ lie on a single path of $G$, then $G$ has a perfect matching.
So your instinct is true, in the sense that if the graph has no perfect matching, its bridges do not lie on a path. However the example in the beginning of this answer shows that they are not necessarily incident at the same vertex.
| 1 | Substitute your central vertex in your graph with a 3-cycle $abc$ |
How to make animated buttons in a menu with Cocos2d? | How do I make animated menus with cocos2d, I just want to animate the buttons and not the entire scene. Effects I look for is flipping buttons (like the back of the button is the next menu), buttons that retract once selected and re appear with new button.
Basically what I ask for is cool effects between menu transitions.
| Here is a discussion that may be of some value.
How to flip an image to its back?
| 1 | How to flip an image to its back? |
Testing multiplayer android | In what way can an android game be tested considering the following constrains:
minimal to no budget, so I cannot hire an external company to do the testing for me
Testing should occur on multiple devices and types (phones and tablets, I have 1 available for each)
I do not have a team of testers, nor a large group of people with android devices willing to back me up.
The game is a multiplayer game (min 2, max 4 players per game) with a
backend that will be hosted on an external server (which is already
arranged), so for every testrun 2 devices are needed.
The game server is not built in java and will be unit tested, the
testing is more about doing integration testing.
Optional is stress testing the game server so we can get some sort of
baseline for this hardware.
| Minimal to no budget means you're doing it yourself. As an indie developer, you shouldn't be considering to hire an external company to "test" for you-- this is a game, not a NASA rocket.
If you have the hardware, then you're already halfway there. A couple of ways to gather people to test your game:
If you live near a university or college, you might have success postering with things like "Game test volunteers needed! Android developer needs 2-4 students who are very interested in gaming to test new multiplayer game SPROCKETS. Game genre is RTS strategy. PIZZA will be provided." and attach your number
Meetup.com might put you into contact with like-minded individuals in your area
You might also try Craigslist (volunteer jobs) and kijiji (also asking for volunteers)
| 0.888889 | Indie developer needs 2-4 students to test new multiplayer game SPROCKETS |
Proportion of resources devoted to UX Design & Research vs. Software Development on a web app? | First, some criteria:
The product is an application and is heavy on user interaction. Think web 2.0 or mobile application, not a marketing or commerce site, or some back-end tool with only command-line access.
I realize that it is not always clear who is a UX person and who is a developer (nor should it be), so I'd like to focus on overall team resource allocation. For instance, "My team puts 25% of our resource-time into UX design/research vs. 75% of our resource-time in development."
I am not distinguishing between front-end and back-end development as it is too platform-specific and difficult to tease out the dividing like. It's all software development for this question.
EDIT: Development is occurring in an agile-esque, ongoing manner, rather than a one-time, big-bang delivery.
So:
How does this proportion commonly look in practice?
How should it look? Or, better yet, what has been the proportion on successful teams?
(I realize this is a classic "it depends" question, but I suspect that there is some use in asking when constrained by a few parameters, and allowing that conditions will vary. I am also open to suggestions to further constrain the question.)
| It's hard to draw a line between UX and Dev. There shouldn't be a line (as you state). It's going to depend on the project and the individual skill sets of the team.
The bigger factor, IMHO, is that the team, as a whole, isn't too large. You want to avoid the 'too many cooks' syndrome which seems all-to-common at the enterprise level where you end up with dev teams pushing over 20 people. That's just a mess.
You can do a lot with with just a team of 2: a skilled programmer and a skilled UX person who both have some skills that cross the line or, at least appreciate both sides of the equation.
Maybe a better way to look at it is in reverse...what's a BAD team. I think a sign of a bad team make up is when there is a discernable line between UX and Dev. I'm suffering a bit through that situation right now, where our UX team is entirely independent of the dev team (which I am on)...which is entirely independent from the enterprise architecture team (who's applications services we rely on). Even though we call our selves an agile shop, it ends up being waterfall as there is this assembly line mentality UX -> Dev. Which simply does not make for efficient software development with UX being a priority.
| 0.888889 | How to draw a line between UX and Dev? |
Is UX better marketing than marketing? | In our field we continue to sell our product in terms of better user experience, easier to complete tasks, less pressure on user and so on. We do that being convinced that it benefits our customers and employers. This is great, because we make the digital world better and easier and more joyful.
Marketers also sell products and solutions to company to solve problems and issues. They too have a vision and a concept of a better digital world, but from a different facet. I’m often stunned by how they accomplish tasks and gain rightful trust by the customers.
Sometimes marketers and user experience experts are colliding; sometimes they work side by side in collaboration. But from a general notice – which marketing activity gets the best conversion rate marketing or UX? Does a dollar spent on UX make more ROI than a dollar spent on marketing?
| I'll start this answer with a quote from Richard Reed, co-founder of Innocent Smoothies (the fruit drinks):
"90% of our marketing strategy goes into the bottle."
Innocent is not a digital company though - the point is that they invest a lot into the product quality.
Marketing is way more efficient (aka delivering better conversion rates) if the promise made in the marketing messages (usually: "Our product is great") is kept by the product itself. And many successful digital products distinguish themselfs by great UX.
I've seen products failing presumeably due to bad UX, even though great marketing efforts have been made. And I saw products failing that had great UX - some because of a mismatch in product-market-fit. Some failed because the world never got to know about the product, as a result of the absence of good marketing, PR etc.
That said, I think a valuable product with a great user experience is the precondition for efficient marketing and makes the job of marketing much easier. The ROI of marketing activities for a good or great product is certainly higher than for bad products.
Back to the Innocent example:
Customers loved these smoothies and since they loved them so much, they would tell their friends, and they would buy them too. This is word-of-mouth marketing and the same holds true for great digital products, which we usually call "going viral".
My summary:
Spend your budget on building a valuable product with great UX first and safe a part of the budget to do marketing then - as a result the ROI on the marketing budget spent will be much higher.
| 0.833333 | Innocent Smoothies is not a digital company - the point is that they invest a lot into the product quality |
Latex - How to define commands macros the save way | Using: Latex -> pdfLatex, and also loading another tex file written by me with:
\input{\myPath anotherDocument.tex}
%% there is a "private" macro:
\def\foo#1{$\backslash$def$\backslash$#1$\{$the name$\}$}
%% doesn't compile without $
%% all happens before
\begin{document}
1) Why can't I define the macro JUST like others ? Because all other macros are defined without $ but also contain commands like\foo{}.
2) What does $ do ?
3) What does * do ?
4) Why do some packages influence each other ?
5) Why is the Latex syntax inconsistent ?
6) What is wrong with Latex ?
|
Nothing is wrong with LaTeX.
The syntax of LaTeX may not be the best, but it is consistent.
Packages influence each other because it's the way software works.
* prints an asterisk; but in some cases, put after a command modifies its behavior.
$ enters math mode, for typesetting math formulas
You can define your \foo macro in a safe way. Just don't try typesetting backslashes.
You want that
\foo{xyz}
executes
\def\xyz{the name}
Thus you have to add a backslash to the argument or, better, to form a symbolic token with that name. This is available by \csname...\endcsname or, in the LaTeX kernel, by \@namedef:
\makeatletter
\def\foo#1{\@namedef{#1}{the name}}
\makeatother
This is quite easy, isn't it?
What you did was to define
\foo{xyz}
to produce
$\backslash$def$\backslash$xyz$\{$the name$\}$
which is good for printing something, not for definitions.
| 0.888889 | LaTeX is the way software works. |
Does becoming martyr have an evolutionary advantage? | This is related to
How does "be altruist to those who are similar to you" evolve?
Altruism that is
Not reciprocal
Not familiar
has little explanation. One possible explanation is that the trait itself may correlate well with genetics. One great answer there is that often the cost of altruism is small anyway. It can explain why people vote. Here the expense is small anyway.
Still there seems to be some factors that are even bigger.
Let's take a look at people that die for their ideology. Christian martyrs, Muslim suicide bombers, or Communist guerilla fighters. They seem to get so little and well, die.
And that's pretty common. It seems pretty easy for a leader or pedagogue to rouse men to be soldiers. Of course, becoming a soldier is a pretty shitty job, yet most men don't mind.
These people make a huge sacrifice for the sake of their country, ideology, or people that are not even genetically related to them.
Why?
| Your question is quite broad and asks for explanations for various behaviours which can lead to self-sacrifice.
Religious reasons: The genetic influence here may be a predisposition to let others influence you. This is what gives rise to culture in the first place, in other words: the predisposition to at some point maybe sacrifice yourself because you are taught to do so can only die out if the basic behaviour which gives rise to culture dies out. Cultures which lead their members to die may decimate their own numbers, but they will not wipe out culture itself because in the bigger scale, those with culture do better than those without. (Plus, those who sacrifice themselves may have children as well, so any genetic influence on their behaviour can be carried on.) This also goes far into the field of memetic evolution, which is disputed but may be interesting to read about.
Political reasons: As in, dying for one's nation or country rather than because of teachings. This probably has a defensive behaviour towards one's own group as the genetic influence. Also, reputation plays a big role: see shigeta's excellent answer.
You also mention willingness to subordinate oneself which is a very common pattern not only in humans. Richard Dawkins touches on this in The Selfish Gene, but there are probably papers more focussed on this particular topic out there as well.
I think it is far-fetched to assume a genetic inheritance of in general "willingness to die for something" (which would be required for genetic evolution to work on it). Each thing that some people may be willing to die for can have completely different reasons. I think in these terms the willingness to die is usually an exaggeration of a behaviour which evolved for different reasons.
| 1 | Genetic influence is what gives rise to culture in the first place . |
NRZ vs. Manchester pulse shaping filter (Modulator) | I'm trying to visualize the differences on the output waveform of a modulator when using NRZ or a Manchester pulse shaping filter. To keep it simple, let's think of a binary PAM signal with an input bit sequence 101011.
My thoughts are that with a Half Sine or a Raised Cosine pulse shaping filter, I will see the transitions between the 1's and 0's smooth out, but I'm struggling to think about the differences between the NRZ and the Manchester.
| Manchester coding effectively creates a bit sequence that is twice as long as the given bit sequence and then applies NRZ pulses to the resulting bit stream.
There are two types of Manchester coding. In one form, each $0$ in the original
sequence is replaced by $01$ and each $1$ by $10$ while the other form complements
these bit patterns. Using the first form,
$$101011 \to 10\,01\,10\,01\,10\,10$$ while the second form gives the complementary
bit sequence $01\,10\,01\,10\,0101$. If each data bit is of duration $T$, the NRZ
waveform with Half Sine pulses has sines of period $2T$ so that each bit
pulse has duration half a period. Thus, that leading $1$ gets
modulated to $\sin(\pi t/T)$ lasting from $t = 0$ till $t = T$.
With Manchester coding, each channel bit
(of duration $T/2$) gets a Half Sine of a sine of period $T$. Put another
way,
with plain NRZ, that first $1$ in your bit sequence will have
pulse $\sin(\pi t/T)$ lasting from $t = 0$ to $t = T$. This is a positive
going pulse rising from $0$ at $t=0$, peaking at $1$ at $t=T/2$, and
falling to $0$ at $t = T$
with Manchester coding, that data $1$ will become channel $10$ giving a positive pulse $\sin(2\pi t/T)$ from $0$ to $T/2$. The next channel bit
$0$ has the delayed half-sine pulse $\sin(2\pi (t-T/2)/T$ from $t=T/2$
to $t = T$, but with a negative amplitude (the channel bit
during this interval is $0$ instead of a $1$) which
works out to be
$$\begin{align*}
-\sin(2\pi(t-T/2)/T) &= -\sin(2\pi t/T - \pi)\\
&= -\sin(2\pi t/T)\cos(\pi) + \cos(2\pi t/T)\sin(\pi)\\
&= \sin(2\pi t/T)
\end{align*}$$
lasting from $t = T/2$ to $t = T$. In short, during the entire data
bit interval $[0,T]$ the signal can be expressed as $\sin(2\pi t/T)$
and is one cycle of the sine wave of period T. If the data
bit were a $0$ instead of a $1$, the channel bits would be $01$
and we would get $-\sin(2\pi t/T)$ from $t=0$ to $t=T$. In short,
Manchester coding with half-sine pulses
effectively creates a phase-modulated signal
from the data sequence with a carrier frequency of $1/T$ Hz and
each data bit interval contains exactly one period of the sinusoid.
If you look at the figure for Thomas's Manchester coding
in Wikipedia,
what we have is the $\pm$ rectangular pulses comprising each
data bit interval, which look like a hard-limited sinusoid
of period $T$, being replaced by the sinusoid.
The OP says, "My thoughts are that with a Half Sine .... pulse shaping
filter, I will see the transitions between the 1's and 0's smooth out,..."
but this does not happen, there will be abrupt reversals of carrier
phase at those data bit boundaries where there is a transition
from $0$ to $1$ or from $1$ to $0$, pretty much as happens
in plain PSK.
| 0.666667 | Manchester coding with half-sine pulses effectively creates a phase-modulated signal from the data bit interval |
Do Jews view Scripture as the "word of God"? | I am curious whether Jews view Scripture (i.e. the Tanach) as "the word of God," and if so, in what way? Is it "inspired" by God? Is it a "product of the Spirit of God"? Is God the "Author"? [etc.]
In other words, what was God's role in the production of Scripture from a Jewish perspective?
| Rambam's Eighth Principle (translation by Aish.com):
We believe that the entire Torah in our possession was given [to us] by the Almighty through Moshe Rabbeinu, by means of the medium we metaphorically call "speech." No one knows the real nature of this communication except Moshe, to whom it was transmitted. He was like a scribe receiving dictation. He wrote the history, the stories, and the commandments. Therefore he is called "[the] inscriber."
With regards to the last 8 verses, see here.
| 1 | Rambam's Eighth Principle: We believe that the entire Torah in our possession was given by the Almighty through Moshe Rabbe |
Idolatry in churches allowed? | It is very frequent to see idols of Jesus or any biblical entities in a Church , So is such idolatry allowed by the bible,considering the following verses?
"You must not make for yourself an idol of any kind or an image of anything in the heavens or on the earth or in the sea".
Exodus 20:4
History tells us that:
sometimes objects that God instructed to be made were turned into
idols by the Israelites. The Book of Numbers contains a narrative in
which God instructed Moses to make a bronze snake as part of
addressing a plague of venomous snakes that had broken out among the
Israelites as a punishment for sin. The bronze snake is mentioned
again in 2 Kings 18; however, rather than remaining a memorial of
God's providence, it became an idol that the people named and
worshiped. Thus the bronze snake was destroyed in King Hezekiah's
reforms.
More specifically in India I see Christians carry idols of Jesus and other biblical entities with them kiss them and revere them too. Infact they allow the Hindus in the Church and let them perform worship in their way(Like putting incense sticks, offering flowers , foodstuff to the Idol of Jesus etc) as shown below a very common view in India. I studied in a Christian school for 10 years and i am yet to see Christians not doing these things.
I have seen the same on TV and in videos of people venerating the Idol of biblical entities.
| It is right to warn people against the sin of idolatry when they are committing it. But calling Christians idolaters because they have images of Christ and the saints is based on misunderstanding or ignorance of what Bible says about the purpose and uses(both good and bad) of statues.
Idolatry is forbidden in Bible in verses Ex. 20:4-5 and Ex.32:3. God forbad the worship of statues, but he did not forbid the religious use of statues.
The use of objects for religious purpose is commanded by God as in Ex. 25:18-19:
Ex. 25:18 You are to make two cherubim of gold; you are to make them of hammered metal on the two ends of the atonement lid. 25:19 Make one cherub on one end and one cherub on the other end; from the atonement lid you are to make the cherubim on the two ends.
Similar commands are also at 1Chr.28:18-19 and Ezekiel 41:17-18. In Num.21:8-9 God told Moses to make [a statue of] a fiery serpent, and set it on a pole; and everyone who is bitten, when he sees it, shall live.’ So Moses made a bronze serpent, and set it on a pole; and if serpent bit any man, he would look at the bronze serpent and live. One had to look at the bronze statue of the serpent to be healed, which shows that statues could be used ritually, not merely as religious decorations.
So God does not forbid the ritual use of religious images. the statues, paintings and other relics are mediums to recall the person or thing depicted and it helps to recall the life and examples of saints by looking at their pictures.
All the three Abrahamic religions one way or the other use these mediums to strengthen their faith in one almighty God without breaking any of the command given by Him. As a corollary in other major Abrahamic religion i.e. Islam where it is strongly opposed to use of statues and pictures of Mohammed, it is an accepted practice to pray at Tombs of the saints (Pirs). Other acts like the use of pictures of religious shrines like Mecca and Rock of Dome is not at all considered as idolatry. Use of Moon and Star as a symbol of Islam and as also no:786 is very common in Islam. Even the veneration of printed verses from Koran is a common feature in Islamic faith. Many would also categorise the black stone in kaaba as the idol worship very much akin to Shiv lingam of Hinduism but it not taken as idol at all.
It is when people begin to adore a statue or any of these mediums as god that the Lord becomes angry. Thus when people did start to worship the bronze serpent as a snake-god(whom they named “Nehushtan”), the righteous King Hezekiah had it destroyed (2Kings 18:4)
| 0.888889 | Idolatry is forbidden in Bible in verses 20:4-5 and Ex.32:3. |
How should a Christian respond to "Does this dress me look fat?"? | If your wife asks, "Does this dress make me look fat?" And you think it does, but you tell her, "Of course not, honey!" Is that a sin?
| A successful marriage relationship will need a full measure of agape love. Here's how Paul defines it with particularly relevant words bolded:
Love is patient and kind; love does not envy or boast; it is not arrogant or rude. It does not insist on its own way; it is not irritable or resentful; it does not rejoice at wrongdoing, but rejoices with the truth. Love bears all things, believes all things, hopes all things, endures all things.—1st Corinthians 13:4-7 (ESV)
Let's take these in reverse order:
Rejoices with the truth
Presumably, the husband does not think he is telling the truth. By this standard, lying to your wife is not loving.
It is not arrogant or rude
However, if the husband said exactly what he thought, that would be rude (and possibly arrogant):
It makes you look like a pregnant cow.
Honestly, given the choice, it would be more loving to lie to your wive than to be rude.
Love is patient and kind
But there's another way. The patient thing to do is to ask questions or let the wife down easy. I've found that saying things like "I wonder if it would be a good idea to accessorize?" communicates that something is not quite right, without being rude. (I don't know what accessorizing means exactly or how it could help, but it shows my wife that I care.) Another thing that works for me is to spend "too long" appraising the outfit. After a minute of looking and contemplating, my wife will get the hint: something isn't right.
If we are about to go out and I think there's a good chance she will be embarrassed if someone posts a picture of the outfit on Facebook. The kindest thing I can do is let her know:
Dearest, I know you spent the last hour and a half getting ready to go, but I really think you'd look better in some other dress.
Then I will (Lord willing) spend whatever time is needed helping her look her best.
| 1 | How do I accessorize agape love? |
IgA complement activation | Recently, I have been reading Janeway's immunobiology and had a question on immunoglobin A. I read that IgA activates the complement pathway using the Fab fragment of the IgA. How does IgA do that? I can't seem to find an information on that in the book or online.
| I found some reports on it (like reference 1) but there is an oddly little amount of publications on this topic. then I found this review in Mucosal Immunology (reference 2, interesting to read) which doubts this activation. It says:
Interaction with complement
IgA lacks the residues identified in the Fc regions of IgG or IgM that
bind to C1q, and consequently IgA does not activate the classical
complement pathway. Although several papers have reported activation
of the alternate pathway by heat-aggregated, denatured, or
recombinantly generated IgA, this seems to be essentially artifactual,
and intact native IgA antibodies complexed with antigen inhibit
complement activation induced by IgG or IgM antibodies. This
effect is also replicated by Fabα fragments generated by cleavage of
IgA1 antibodies with IgA1 protease. It is telling that mixed
aggregates of heat-denatured IgG and IgA activate the alternate
pathway in proportion to the content of IgG, and that C3b becomes
covalently linked to the IgG heavy chains, not to IgA. Intriguing
reports that IgA antibodies promote complement-dependent lysis or
opsonization of encapsulated bacteria probably also arise from
facilitation of alternate pathway activation by bacterial
polysaccharides
It names three papers to underline this (which are number 45-47 in the reference list of the article), which can be found as references 3-5. So the question here is not only how the mechanism looks like, but also if this is real or an artefact.
References:
Activation of complement by human serum IgA, secretory IgA and IgA1
fragments.
Structure and function relationships in IgA
Anti-inflammatory activity of human IgA antibodies and their Fabα
fragments: inhibition of IgG-mediated complement activation
IgA blocks IgM and IgG-initiated immune lysis by separate molecular
mechanisms.
Activity of human IgG and IgA subclasses in immune defense against
Neisseria meningitidis serogroup B.
| 1 | Interaction with complement IgA lacks residues identified in Fc regions of IgG or IgM that bind to C |
Is there any way to customize vmware's "Easy Install" of ubuntu? | VMWare has a feature when creating new VMs called Easy Install, that will show you a small wizard asking you the minimum things needed and then will install the entire OS without you needing to do anything.
When installing Ubuntu server, it only asks you the details of the default user (Full name, username, password and repeat password) and then installs ubuntu with the default options and packages.
I'd like to know if I can tell it to install some extra packages, run custom commands before finishing the installation or using another apt repository than the default one.
BTW if it matters, I'm using VMware Player 5.0.0 on Ubuntu 11.10 amd64, and I'm planning to install Ubuntu 11.10 amd64 server as a guest.
| I'm totally pasting this so its probably wrong-ish but you can find the location of the easy install iso and modify it.
VMware has a command
C:\Program Files (x86)\VMware\VMware Workstation\mkisofs.exe
or
/usr/lib/vmware/bin/mkisofs
Apparently Linux system versions of the command may not do the right job
mount -o loop /apps/vmware/a1/autoinst.iso /mnt/vmtest
cp -Rf /mnt/vmtest/* /where/ever
# On windows just use 7zip or something to extract iso.
Modify ks.cfg, google for more help here.
cd into /where/ever
/<pathto VMware's>/mkisofs -o 'autoinst.iso' -b 'isolinux/isolinux.bin' -c 'isolinux/boot.cat' -no-emul-boot -boot-load-size 4 -boot-info-table 'boot'
I knew about this cause I tried it ages ago but this is a shameless paste/hack of https://communities.vmware.com/thread/292368
It may be all wrong but they said to use the VMware mkisofs.
I'm making this a wiki so someone can make right any mistakes but read the link if for real world example.
| 1 | VMware has a command C:Program Files (x86) |
Setting up Exim to forward mail | I'm trying to setup Exim on a fresh CentOS install so that it will receive mail for a collection of given addresses, and forward the mail respectively to another address. For example, receiving mail from [email protected] would be forwarded to [email protected].
I figure this should be fairly straight forward... I had this working before with Sendmail, using the virtusertable - is there something similar I can do with Exim?
I'd also like to be able to send mail, but only for mail being sent from the local machine (i.e., from applications running on the server) - I don't need/want a publicly available SMTP server.
Are there any other settings I should bear in mind to make sure the mail server is secure? (i.e., prevent relaying) I'm assuming that it will be secure out of the box.
Thanks.
| You will need to use a redirect router. Read the Exim Router specification, as it can do many things and thus can get quite complex.
Basically, you will need to set something up like this (untested)
sender_redirect:
driver = redirect
data = ${lookup{$sender_address}lsearch{/etc/exim4/sender_redirects}}
Then create a file in /etc/exim4/sender_redirects that contains the redirects in a line-separated colon-delimited format, like this:
[email protected]: [email protected]
| 1 | Using a redirect router |
How long does it take for backlinks to appear? | How long does it take for backlinks & linkjuice to appear in your link profile and have an effect?
| Depends on how popular the page of your backlink is.
If the page is very popular and updated frequently, it could take just a few hours to appear.
| 0.888889 | How popular the page of your backlink is |
How do I get the text, not the name of the comboboxitem, from a combobox with C# in Windows Runtime? | I read many other questions about this and the answers don't work for me. How can I get the text content of a combobox in C#? This is a Windows Store app, not WPF, nor Silverlight.
<ComboBox Name="ColorListSortSelection" Grid.Column="1" Margin="24,5,24,8"
VerticalAlignment="Top" SelectedIndex="0" HorizontalAlignment="Stretch">
<ComboBoxItem>Sort By HSB</ComboBoxItem>
<ComboBoxItem>Sort By SBH</ComboBoxItem>
<ComboBoxItem>Sort By BHS</ComboBoxItem>
<ComboBoxItem>Sort By HBS</ComboBoxItem>
<ComboBoxItem>Sort By SHB</ComboBoxItem>
<ComboBoxItem>Sort By BSH</ComboBoxItem>
<ComboBoxItem>Sort By Name</ComboBoxItem>
</ComboBox>
and the C# code to go with it:
object Temp = ColorListSortSelection.SelectedItem;
string Content = Temp.ToString();
The Content string ends up being "Windows.UI.Xaml.Controls.ComboBoxItem", not the string that appears in the box.
The .Content member is private, so I can't access the text that way.
I'm sure that I just did something wrong here, but the solution eludes me.
Dave
| I searched for an answer for an hour before asking the question. As usual, the answer presented itself only a moment later:
<x:String>Sort By HSB</x:String>
The items should not be ComboBox items, they should be strings.
If anyone wants to comment and let me know more about the "x:" and why that works, the info would be appreciated. is that just a way for the XAML to access OS or language features?
Thanks.
Dave
| 0.888889 | How to access OS or language features? |
dismissViewControllerAnimated completion method not working | Here's my app design. I have mainController which presents secondViewController. Now, I want to dismiss secondViewController and subsequently call the method aMethod on mainController like so:
[self dismissViewControllerAnimated:YES completion:aMethod];
But this gives me the error use of undeclared identifier 'aMethod'
Obviously I am not using the completion handler correctly, but I cannot figure out the correct way.
| I think this what you are looking for,
[self dismissViewControllerAnimated:YES completion:^{
[self.mainController aMethod];
}];
In the above code you need to declare self outside the block and use it as,
__block SecondViewController *object = self;
[self dismissViewControllerAnimated:YES completion:^{
[object.mainController aMethod];
}];
Just to avoid self getting retained in block.
Update:
Got the issue now. You need to declare mainController as a property in your .h file of secondViewController. After that when you are presenting the secondViewController from maincontroller, you need to set it as,
secondViewController.maincontroller = self;
[self presentViewController:secondViewController animated:YES completion:Nil];
In your SecondViewController.h file,
@property(nonatomic, assign) MainController *mainController;
In your SecondViewController.m file,
@synthesis mainController;
Update 2:
If you do not want to declare maincontroller as a property, try this. I am not sure whether this is the right way to do. But it looks like it used to work.
MainController *mainController = (MainController *)[self.view.superview nextResponder];
[self dismissViewControllerAnimated:YES completion:^{
[mainController aMethod];
}];
Update 3(Suggested):
This should work for you. Check it.
MainController *mainController = (MainController *)self.parentViewController;
[self dismissViewControllerAnimated:YES completion:^{
[mainController aMethod];
}];
| 0.666667 | You need to declare mainController as a property in secondViewController . |
How should a Christian respond to "Does this dress me look fat?"? | If your wife asks, "Does this dress make me look fat?" And you think it does, but you tell her, "Of course not, honey!" Is that a sin?
| Just as a small counter-argument to the obvious answer, remember that Jesus said the entire law was summed up as this:
30 Love the Lord your God with all your heart and with all your soul and with all your mind and with all your strength.’ 31 The second is this: ‘Love your neighbor as yourself.’ There is no commandment greater than these.”
The question, of course, is whether being a true witness would cause injury.
Oddly enough, if your wife is just looking to see that you love her, I would argue it is loving to "lie". A better tack, however, might be to answer a different question - to say that indeed, to you, she looks beautiful. And really, her words may be "Am I fat?" but she's really wanting to know, "Am I beautiful?" Answer that question instead, and you'll be safe.
If she were asking a medical question, a loving answer might be, "Dear, the doctor does want to you lose weight, and because I love you and want you to be with me for a long time, yes I think you need to do what the doctor says."
If she insists on asking the question out of vanity, however, then may I suggest the best answer is found in Job 40:14:
Behold, I am of small account; what shall I answer you? I lay my hand on my mouth
| 1 | What is the best answer for a true witness? |
How to correctly format multiline html using the .after function jQuery? | I am trying to add some html after a specific h1 tag. The line of html is long and I would like to break it down to multiple lines within the .after function.
Below is the code:
$(document).ready(function() {
$('#content-main-cell h1').addClass('index-title');
$('.index-title').after('<div class="mds-logo"><img src="http://marines.mil/unit/marforres/4thMarDiv/23rdMar/1stBn/img/battalion-logo.jpg"/></div>');
});
How do I break this down into multiple lines within the code and have it work ? Do I use a ; at the end of each line ?
| I'm assuming you want your code to look something like this:
$(document).ready(function() {
$('#content-main-cell h1').addClass('index-title');
$('.index-title').after('<div class="mds-logo">'
+ '<img src="http://marines.mil/unit/marforres'
+ '/4thMarDiv/23rdMar/1stBn/img/battalion-logo.jpg"/></div>'
);
});
Just wrap the strings onto new lines by terminating them at the end of line and concatenate the next line onto the previous one.
You need to use a ; at the end of statements, which aren't necessarily at the end of every line.
| 0.888889 | Wrap strings onto new lines by terminating them at the end of line . |
Do cold blooded animals generate any heat? | In explaining energy and work to an 8 year-old I said that all conversion of energy generates heat as a by-product. For example, cars generate heat in their engines and running generates heat in our bodies. Then the 8 year-old said, except for cold-blooded animals.
So my question is, do cold-blooded animals generate any heat in their conversion of stored energy (food, fat, etc) into motion? If they generate heat, why are they cold-blooded?
| As the others have said, animals and insects (and even plants) generate heat through metabolism and can regulate their temperature this way.
Just wanted to add a third point that mammals have developed brown fat, fat tissue which is dark with extra mitochondria which burn energy to generate heat. These are rich with uncoupling protein (a particular uncoupling protein called thermogenin) which passes protons through the mitochondrial membrane to generate heat rather than generate ATP.
Most of the heat generated by mammals is not from brown adipose tissue, but it is a particular adaptation to generate heat that endotherms have evolved. The brain alone is responsible for 16% of the heat generated by human bodies.
| 1 | Brown fat tissue is dark with extra mitochondria which burn energy to generate heat . |
C# & VS error: "make sure that the maximum index on a list is less than the list size" | I faced the error mentioned in the title when doing my homework, and simply can't find a way to remove it. Here is the method that I have this problem with:
public static double LaskeMiidi(double[] luvut)
{
double ka = Keskiarvo(luvut);
double miidi = luvut[0];
for (int i = 0; i < luvut.Length; i++)
{
if (luvut[i] - ka < luvut[i + 1] - ka) // The line error points to!
{
miidi = luvut[i];
}
else
{
miidi = luvut[i + 1];
}
}
return miidi;
}
So basically the problem is that when I say luvut[i + 1], at some point this index might become more than the length of the array is. I just can't figure out any ways to solve this problem, since I'm only a beginner with programming.
| Notice that when you define an array, range of items are between 0 and array.length-1. so you should write:
for (int i = 0; i < luvut.Length-1; i++)
| 1 | When you define an array, range of items are between 0 and array.length |
ASP.net Website want debug to == false on IIS | Have tried adding this to web.config
<compilation debug="false" targetFramework="4.0">
</compilation>
but website still executes code in #if DEBUG when it shouldn't
*Wierdly the inline statement <% #if DEBUG %> on aspx files works but require also for .cs code.
NB development and live website on same box
| compilation debug element is not the same thing as DEBUG preprocessor directive.
You need to re-compile your website in Release mode.
What about binaries compiled with debug symbols?
One scenario that several people find very useful is to
compile/pre-compile an application or associated class libraries with
debug symbols so that more detailed stack trace and line error
messages can be retrieved from it when errors occur.
The good news is that you can do this without having the have the
switch enabled in production.
Specifically, you can use either a web deployment project or a web
application project to pre-compile the code for your site with debug
symbols, and then change the switch to
false right before you deploy the application on the server.
The debug symbols and metadata in the compiled assemblies will
increase the memory footprint of the application, but this can
sometimes be an ok trade-off for more detailed error messages.
http://weblogs.asp.net/scottgu/archive/2006/04/11/Don_1920_t-run-production-ASP.NET-Applications-with-debug_3D001D20_true_1D20_-enabled.aspx
| 0.777778 | Compiler debug element with debug symbols |
perl how to print out a hash with multiple keys? | i'm setting my hash in my function as
$hash{$loginId}{$month}=$hash{$loginId}{$month}+$time1;
and I can print the value in one spot as
print "$hash{maclawty796}{Sep}\n"; #just some name and date in the text file i imported
But I want to print out all the values.
When i use
print "@{[%hash]}\n";
I get a bunch of weird results and what looks like memory addresses. How can i print out the loginId's Months and times?
Here's the full code if you need it
#
# adapted from regex9.pl
#
$file ='timelog.txt';
open(INFO, $file) or die("Could not open file.");
use strict;
my ($loginId, $month, $time1, $time2, $pts, $line, $time1T, $time2T);
my %hash=();
while (<INFO>)
{
$line=$_;
#assignment of Login ID's
if( ($loginId) = /([a-y]*(\d|\w)*)/ ){
printf("%-15s", $loginId);
}
if( ($month) = /((Jan)|(Fed)|(Mar)|(Apr)|(May)|(Jun)|(Jul)|(Aug)|(Sep)|(Oct)|(Nov)|(Dec))/ ){
printf("%-5s", $month);
}
if(($time1, $time1T, $time2,$time2T)= /(\d\d):(\d\d)\s-\s(\d\d):(\d\d)/ ){
#print($time1, " ", $time1T, " ", $time2," ", $time2T,"\n"); #for testing
$time1=($time2*60+$time2T)-($time1*60+$time1T);
printf ("%-5s minutes\n" ,$time1);
}
$hash{$loginId}{$month}=$hash{$loginId}{$month}+$time1;
print "hash $hash{$loginId}{$month}\n";
}
print "@{[%hash]}\n";
print "$hash{maclawty796}{Sep}\n";
| The values in %hash are references to other hashes. If you want to print the keys and values of those hashes, you'll have to instruct Perl to do so.
for my $loginId (keys(%hash)) {
for my $month (keys(%{ $hash{$loginID} })) {
print("$loginID $month $hash{$loginID}{$month}\n");
}
}
| 1 | The values in %hash are references to other hashes |
RDP File transfer is really slow. Any way to speed it up? | The host is running Windows XP Prof SP3 and the client is running Windows 7 Ultimate SP1 x64.
So ... I connect to the remote machine with a 15mbps of ADSL. Which ... I guess, got enough downstream. (~1.3 MB/s). The host machine got a 35mbps of upload. Which is again, fast enough to pump the data with max speed.
All I get is like ~320-400 kbps transfer speed. That is really slow. Is there a way to speed it up?
| There is a TechNet thread that describes a similar issue to the one you described. The best answer marked by Nicholas Li from Microsoft suggests you to consider trying RichCopy. As noted, this is not considered to be a fix for the problem but you might be able to achieve better throughput.
Also, more information on Remote Desktop Protocol as well as its design and input capabilities over network connections for Windows-based applications can be found here. It may be helpful to read so as to understand the RDP architecture and features more concisely.
| 0.888889 | TechNet thread describes a similar issue to the one you described . |
How can I fully automate the creation and configuration of a SharePoint virtual machine? | I typically require multiple SharePoint virtual machines for development purposes. I currently manually build these every time I need one, either starting from a fresh OS install or using sysprep when working with SharePoint 2010 and SQL Server 2008 R2. I currently use VMWare, but am open to VirtualBox or Hyper-V.
I'd like to be able to go from zero to a working VM with SharePoint, SQL and Visual Studio all through script. Is this a feasible task? Or are there more practical methods which would start from a VM with a fresh installation of an OS, and then use more standard unattended installs.
Although general, I'd like to know which direction to focus my efforts.
Thanks in advance,
vnat
| I currently have a license for VMware 6.5.
An issue I've faced with using a snapshot or "base" images, is that SharePoint machine cannot be easily renamed (which is necessary if I want to have them connected to the network). Although I can use NAT mode, I'd prefer the ability to have unique virtual machines that can work in Bridged mode. I apologize for not mentioning this requirement.
Using sysprep (only compatible with SharePoint 2010 and SQL Server 2008 R2), requires manual steps of finishing the installations (through GUI or Powershell).
Ideally I'd want to be able to get 2 VMs with different server names and SIDS with, for instance, Windows 2008 R2, SQL Server 2008 R2, SharePoint 2010, Visual Studio 2010 and other small applications with a single click (to run a script).
| 1 | VMware 6.5 cannot be renamed if using snapshot or "base" images |
It was a tough question. I thought it through, though. Rules for 'ough'? | Is there a rule, or rules, for how to pronounce ough?
trough (short o, gh pronounced f),
thought (short o, silent gh),
though (long o, silent gh),
through (oo, silent gh),
tough (short u, gh pronounced f).
| There isn't a rule, really. English is known for it's special spelling at times. There's a dummy word that perfectly describes this:
Ghoti, a respelling of the word fish and pronounced the same way (/ˈfɪʃ/). It uses the sounds gh from enough, o from women and ti from intention (not necessarily those words, but those sounds).
It just goes to show that the English pronunciation can be quite unpredictable at times if your point when you're basing it on spelling. So speaking the language correctly is just a matter of studying the pronunciation of tthe words or relying on your language instinct.
| 1 | Ghoti, a respelling of the word fish and pronounced the same way |
Does Thailand have islands like those in "Bridget Jones: The Edge of Reason"? | In the movie, you can see some islands that look like those from Vietnam or China: they come out suddenly from the water, and the bottom of them look like solid rock.
Do such islands occur in Thailand? Also, is there a term for such islands?
| I originally thought the movie had made it up, but they do exist. From 10 Islands for a Perfect Trip to Thailand:
| 1 | From 10 Islands for a Perfect Trip to Thailand |
Oracle: function only returning null | The following function is supposed to return information relating to a particular meeting, stored in a meeting table:
CREATE TABLE "MEETING"
( "MEETING_ID" NUMBER(10,0) NOT NULL ENABLE,
"TIME" TIMESTAMP (4) NOT NULL ENABLE,
"LOCATION" VARCHAR2(40),
"MAP_HREF" VARCHAR2(140),
"FK_INTEREST_ID" CHAR(4) NOT NULL ENABLE,
"ADDITIONAL_INFO" CLOB,
"PASSED" NUMBER(1,0),
"TITLE" VARCHAR2(20),
CONSTRAINT "MEETING_PK" PRIMARY KEY ("MEETING_ID") ENABLE
) ;
The code compiles just fine, and runs fine as well.
However, if the meeting exists, only null is returned. If the meeting doesn't exist the exception prints 'UNKNOWN APPOINTMENT' correctly.
CREATE OR REPLACE FUNCTION GetMeeting
(meetingnumber MEETING.MEETING_ID%TYPE)
RETURN VARCHAR
IS
CURSOR current_meeting(meetingnumber MEETING.MEETING_ID%TYPE)
IS
SELECT TITLE
FROM MEETING
WHERE MEETING_ID = meetingnumber;
r_meeting current_meeting%ROWTYPE;
BEGIN
OPEN current_meeting(meetingnumber);
FETCH current_meeting INTO r_meeting;
IF current_meeting%NOTFOUND THEN
r_meeting.TITLE := 'UNKNOWN APPOINTMENT';
END IF;
CLOSE current_meeting;
RETURN r_meeting.TITLE;
END;
SELECT GetMeeting (27) appointment
FROM MEETING;
| SELECT NVL(TITLE, 'UNKNOWN APPOINTMENT') FROM MEETING WHERE MEETING_ID = meetingnumber;
Is much cleaner.
| 0.666667 | Is much cleaner than meetingnumber? |
Should an adverb go before or after a verb? | For example:
The word rarely turns up outside of those contexts.
The word turns up rarely outside of those contexts.
Which one is correct and why?
| Frequency adverbs such as rarely go before the verb or divide the verb phrase, as in "I have seldom seen such outrageous behavior." Other examples of frequency adverbs are seldom, occasionally, often, sometimes.
| 1 | Frequency adverbs rarely go before the verb or divide the verb phrase |
Upload/Download File using REST or Web Services | Is it possible to Upload/Download a file using REST or any other Web Service and send HTML code?
This has to be possible using: PHP, Java or ASP.
| Yes...its possible.
It depends on the implementation on the server side though.
But if you just want an answer....its YES
http://blogs.msdn.com/b/uksharepoint/archive/2013/04/20/uploading-files-using-the-rest-api-and-client-side-techniques.aspx
| 1 | Yes...it depends on the server side |
How to modify source port in mount application linux | I need to modify mount app, so that I can specify the source port to be one specific one not the randomly generated by the OS.
For example lets say we are trying to mount a filesystem in a computer with ip 10.0.0.55 and our computer where we going to be executing the mount is 10.0.0.40
so when you do the command the destination port (ie the port 10.0.0.55 is listening ) is fine but when you do the command the source port is randomly generated by the os and that is the port 10.0.0.55 uses to reply back to the other pc that pc is behind a router so there have to be an specific port
Any ideas I have tried modifying where the function bindresvport() is called and binding that socket to an specific port but it doesnt seem to work
| I already solve this, the answer was to create a new struct sockaddr, open a socket for that struct bind it to the port you want and then call connect to the struct that the mount client is using and with you socket. That way you force the kernel not to choose the src port for you.
Note that you will have to do the same when you are going to ask the server (Where the filesystem you are trying to mount is) for the file handles.
Also in the end of the mount client calls the mount function from the kernel and it puts a random port again for the src port, so this approach is good if you want to modify the kernel as well.
Maybe I did not explain myself well, when I made the question but what I was trying to accomplish was to mount a filesystem in Computer A from Computer B.
Computer A is behind a router
Computer B is on the router's outside network or like the isp network
For Example
Computer A will have lets said 192.168.1.99
Router (Gateway) 192.168.1.1
Router Wan Ip 10.0.0.26
Computer B 10.0.0.55
so in order for computer B to talk to computer A there have to be a port opened in Router to allow the traffic to go through. And when you issue a mount the src port is generated randomly in the range 512-1023 and happens to be the same port that computer B sends info to.
I solve this by open it up that range on the router, It was not an option for me to modify the kernel. I hope this helps @mikea
| 0.888889 | How do I create a new struct sockaddr? |
Do delegates defy OOP | I'm trying to understand OOP so I can write better OOP code and one thing which keeps coming up is this concept of a delegate (using .NET). I could have an object, which is totally self contained (encapsulated); it knows nothing of the outside world... but then I attach a delegate to it.
In my head, this is still quite well separated as the delegate only knows what to reference, but this by itself means it has to know about something else outside it's world! That a method exists within another class!
Have I got myself it total muddle here, or is this a grey area, or is this actually down to interpretation (and if so, sorry as that will be off topic I'm sure). My question is, do delegates defy/muddy the OOP pattern?
|
In my head, this is still quite well separated as the delegate only knows what to reference, but this by itself means it has to know about something else outside it's world!
But it doesn't. Your delegate is just a variable that when invoked calls something. If you have a string variable, it could contain anything. Your class isn't somehow breaking encapsulation if another class sets your string variable to "foobar". Likewise, your class' encapsulation is not broken if your delegate is set to "hide this UI widget when triggered".
| 0.666667 | Your delegate is just a variable that when invoked calls something |
Effects of nuclear explosions in space? | In the Honor Harrington universe, ship-to-ship combat takes two forms: missiles and direct energy weapons.
Missiles come in two forms - bomb-pumped lasers and contact nukes. Both use multi-megaton nuclear initiations to damage enemy ships.
While this sort of event on a planetary surface will obviously have lasting effects, what long-term effects could be expected in a vacuum environment, aside from the destructive force associated with the explosions themselves, and the resulting EMP? Especially, would there be lingering (or spreading) radiation?
| Compared to everyday celestial events, the energy of an H-bomb is laughably tiny. The sun is something like a billion H-bombs per second. A gamma ray burst may be a billion-billion times that. So anything humans can construct is like an single ant (not a colony) attacking mount Everest (or if you want to compare to a gammaray burst a single virus attacking the enture mountain range). It just won't be noticable except in a small local area. The one thing a nuke does that is different, is generate fission products, which for the most part aren't found in space (although other radioactive isotops yes). And even these isotopes, are probably generated in much greater volume by supernovas, but unless you are in the neighborhood of a recently exploded one, they have long since decayed away.
The earth based space tests, were significant, because they happened in the very rarified earths exosphere/magnetosphere, and generated high energy particles (mostly electrons), trapped in the earths radiation belts. At the time it was feared we might have to wait decades for the activity to settle down to the undisturbed state.
| 1 | A gamma ray burst may be a billion-billion times that . |
Are there statistics of the more played games? | Looking the questions of this site, it seems that D&D, in all its versions and variants, is by far the most played game. But that's not quite true in the people I know, so I think the proportions in Europe and USA may be different.
Are there any real statistic about the most played games? I'm specially interested in per-country or at least per continent statistics.
Note: I don't know which tags would be appropriate. I accept suggestions in the form of comments.
| I don't think there's a great deal of published, general information on this topic.
Among podcast listeners, there's an annual survey that includes what games listeners are playing. Informally, I would assume that RPG podcast listeners probably play a broader range of RPGs than the gaming population as a whole. Jennisodes has a discussion of the survey results.
| 0.888889 | RPG podcast listeners play a broader range of RPGs than the gaming population |
What is inspiration? | I've noticed a new mechanic in the 5th edition rules that stands out from the rest. It's called Inspiration.
What is this, what is it good for and how should I as a DM grant it?
It looks like it's simply a way to grant advantage for good role-playing? Is this what it's meant for or does it have more meaning than this?
| To players, mechanically, Inspiration is a token you spend to gain advantage on a roll, and that’s all it is. You can only ever have one of these tokens in your possession, which is incentive to use Inspiration up quick and not hoard it. You can also pass that token to others, so you might do that if you’re about to get a second one.
The true reason Inspiration exists, though, is this: it's a mechanical reward for playing the way the Dungeon Master appreciates. The guidance is thin, and that’s what it comes down to, though the guidance doesn't say it in such explicit terms. To support saying that, I’ll quote in full everything (everything) from the Basic Rules about how you acquire Inspiration, barring the example, found on pages 35-36:
Inspiration is a rule the Dungeon Master can use to reward you for playing your character in a way that’s true to his or her personality traits, ideal, bond, and flaw.
Your DM can choose to give you inspiration for a variety of reasons. Typically, DMs award it when you play out your personality traits, give in to the drawbacks presented by a flaw or bond, and otherwise portray your character in a compelling way. Your DM will tell you how you can earn inspiration in the game.
(further down, after the example...) Additionally, if you have inspiration, you can reward another player for good roleplaying, clever thinking, or simply doing something exciting in the game. When another player character does something that really contributes to the story in a fun and interesting way, you can give up your inspiration to give that character inspiration.
That’s all the guidance there is in the Basic Rules. The guidance suggests to use Inspiration for roleplaying consistent with one’s character sheet, but then gives the DM the freedom to choose to award it however they want:
Your DM will tell you how you can earn inspiration in the game.
So given that, and the fact the DM is the only one who can create new Inspiration, the entire mechanic comes down to being a device to encourage the players to play the way the DM wants.
That can be used to constructive or destructive ends. People are going to have Opinions about how Inspiration should be used, and what ways are good or bad, but the Basic Rules guidance begins and ends at the above. That guidance certainly seems to fit in with D&D’s established notion that the DM has precedence over the players, and enhances that idea.
Inspiration could be used like Fate points, and awarded as compensation and reward for a player making a mechanically suboptimal choice. (Apparently, the Starter Set suggests as much!) However, D&D 5e presently lacks pretty much all of the mechanical support and a large amount of play guidance that drives Fate points working the way they do. Note the conspicuous absence of “the players can suggest they should probably get it” in the guidance, for instance. Choosing to use Inspiration this way is entirely a choice of the group. The management of Inspiration can also be made by group cooperation, but again, that’s a choice of the group.
It seems the authors could have included Inspiration to be a solution to all those complaints of “my player isn’t roleplaying consistent with their character’s alignment and story!” - since then the DM just penalises that player with no Inspiration whilst they’re doing that. I have Opinions on whether this is healthy for the game, and so will others.
At the end of the day: consider whether there’s behaviour you want to encourage in your game, and if it’s healthy to provide mechanical incentive for players to behave that way. If so, use Inspiration for that.
| 1 | Inspiration is a mechanical reward for playing your character in a way that’s true to his or her personality traits . |
System for Setting: Misfits | On the recommendation of one of my players, I'm watching Misfits, a British TV show about kids (Their ages aren't so far specifically stated; they're old enough to drink and young enough to live at home, so late-teens to early 20s, I guess) serving community-service sentences who get super powers. The recommendation included an explicit desire for me to run a game like this.
I'm watching it and thinking about what system to run it in. I want to ask this question more clearly than my last system-for-setting question, so here are some specific points to consider when answering:
WARNING! Spoilers Below!
If you haven't watched the series but plan to, you might not want to read what follows. I tried to separate setting spoilers from the system requirements, but it just didn't work.
The world is gritty and the power level is relatively low. It reminded me of Wild Cards, with "the storm" as the catalyzing event. Therefore, the system must support fine gradations in power - the scale is pretty low, so a small advantage needs to be representable.
Powers are uncontrollable - at least at first. Alisha's lust-inspiring power is uncontrolled as far as I have watched, and the immortality power (obviously) works without conscious effort. Curtis' time rewind is a power of huge significance, but it's not controlled by the beginning of the second season either. Therefore the system must support uncontrolled and unreliable powers.
The system you recommend must support regular humans as significant combat threats - Sally gave Simon a real fight. Player character death must be a real possibility.
This is also an ensemble drama, like Buffy, and much of the story is about the changing relationships between the characters.
When answering, please include only one system per answer to facilitate voting.
In your answer please address the following:
How that system fits the given criteria
What special or unique features of the system are particularly suited to driving this style of play
I will not accept answers along the lines of, "You can do this (or anything) in any system". They will be downvoted and / or flagged for deletion. This question presupposes that System Does Matter.
| Wild Talents might also fit the bill. It's based on the One-Roll Engine (ORE), the same thing that powers REIGN and Monsters and Other Childish Things. I haven't had the chance to play it yet, so I don't know how well it handles your criteria in practice. That said, the rules allow for scaling from "normal human" all the way up to "epic" (ie. Superman). It also explicitly has the Uncontrollable flaw for power creation. There are no real mechanics for character relationships that I could find, but they might exist in an expansion.
| 0.833333 | Wild Talents is based on One-Roll Engine (ORE) |
How to capture Exception in nSpec | In my 'act' I want to capture an exception so that I can do multiple tests on the exception data. Examples on the web show how to capture and compare the type/message within a test (or 'It' block) but not how to capture the exception as an 'act' in itself.
I am currently just doing a try/catch within the 'act' body and storing the exception within the context for later testing in the 'It' block. There I can perform a number of different fluent assertions on the data. Is this the best approach?
| Actually, there is indeed a better way to do this:
void describe_some_exceptional_behavior()
{
context["when throwing an exception"] = () =>
{
act = () => throw new InvalidOperationException();
it["should raise the exception"] = expect<InvalidOperationException>();
};
}
Note: you assign the result of expect directly to it. This tripped me up the first time.
See the nspec specs for more examples.
| 0.777778 | void describe_some_exceptional_behavior |
How can I open a window on a different monitor? | With multiple monitors, I have so far been dragging windows manually around. Is there a way to make a window open on a specific screen in a dual-head setup? (Not to be confused with multiple X server displays.)
Something like: SCREEN=2 firefox or open-in-screen 2 firefox.
If it matters, my environment is KDE using the KWin window manager. KWin window rules can only match some properties like title, but I could not find an environment variable as filter.
The secondary display extends the primary screen:
$ xrandr -q
Screen 0: minimum 320 x 200, current 3520 x 1080, maximum 32767 x 32767
LVDS1 connected 1600x900+0+0 (normal left inverted right x axis y axis) 382mm x 214mm
1600x900 60.1*+
1024x768 60.0
800x600 60.3 56.2
640x480 59.9
VGA1 disconnected (normal left inverted right x axis y axis)
HDMI1 connected 1920x1080+1600+0 (normal left inverted right x axis y axis) 477mm x 268mm
1920x1080 60.0* 50.0 59.9
1920x1080i 60.1 50.0 60.0
1680x1050 59.9
1280x1024 75.0 60.0
1440x900 59.9
1280x960 60.0
1280x720 60.0 50.0 59.9
1024x768 75.1 70.1 60.0
832x624 74.6
800x600 72.2 75.0 60.3 56.2
720x576 50.0
720x480 60.0 59.9
640x480 75.0 72.8 66.7 60.0 59.9
720x400 70.1
DP1 disconnected (normal left inverted right x axis y axis)
| I did come across this method which makes use of xdotool, xprop, & wmctrl.
Here’s what the below script will do:
Find the active window
Get its maximized state and remember it
Remove maximization
Get its geometry
Calculate the new position
Move it
Maximize based on the previous state
Raise it
Here’s a script that does that:
script
This will move the active window to the other monitor. It can only handle a side by side, aka. horizontal, configuration of monitors.
wid=`xdotool getactivewindow`
max_state=`xprop -id $wid _NET_WM_STATE`
wmctrl -ir $wid -b remove,maximized_vert,maximized_horz
eval `xdotool getwindowgeometry --shell $wid`
new_x=1600
if [[ "$X" -ge "$new_x" ]]; then
new_x=0
fi
xdotool windowmove $wid $new_x $Y
if [ -z "${max_state/*_NET_WM_STATE_MAXIMIZED_*/}" ]; then
wmctrl -ir $wid -b add,maximized_vert,maximized_horz
fi
xdotool windowraise $wid
Source: Xubuntu – moving windows between monitors
| 0.888889 | xdotool, xprop, & wmctrl |
What is the purpose of active and passive voice? | In both passive and active voice, the meaning of the sentence is same.
So what is the purpose of passive and active as by two different names?
| The sentence may recount the same facts, or it may not. One very significant difference is that in the active voice you must identify the Agent: the person (or other entity) who performs the action, whereas in the passive you are free to omit the Agent.
Active
ok John stole my book.
∗ Stole my book.
Passive
ok My book was stolen by John.
ok My book was stolen.
In either case, the passive voice is employed to focus on the Patient of the action—the person or thing which 'suffered' it—rather than on Agent who or which performed it. There are several reasons you might want to do this:
Because you don’t know or don’t care who performed the action
Because what is important is the action itself rather than who performed it
Because what is important is the result of the action rather than who performed it
Because you want your readers to think of the action as 'impersonal'
The last reason became particularly important in the 19th century, when scientific writers—or writers who wanted to be thought of as adopting a 'scientific' attitude—were particularly careful to banish any suggestion that the writer's personality or attitudes had any influence on what was reported. The passive voice remains to this day something of a fetish in the sciences, particularly in the 'soft' sciences, where there is still substantial anxiety about the scientific status and value of the work done.
∗ marks an utterance as ungrammatical.
| 1 | Active ok John stole my book. Passive ok My book was stolen. |
What are the disadvantages of "puncture proof" (or puncture resistant) tires? | Some people refer to tires that are more resistant to punctures as "puncture proof" tires.
For example: Specialized All Condition Armadillo Tyre
Even though these tires are not really puncture proof, they do reduce a lot the chances of puncturing. So the advantage is obvious.
Apparently, they're not too expensive compared to regular tires. So, I was wondering why people would choose not to use these more resistant tires. What are their disadvantages?
| I have a pair of the Armadillo tires for my road bike, and they've helped quite a bit (we have a lot of thorny plants in my area, see my question here).
The downsides to this tire as compared to the tire that came with my bike:
The Armadillo is much skinnier than my previous tire (my choice, they do have larger sizes)
The Armadillo has less tread than my previous tire - I can go faster, but I have to be careful in wet conditions, as this tire can slip a lot easier. I've found riding in sand/dirt/loose gravel can be nearly impossible, depending on how loose it is. I have the All Condition tire.
Because the Armadillo has the thick (I think it's Kevlar) weave, it doesn't flex as easily. This makes your tire want to "skip" off of objects, instead of flexing and rolling right over them.
That said, I do prefer the Armadillos over my stock tires - since switching, I haven't had a single flat, and I've put about 500 miles on them so far (riding through the same areas where I got punctures before).
| 1 | The Armadillo is much skinnier than my previous tire . |
Subsets and Splits