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 visualize a value resulted from math node?
|
How to visualize a value resulted from math node,or just to know it.
I tried the way of scaling this value to the scene size and then pick the color and get the value but I want more effective way to do this.
|
Unfortunately this isn't possible without the clumsy tricks already mentioned in the question.
You might consider asking the devs if this can be changed. See Best Place to put Feature Requests?
| 0.777778 |
Best Place to Feature Requests
|
Which whois is the most frequently updated?
|
As the domain manager of 200+ domains, it's essential that I am able to get the most up-to-date information for all the domains I manage and monitor. And I realise that, in general, whois sites do not update their databases often at all.
I've been using who.is all this time but the details for domains I look up aren't always recent. What whois database is the most accurate and up-to-date? I've tried looking up a few but it's hard to tell how often each one updates its database.
|
Being one who has a similar site, I would have thought who.is or whois.com were the most accurate. Mine is different in that I capture the information at the time of an attack, spam, or other similar event. However, most other sites will re-query the whois data when the page is accessed assuming that there is a measure to ensure that the same whois data is not being requested to often. Some sites subscribe and download bulk whois data from time to time and update their databases that way instead of relying on traffic. With a large site such as these, it is nearly impossible to keep the data 100% fresh. There are limits to whois look-ups and sites have to be careful not to over do it.
The best thing to do is either use nslookup in a Windows command window or nslookup or whois in a terminal window in Linux. This will give you the current whois information. But be sure not to try and make bulk queries or you just may be blacklisted. Spread them out a bit and you should be fine.
| 0.777778 |
Whois or whois.com re-query data when page is accessed
|
hard self collision: make particles occupy space
|
By default, Blender's particles don't have any spatial extension. This is fine as long as particles are rendered as halos. But if you give them a size and an appearance as object, it becomes obvious that they're able to go through each other.
What tricks can be pulled off to fix that problem?
For example, if you want to fill an area with houses, toss some leaves onto the floor, or just want charged balls to stick to each other.
I'm aware that a precise solution of this problem is very challenging -- but already some kind of approximation would do in most cases.
|
one partial and approximate solution is to use the harmonic forces as a self-effect on the particle system. Here, "harmonic forces" means to turn the particles into a set of oscillators, connected by virtual springs. The rest distance is the distance we want to keep between objects.
The key point to note is that this now adds an attraction for particles spaced wider than the rest distance, and that it might lead to wobbling. The latter can be controlled with a high damping factor (at or close to 1 gives us "acyclic damping"). To control the former, judicious use of the maximum distance and the strength and power of the force field is necessary. The result can be further improved by use of charged particles (so they repulse each other) and maybe combine that with invisible, charged objects as external attractors.
Downside of this approach is that the self effect on particles is limited to two forces and that getting the right behaviour can be tricky and insidious.
But the largest shortcoming is that there seems to be no way to tie the rest distance to the actual size of the particles, which might vary randomly
| 1 |
"harmonic forces" means to turn particles into oscillators, connected by virtual springs .
|
High memory usage Windows Server 2008r2 on VMware
|
We are running Windows Server 2008r2 on VMware and are experiencing extremely high memory use when nothing is running. The server memory usages slowly creeps up to 98-99%. The server is configured to use 8GB of memory. Is there some setting we should be using so the server can better manage it's memory usage. It's behaving as if there is a memory leak.
|
It's probably taking the memory to use for its cache.
Found some other things you can try here if it's causing an issue for you: http://communities.vmware.com/thread/210226
| 0.666667 |
Is it taking memory to use?
|
How do you pronounce "but"?
|
In which context do you use the stressed bʌt and when do you use the unstressed bət? How often is that?
If you know about the website www.forvo.com, I think it's a shortcoming that speakers use only one of the two versions.
|
The word is similar to a and the (ā vs. ə and ðē vs. ðə). The stressed bʌt tends to be used more when I am emphasizing that I am making a contrast:
I would go, but my parents won't let me. (whining teenager)
The unstressed bət is used more often when what I am saying is more important than the fact that there is a contrast:
...but I don't wanna go! (whining child)
| 0.888889 |
The stressed bt tends to be used more when I am making a contrast .
|
What types of sauces would pair well with boiled pork knuckles?
|
I'm going to be boiling some pork knuckles. What type of sauce would be a good pairing?
I am guessing that because pork knuckles are fatty, the sauce should tend to be sour or pepper-ish to balance out the fatty taste?
|
One traditional accompaniment for pork is apple sauce. This follows the convention that a fruity sauce cuts through the fattiness of meat - duck a l'orange is another example.
Apple sauce is easy to make - just taking a cooking apple, chop it up, stew it down with a little water, then stir in some sugar and butter to taste.
| 1 |
Apple sauce cuts through the fattiness of meat .
|
Real norms on vector spaces over finite fields
|
I am interested in functions of the form $\psi: F^n \to \mathbb{R}^+$, where $F$ is a finite field, that have norm-like properties, e.g., $\psi(x+y) \le \psi(x) + \psi(y)$. Does anybody know if there is any literature on this area?
|
If you are truly only interested in the triangle inequality, then there is the Hamming weight
$w(x_1,x_2,\ldots,x_n)=m$ where $m$ is simply the number of non-zero components. This gives you a metric. Mind you, the space $F^n$ is finite, so any metric on it is going to give you the discrete topology. Adding any kind of norm-like requirements (on top of the triangle inequality) is problematic for several reason, as others have pointed out.
The Hamming weight obviously depends on the choice of basis, which may restrict its usefulness (depending on what you wanted to do with this 'norm').
I'm sad to say there isn't an awful lot of analysis happening in this space.
| 1 |
Adding a metric on top of the triangle inequality is problematic for several reasons .
|
Different subnet for different device types
|
I have noticed a certain pattern in a wireless network. It goes something like this:
All mobile devices (Android and iOS) take the subnet 10.8.5.x.
All laptops (Windows and Linux) take the subnet 10.8.3.x.
It might be pure coincidence, but I like to believe there is something else going on. If such mechanism on the router (i.e. providing different ip subnets to different device types) exists, how is it called? And how is the router able to distinguish between the different device types, isn't the MAC address everything it gets from the device?
Thanks in advance.
|
The first few bytes of a MAC address (unless overridden) supply manufacturer and device type that a discriminating DHCP server could use to allocate devices into different address ranges.
The subnet could be large enough that both address ranges could be within the same subnet. So, it may not actually be different subnets. Further, trying to have a router administer multiple subnets could be a difficult thing to configure, but might be available on higher-end access points or routers.
| 0.888889 |
Discriminating DHCP server can allocate devices into different address ranges
|
CLR SQL Assembly: Get the Bytestream?
|
I have a SQL CLR dll I want to deploy, but have found you can embed the byte stream/varbinary_literal/ varbinary_expression/assembly bits into a text file to get around the messy hassle of packaging a DLL and making sure it's accessible for the CREATE ASSEMBLY command.
But what I have yet to find is how to get that byte stream/varbinary_literal/ varbinary_expression/assembly bits value. I haven't found any consistent terminology, and what I keep finding in using Load().
Help?
|
It's just a hex representation of the dll. This bit should do the trick:
static string GetHexString(string assemblyPath)
{
if (!Path.IsPathRooted(assemblyPath))
assemblyPath = Path.Combine(Environment.CurrentDirectory, assemblyPath);
StringBuilder builder = new StringBuilder();
builder.Append("0x");
using (FileStream stream = new FileStream(assemblyPath,
FileMode.Open, FileAccess.Read, FileShare.Read))
{
int currentByte = stream.ReadByte();
while (currentByte > -1)
{
builder.Append(currentByte.ToString("X2", CultureInfo.InvariantCulture));
currentByte = stream.ReadByte();
}
}
return builder.ToString();
}
You should use the resulting string like so:
string hexString = GetHexString(assemblyPath);
string sql = "CREATE ASSEMBLY [" + assemblyName + "] FROM " + hexString +
" WITH PERMISSION_SET = " + somePermissionSet;
| 0.777778 |
static string GetHexString (string assemblyPath)
|
Inserting a blank line in vim?
|
I quite often find I have a need to insert a blank line either below or above the current line when editing in vim. o and O will do this, but they subsequently switch into insert mode, which is annoying. Is there any built-in command to do this which will remain in normal mode?
|
I've been using these
map <Enter> o<ESC>
map <S-Enter> O<ESC>
in my .vimrc for years.
Press Enter to insert a blank line below current, Shift + Enter to insert it above.
| 1 |
.vimrc map <Enter> o≪ESC
|
.NET - VB - OOP - Partial Class - How to create Partial Constructors
|
I have a Partial Class in a file MainFile.vb with a constructor like this:
Partial Class MyAwesomeClass
' The constructor - Name it MainConstructor
Public Sub New(Dim x As Integer)
' Some awesome code here
Line1_of_code()
Line2_of_code()
Line3_of_code()
End Sub
End Class
Now I want to add some more lines of code in the same constructor i.e. MainConstructor but my problem(s) is/are:
I can't edit the file MainFile.vb
I can't create another constructor
All I can do is -- since the MyAwesomeClass is a Partial Class; I can create another file e.g. ExtendedFile.vb and write my lines of code
So I'm trying to do like this which is not allowed in .NET:
Partial Class MyAwesomeClass
' The extended constructor - Name it ExtConstructor
Public Sub New(Dim x As Integer) ' Boom!!!! Error: Duplicate constructor with same kind of arguments
' my extended awesome code here
Line4_of_code()
Line5_of_code()
Line6_of_code()
End Sub
End Class
Ultimately I want to do something like - When I create an object of MyAwesomeClass; it should execute Line1_of_code() to Line6_of_code(). I.e.
Dim objAwesome As New MyAwesomeClass(5) ' Any Integer will do
should execute all the below lines for objAwesome (and in the same order, too)
Line1_of_code()
Line2_of_code()
Line3_of_code()
Line4_of_code()
Line5_of_code()
Line6_of_code()
I'm using .NET Fx 4.0 -- Is there any workaround or solution? Any help would be appreciated.
|
You can think of a partial class as code in separate files. Then compiler will merge it in one class file.
One solution is to just make new inherited class and override constructor.
Second solution is to make Shared (static) method builder:
Partial Class MyAwesomeClass
Public Shared Function Create() As MyAwesomeClass
' your code goes here
' calling base instance creation
Third solution is to make different signature for second constructor, because you cannot have two methods in class with same name and signature, e.g.
Partial Class MyAwesomeClass
Public Sub New(Dim x As Integer, Dim buildWithNewAwesomeImplementation as Boolean) '
Me.New(x) ' calling base constructor
If(buildWithNewAwesomeImplementation)
Line4_of_code()
Line5_of_code()
Line6_of_code()
End if
End Sub
End Class
First solution seems more reasonable.
| 1 |
a partial class as code in separate files .
|
How to easily determine the results distribution for multiple dice?
|
I want to calculate the probability distribution for the total of a combination of dice.
I remember that the probability of is the number of combinations that total that number over the total number of combinations (assuming the dice have a uniform distribution).
What are the formulas for
The number of combinations total
The number of combinations that total a certain number
|
There's a very neat way of computing the combinations or probabilities in a spreadsheet (such as excel) that computes the convolutions directly.
I'll do it in terms of probabilities and illustrate it for six sided dice but you can do it for dice with any number of sides (including adding different ones).
(btw it's also easy in something like R or matlab that will do convolutions)
Start with a clean sheet, in a few columns, and move down a bunch of rows from the top (more than 6).
put the value 1 in a cell. That's the probabilities associated with 0 dice. put a 0 to its left; that's the value column - continue down from there with 1,2,3 down as far as you need.
move one column to the right and down a row from the '1'. enter the formula "=sum(" then left-arrow up-arrow (to highlight the cell with 1 in it), hit ":" (to start entering a range) and then up-arrow 5 times, followed by ")/6" and press Enter - so you end up with a formula like =sum(c4:c9)/6 (where here C9 is the cell with the 1 in it).
Then copy the formula and paste it to the 5 cells below it. They should each contain 0.16667 (ish).
Don't type anything into the empty cells these formulas refer to!
move down 1 and to the right 1 from the top of that column of values and paste ...
... a total of another 11 values. These will be the probabilities for two dice.
It doesn't matter if you paste a few too many, you'll just get zeroes.
repeat step 3 for the next column for three dice, and again for four, five, etc dice.
We see here that the probability of rolling $12$ on 4d6 is 0.096451 (if you multiply by $4^6$ you'll be able to write it as an exact fraction).
If you're adept with Excel - things like copying a formula from a cell and pasting into many cells in a column, you can generate all tables up to say 10d6 in about a minute or so (possibly faster if you've done it a few times).
If you want combination counts instead of probabilities, don't divide by 6.
If you want dice with different numbers of faces, you can sum $k$ (rather than 6) cells and then divide by $k$. You can mix dice across columns (e.g. do a column for d6 and one for d8 to get the probability function for d6+d8):
| 1 |
Calculate convolutions in a spreadsheet
|
Security concerns with a "fiddle" site?
|
I recently came across a cool site for testing .NET code (http://dotnetfiddle.net/). In the FAQs they mention that they have two restrictions for security purposes:
No access to File System IO
No external internet access
Is this sufficient to prevent malicious users from exploiting the site? Is there anything that a malicious user could still do even with these restrictions in place?
|
Is there anything that a malicious user could still do even with these restrictions in place?
It depends on your definition of "malicious". Running a tight loop or otherwise consuming huge amounts of resources is arguably malicious. Serving up a fake PayPal front is malicious, but certainly not prevented by these features.
You pick the level and type of insecurity you're willing to tolerate based on the features you feel you need. And then over time you might adjust based on usage.
| 0.888889 |
Is there anything that a malicious user could still do even with these restrictions in place?
|
What is the difference between a telephoto lens and a zoom lens?
|
Looking at the product page for Nikon lenses, I notice a distinction between telephoto lens and zoom lens.
What is the difference between the two? Why would I want one over the other? I wiki'd telephoto lens but remain confused about this distinction.
Please talk to me like I'm stupid. :) I am hoping for a completely lay explanation. In particular, I'd like to understand in what situations I'd use a telephoto lens, and in what (other) situations I'd use a zoom lens.
|
A zoom lens means the lens can change focal length via zooming, i.e. it is not a prime lens. A telephoto lens has a long focal length (I do not know if there is an official threshold to call a lens telephoto, but Nikon seems to start it at 85mm.
So, you can have a prime telephoto lens that is not a zoom, and you can have a wide angle zoom lens.
| 0.888889 |
a zoom lens can change focal length via zooming
|
AppleScript: how to get the current directory of the topmost Terminal
|
I want to get the current directory of the topmost Terminal tab/window (via AppleScript or something else, it doesn't really matter). How can I do that?
|
Another solution.
get_foregroundterminal_curdir_fast.scpt:
tell application "Terminal"
do shell script "lsof -a -p `lsof -a -c bash -u $USER -d 0 -n | tail -n +2 | awk '{if($NF==\"" & (tty of front tab of front window) & "\"){print $2}}'` -d cwd -n | tail -n +2 | awk '{print $NF}'"
end tell
I use lsof itself to get PID of the bash shell of the corresponding Terminal window. This is MUCH faster than using fuser (milliseconds vs. seconds).
| 0.888889 |
tell application "Terminal" do shell script "lsof"
|
Is there a word specifically referring to the stand upon which a large book is displayed, opened to a page?
|
I'm thinking in particular of dictionaries or illuminated bibles being displayed on these stands, which are at least waist-high on a standing person, constructed of wood. Is there a particular word for this, other than "book stand"?
|
A lectern is a reading desk, with a slanted top, usually placed on a stand or affixed to some other form of support, on which documents or books are placed as support for reading aloud.
| 1 |
Lectern is a reading desk with a slanted top, usually placed on a stand or affixed to
|
Solubility, pressure and Henry's law
|
Im trying to do my chem homework and I'm stumped.
Determine the solubility of $\ce{N2}$ in water exposed to air at 25°C, if the
atmospheric pressure is 1.2 atm, assume that the mole fraction of
nitrogen is 0.78 in air and the Henry's Law constant for nitrogen in
water at this temperature is $6.1 × 10^{-4} M/atm$.
I have the answer, but i want to know how to solve for it. I've been reading through my notes and the book trying to find a reference through which to approach this problem and i have found none. If anyone can guide me in the right direction that would suffice
|
What are the units of your answer? You need a solubility, which is an amount per volume. If your amount is moles, the your solubility is in moles/liter: $\text{M}$.
That unit appears in the Henry's Law constant! $6.1\times 10^{-4} \frac{\text{M}}{\text{atm}}$. What can you do to get rid of the atmospheres in the denominator? You probably need the pressure and the mole fraction.
| 1 |
How to get rid of atmospheres in the denominator?
|
Delay in debt appearing on credit card statement
|
We charged hospital fees totalling $2400 on a St George Bank credit card on 17 and 21 April 2014. The hospital was located in Denpasar Bali. On last checking the amount owed on the card (12/05/2014) in Sydney, we were advised that no account from the hospital has appeared. It is now three weeks since the transaction occurred and still there is no indication from St George bank that any money is owed them in relation to the hospital fees. Does anyone have a possible explanation for what might have occurred.
|
There may be a delay in the hospital's administration processing the payment or they may have misplaced or lost the payment paperwork details. You will just need to keep checking your statement in case the payment still comes through at a later date.
| 1 |
There may be a delay in the hospital's administration processing the payment .
|
if(pictureBox.Image == null) in WPF
|
I want to control my image object is or is not null. if(pictureBox.Image == null) works C# but I cannot find a code for WPF. What should I write for this?
|
WPF doesn't have a PictureBox control. The equivalent is Image (as shown here), so you could just do this:
if(myImage.Source == null) ...
Unless you're doing something more complicated and hosting WinForm controls in WPF?
| 0.777778 |
WPF does not have PictureBox control
|
Device including RTC EEPROM and battery?
|
I am currently designing an electronic board and i got a question:
Do you know if there is any device in which are integrated an RTC, an EEPROM and a battery? I heard about this type of device (i think it is called Time keeper) but I can't find any.
Thank you
|
There a few RTC modules out there, here is one option that uses the DS1307 (which has 56 bytes of EEPROM IIRC) and has an onboard battery:
Sparkfun RTC module
Another one here with 236 bytes of non-volatile memory (battery holder on underside):
| 0.333333 |
Sparkfun RTC module Another one with 236 bytes of non-volatile memory
|
Consider Global Reputation Points
|
I have come to enjoy the Stack Exchange community as a whole over the past few weeks. Originally, I started out seeking computer help from a couple of subcommunities where I could learn and get help with my computer problems. Itself is a great idea and there are a few forums that offer similar help resources.
What makes Stack Exchange different is that it expands across so many arenas with a single account making it a very expansive place to give and take. For example, I found myself on the English Learning site where I actually have a lot to contribute. I am actually an English teacher but I have computer problems sometimes.
One thing though, the reputation points don't carry over across subcommunities which I think is a bit detrimental and defeating the purpose in a way.
My arguments are:
If the purpose of reputation points is to build a character reference, then shouldn't it be global? For instance, I can be helpful in one community and have a ton of reputation but a complete 'weirdo' in another. Whereas a universal point system wouldn't allow this. Reputation as a whole builds your identity across multiple communities.
I join a new community and I am limited to what I can post (even if my post can be useful or helpful). Specifically, I ran across this during commenting. I had a perfectly viable comment to help a person but wasn't allowed because I didn't have reputation but I had reputation in another community. I had to post it as an answer and then I got 'moderated' by the community on where I should post and was down voted for leaving a comment in the answer area. Thus, losing reputation.
It doesn't seem to create a way for incentives in some cases. For example, I have computer problems and I can't say I am phenominal at solving or answering computer questions. I could ask a question that may not get answered but if I have enough reputation I could put a bounty on it as incentive to get people to answer it. BUT WAIT!! I can't really earn reputation on a computer community to put a bounty on a question because there is nothing I can really answer or be helpful with.
However, I am great at writing, editing and dealing with international students!!! But, what is the sense of me just racking up points in a community when I will hardly need to ask a question much less put a bounty on it? Sure, points are great. It's nice to have a lot of points but what if I need them elsewhere?
So, when I need computer help desperately I can use my reputation collected from another community to put incentive in trying to get a question answered. Essentially, I'm a good guy and helpful at something but I am not a computer whiz.
Everyone is good at something and thats what the community at large should be in my opinion.
Just my opinion. I used my situation personally to explain but I am sure other people have experienced a similar situation or have had a similar thought.
|
For instance, I can be helpful in one community and have a ton of reputation but a complete 'weirdo' in another.
You are making points against yourself in your argument for the feature. That reason, right there, is exactly why this is a bad idea. Just because you are skilled and knowledgeable in one field and community doesn't mean you know what you're doing in another.
While the system and features of each site are the same, each community is different. They develop their own quality standards and their own expectations, and it doesn't make sense for reputation to carry over across all sites.
The system already gives you a small reputation boost up to at least 101, so long as you have at least 200 reputation on any other site in the network. That lets you get the two most basic features: upvoting and commenting. Privileges past that become highly dependent on the community in which you're participating, and it's dangerous to let just anyone out of the blue show up in a community and start editing or voting to close things when they've never participated there before.
| 0.777778 |
Reputation boost in a community is a bad idea .
|
Quasi-isometric embeddings of the mapping class group into the Teichmuller space
|
Does there exist a quasi-isometric embedding
$$MCG(S) \to (\mathrm{Teich}(S), d)$$
for $d$ any "known" distance on the Teichmuller space (i.e. Teichmuller, Weil-Petersson, Thurston...) ?
|
A result of Behrstock and Minsky (cf. Hamenstadt too) implies that the rank of mapping class groups is the maximal rank of abelian subgroups, which is $3g+p-3$ for a connected hyperbolic surface of genus $g$ with $p$ boundary components. The rank of Teichmuller space with respect to the Weil-Petersson metric they show is $\lfloor \frac{3g+p-2}{2}\rfloor < 3g-3+p$, so there is no q.i. embedding of the mapping class group to Teichmuller space with the Weil-Petersson metric.
On the other hand, Eskin-Masur-Rafi show that the rank of the Teichmuller metric is equal to that of the mapping class group. They point out that the orbit of a point under the mapping class group is not a quasi-isometric embedding. But this leaves open whether there might be a non-equivariant q.i. embedding.
| 0.333333 |
q.i. embedding of mapping class groups to Teichmuller space
|
How does the colour of ambient lighting affect colour rendition?
|
How does the colour of ambient lighting affect colour rendition?
For example:
If I stand under a sodium-vapour (orange) streetlight and calibrate my camera's white balance, what effect would this have if I were to take a photo of a colour test chart? Presumably, white would still render as white due to the white balance calibration, but how would other colours be rendered?
How would the result differ under primary and secondary coloured lighting, e.g. a red or yellow light?
Thanks.
|
The issue with these sorts of light sources isn't the color temperature, but rather the spectrum provided by the light.
A camera (or your eyes) can only record colors which are reflected from the objects in the scene (not counting objects which have fluorescent properties). If the light shining on the object doesn't contain a certain color, it can't bounce to you, and therefore the color of the object can't be recorded in the way it might be under full spectrum light.
In your specific example of a sodium-vapor light, the color spectrum looks like this:
CC-BY-SA image from Wikimedia Commons, author Philips Lighting
You can see that there's a very narrow spike of light just short of 600nm, which is quite yellow. Everything you see (or photograph) will be in terms of how the object reflects light in that narrow band. So your assumption is correct — you can shift what is recorded as neutral grey/white, but your chart will probably look quite strange and "inaccurate". And there's really nothing you can do about it besides bringing in other lighting.
If your other lighting is also narrow-spectrum, that will improve rendition of the colors it adds — pretty simple, except when it comes to getting everything in your scene lit the way you'd like it to be with each different color. And your white balance will need to be more of a compromise (probably you'd pick something which would preserve both strong color casts, rather than attempting to neutralize them).
More details are covered in several existing questions:
Best fluorescent bulb color temperature for shooting people and interviews?
What white balance settings do I need to capture the cast of a coloured streetlight?
When should I use manual white balance settings?
| 1 |
What is the best color temperature for a coloured streetlight?
|
CASTING attributes for Ordering on a Doctrine2 DQL Query
|
I am trying to get Doctrine2 Entities, ordered by their ID which apparently is a String even though it contains only Numbers.
So what I would like to do is something like this:
SELECT entity1, cast (entity1.id AS integer) AS orderId
FROM Namespace\Bla\MyEntity
ORDER BY orderId
Is there a way to do something like this in Doctrine2?
Or, what would be the best practise to get my Result if i can't change the type of the id (due to customer requirements of course)?
Attention: I am not asking SQL Code, i am asking for a Doctrine2 Solution, preferably in DQL
|
Not sure if this works, but to access an entity ID you need the IDENTITY() DQL function. Try this:
SELECT entity1 FROM Namespace\Bla\MyEntity ORDER BY IDENTITY(entity1)
| 1 |
IDENTITY() DQL function to access an entity ID
|
Identifying sequential patterns
|
I am working with sequence data which are long lists of malware win-api calls. I am trying to cast the problem of identifying 'malware behavior' into one of finding sequential patterns. I treat each api call as a single item Itemset. The number of different possible items (api calls) is quite large.
Now, when I apply the SPADE algorithm (see also, Zaki, SPADE: An Efficient Algorithm for Mining Frequent Sequences, Machine Learning, 42, 31–60, 2001) I run into memory problems.
Is there a better alternative way to find sequential patterns among large high vocabulary sequences?
|
You may try other sequential pattern mining algorithm.
For example, the open-source SPMF java data mining library offers SPADE, but also PrefixSpan, SPAM, CM-SPAM, CM-SPADE, GSP, etc (by the way, I'm the project founder). To my knowledge CM-SPADE usually is faster than SPADE. In terms of memory perhaps that SPAM uses less memory.. You could try it.
| 0.777778 |
CM-SPADE is faster than SPADE
|
Delete un-seen mesh with Blender
|
I am wondering if there is a way to delete un-seen mesh with Blender. Here's an example. I have a cube, and it has 3 cubes inside of that cube.
Is there a way to delete the mesh inside of the cube without selecting the cubes manually? This would clear up lots of extra mesh and speed up my render engine. I am using Cycles, so if Cycles has an option to not render hidden meshes, that would be good too. (although deleting them would be better). A Python script would also do. :)
Thanks!
|
You could select something of the surrounding object (vertex,edge or face) in Edit Mode and select linked L followed by invert selection Ctrl-I
Faces where all edges are connected to more than 2 other faces (users) can be selected via Select Menu / Interior Faces
| 1 |
Invert selection Ctrl-I Faces where all edges are connected to more than 2 other faces
|
ros send message on startup doesn't seem to work
|
I have the following code:
void NewCore::spin(){
ros::Rate rate(10);
int first =1;
while(ros::ok()){
if (first){
askMath();first=0;}
ros::spinOnce();
rate.sleep();
}
}
int main(int argc, char **argv){
ros::init(argc, argv, "newCore");
NewCore nc;
nc.init();
nc.spin();
}
void NewCore::init(){
mngrSub = handle.subscribe<std_msgs::String>("/tawi/core/launch", 10, &NewCore::launchCallback, this);
mngrPub = handle.advertise<std_msgs::String>("/tawi/core/launch", 100);
mathSub = handle.subscribe<std_msgs::String>("/display", 10, &NewCore::launchCallback, this);
serSub = handle.subscribe<std_msgs::String>("/tawi/arduino/serial", 100,&NewCore::serialCallback,this);
mathPub = handle.advertise<std_msgs::String>("/questions", 100);
ballPub = handle.advertise<std_msgs::Int16>("/tawi/core/ballcount", 100);
nmbrPub = handle.advertise<std_msgs::Int16>("/tawi/core/number", 100);
}
void NewCore::askMath(){
ROS_INFO("addition1d<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<");
std_msgs::String question;
question.data = "1digitAddition";
mathPub.publish(question);
}
(code that isn't interesting has been removed)
Running this causes the following output to appear:
$ rosrun glados newCore
[ INFO] [1421236273.617723131]: addition1d<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
However if I have the following code on during launch:
$ rostopic echo /questions
then it does not show me an initial message being sent.
Changing
if (first){
askMath();first=0;}
into
askMath();first=0;
does appear to work but it then sends a message every cycle rather then just the one at the start.
Does anybody know what is wrong here?
|
I experimented a bit and here's what I think happens.
When you run
$ rostopic echo /questions
The /questions topic doesn't exist before you run the program. Maybe you cheat it by first running your programming, running this command and then running your program again, but this assertion is still true. So at the point when you run your program, rostopic is not subscribed to any topic.
I don't know internally how this is handled by roscore and rostopic, but somewhere along the line, this is what's happening as the observed behavior of rostopic:
forever
/* establish connection */
while not subscribed to topic
try to subscribe
if failed
sleep a bit
/* intercept messages */
while topic still exists
wait for message
print message
This means that rostopic (or more likely roscore on its behalf) waits for a topic to become available and subscribes to it. It then proceeds to print incoming messages. If the topic becomes unavailable, rostopic (or again more likely roscore on its behalf) goes back to waiting for the topic to become available again.
That said, here's what happens when this runs in parallel with your code:
rostopic you
wait for topic
sleep
wait for topic
sleep
start
ros::init
advertise topic
publish first message
subscribe to topic
wait for message
sleep
As you can see, your program publishes its first message immediately after advertising the topic. The unsuspecting rostopic program is not yet aware of this advertisement so is not actually subscribed to the topic yet. You publish the first message before rostopic gets a chance to subscribe to the topic.
You can verify this simply by putting a relatively large sleep after you advertise the topics and before you publish to them, i.e. between nc.init() and nc.spin().
To address your real problem (as stated and responded in the comments), which is to understand when the node has started up and use this as a trigger for further actions, I'd advise to consider another strategy.
Generally, you would want to make sure a node is up to make sure the other nodes that depend on it can run correctly. However, this doesn't mean that the original node has to be run just before the depending nodes. It could in theory be run long before them, or since ROS doesn't run in real-time and as you have observed, the timing between when topics are advertised, subscribed and the messages going around are quite unpredictable. Add network to this and they are really unpredictable.
So instead, you could devise a mechanism to query whether your node is available or not. This is simply done with a ROS service. You would essentially do all the necessary startup and then put up a service that always returns true. Any node that needs to ensure this node is available before proceeding can poll this service and as soon as a call to this service succeeds, you know the node is running.
As an added bonus, this means that you don't have to take this node down (and all depending nodes) just because you need to restart one of the depending nodes.
| 1 |
When you run $ rostopic echo /questions, the 'questions' topic doesn't exist .
|
Why does cyclopropane give bromine water test?
|
This question was in my exam and all I could tell was that it is related to high angle strain as the angle is $60^\circ$ in stead of required $109.5^\circ$. No book I have read mentions this. Also, what is the product formed?
|
The following ring opening reaction will occour:
You are quite right about the angle strain. Because orbital interactions are not optimal in this geometry. Consider $p$-orbitals, then a natural bond angle would be $\theta\in [90^\circ; 180^\circ]$. A mixing of $s$ and $p$ type orbitals allows a wide range of angles $\theta\in (90^\circ,\dots, 180^\circ)$.
In the cyclo propane $\ce{C3H6}$ - which you can also describe as trimethylene $\ce{(CH2)3}$ - bonds have to be bent to overlap at all. A possible way of describing the bonding situation is regarding each $\ce{CH2}$ entity as $sp^2$ hybridised. Two of these orbitals are used for $\ce{C-H}$-bonds (not shown) and one forms an inner two-electron-three-centre $\sigma$ bond (left). Leaving $p$-orbitals to form some kind of degenerate $\pi$-like orbitals (middle, right).
This very general approach can be derived from a Walsh diagram. Schwarz et.al. {@academia.edu} and Hoffmann {@roaldhoffmann.com} described bonding quite similar and it is in quite good agreement with a calculation (BP86/cc-PVTZ, $D_{3h}$) I have done. From this I have prepared a chart of all occupied molecular orbitals formed from valence orbitals and the LUMO. Preview:
Especially the symmetrical orbital 8 resembles very well the schematics. A quite rigorous approach for this theory can also be found here.
It is noteworthy - as mentioned by ron - that there is no notable increase in electron density in the centre of the ring. This may be due to the fact that there are much more orbitals having nodes in the centre than there are without.
Now bromine is known to be easily polarised $\ce{{}^{\delta+}Br-Br^{\delta-}}$ and may intercept at any point of the ring causing a bond break and relaxation to a less strained structure. It will most likely attack at the the $\pi$ type orbitals since bromine is an electrophile. The mechanism is analogous to the addition of bromine to ethene, which is nicely described at chemguide.co.uk. The essential part is the attack of the bromine at the HOMO(s).
The ring opening reaction can be reversed by adding sodium.
However, when there are bromine radicals present (UV light) then substitution will occur:
\begin{aligned}\ce{
Br2 &->[\ce{h\nu}] 2Br.\\
&+(CH2)3 -> (CH2)2(CHBr) + HBr
}\end{aligned}
| 0.777778 |
The symmetrical orbital 8 resembles very well the schematics
|
How to deploy OSGi bundle to Maven repo with deploy:deploy-file?
|
I have an OSGi bundle that was built using Maven by another team. The POM file declares its packaging as "bundle" and uses the Apache Felix plugin.
I need to deploy this artifact to a local Maven repository (Nexus) so that it can be used by our internal projects.
I have used the deploy:deploy-file target to deploy the bundle to the repository, just as you would with a standard JAR file and this works without error. I extracted the embedded POM from the bundle and passed that on the command line, so the command line was:
mvn deploy:deploy-file -Dfile=3rdpartybundle.jar -DpomFile=pom.xml -DrepositoryId=internal -Durl=http://internalserver/nexus
The issue is that when I deploy it like this, the packaging is set to bundle and as a result the name of the artifact in the repository ends up with a .bundle extension, instead of a .jar extension.
Now, we cannot figure out how to declare it as a dependency. If we declare it like this:
<dependency>
<groupId>...</groupId>
<artifactId>...</artifactId>
<version>...</version>
<type>bundle</type>
</dependency>
We get an error stating that the dependency cannot be resolved. The interesting thing is that the GAV coordinates in the error message actually has "jar" as the value for the type of the dependency even though we set it as "bundle".
If we change the dependency to:
<dependency>
<groupId>...</groupId>
<artifactId>...</artifactId>
<version>...</version>
<type>jar</type>
</dependency>
We get the exact same unresolved dependency error.
So how are you supposed to deploy an artifact packaged as a bundle to a Maven repository, so that it can be used as a compile time dependency for another project?
Thanks
|
The issue is that "3rdpartybundle.jar" is being built without setting extensions=true and/or supported types:
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
...
<extensions>true</extensions>
...
<configuration>
<supportedProjectTypes>
<supportedProjectType>jar</supportedProjectType>
<supportedProjectType>war</supportedProjectType>
</supportedProjectTypes>
If you can't fix that upstream, then there's a couple of options;
1) Repack it as a Jar using a new project pom:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.3</version>
<configuration>
<actTransitively>false</actTransitively>
<outputDirectory>target/classes</outputDirectory>
<artifactItems>
<artifactItem>
<groupId>3rd</groupId>
<artifactId>party</artifactId>
<version>X.Y.Z</version>
</artifactItem>
</artifactItems>
</configuration>
<executions>
<execution>
<goals>
<goal>unpack</goal>
</goals>
<phase>compile</phase>
</execution>
</executions>
</plugin>
2) Try using mvn deploy:deploy-file with -DgeneratePom=false -Dpackaging=jar -Dfile=/path/to/3rdpartybundle.jar but without specifying -DpomFile= - hope there's no META-INF/maven/pom.xml inside the 3rdpartybundle.jar - it should work using this but you'll need to specify the groupId/artifactId/version parameters as these won't be derived from the project's pom.
I know I've build bundle artifacts in the past and deployed these to our nexus (v1.9.0.1) and those in the Spring repo are typed bundle too, but don't recall any issue. (Incidentally you don't need to specify the bundle in dependency declarations, AFAIK if it's the only artifact it should be inferred)
| 0.333333 |
"3rdpartybundle.jar" is being built without setting extensions=true and/or supported types
|
What to keep in mind when copying a small card game?
|
There's an old card game I want, but it's been out of print for 15 years and currently going for >$1000 used. There are just 80 cards in the game, and I've got a friend who does own it.
My plan is just to scan the cards, print them two-sided, laminate them and cut them out with a knife. I could also get plastic pockets and print the front and back separately.
What are some common pitfalls in printing a card game, and what am I likely to have missed?
(Don't worry, of course I'll mail a fit donation to the manufacturers.)
|
As commenters have pointed out, the copying that you are describing is illegal in most countries.
This isn't legal advice (and it depends on where you're located), but a quick Google search about copying and protecting card games seems to suggest that you probably can make a copy if you don't directly copy the artwork or wording used in the original game. It sounds like you can write out the rules in your own words, and make your own cards. Of course, some would say this is ethically questionable. And who knows what the issues are if the game mechanics are patented in some way.
(Don't worry, of course I'll mail a fit donation to the manufacturers.)
There's a better way. If the game is out of print, but the manufacturers are still contactable, why not just write to them? You can avoid the issue of illegal copyright infringement if you have permission.
Something like "I am really interested in a copy of this game. Is it possible to buy it from you still? Are you likely to reprint it anytime soon? If not, would you mind if I photocopied my friends copy and mailed you $70?"
| 0.777778 |
How do I copy a card game?
|
How to specify the multicolumn width in table header?
|
I want to read/input the body of a table from a separate file. I have mostly solved this problem using this question.
But when I try to read a table with multicolumn from a separate file, it failed.
The following is an example.
%main.tex
\documentclass{article}
\usepackage{filecontents,catchfile}
\begin{filecontents*}{table.tex}
%table.tex
\hline
A & B & C & D \\ \hline
E & \multicolumn{3}{l|}{This is generated by excel2latex macro. I want to let it auto wrap according to the width of (B+C+D) } \\ \hline
\end{filecontents*}
\begin{document}
Table test.
\section{Insert a full table}
\begin{tabular}{|p{2cm}|p{2cm}|p{2cm}|p{2cm}|}
\hline
A & B & C & D \\ \hline
E & \multicolumn{3}{p{6cm}|}{This is generated by excel2latex macro. I want to let it auto wrap according to the width of (B+C+D) } \\ \hline
\end{tabular}%
\section{ Input the body of table from a separate file}
\CatchFileDef{\mytable}{table.tex}{}% table.tex > \mytable
\begin{tabular}{|p{2cm}|p{2cm}|p{2cm}|p{2cm}|}
\mytable
\end{tabular}%
\end{document}
I just don't want to manually define the width in the body of table because it is generated automatically.
|
I uses tabularx enviroment and its X coloumn format and solved this problem.
\documentclass{article}
\usepackage{bigstrut}
\usepackage{tabularx}
\begin{document}
\begin{tabularx}{70mm}{|p{20mm}|p{20mm}|l|}
% Table generated by Excel2LaTeX from sheet 'Sheet1'
\hline
A & B & C \bigstrut\\
\hline
\multicolumn{3}{|X|}{This is combined from A+B+C, and the contents is very very long.} \bigstrut\\
\hline
\end{tabularx}%
\end{document}
| 1 |
Tabularx enviroment and its X coloumn format
|
Why are there so many different types of screws (phillps/flat/hex/star/etc)?
|
Newbie question.
Why is it that there's a bazillion different types of screws? Why can't we just always use one standard screw type? Are there advantages/disadvantages to the different types? Are there times when one type is preferred over another?
Help me understand why there isn't one screw to rule them all.
|
Same reason there different shapes and sizes of screws. It's because there is no single design of screw or screw head which satisfies all requirements. Even when the Phillips design came out there was almost immediate competition from posi-drive and others (most of which have since disappeared) because the Phillips design leaves a lot to be desired, such as the bit rising in the slots when the screw gets tight. Some designs, such as allen heads, have been around a lot longer and for most purposes are very superior but even then, a countersunk allen head of necessity has a rather small socket which creates other problems, such as a tendency to break the keys. Also, allen heads and other socket designs are mostly only used in hardened materials, which resist the tendency of the socket to deform under pressure.
The reason we currently have so (relatively) few mainstream designs of screws is simple practicality. Nobody, merchant or user, wants to stock the massive number of screws we would need to have to use the best possible design for every possible application, so we compromise and use ones that are adequate in the majority of cases.
| 1 |
No single design of screw or screw head which satisfies all requirements
|
Is there a way to automatically run scripts based on conditions on PC/Mac/Linux, like Tasker for Android?
|
I'm not thinking about pure scheduled tasks, but rather things where a daemon in the background will automatically trigger a script when certain conditions are met.
For those who have used Tasker on Android, you probably have an idea of what I'm talking about already. For those who don't, this would include things like:
automatically triggering scripts when a Macbook is plugged in or unplugged; or
having the computer automatically go into sleep mode when it gets a certain message (via an open port, or email, or whatever), and similarly wake up again; or
automatically opening a connection to a file server on the same network at a certain time of day; and so on.
I've seen assorted software tools to do this kind of thing piecemeal, but I'd be extremely curious in finding any mostly-integrated way, premade or homebrew, to accomplish the same kind of flexibility in automation that I've gotten used to on my phone.
I also figure this question will be most helpful if applied across the range of OSes rather than more limited.
|
I'm not thinking about pure scheduled tasks
Actually, I think you are thinking of Scheduled Tasks, as least in Windows. In Windows 7, you can set up scheduled tasks that start based on certain events. I know at least 1 and 3 from your list, and possibly also #2 depending on the app that's listening.
The screen shot below shows the available trigger options. The big one here is the "On an event" option, as Windows writes a huge amount of information to the event log. It's just a matter of tracking an example down in the event viewer.
An example for "Resume from sleep", choose the System event log, the Power-Troubleshooter source, and Event ID 1. The "custom" option allows you to also filter on the data in the event.
| 1 |
Scheduled Tasks can start based on certain events
|
Kosher salt vs. Table salt for rib eye steak
|
I don't have any Kosher salt on hand and I'm cooking a rib eye steak tonight. Can I just use table salt, or would that drastically effect the taste of the steak?
Why is Kosher salt better to use?
|
The difference in salt is more related to how the salt is being used. So for the purpose of quickly salting before cooking or at the table any type of salt will do.
However if you are salting your meat at least an hour in advance and letting it rest before cooking (which I HIGHLY recommend you do) then using the larger grains of Kosher salt has a positive effect. Salting the meat causes the proteins contained in the meat to change and allows the meat to retain juices significantly better. At the same time some of the salt is pulled into the meat as the water that has been drawn out of the meat through osmosis is reabsorbed back into the meat near the end of the hour. Using a finer grain salt, such as table salt, will allow significantly more salt to be absorbed into the meat. Using a coarse grain salt, kosher, will mean a more perfectly salted piece of meat.
For reference see: http://www.seriouseats.com/2011/03/the-food-lab-more-tips-for-perfect-steaks.html
| 1 |
Salting your meat at least an hour in advance or at the table
|
Front end submit form with jquery form plugin
|
Maybe someone can help me with a small problem I'm having. I'm trying to use this: http://jquery.malsup.com/form/ to create a submit form for Wordpress. I've tested it on a regular site(not WP) and it works. I can't figure out why it won't work in wp.
This is my form. I've created two page templates, one has the form, the other has the wp_insert_post code. If I change the form action to action="http://mysite.com/page.php" it works, if I point it to a page template it doesn't. I need it to point to a page template for the wp_insert_post code to work.
This is on one first page:
<form id="myForm" action="http://mysite.com/submitest" method="post">
Name: <input type="text" name="name" />
Comment: <textarea name="comment"></textarea>
<input type="submit" value="Submit Comment" />
Thanks
|
Leave the action value as blank. Give the submit button a name as name='form_sub'. Then add the following code to your functions.php file. Check the codex for init hook.
You can create a 'Thank You' page, or a confirmation page where the user should go after successful submission.
<?php
add_action('init', 'form_submit');
function form_submit(){
if(isset($_POST['form_sub']))
{
//here you'll have your form data in a $_POST array, you can check it using a print_r. parse the form and insert the post
$title = $_POST['name'];
$content = $_POST['comment'];
//change the category and author as you want
$post_obj = array(
'post_title' => $title,
'post_content' => $content,
'post_category' => array(1), //Uncategorized
'post_status' => 'draft',
'post_author' => 1 //Admin
);
$id = wp_insert_post($post_obj);
//check if successfully submitted
if(isset($id) && !is_wp_error($id))
{
//redirect to a thank you page, make sure the slug is 'thank-you'
wp_redirect(home_url('/thank-you'));
exit;
}
}
}
?>
Try this. Let me know if you are stuck.
Edit:
This is how the form template should be. The submit button should have the name attribute, not the form.
<?php /* Template Name: Submit */ ?>
<?php get_header(); ?>
Form this:
<form action="" method="post">
Name: <input type="text" name="name" />
Comment: <textarea name="comment"></textarea>
<input type="submit" value="Submit" name="form_sub" />
</form>
<?php get_footer(); ?>
| 0.888889 |
Create a thank you page or a confirmation page where the user should go after successful submission
|
What is the exact word used for this unusual "interval" of sorts?
|
I knew this word a long time ago. Then I lost my memory. childhood and all. mva trauma, head injury.. I was good with words before because I was a songwriter, and I had a feeling that this word was etched in my memory somewhere but was just inaccessible.. knowing this word again could solve a lot of consequent problems in writing/overcome writers block to some degree for me.
So here it is: You know how there is an "interval" between say a "train of events"? "Interval" is the best and only word I could think of -closest to this phenomenon- to describe it.
To be a bit more vivid, imagine a train (locomotive) with 10 carriages, and the third and fourth carriage missing above the wheels. So, as the train moves past you, there is a "gap" that transitions through your visual and sound spectrum yes? What is this phenomenon? "Something" (that) passes by you.. It is a very obvious word, but I just can't figure out.. Even after one of you points it out, I might have to give it a memory marker to make it a long term memory- as my short term memory is still not in very good shape (or maybe it's just in the head).
Further, imagine this "gap" or "interval" of sorts streaking past you like a bullet.. What is this phenomenon? :)
|
"Window" captures some of the meaning you're trying to express; in the sense of a gap between solid things, as well as something moving and only available for a certain period of time, as a "launch window."
| 0.777778 |
"Window" captures the meaning you're trying to express
|
Esoteric Programming Languages - Acceptable or Discouraged?
|
In A Nutshell: This is a question regarding the acceptance of asking instances related to esoteric programming languages, such as:
Brain@%#!
Ook!
LOLCODE
Omgrofl
Whitespace
Historical Significance
Proof of (real-world) usage of esoteric languages lies inside the following quote:
The game Lost Kingdom won the First Annual Classic 2k Text Adventure Competition in 2004, and has been (re)written and enhanced by the original author in brain@%#!
Source: The Lost Kingdom Brain@%# Edition
This shows that esoteric programming languages can actually be used to develop real-world applications.
Actual Questions Relating To Esoteric Programming Languages
Practical COW example program?
What good is the NERFIN loop operation in LOLCODE?
brain%!@# greater sign
The Big Cookie
Now for the moment we've all been waiting for...
Are esoteric programming languages acceptable programming questions or discouraged?
|
There would be absolutely no reason to specifically discourage any language or family of languages. If you have questions on any language that would qualify as an esoteric language, feel free to ask them.
Esoteric languages are part of Stack Overflow as every other language, two of them (Python and Ruby1) are even featured in SO's 404 polyglot:
1 If you are a Pythonista or a Rubyist and feel like chopping my head off, just replace that with C and Perl.
| 0.888889 |
Esoteric languages are part of Stack Overflow .
|
Tilde on unix:hpux and / or solaris
|
On Linux press F9 return a correct
~
On unix(solaris or hpux) return
0~
How to set correct tilde on those systems?
|
I don't know what makes you think F9 returning a tilde is "correct", but if you want a tilde, you should use the tilde key.
Function keys are mostly undefined, based on the differences in the client-side hardware you are using, the client-side software you are using, the server-side software you are using, and the server-side hardware you are using.
| 0.666667 |
Function keys are mostly undefined based on the client-side hardware you are using
|
Get MS SQL Server to release disk space
|
A poorly managed database table has grown to be enormous. 48+gigs of orphan records. I am trying to clean it up and put my dangerously full hard drive back to a normal state. I will be deleting approx 400 million records from this table. This is running as I type. I notice that I am not seeing any drop in my hard drive space but I am seeing the memory drop on system table queries, I am running to get table size. The database is using "Simple Recovery Model".
There are many questions similar to this with responses saying you need to shrink the database. But they go on to explain how bad/scary this is to do because of fragmented data etc.
Since the database should not be this size. Is it still bad for me to shrink it?
This is a production database. If I shrink it will it cause downtime or lock the database?
In SQL Server Management Studio you have two options for shrink, database or files. Given my situation what would be the best option?
is there a rule on the percentage of free space a DB should have?
Even reading the tag description of shrink makes me not want to do it. Is there another way?
|
you have good reason to be concerned as DB shrinks in SQL Server often "suck". Paul Randal, the head of the Storage Engine in SQL 2005 stated, ShrinkDB is written very poorly. It will find empty space by taking the data at the very end and put it in the very beginning and keep doing this until it has free space at the 'end' of the DB files. At this point it can then release the space from SQL Server and give it back to the OS. You are effectively reversing your database files thus you will see massive fragmentation usually. You can read about his views on this blog post or on this MCM Internals Video
As with everything, you really must test these in your environment first. A better way of doing it is to move data to a different filegroup. You can do a online index rebuild with the clustered index and then reindex in the new filegroup. Then you can drop the old one and release the space and have almost no fragmentation. Note this will take about 120% extra space while it's working through it. The problem with this is that you need even additional free space which it looks like you might not have. This is an enterprise feature.
If free space is at that much of a premium, then you might have to bite the bullet and slowly shrink the DB a small chunk at a time to avoid long running processes. Note that your data will be heavily fragmented and you will want to reindex everything again. Note that after reindexing everything, you will then balloon up your used space a bit and go back to having additional free space. See Brent's advice here.
As far as how much free space is good for you, is a matter of how much you can afford fragmentation and file growth activities. With IFI enabled, the file growth is almost instant but you still get fragmentation. A good rule of thumb is to preallocate as much as space as you think you'll need, or monitor the growth and adjust in chunks periodically if you have to. This keeps physical fragmentation down.
Also log file growth is a lot more important. Additional log files can cause VLF fragmentation. This makes your restores a lot slower and can affect checkpoint/truncates. Here's some performance risks you take with a fragmented log. Do a DBCC LOGINFO(); on each database. Try to keep the number around 50ish per Kim Tripp, but if you see hundreds, you have fragmentation issues which means your log files had to grow to support operations. A good way to see what your log file should be per Paul Randal is to just let it grow for a week and reindex. That could be a good point, perhaps you can throw a bit more free space on there just in case. Make sure your logs are not fragmented with DBCC LOGINFO(); again and if they are, it means they grew a lot. Shrink and re-expand the log file using this method.
| 1 |
ShrinkDB shrinks in SQL Server often "suck"
|
Left align equation description
|
I have a short description for each of my equations. I want to have them flushleft (similar to the equation numbers which are flushright). How can I do that?
Here is a MWE:
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{equation}
\text{this is my first equation: } z = x
\end{equation}
\begin{equation}
\text{this is my second equation: } z = x+y
\end{equation}
\end{document}
And my desired output is like this:
|
A regular align with some macro-involvement would obtain the desired result:
\documentclass{article}
\usepackage{amsmath}% http://ctan.org/pkg/amsmath
\newcommand{\alignmath}[2]{\makebox[0pt][#1]{$\displaystyle#2$}}
\newcommand{\lmath}[1]{\alignmath{l}{#1}}
\newcommand{\rmath}[1]{\alignmath{r}{#1}}
\newcommand{\cmath}[1]{\alignmath{c}{#1}}
\begin{document}
\begin{align}
& \text{this is my first equation:} & \cmath{z=x} & \\
& \text{this is my second equation:} & \cmath{z=x+y} & \\
& \text{this is my third equation:} & \lmath{z=x+y} & \\
& \text{this is my fourth equation:} & \rmath{z=x+y} & \\
& \text{this is my last equation:} & z &= x+y
\end{align}
\end{document}
\cmath inserts a zero-width box that is centred. The advantage here is that you maintain the align-like vertical spacing.
I've added \lmath and \rmath for completeness, since \makebox allows for left- and right-aligned boxes. Also, the vertical rule indicates the horizontal alignment with respect to the default align - also supported in the above syntax.
| 0.777778 |
makebox allows for left- and right-aligned boxes
|
Translate C code to assembly code?
|
I have to translate this C code to assembly code:
#include <stdio.h>
int main(){
int a, b,c;
scanf("%d",&a);
scanf("%d",&b);
if (a == b){
b++;
}
if (a > b){
c = a;
a = b;
b = c;
}
printf("%d\n",b-a);
return 0;
}
My code is below, and incomplete.
rdint %eax # reading a
rdint %ebx # reading b
irmovl $1, %edi
subl %eax,%ebx
addl %ebx, %edi
je Equal
irmov1 %eax, %efx #flagged as invalid line
irmov1 %ebx, %egx
irmov1 %ecx, %ehx
irmovl $0, %eax
irmovl $0, %ebx
irmovl $0, %ecx
addl %eax, %efx #flagged as invalid line
addl %ebx, %egx
addl %ecx, %ehx
halt
Basically I think it is mostly done, but I have commented next to two lines flagged as invalid when I try to run it, but I'm not sure why they are invalid. I'm also not sure how to do an if statment for a > b. I could use any suggestions from people who know about y86 assembly language.
|
Jens,
First, Y86 does not have any efx, egx, and ehx registers, which is why you are getting the invalid lines when you pour the code through YAS.
Second, you make conditional branches by subtracting two registers using the subl instruction and jumping on the condition code set by the Y86 ALU by ways of the jxx instructions.
Check my blog at http://y86tutoring.wordpress.com for details.
| 0.888889 |
Y86 does not have any efx, egx, and ehx registers
|
Custom stackoverflow settings
|
Is it possible to be able to set some default settings, such as the display format of dates of posts? (For example, I would much rather see 2011-13-01 than the current jan 13 '11)
In addition to an alternative datetime format one could also think of some other settings, perhaps some color blind settings, light/dark-theme or some other stuff I'm sure some clever people here can think of.
|
No, please do not overcomplicate things with endless little settings to suit each and every user.
You can style and tweak Stack Overflow endlessly in your own browser.
There are Stylish plugins for Firefox, Chrome, Safari and Opera, with several Stack Overflow themes to choose from already. It is easy to create your own styles.
For altering behaviour, you can add Greasemonkey to Firefox and Opera or NinjaKit to Safari; Chrome supports most such scripts out-of-the-box. Then head over to UserScripts.org to find yourself Stack Overflow tweaks.
Many of these styles and scripts are also (or only) featured on StackApps.com, the Stack Exchange Q&A site for the SE API, SE applications and scripts.
| 0.888889 |
Style and tweak Stack Overflow in your own browser
|
Tikz: Text along top and bottom of arrow path
|
How can I add text to both the top and bottom of a path? My commutative diagram below is 90% complete. I would, however, like text={${gKer({\varphi}){\mapsto}{\varphi(G)}}$} following the path below the arrow and \cong following the path above the same arrow.
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{positioning}
\usetikzlibrary{decorations.text}
\usetikzlibrary{decorations.pathmorphing}
\begin{document}
\begin{tikzpicture}
\node (A) {$G$};
\node (B) [right of=A] {$G'$};
\node (C) [below of=A] {$G/Ker(\varphi)$};
\draw[->>] (A) --(B) node[above,midway] {$\varphi$};
\draw[->,postaction={decorate,decoration={text along path,text align=center,text={${\pi}{\;}$}}}] (A) to node[swap] {} (C);
\draw[->,postaction={decorate,decoration={text along path,text align = center,text={${gKer({\varphi}){\mapsto}{\varphi(G)}}$}}}] (C) to node[swap] {} (B);
\end{tikzpicture}
\end{document}
|
I would suggest you tu use the tikz-cd package for your commutative diagrams; also, since the problematic label is not really the name of a map, but rather its action, I would also suggest you to describe the map outside the diagram (otherwise, the diagram might result too crowded):
\documentclass{article}
\usepackage{amsmath}
\usepackage{tikz-cd}
\DeclareMathOperator{\Ker}{Ker}
\begin{document}
\[
\begin{tikzcd}
G\arrow[twoheadrightarrow]{r}{\varphi}\arrow{d}{\pi} & G' \\
G/\Ker(\varphi)\arrow[sloped,swap]{ur}[near start]{\tau}[swap]{\cong}
\end{tikzcd}
\]
where $\tau:G/\Ker(\varphi)\rightarrow G'$ is defined by $g\Ker({\varphi}){\mapsto}{\varphi(G)}$.
\end{document}
Of course, you can draw the diagram with the originally requested labels, perhaps increasing the distance between nodes:
\documentclass{article}
\usepackage{amsmath}
\usepackage{tikz-cd}
\DeclareMathOperator{\Ker}{Ker}
\begin{document}
\[
\begin{tikzcd}[row sep=60pt,column sep=huge]
G\arrow[twoheadrightarrow]{r}{\varphi}\arrow{d}{\pi} & G' \\
G/\Ker(\varphi)\arrow[sloped,swap]{ur}[pos=0.15]{g\Ker({\varphi}){\mapsto}{\varphi(G)}}[swap]{\cong}
\end{tikzcd}
\]
\end{document}
Notice the use of
\DeclareMathOperator{\Ker}{Ker}
(requires the amsmath package) to produce the correct shape for the Ker operator; (I initially overlooked this, but Ethan Bolker signaled it out in a comment).
| 1 |
tu use tikz-cd package for commutative diagrams
|
Can my protected tweet be seen by the recipient who doesn't follow me?
|
So the description for protected tweets are:
Only confirmed followers have access to @foo's Tweets and complete profile. Click the "Follow" button to send a follow request.
But what if I tweet to a user who doesn't follow me, will he/she be able to see my tweet?
Hey, @userwhodoesnotfollowme can you see this tweet?
|
No, they will not be able to see the tweet.
| 0.888889 |
No, they will not be able to see the tweet.
|
Purification of Ethanol
|
In Vogel's organic book, they have mentioned that in the Lund and Bjerrum method of purification of ethanol, magnesium is added, which forms ethanolate. But they said to activate the magnesium first by iodine.
Why is the activation needed and how exactly does this activation process work in the activation of magnesium?
|
The refluxing of methanol or ethanol over magnesium is indeed the method of choice to dry these solvents.
As far as the iodine is concerned, this is a classical trick, which is also used to initiate Grignard rections. Is is assumed that magnesium iodide is formed, which is soluble in the alkanols. As a result, a fresh, activated metal surface is left behind.
This might even work, when the magnesium metal is covered with a very thin oxide layer.
| 0.777778 |
The refluxing of methanol over magnesium is the method of choice to dry solvents
|
Linux: limits.conf values are not honored
|
I set some values in /etc/security/limits.conf as below:
* hard stack 204800
* hard nofile 8192
Then rebooted the server. Also I have removed the file /etc/security/limits.d/90-nproc.conf
However, the ulimit command still lists some old/default values:
# ulimit -s
10240
# ulimit -n
1024
I running RHEL 6.2 64-bit
What is wrong here? Is my syntax in limits.conf wrong? Why after server reboot it does not honor limits.conf values?
BTW, I had posted this question earlier on superuser but failed to get the hits, so trying my luck on serverfault.
|
limmits are loaded upon logon. change
/etc/security/limits.conf
...... logout and log back in.
| 1 |
Change /etc/security/limits.conf
|
Mobile 3D engine renders alpha as full-object transparency
|
I am running a iOS project using the isgl3d framework for showing pod files.
I have a stylish car with 0.5 alpha windows, that I wish to render on a camera background, seeking some augmented reality goodness.
The alpha on the windows looks okay, but when I add the object, I notice that it renders the entire object transparently, where the windows are. Including interior of the car.
Like so (in example, keyboard can be seen through the dashboard, seats and so on. should be solid)
The car interior is a seperate object with alpha 1.0.
I would rather not show a "ghost car" in my project, but I haven't found a way around this.
Have anyone encountered the same issue, and eventually reached a solution ?
|
(No experience with 3D programming on iOS, but this should work on regular OpenGL devices.)
I can think of 2 options that might fix this.
Try separating the model in 2 parts, first render the opaque part and then render the transparent part.
Another option might be to disable alpha writing when rendering the object.
What I think is happening is that when the window is rendered the alpha value is simply written to the color buffer. When then rendering the color buffer over the camera image the windows are alpha blended with the image behind it, causing ghost cars.
| 0.888889 |
2 options to disable alpha writing when rendering the object
|
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.
|
You cannot, because you never will. There is always more to understand about any given topic.
| 1 |
There is always more to understand about any given topic
|
Who to involve when making user tasks/scenarios for a usability test?
|
I am conducting my first usability test in our in-house testlab. I have asked my team (and the rest of the company) for hypotheses and aches regarding the service we are goint to test. Based on these (and pther things as well) I have made some tasks.
My question is: Who should I invite to comment or review the tasks?
I am thinking that the product owner should definitely look at them/have a say – and of course my UX colleagues. But what about the rest of the team (developers and testers)?
|
The most important types of people to bring in are those who know the research for your end user very well, preferably people who can remain unbiased about the product and focus more on the user needs. It is good to let the some of the stakeholders know what you are doing and provide some feedback, but be careful not to give them too much control; stakeholders are attached to the product and are more likely to accidentally bias the testing process to achieve the results they are looking for.
The biggest piece of advice I would recommend that you should limit the amount of people who have a say in the process because of one common issue: the more people you have involved, the more subjective your research is likely to become. Each department has their own objectives which can quickly muddle what should be an unbiased UX process. If your research has been done well (which I'm sure it has) all you should need it some quick fact checking from no more than 3-5 people total.
| 1 |
The more people you have involved, the more subjective your research is likely to become
|
How does arbitary code execution work?
|
I'm unable to understand how arbitrary code execution vulnerabilities are supposed to work.
Wikipedia mentions:
Arbitrary code execution is commonly achieved through control over the instruction pointer of a running process.
Say, the vulnerability is being triggered by some maliciously crafted file that said process is reading. How could it modify the instruction pointer, or, otherwise, corrupt the internal state of the application so as to cause it to execute the attacker's code?
Also, given that modern OSes implement DEP and ASLR, how is this even feasible? The data loaded from the application would not even be executable, and additionally, it's also difficult to determine the offset of the shellcode/payload.
Brownie points for showing a small snippet of code that would be vulnerable to such an exploit.
|
Each vulnerability has a specific cause, which in turn leads to ways of exploiting the vulnerability. It is hard to understand how one can exploit something abstract and gain some abstract results, but it is way easier to understand when illustrated with examples. The simplest would be the classical stack-based buffer overflow:
void f(const char *str) {
char buf[10];
strcpy(buf, str);
}
This is a primitive example that should be sufficient to demonstrate the issue. Suppose the str argument points to a NULL-terminated string longer than the 10 chars allocated for the variable it is being copied into. What will happen? strcpy() will blindly copy the date over the end of the buffer, overwriting whatever was there. But what exactly is there?
On x86, for example, the buf variable would be allocated on the stack. The stack is also used to save the return address when a CALL instruction is executed. So (simplified) stack layout would look like this (addresses are increasing top to bottom):
...
buf[0..3]
buf[4..7]
buf[8..9]
return address
...
So, by supplying an overly long string via the str argument, we would be able to overwrite the return address from f(). If the attacker is able to control the string, then he can control where the control flow will go after f() returns. This may occur when parsing a specially crafted file, for example.
The next thing would be to direct the control to a JMP ESP instruction or similar in effect, causing code from the stack to be executed. This "direct" code execution is prevented by DEP.
Of course, the example above doesn't include bypassing any of modern mitigations (stack canaries, SafeSEH, DEP). This does not mean it is globally impossible, but it may be impossible in certain cases. Bypassing DEP usually involves Return-oriented programming -- instead of code itself, specially crafted data is placed on the stack, which utilises fragments of already existing functions in the process image (called gadgets) to execute code. This, in turn, is mitigated by ASLR, making the gadget addresses somewhat unpredictable. There are techniques of bypassing ASLR as well.
If you would like to get your hands on exploiting real-life programs, I would suggest corelanc0d3r's tutorials as a starting point.
EDIT: Replaced the offending part.
| 1 |
How to exploit a stack-based buffer?
|
Are low commission trading sites safe?
|
There are sites such as OptionsHouse and TradeKing which offer trades for as low as $4. This is less than half of what's offered from the big brands.
Are there any catches or things I should know about before using such sites? Are their brokers equally effective?
|
I have used TradeKing for a couple of years now and love it. It really is a great site. They hold an IRA trading account for me and have been helpful in rolling money into that account, and with answering the occasional question.
Previously I have used Scottrade and found that TradeKing is a much better value.
| 1 |
TradeKing is a great site for IRA trading
|
3D array multiplication
|
I have arrays A and B both of dimension MxNxH.
I would like to define a binary operator, to "multiply", such that the result is MxN dimensions.
The equivalent operation would be:
C = A[:,:,0] * B[:,:,0] + A[:,:,1] * B[:,:,1] + .... + A[:,:,H] * B[:,:,H]
Is there a way to do this operation in a more efficient way?
For example, using a built in function in numpy?
I have tried tensordot, but this gives a different result.
|
try this: numpy.sum( A*B, axis=2 )
this is similar to the other suggestion but perhaps clearer (axes are numbered from 0, so axis=2 is the 3rd axis or H out of MxNxH)
| 1 |
Numpy.sum( A*B, axis=2)
|
Could Belief in Little Fears: Nightmare Edition cause the dark side of the moon to really be dark?
|
I'm writing an episode which involves a plot by the monster Vanish involving possessing the dark side of the moon (if you don't know, his power is to possess shadows). I was going with the fact that the term "the dark side of the moon" would cause enough children to believe that it really was dark for Belief to make it so, but I'm not entirely sure that Belief works that way. Does it?
|
Yes it totally can! Believe is the immense magic force, which spawned the whole dimension called Closetland into existence!
So the far side of the moon could really be a dark place, where the sun never reached - although adults would not see it as such, or would find a scientific explanation!
| 0.888889 |
Believe is the immense magic force, which spawned Closetland into existence!
|
How many times do the two given curves intersect at the origin?
|
I'm reading/studying on my own a book about algebraic curves.
I'm trying to find a way for Mathematica help me with the following (the book, ISBN: 038731802X, allows me to use any CAS / program.
Here is a question:
How many times do the two given curves intersect at the origin?
$\quad(a)\quad y = x^3$
which I can rewrite as $y-x^3 = 0$
$\quad(b)\quad y^4 + 6x^3*y + x^8 == 0 $
I can view both curves using:
ContourPlot[{y^4 + 6 x^3*y + x^8 == 0, y - x^3 == 0}, {x, -5, 5}, {y, -5, 5}]
However, I have no idea how to find the the multiplicity of the zeros at the origin. I'm really stuck.
|
General approach
If {x0, y0} is a root of a polynomial system {p1, p2} such that there is no other root of the form {x0, y1}, the multiplicity is given by the multiplicity of the zero x0 of the resultant
Resultant[p1, p2, y]
We can compute the multiplicity of this zero with
SparseArray[
CoefficientList[Resultant[p1, p2, y] /. x -> x0 + u, u]
]["NonzeroPositions"][[1, 1]] - 1
If a root {x0, y0} lines up with another root {x0, y1}, a linear transformation of the variables can always be found so that moves all the other roots off the line x = x0. So in principle, this method can be applied to any system.
OP's example
In the OP's case, the command can be simplified a little since x0 == 0:
SparseArray[
CoefficientList[Resultant[y^4 + 6 x^3*y + x^8, y^2 - x^3, y], x]
]["NonzeroPositions"][[1, 1]] - 1
(*
6
*)
Comparison
I assume the OP wants a method, not just the answer. (The OP's is simple enough to do, plug in x^3 for y, in one's head after all.) We compare the NSolve method and @belisarius's Solve method with the Resultant method.
My original method was to use NSolve, which seems to work although the docs do not promise that it will, like this if we add Count as @belisarius did:
Count[NSolve[{p1 == 0, p2 == 0}, {x, y}], {x -> 0.`, y -> 0.`}]
Generalizing @belisarius's answer, I would get something like
Count[Solve[p1 == 0 /. #, x, Reals] & /@ Solve[p2 == 0, y] // Flatten, x -> 0]
which indeed yields 6 on the OP's example.
A more difficult example
Now let's consider the system with y^2 replacing y in the second polynomial:
p = {y^4 + 6 x^3*y + x^8, y^2 - x^3};
The two solve-based methods give different answers:
Count[NSolve[p == {0, 0}, {x, y}], {x -> 0.`, y -> 0.`}]
(* 9 *)
Count[Solve[p[[1]] == 0 /. #, x, Reals] & /@ Solve[p[[2]] == 0, y] // Flatten, x -> 0]
(* 10 *)
One solution gets counted twice in the Solve method, I guess, because the Resultant method yields
SparseArray[CoefficientList[Resultant[p[[1]], p[[2]], y], x]]["NonzeroPositions"][[1, 1]] - 1
(* 9 *)
Failure on repeated x0 - and the workaround
If we add some factors to the OP's system so that {x, y} = {0, 1} is a root, all the current solutions fail to yield 6:
p = {(y^4 + 6 x^3*y + x^8) (x^2 + (y - 1)^2), (y - x^3) (y - 1)};
Count[NSolve[p == {0, 0}, {x, y}], {x -> 0.`, y -> 0.`}]
(* 3 *)
Count[Solve[p[[1]] == 0 /. #, x, Reals] & /@ Solve[p[[2]] == 0, y] //
Flatten, x -> 0]
(* 8 *)
SparseArray[CoefficientList[Resultant[p[[1]], p[[2]], y], x]]["NonzeroPositions"][[1, 1]] - 1
(* 8 *)
Edit: Actually NSolve gets close, literally. Numerical error leads to three of the roots being slightly off:
Count[Chop[NSolve[p == {0, 0}, {x, y}], 10^-50], {x -> 0, y -> 0}]
(* 6 *)
One can also use the Resultant method by transforming the coordinates so that the root {0, 1} is moved off the line x = 0:
With[{p = p /. {x -> x + y, y -> y}},
SparseArray[CoefficientList[Resultant[p[[1]], p[[2]], y], x]]["NonzeroPositions"][[1, 1]] - 1]
(* 6 *)
Simply switching x and y also works in this case.
Orginal answer -- NSolve gives the correct multiplicity in V10
NSolve will return the multiplicity, which turns out to be 6 in this case:
NSolve[{y^4 + 6 x^3*y + x^8 == 0, y - x^3 == 0}, {x, y}, Reals]
(*
{{x -> 0., y -> 0.}, {x -> 0., y -> 0.}, {x -> 0., y -> 0.},
{x -> 0., y -> 0.}, {x -> 0., y -> 0.}, {x -> 0., y -> 0.}}
*)
(I included a solution using Eliminate but it's not worth the space it would take up.)
| 1 |
NSolve is a root of a polynomial system
|
Should I leave the fan switch on my thermostat set to fan rather than auto?
|
I purchased a new Amanda Furnace in Oct'2013. I am told in order to maximize a warm, consistent room temperature I should set the thermostat to the Fan position rather than the Auto position. Does this make a difference in maintaining room temperature and is it more costly?
|
While it is impossible to give you a quantitative answer without knowing more details about your house and system (e.g. how they set the fan speed in each setting) in my opinion it is better to have the system on Fan setting.
What it does is running the blower motor even when heat/AC is not actively heating cooling. While running the fan does consume electricity, you end up with a more uniform air throughout the house.
| 1 |
How to set the fan speed in each setting?
|
When to use tools vs custom development?
|
To learn dependency injection in a current side-project, I am writing my own dependency injection container.
But this has lead me to wonder, at what point is it worthwhile to use a third party product vs "roll my own"? What would be the kind of questions you would ask to figure this out?
|
The "buy vs build" decision comes down to a number of factors. Can you maintain the tool that you are buying (even if it's open-source)? Is there adequate support for it, if you run into a problem? Do you have the resources to build it yourself, and are you smart enough to generalize it so it can be reused in a variety of scenarios? And so on.
Regarding dependency injection: DI containers are not needed for most applications. Unless your application is a large, enterprise-type application, you don't need a DI container, and if you do need one, there are a number of containers already available that would serve the purpose well.
Smaller applications benefit more from a simpler form of DI, like injecting your dependencies directly through the constructor methods of your objects. You would only use a DI container if you needed to provide a central place to manage your dependencies in, say, an XML file describing them.
In the vaguest of terms, there is a "rule of three." If you find yourself doing the same thing three times in a software application, you either refactor it into its own tool or method, or find an off-the-shelf tool that replaces those three things with one generalized thing. Knowing when to do this comes with experience.
| 0.888889 |
Is there adequate support for the tool that you are buying?
|
Setting up a food pantry/orphanage?
|
I can't find much on how to set up any kind of establishments that are for charity. HOw would I go about this? Acquiring a building, a few volunteers, how much to run it per day, ect? Anyone have any experience in this? My character is a NG Druid, who had never been to a city and saw the poverty and lack of food and housing for people. He wants to help! But I have no idea on how to establish a continual act of help. Buying food for the town and stuff, one time is easy to figure out. How many people * ammount of food needed is the price. But for bigger acts of continual charity, who knows?
EDIT:
So, it was suggested that I make an eco orphanage in a forest. I accidently doomed the continent with demons, so that won't work. (Wish spell to get rid of orcs, things went horribly wrong) NO one knows it was me though! :D
I don't want the leadership feat cause I need my 6th level feat for a prestige class.
Also, I don't want to donate to the churches in this city, I'm finding a lot of corruption in some of these churches, especially this city, so I want something more controllable by me.
|
There isn't anything in the core rules about building ownership, but you (or your DM) can fake it in a good-enough way (at least, so long as nobody tries to break the game using such a ruling) by estimating off the equipment tables. You need three things: cost for building maintenance (or rent), cost for food, and (if not renting) initial price of the building.
In the equipment chapter under Food, Drink, And Lodging, a poor meal costs 1sp. I'm picking "poor" because no matter how much you have, you want to stretch it as far as you can to feed as many, right? So go with "poor". That price is assuming making a profit, so let's be conservative (on the "more expensive for you" side) and cut it in half: 5cp to feed an orphan. Maybe shave that down to 3cp, since they're kids and not grown adults eating at a poor inn. (This is really back-of-the-envelope stuff, not rigorous at all.)
We can do something similar for the rent/maintenance of the building: a night's stay in a poor inn is listed as 2sp. Let's cut it in half to 1sp to eliminate the profit normally involved. Since a normal poor inn can maintain the whole building on 2sp per room per night, we can be pretty sure that the 1sp per orphan per night will cover (sans profits) whatever costs are involved in paying rent or taxes, repairs, replacing bedding, laundering, upkeep of the non-sleeping quarters and so on.
Somewhere, between the price for meals and the price for rooms, a combined inn/tavern also pays for their kitchen, so we're probably safely in the black with our estimates. You probably don't need to maintain a stable like a normal inn, and you're not paying for the volunteer labour, so that makes the estimate even more likely to at least meet or exceed the costs of rooms and food.
Altogether, that makes it 1sp, 3cp to feed and house a single orphan per day, assuming one good meal every day (which is not far off the unfortunate reality of old orphanages). If you want to have them slightly healthier, but be able to take in fewer, make it two meals per day and double the meals costs to 6cp, for 1.6sp per orphan per day.
So, very roughly, you see how you can use the goods and services lists in the core book to get a gameable estimate of the costs per orphan per day. From there you can look at what money you've got stashed and what your incoming donations are, and estimate how many orphans you can house and feed at once on an ongoing basis.
As for the initial cost of acquiring the building, that the core rules don't provide anything even close to helpful for estimating. You don't have to worry about this if you find a willing landlord, but if you have to buy the building outright, this becomes a slightly sticky issue. If I was running this game I'd probably just play it out, maybe angling for the druid to find a donor with a vacant building. At worst I'd just name a price in gold and get on with it, while making sure that the players know that the price is particular to this building from this seller, and they shouldn't expect it to set a precedent. Maybe, like 100gp or something.
| 0.888889 |
Cost of building maintenance, rent, food, and rent in a poor inn?
|
What exactly is computation?
|
I know what computation is in some vague sense (it is the thing computers do), but I would like a more rigorous definition.
Dictionary.com's definitions of computation, computing, calculate, and compute are circular, so it doesn't help.
Wikipedia defines computation to be "any type of calculation that follows a well-defined model."
It defines calculation as "the deliberate process that transforms one or more inputs into one or more results, with variable change." But it seems this definition includes many actions as computations even though they aren't typically thought of as computation.
For example, wouldn't this entail that, say, a bomb exploding is a computation, with the input being the fuse being lighted and the output being the explosion?
So, what exactly is computation?
|
Perhaps the problem here is looking a for a highly specific definition of a very general concept. I don't see the problem of viewing virtually everything as a computation. Although we don't think about it, everything we do is expressible in terms of the Physics of the component parts, down to at least quarks buzzing about. We have the same situation with computation. There's inputs, outputs and a process (all of which could be trivial). Whether they're interesting or useful as computations or models of computation is a very different question.
The strongest working definition we have comes via the (strong) Church-Turing Thesis, which states that every possible physically realizable model of computation is no more powerful than a Turing Machine. If you believe that this is true, then although we may have lots of way to express things, ultimately we can reduce every computation to a Turing Machine, hence giving a definition of computation as "anything we can reduce to a Turing Machine".
In this model, the exploding bomb is a computation. It's not a widely applicable one (we hope ;) ), but we can model in some fashion with a Turing Machine (though there is an argument here about the nature of the output and the equivalence with the TM's output). It's also not a good model of computation in general, in that it seems unlikely that the exploding bomb model is Turing complete.
| 1 |
What's the difference between computation and a Turing Machine?
|
Is research a viable business model?
|
I have had the suspicion that it may be for a while and apparently not all is a product of my mind. Let me quote from an answer:
In my experience, in UK and other European countries, the research
funding comes from successful proposals to the relevant funding
bodies. There are research centres that were established and keep
going only because the staff there constantly submits project
proposals (somebody told me that the success rate is 1 out of 5 or
maybe even lower).
There are two questions here.
Can a company feasibly focus on obtaining funds in publicly funded research (as a business model) successfully enough to "survive"?
Can such a company be started (nearly) from scratch?
In short, the company would be exactly like a research institute (or institution) except that it would be private.
Reasons why question 1 may not be feasible:
I don't see any company doing this kind of thing, i.e. there may be some, but there are not many, which means that it may be hard. It's a bad sign.
Public funds seem to be assigned to public entities, while companies can benefit from the collaboration and synergy, but they are expected to get their funding from their work as companies (searching for customers, etc.) In this case the customers would be the partners in the projects and the society itself, but again, this seems to be an "innovative" (maybe naïve, or even plain stupid) idea.
Research is a means for something, not an end on itself, that's why the business model should be on something else (point two) and that's why such a company would raise eyebrows on the mere idea of its existence. It may even be against some kind of tacit rule or even written laws.
Reasons why question 2 may not be feasible:
No previous history of success of the company, or products or anything means zero (or negative) trustworthiness and no projects assigned to the company.
No partners would like to associate with the company in a project for the reasons in point 1.
The most similar case I can think of are spin-off companies that are created from successful research labs, not from scratch.
OMG so much communism! Go to kickstarter you hippie!
As an example, a possible scenario that could be close to this: Someone writes a paper about a software system that does something not very novel in the state of the art but in a way that is very different from an architectural point of view, leading to good results in practical terms. In short: in theory nothing is new, in practice what was just a dream is now a reality. What is done remains the same in theory, but how it is done is completely different in practice (and now it works). Unfortunately only a proof of concept (PoC) can reasonably be implemented.
Would it be feasible to request funds to continue the development of this PoC (still very far from a commercial product) as a start-up or that simply doesn't make sense?
|
In Europe, companies exist that primarily live from FP7 or, now, H2020 funding. They rarely contribute much to projects in terms of research, but often handle tangential issues, such as project management, dissemination, marketing, or association with standardization bodies. Their model works because (1) they do things that none of the research partners actually wants to do, and (2) because they are often SMEs, which is generally politically helpful to get your funding proposals accepted. Further, as writing grant proposals is their core business, they usually also have grant writing experts that have the time to actually keep up with the various changes that the european commission is constantly applying to its programmes and rules (something that many researchers struggle to find the time for).
Formally, these companies often camouflage as either consultancies or technology spinoffs. That is, you will not find it on their web page that their core business model is actually to milk grant programmes, as this is strictly against official funding rules (as a company, you can only apply for funding if you plan to commercialise the results, and you are not supposed to make a profit from the project itself). In practice, the project officers seem to tolerate these businesses - for now.
Can such a company be started (nearly) from scratch?
You will need a reasonable amount of seed money, as the H2020 rules require proof that an organization applying for grants has enough financial stability to likely survive over the typically 3-year project duration. I know from one startup that wanted to participate in a project (for actual technology reasons) which was in fact struggling to cross this hurdle. However, if you have the required seed funding, I see no reason why you would not be able to start such a business. Whether it is a smart business idea is a different question, given that you are basically living off of a loophole in the current funding practices, and you can never tell how long this loophole will stay open.
Edit:
I just saw that I missed this question:
Would it be feasible to request funds to continue the development of this PoC (still very far from a commercial product) as a start-up or that simply doesn't make sense?
Yes, at least in Europe there are funding sources for exactly this kind of case. You should inform yourself about the concept of Technology Readiness Levels (TRLs, slide 4), and the different kinds of funding available for each TRL. If you look at this presentation and go to slide 32, there is an overview over different funding instruments in H2020 depending on the maturity of the idea.
| 0.777778 |
Can a company be started (nearly) from scratch?
|
How can I tell when music is live and not recorded?
|
I was walking past a bar the other day and heard music coming out. I could immediately tell that the music was live, being played in the bar at that moment. This is something I have often noticed, I can tell whether music is recorded or being played live.
This seems to extend to recordings of live music as well. I have often found myself identifying that the musical background of, for example, a youtube video was being played at the time and was recorded using the same microphone that recorded the ambient sound of the video.
First of all, I assume that I am not alone and that any musician or music lover can also make this distinction. So, why can we do this? What is it that allows us to recognize live performances? I assume it has something to do with the way they are recorded (or not as the case may be) and that a good sound engineer would be able to fix things so that I couldn't tell but what does it depend on?
|
Recorded music has the acoustics of two rooms. Strongly amplified live music actually tends to have a lot more problems than studio music because you have the mics also picking up the PA and the environment and the sound intended for other mics. Of course, that does not hold for electric guitars and other instruments amplified without microphones.
Unplugged music is rather direct and clear. Recorded music only picks up the sound at a number of defined points and gets mixed to two channels usually. A lot of spatial information gets lost in that way.
That's one reason that Hammond organs have been semi-popular: the rotating Leslie speakers used with them create a great spacy sound in concert, but the effect is practically not recordable in a manner reproducing its character well. Neither for replay of recordings, nor for remitting over a big powerful PA.
| 1 |
Recorded music has the acoustics of two rooms
|
Existing proofs of Rokhlin's theorem for PL manifolds
|
I'm looking for a comprehensive reference to existing proofs of Rokhlin's theorem that a 4-dimensional closed spin PL manifold has signature divisible by 16.
I'm specifically interested in direct proofs (if any such exist) which do not rely on the fact that $\pi_i(PL/O)=0$ for small $i$.
The most commonly cited reference seems to be the book by Kirby "The Topology of 4-manifolds". But the proof there is for smooth manifolds and I'm not sure why it works for PL manifolds although I've seen it claimed in various places that it does. The same is said about Rokhlin's original proof but I don't know why that's true either. I would also like to know if other proofs for PL manifolds exist. I'm particularly interested to know if there is a PL proof based on the Atiyah-Singer index theorem.
|
Another approach to the theorem that could probably be rewritten to work in the PL category is the approach of Kirby and Melvin in Appendix C of the following paper:
MR1117149 (92e:57011)
Kirby, Robion(1-CA); Melvin, Paul(1-BRYN)
The 3-manifold invariants of Witten and Reshetikhin-Turaev for sl(2,C).
Invent. Math. 105 (1991), no. 3, 473–545.
See Corollary C6.
The idea of this approach is as follows. There is a famous $\mathbb{Z}/2$-invariant of homology $3$-spheres called the Rokhlin invariant. The usual definition of this invariant is as follows. Letting $M^3$ be a homology $3$-sphere, there exists a compact spin $4$-manifold $W^4$ with $\partial W^4 = M^3$. Let $\sigma$ be the signature of $W^4$. Rokhlin's theorem implies that modulo $16$, the value of $\sigma$ is independent of $W^4$. Since $\sigma$ is divisible by $8$ for number-theoretic reasons (namely, van der Blij's lemma about quadratic forms), the value of $\sigma/8$ is well-defined modulo $2$.
Using the Kirby calculus, Kirby and Melvin give a $3$-dimensional'' construction of the Rokhlin invariant, avoiding all mention of $4$-manifolds. They then go backwards and use this to prove Rokhlin's theorem about $4$-manifolds.
Looking at their proof, Kirby and Melvin use smoothness in two ways. The first is to prove that the Rokhlin invariant is well-defined. But this is harmless since (by work of Moise) all PL $3$-manifolds can be smoothed in a unique way. The second use of smoothness is to obtain a handlebody decomposition of the $4$-manifold. But this should be easier in the PL category!
| 0.666667 |
Kirby and Melvin use smoothness in two ways
|
Facing Problems While Installing Java
|
First When I downloaded java from official website I got confused how to install it.
Then I searched it on software center and I found it. But when I install it, it starts but instantly stops and the line highlighting the installation status in progress tab doesn't move forward. Then I searched on the internet and tried installing it by terminal, but the terminal said that I first have to configure something that I dont know. It tells me to run this sudo dpkg-configure -a and when I run this command the terminal process stops in the middle and even after leaving it for about an hour it doesn't proceed. After that when I want to close the terminal, it says that the terminal is in hte middle of a process, and closing it would interrupt it.
So I am greatly confused because even other software, like gimp image editor, are not getting installed.
Can anyone help me? Thanks in advance.
|
If the process freezes in Ubuntu Software Center or in terminal, you should kill the process manually from terminal by typing killall dpkg, if you don't kill the process it wont let you install anything, neither from software center nor from terminal.
| 1 |
If the process freezes in Ubuntu Software Center or in terminal, you should kill it manually by typing killall dpkg
|
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.
|
The whole iconoclastic controversy has raged for thousands of years. In a nutshell, iconoclasts are taking your position, whereas iconodules maintain the position that what Christians do is venerate not worship these images. Muslims obviously are strict iconoclasts, and thus reject any depiction whatsoever.
Over the centuries, Christian thought has alternated on what artistic representations are. When Cromwell took Power in the 1650s, for example, they went all Iconoclast and started smashing all the icons they could find, not altogether unlike the rebels in Mali or the Taliban in Afghanistan who blew up the Bamuyan Buddhas.
The Seventh Ecumenical Council in particular weighed in on this, however, declaring that representations of Christ do not infringe on the person of Christ and are thus not idols. Unlike Hinduism where there is a spectrum of attitude towards what one is doing with, say, a lingam, there is official ruling, accepted by "all" of the worlds Christians (at least by Catholics, Protestants and orthodox ) that declares this is veneration and not Latreia.
St. John of Damascus says:
Concerning the charge of idolatry: Icons are not idols but symbols, therefore when an Orthodox venerates an icon, he is not guilty of idolatry. He is not worshipping the symbol, but merely venerating it. Such veneration is not directed toward wood, or paint or stone, but towards the person depicted. Therefore relative honor is shown to material objects, but worship is due to God alone.
We do not make obeisance to the nature of wood, but we revere and do obeisance to Him who was crucified on the Cross... When the two beams of the Cross are joined together I adore the figure because of Christ who was crucified on the Cross, but if the beams are separated, I throw them away and burn them.
Does actual practice sometimes get this wrong? Sure. The nature of syncretism is such that in some cultures, practices bleed across beliefs. Offering incense, devotion, and performing rites that look like idol. Worship is not surprising in a culture where the majority pursues it. Doesn't mean it's orthodox in any event.
One could look at the perversion of Jihad and say, "Muslims are all suicide bombers, " too- but many don't because we can distinguish between orthodoxic pronouncement and individual (mis)practice. You would do well to consider the same.
| 1 |
Icons are not idols, but symbols, and therefore worship is due to God alone .
|
Replacing one character of a string in python
|
In python, are strings mutable? The line someString[3] = "a" throws the error
TypeError: 'str' object does not
support item assignment
I can see why (as I could have written someString[3] = "test" and that would obviously be illegal) but is there a method to do this in python?
|
In new enough pythons you can also use the builtin bytearray type, which is mutable. See the stdlib documentation. But "new enough" here means 2.6 or up, so that's not necessarily an option.
In older pythons you have to create a fresh str as mentioned above, since those are immutable. That's usually the most readable approach, but sometimes using a different kind of mutable sequence (like a list of characters, or possibly an array.array) makes sense. array.array is a bit clunky though, and usually avoided.
| 0.888889 |
In new enough pythons you can also use the builtin bytearray type .
|
Why does string theory have such a huge landscape?
|
I was browsing through Foundations of Space and Time, a compilation of essays on various theories of quantum gravity. The following passage in the introduction intrigued me:
Each compactification leads to a different vacuum state.... at least one state should describe our Universe in its entirety.... the enormous number (~10^500 at last count) of solutions, with no perturbative mechanism to select mechanism to select among them, leads some critics to question the predictive power of the theory..Even more worrying is that, while the theory is perturbatively finite order by order, the perturbation series does not seem to converge.
I don't know anything about string theory and so I could not make head or tails this. All I know is that ~$10^{500}$ is a very large number.
What exactly is a 'solution' in string theory? Is it a spacetime metric of some sort or the terms of a S-matrix of some sort?
Why are there so many 'solutions'?
I thought string theory was supposed to be finite, why do perturbative series still diverge?
Is there any experimental technique to limit the number of 'solutions'?
Will experimental techniques be able to pinpoint a solution within present day string theorists' lifetimes too? If not, how long will it take before we can experimentally probe these things?
Are string theorists completely relaxed about these issues? Or are they in anguish?
|
Who wrote that passage? It contains some misunderstandings.
All I know is that $10^{500}$ is a very large number.
It is a finite number. How many theories do you know which have a finite number of solutions? Have you tried to count the number of solutions of plain Einstein-Yang-Mills-Dirac-Higgs theory without its string-theoretic UV completion? There are not only infinitely-many solutions, there is a hugely infinite-dimensional space of solutions. This is the usual state of affairs for most every theory of physics ever considered. String theory is special in that it puts many more constraints on the solutions, such as to even leave just a finite number (under some assumptions).
What exactly is a 'solution' in string theory?
A background for perturbative string theory is a choice of 2-dimensional superconformal QFT of central charge -15. This can be interpreted as describing an effective target space geometry which is a solution to a higher dimensional supergravity theory with higher curvature corrections. A "solution" to string theory is a solution of the equations of motion of that. At least without non-perturbative effects taken into account.
See on the nLab: landscape of string theory vacua for more.
I thought string theory was supposed to be finite, why do perturbative series still diverge?
String theory is thought to be loop-wise finite, thus being a renormalized perturbative theory. No sensible remormalized perturbative QFT can have converging perturbation series. The perturbation series must be an asymptotic series to be realistic, and it comes out exactly like this in string perturbation theory.
See at the String Theory FAQ on the nLab the item Isn’t it fatal that the string perturbation series does not converge?
Is there any experimental technique to limit the number of 'solutions'? Will experimental techniques be able to pinpoint a solution within present day string theorists' lifetimes too?
Models that have been and are being built in string phenomenology approximate the standard model to more detail than probably most people are aware the standard model even has. Check out some of the references there. Given the slow but continuous flow of new articles on these matter, one sees that some people are slowly but surely working on improving ever further. Check out the references at string phenomenology.
[edit: I have now added a corresponding item to the nLab String Theory FAQ: What does it mean to say that string theory has a “landscape of solutions”?]
| 1 |
What exactly is a 'solution' in string theory?
|
Changing LED color for notifications
|
I am basically just experimenting with Android development, and a couple of days ago I came across this app called "Go SMS Pro", which, among other things, can set up notifications in different colors (blue, green, orange, pink and light blue). So, I have tried to do this myself in my own app, however I cannot change neiher the color nor the blinking internal of the LED. I currently use this code:
public class MainActivity extends Activity {
static final int NOTIFICATION_ID = 1;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Button button = (Button) findViewById(R.id.button);
button.setOnClickListener(buttonOnClick);
}
public OnClickListener buttonOnClick = new OnClickListener() {
@Override
public void onClick(View v) {
String ns = Context.NOTIFICATION_SERVICE;
NotificationManager mNotificationManager = (NotificationManager) getSystemService(ns);
Notification notification = new Notification(R.drawable.icon, "Hello", System.currentTimeMillis());
notification.flags = Notification.FLAG_SHOW_LIGHTS | Notification.FLAG_AUTO_CANCEL;
notification.ledARGB = Color.BLUE;
notification.ledOnMS = 1000;
notification.ledOffMS = 300;
Context context = getApplicationContext();
CharSequence contentTitle = "My notification";
CharSequence contentText = "Hello World!";
Intent notificationIntent = new Intent(MainActivity.this, MainActivity.class);
PendingIntent contentIntent = PendingIntent.getActivity(MainActivity.this, 0, notificationIntent, 0);
notification.setLatestEventInfo(context, contentTitle, contentText, contentIntent);
mNotificationManager.notify(NOTIFICATION_ID, notification);
}
};
}
But as I said, it doesn't work the way I want it to; instead it just blinks in regular green with the default delay, and not the one I have set in my code.
Can anyone see what is wrong with my code, or know if I have to do something else to achieve this?
|
Try using the hex color, include an alpha value and set the defaults to 0:
notification.defaults = 0;
notification.ledARGB = 0xff0000ff;
Also, the notification interface says this:
public int ledARGB
Since: API Level 1
The color of the led. The hardware will do its best approximation.
I'm assuming your hardware has all the colors, but it may not.
| 0.666667 |
The hardware will do its best approximation .
|
Etiquette for closing your own questions
|
For all of my questions I have received great answers. I have implemented the answers in code and they work. I now feel compelled to close the questions because I don't believe there are more or better answers out there.
Should you close your questions that you feel have been answered sufficiently? Would allowing more people to answer dilute the existing, good answers?
Return to FAQ index
|
Euro Micelli's post covered it well. I just wanted to add, I can't tell you how many times I've stumbled onto a Yahoo Answers page that has been closed with several incorrect or incomplete answers. It's quite frustrating, to say the least. We certainly can do better than they have.
| 1 |
Yahoo Answers page closed with incorrect or incomplete answers
|
Is there a list of Mitzvot and their corresponding body parts?
|
The Talmud (Makkot 23B)and the Zohar (1:170B - unverified English translation here) say that the 248 positive commandments correspond to the 248 limbs of the human body. (The Mishna (Ohalot 1:8) lists the 248 Halachic limbs). The Talmud also says that the 365 Negative commandments correspond to the days of the year.
The Zohar adds that the 365 negative commandments also correspond to the 365 sinews in the human body (See Yonatan Ben Uziel Bereshit 1:27), and connects them to the days of the year.
R' Chaim Vital, in Shaar HaKavanot (Shaar 1, Part 1) says that "Each of the 248 spiritual limbs gets its nourishment from a particular mitzvah that corresponds to that limb. When a person fails to perform that particular mitzvah, the corresponding limb will lack its proper nourishment..." (translation from here)
Is there any source which tells us which limb (and/or sinew) each Mitzvah corresponds to?
As an example, the Zohar referenced above (1:170B), connects Gid Hanasheh (sciatic nerve), one of the 365 sinews, to the prohibition of eating on Tisha B'av.
|
The Luz bone corresponds to the Mitzvah of Melaveh Malka. (Wikipedia quotes the Kaf haChaim (300:1-2) as saying this, although I thought that this was first stated earlier than him)
| 0.888889 |
The Luz bone corresponds to the Mitzvah of Melaveh Malka
|
1024-bit DHE vs 2048-bit RSA
|
Currently with apache/mod_ssl, if DHE is enabled then a 1024-bit ephemeral key will be used. I found the following quote in Adam Langley's blog:
Ideally the DH group would match or exceed the RSA key size but 1024-bit DHE is arguably better than straight 2048-bit RSA so you can get away with that if you want to.
So it appears that he is advocating something like DHE-RSA-AES256-SHA with 1024-bit ephemeral DH keys over AES256-SHA with a 2048-bit RSA key. My understanding is that 1024-bit DH (ephemeral or not) is of comparable security to 1024-bit RSA. Why would he make such a recommendation? Does he value the forward secrecy offered by DHE that much?
|
There are two sides to the question:
Perfect Forward Secrecy: by using a "DHE" cipher suite, you actually encrypt the data with regards to a DH private key which never gets stored on any disk. For any given SSL session, the encryption may be cracked if the attacker succeeds at cryptanalysing the public key used for encryption (DH for a DHE cipher suite, RSA for a RSA cipher suite), or if the attacker steals a copy of the private key. The latter occurrence is actually much more probable in practice for a RSA-based cipher suite; and the point of PFS is to remove that threat.
RSA vs Diffie-Hellman: for the time being, the best known methods for breaking RSA and DH entail solving two hard problems, integer factorization and discrete logarithm respectively. It so happens that for both problem, the fastest known algorithm is the General Number Field Sieve (though initially a factorization algorithm, a variant of GNFS can be applied to discrete logarithm). For asymptotic complexity, RSA and DH are thus of equivalent hardness when the DH modulus has the same size as the RSA modulus.
However, in practical term, DH is a tad harder. GNFS includes several phases, the two main being the sieve and then the linear reduction. For a big modulus, the linear reduction becomes the bottleneck because of the sheer size of the matrix. For a given modulus size, you will get the same number of elements in the two matrices (the one for RSA and the one for DH), but the matrix elements are simple bits in the RSA case, vs integers modulo p in the DH case. Thus, the DH matrix is larger.
It won't make n-bit DH as "hard" as 2n-bit RSA, though. If we look at the records, we see 768-bit for RSA, 530-bit for DH; and the DH case used less raw power. Moreover, it is not completely justified to compare the hardness of 1024-bit DH with the hardness of 2048-bit RSA, since both are in the "cannot break it" zone.
A summary of all this goes thus: while 1024-bit DH is somewhat stronger (theoretically) than 1024-bit RSA, the difference is slight (say, 1024-bit DH is like 1200-bit RSA at most). But in practical terms the risk of private key theft, for a non-ephemeral key, dwarfs out any cryptanalytic risk for any RSA or DH of 1024 bits or more; in that sense, PFS is a must-have and DHE with a 1024-bit DH key is much safer than RSA-based cipher suites, regardless of the RSA key size.
| 1 |
Perfect Forward Secrecy: encrypting a private key with a "DHE" cipher suite
|
What are Starfleet Academy required courses for officers?
|
We know that Starfleet academy offers different majors according to its needs. And those are some of the named courses to have been shown that many officers took according to their majors. So my question is: Is there anything in canon or non-canon which specifies what are the basic minimum courses that starfleet officers have to study to prepare for their possible role as future commanders or captains? Is there special training for those who want to assume command?
|
The Bridge Officer's Test is, as far as I know, the only requirement.
In TNG 7x16, Thine Own Self, Beverly Crusher mentions that she had took the test and was promoted to Commander, even though she had previously only been a doctor.
Motivated by the events of TNG 5x05, Disaster, and a class reunion just prior to Thine Own Self, Troi is motivated to do similar - she had previously only been the ship's counsellor, and had been thinking of it since the events of Disaster, where she was unexpectedly thrust into taking command. After completing the test, she too was promoted to commander.
Note that Troi's scenario on the holodeck seen in the episode is only the last part of it - more happens offscreen before that, which Riker makes reference to in the episode.
What Riker says to Troi when she passes largely implies that being a command-level officer requires the right frame of mind more than anything else - something which cannot be taught in school (especially without ending up with people who know what it should be and fake their way through).
| 1 |
The Bridge Officer's Test is, as far as I know, the only requirement .
|
Why are two eigen-state-kets with different eigenvalues orthogonal?
|
The operators $J_1^2$, $J_2^2$, $J_{1z}$, and $J_{2z}$ are mutually commuting operators. Likewise, $J_1^2$, $J_2^2$, $J^2$, and $J_z$ are mutually commuting operators. The two groups are incompatible, and the simultaneous eigenkets along with their eigenvalues are given by:
${J_1}^2 \left|j_1,j_2;m_1,m_2\right> = j_1 \left(j_1+1\right) \hbar^2 \left|j_1,j_2;m_1,m_2\right>$
${J_2}^2 \left|j_1,j_2;m_1,m_2\right> = j_2 \left(j_2+1\right) \hbar^2 \left|j_1,j_2;m_1,m_2\right>$
$J_{1z} \left|j_1,j_2;m_1,m_2\right> = m_1 \hbar \left|j_1,j_2;m_1,m_2\right>$
$J_{2z} \left|j_1,j_2;m_1,m_2\right> = m_2 \hbar \left|j_1,j_2;m_1,m_2\right>$
and
${J_1}^2 \left|j_1,j_2;j,m\right> = j_1 \left(j_1+1\right) \hbar^2 \left|j_1,j_2;j,m\right>$
${J_2}^2 \left|j_1,j_2;j,m\right> = j_2 \left(j_2+1\right) \hbar^2 \left|j_1,j_2;j,m\right>$
$J^2 \left|j_1,j_2;j,m\right> = j \left(j+1\right) \hbar^2 \left|j_1,j_2;j,m\right>$
$J_z \left|j_1,j_2;j,m\right> = m \hbar \left|j_1,j_2;j,m\right>$
I read that each set of eigenkets are mutually orthogonal [1] (for eigenkets corresponding to different sets of eigenvalues). This is what I don't understand. In principle it makes sense, but when I plug in numbers I don't get zero for the inner product. For example take the first eigenket: $\left|j_1,j_2;m_1,m_2\right>$. If I choose different eigenvalues for this eigenket (e.g. let $j_1 = 0$ and then let $j_1 = 1$) I get the following:
for $j_1 = 0$ I can have:
$\left|0,j_2;0,m_2\right>$
for $j_1 = 1$ I can have any of the following, since $\left|m_1\right| \leq j_1$:
$\left|1,j_2;-1,m_2\right>$
$\left|1,j_2;0,m_2\right>$
$\left|1,j_2;1,m_2\right>$
If I take the inner-product of the $j_1 = 0$ eigenket with any of the $j_1 = 1$ eigenkets I do not get zero, e.g.:
$\left<0,j_2;0,m_2 \mid 1,j_2;-1,m_2\right> = {j_2}^2+{m_2}^2$
which is non-zero unless $j_2 = 0$.
What am I misunderstanding here? How do you show that eigenkets with different eigenvalues are orthogonal?
|
your line $\left<0,j_2;0,m_2 \mid 1,j_2;-1,m_2\right> = {j_2}^2+{m_2}^2$ is making an assumption about what an inner product must look like. A technical way to express your problem is to note that the sequence of eigenvalues identify an element in a tensor product of vector spaces, not a direct sum. If it was a direct sum, your sum of squares would be right, but it isn't.
Luboš's Answer is completely right, enough so that I upvoted it because he needs all the rep he can get, but it looks like it needs you to know what you're doing already for you to understand it. When you use objects like $\left|j_1,j_2;m_1,m_2\right>$ to represent a state, you implicitly claim that the operators that have the eigenvalues $j_1,j_2;m_1,m_2$ are self-adjoint and mutually commutative. In elementary terms, we can take this to define the inner product on the Hilbert space. We don't know what the inner product is until we've defined it. If the eigenvalues are different, the inner product is defined to be $0$, if the eigenvalues are the same, the inner product is defined to be $1$.
As Luboš says, all the lines above your first introduction of a bra are only about operators acting on a vector space, you haven't got a Hilbert space until you've defined an inner product (and more than that, closure in the norm). Once you've defined an inner product, $(\left|U\right>,\left|V\right>)$, you can define a bra as the object that acts on a vector to get this value, $\left<U \mid V\right>=(\left|U\right>,\left|V\right>)$. There's a theorem that says we can do this if we're properly careful, http://en.wikipedia.org/wiki/Riesz_representation_theorem.
| 0.333333 |
How to define an inner product on a vector space
|
what is best way to Migrate Content from Tridion 5.3sp1 to 2011sp1
|
Our migration from 5.3sp1 to 2011sp1 will happen for period of 2-3 months, but content will be added on production during that time in tridion 5.3sp1.
After the migration activities we will have migrated system on 2011sp1,
But now i want to migrate new content from production(which is still in 5.3) to upgraded DB.
Content porter version 2.3(currently being used in 5.3sp1 ) is not supported in 2011.
What would be the best approach for this?
|
I'm assuming your 5.3 machine is your development environment and your 2011 is your production environment and your request to send some delta items to your production environment.
It is possible to upgrade from 5.3 sp1 straight to 2011, I'd recommend getting your environments at the same version, which will make it possible for you to content port from one 2011 environment to the other.
Perhaps if you put some more information here you might get a better answer from the community.
| 0.666667 |
Upgrade from 5.3 sp1 straight to 2011
|
Guidelines for video format in Raspberry Pi
|
I'm attending to start a multiprojection project, and I think Raspberry Pi fits really well in it. I need to read a video from the SD card and project it. There will be some (four maybe) videos so I think I need one board for each projection and synchronize them.
For the video, I have to work with some guys that are in the field of video editing. They ask me the resolution, the frame rate, the format (encoding and container), and the maximum size of each video file.
For example:
resolution of 768x576, 25 fps, H.264, file .avi that not exeed 4 GB
what is the best for Raspberry Pi? Do I have to follow some guidelines or best practice to get maximum performance (video must not glitter) for the platform?
PS.: I am using the 2012-10-28-wheezy-raspbian and an SD card with class 10 (for video)
(I'm totally new to this platform so please be patient and also trivial knowledge can help me.)
|
It's handled every video I've thrown at it with ease. However, there are a couple of points to consider:
You must use a video player that supports hardware decoding. I suggest OMXPlayer.
You can purchase an MPEG-2 and vc-1 license key from the Raspberry Pi store. These are proprietary formats that provide decoding capabilities DVD and Windows media (WMV and WTV).
H.264 support is built in, which caters for most HD content you will use (mkv & mp4).
I hope this helps.
| 0.777778 |
OMXPlayer supports hardware decoding .
|
Do tzitzit have to be white?
|
Based on this answer do tzitzit have to be white?
Where is the source that they should be?
I know that they are supposed to have at least one blue (techelet) string, but even that is disputed nowadays.
|
The Shaarei Taamei HaMitzvos says that the reason Tzitzis is white is since white is the color of Selicha, Kapara, and Rachamim.
See Machzor Vitri.
| 1 |
Why Tzitzis is white is because white is the color of Selicha, Kapara, and Rachamim
|
The Discrete Logarithm problem
|
I am puzzled with the following discrete logarithm problem:
Given positive integers b, c, m where (b < m) is True it is to find a positive integer e such that
(b**e % m == c) is True
where two stars is exponentiation (e.g. in Ruby, Python or ^ in some other languages) and % is modulo operation. Using general math symbols it looks like:($b^e \equiv c (\mod m)$).
What is the most effective algorithm (with the lowest big-O complexity) to solve it ?
Example:
Given b=5; c=8; m=13 this algorithm must find e=7 because 5**7%13 = 8
Thank you in advance!
|
The question is not phrased to our taste at mathoverflow, but the user has a point that this particular Wikipedia page is under-developed. As David Speyer suggests, it is a very different problem for very large primes than for small ones. For small primes the simplest algorithms described in Wikipedia are probably the most appropriate. If the question is instead about the theoretical time complexity, see this review article.
| 1 |
Mathoverflow is a very different problem for large primes
|
Euclid's Algorithm (Greatest Common Divisor)
|
According to Donald Knuth in "The Art Of Computer Programming", the following is how to find the greatest common divisor of two positive numbers, m and n, using Euclid's Algorithm.
Divide m by n and let r be the remainder.
If r is 0, n is the answer; if r is not 0, continue to step 3.
Set m = n and n = r. Go back to step 1.
Below is my implementation of this algorithm.
#include <stdio.h>
int greatestCommonDivisor(int m, int n)
{
int r;
/* Check For Proper Input */
if((m == 0) || (n == 0))
return 0;
else if((m < 0) || (n < 0))
return -1;
do
{
r = m % n;
if(r == 0)
break;
m = n;
n = r;
}
while(true);
return n;
}
int main(void)
{
int num1 = 600, num2 = 120;
int gcd = greatestCommonDivisor(num1, num2);
printf("The GCD of %d and %d is %d\n", num1, num2, gcd);
getchar();
return 0;
}
Though it appears to work just fine, it doesn't seem to be as elegant as I'd like, especially in the do-while loop. Also, the while(true) seems dangerous, though I'm pretty confident that r will be reduced to 0 eventually and we'll break out of the loop.
Do you have any suggestions on either making the code more elegant or robust?
|
Unlike Yuushi, I'm not too fond of recursions, at least when they are not really needed. This is one of those cases.
First, the negative input... The greatest common divisor of numbers -8 and -12 is 4, wouldn't you agree? So, instead of
else if((m < 0) || (n < 0))
return -1;
I'd put
if (m < 0) m = -m;
if (n < 0) n = -n;
to ensure that both of the numbers are nonnegative. Btw, else rarely (if ever) makes sense after return.
Second, I think that breaking the loop
if (r == 0)
break;
is misguiding, because what you really want to do is stop the function and return the result. In other words,
if (r == 0) return n;
Third, since your loop is technically infinite, then do { ... } while(true); is equivalent to while (1) { ... }. Personally, I find the latter to be more readable.
Lastly, true does not exist in standard C. If you really want to use it, then include stdbool.h. This belongs to the C99 standard (so, it doesn't work in C89/C90). Personally, I prefer 1 and 0, but this is probably a matter of habit.
| 1 |
recursions are a common divisor of numbers -8 and -12
|
Is a VPN really secure at the VPN providers side?
|
Please forgive my basic ignorance regarding a VPN connection.
As I understand it, a VPN connection encrypts all the data between my computer and the VPN provider. Thus preventing my ISP from seeing my data.
But on the VPN providers side of the connection, surely the VPN provider uses an ISP of some sort. So they send out requests I have made over their ISP, just as if I were sitting there using the ISP they pay for. And they send the data back to me, encrypted.
So on the ISP side they use, the data they send is unencrypted, so it can be understood by other sites/services.
If this is the case, am I not just pushing my data further along. Its still unencrypted but at a different end (VPNs Webside). Its only the data back to me, which is encrypted.
Thanks.
|
If this is the case, am I not just pushing my data further along?
Correct. A VPN is designed to give you a secure connection to the VPN provider; it essentially simulates your being physically on their network. For instance, a corporate VPN simulates being in the office physically connected to the corporate network. This is great when there's some reason to trust the VPN network more than the network you're on for the things you're doing; however, all it amounts to is substituting the VPN provider's network for the network you're on.
| 1 |
A VPN is designed to give you a secure connection to the VPN provider
|
What is the current state of research in quantum gravity?
|
I was browsing through this and was wondering what progress in quantum gravity research has taken place since the (preprint) publication.
If anyone can provide some helpful feedback I would be greatly appreciative.
|
A few developments since 2001:
There is the new field of loop quantum cosmology, which shows some promising signs of being able to actually calculate things that might conceivably be testable by observation.
The LHC hasn't found any evidence of supersymmetry, which may reduce the appeal of string theory.
There have been some high-precision tests of dispersion of the vacuum: http://arxiv.org/abs/0908.1832 . The results have been negative. This was at one time though to be a potential test of LQG, but now it looks like LQG doesn't yet make any definite prediction.
LQG has been reformulated in the last 10 years, so if you're going to try to learn it, you want to learn it from more recent references. A presentation of the new LQG is given in Rovelli, 2011, "Zakopane lectures on loop gravity," http://arxiv.org/abs/1102.3660 .
In 2004 there was an internet debate between Smolin and Susskind on Smolin's claim that "the Anthropic Principle ... cannot yield any falsifiable predictions, and therefore cannot be a part of science:" http://www.edge.org/3rd_culture/smolin_susskind04/smolin_susskind.html
| 1 |
LHC hasn't found any evidence of supersymmetry, which may reduce appeal of string theory
|
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.
|
I like to try and disprove results I am trying to understand.
Sometimes I'll give it a good month- I start by constructing perverse sequences and little heuristic arguments- when I'm onto something good I'll pursue it 'til it's rigorous: more often than not it turns out to be precisely the case disallowed by the theorem's assumptions.
After a while I start to paint my counter-arguments in generalities "An A is not a B if A has perversity X" and I look for the exact line in the proof where 'perversity X' is (perhaps implicitly) dealt with and debunked. Sooner or later I start to see what every line in the proof is for, moreover I start to see why it must be true.
It may not be the fastest way to learn, but it's certainly entertaining if you're having trouble sleeping!
One can also apply the same trick to definitions and constructions by trying to prove that they are useless/degenerate.
| 0.888889 |
Perverse sequences and little heuristic arguments
|
Improper shutdown, now 3 flashes on boot
|
I had to do a hard power off on my Pi, as it had crashed. Now, when I turn it on, I get 3 flashes of the OK LED, which means either loader.bin or start.elf is not found. I have plugged the SD card into my Windows PC to browse the boot partition and neither of those files is present. Is there any way to repair the boot partition and allow the Pi to boot without losing any data on the card? I have important data that hasn't been backed up yet on the card.
|
You could:
Backup the card.
Reflash the card with your OS, which would also fix the boot partition.
Copy the files you want back to your card.
| 0.888889 |
Backup the card with your OS
|
SQL agent job, why is the job history showing that a step is still running even though the job has completed
|
I have a sql agent job that runs Powershell as its first step (there are 3 steps in total).
I have set this step to have 2 retries, with a 3 minute retry interval.
When I look into the job history, the step_1 states that it is still running, and also that it has completed. It has done this for every time that it has run (at least the last year).
Am I missing something from my powershell? Or is this something to do with sql agent itself?
Details of querying the sysjobhistory table (Pipe seperated):
Step_name|step_id|run_date|run_time|run_duration|run_status
(Job outcome)|0|2014/02/12|01:20:00|5|Succeded
Record volume space to file|1|2014/02/12|01:20:00|2|In Progress
Record volume space to file|1|2014/02/12|01:20:00|2|Succeded
Load Volume Space|2|2014/02/12|01:20:02|1|Succeded
Record database data file space|3|2014/02/12|01:20:03|2|Succeded
Step 1 runs the following Powershell:
gwmi win32_volume | select name, capacity, freespace | Export-Csv c:\temp.tmp
|
On the Hey Scripting Guy! blog at Technet, Chad Miller reports that if you run a Windows Powershell command as a SQL Agent job, and there are no syntax errors yet, the command produces an error (for example, attempting to get operating system information from an unavailable server). The SQL Server Agent job will report success.
Check tip #10 in the post for instructions on how to implement error handling with different options so that you can, for instance, have SQL Agent continue on error or halt the Agent job. The reported "succeeded" may not in fact have succeeded.
10-tips-for-the-sql-server-powershell-scripter
| 0.777778 |
SQL Server Agent job if you run a Windows Powershell command
|
Do Not Track header
|
Does Stack Overflow honor the Do not track header... or is support going to be added later? ...(it doesn't seem to honor the header at the moment).
|
Glancing at the draft spec, Do Not Track only seems to apply to third-party tracking, such as from ad networks/servers. As such, Stack Overflow's unregistered sessions/accounts wouldn't be a violation. SO's ad network/server seems to be Adzerk. I've just asked their "Live Help", and he wasn't aware of Do Not Track (though he said he'd read up on it).
| 0.888889 |
Do Not Track applies to third-party tracking from ad networks/servers
|
Entering US via car/land border on 90 day ESTA, exiting after 90 days via air/plane, re-entering via land to begin another 90 days
|
We bought a van in Canada to roadtrip the US for 6 months. We are planning on two 90 day stints in the US so as to comply with the ESTA requirements. It is looking more likely it will be easier to fly Mexico rather than re-enter Canada via land. Will customs have an issue with us leaving and re-entering the US via air if we originally entered via land border?
We have done the west coast and want to now travel the East coast.
Thanks.
|
The simple fact is, you're very likely to have problems.
What you are describing is very clearly a "Visa Run", and even if it's technically within the rules of what is allowed under the VWP (and whether it is or not will depend on the exact details, many of which you haven't provided), there is a very real chance that you will NOT be allowed re-enter the US on your second attempt if the immigration official decides that you are doing a Visa Run.
Instead you should likely apply for a US B-2 visa which will allow you to stay in the US for up to 6 months at a time.
| 0.888889 |
Visa Run is technically within the rules of what is allowed under VWP .
|
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.
|
Hmm. Well, Mutant City Blues is a good modern day low powered supers setting - it would be perfect for the new SyFy show Alphas for example. It doesn't have the uncontrolled powers, though that would be a trivial modification. Normal humans are definitely a threat. It handles investigation very well, as it is GUMSHOE based, but doesn't have explicit relationship mechanics. I've played it and if your game is heavily about investigation, it'll work well.
| 0.666667 |
Mutant City Blues is a good modern day low powered supers setting .
|
Detect HP ML370 G5 Bad disk in RAID0
|
I have one HP ML370 G5 server. Which has four 146GB SAS disks and two 300GB SAS disks that are configured as RAID 0.
I have encountered a problem with one of my disks. The windows server event viewer shows the error below:
Logical drive 2 configured on array controller P400 located in server
slot 1 returned a fatal error during a read/write request from/to the
volume. Logical block address 6331648, block count 256 and command 32
were taken from the failed logical I/O request. Array controller P400
located in server slot 1 is also reporting that the last physical
drive to report a fatal error condition (associated with this logical
request), is located on bus 0 and ID 1.
How can I determine whether all of my disks work well or not? and check for bad blocks on my disks!
|
If these disks are in two logical drives of RAID 0, you may not have any recourse beyond copying your data off the system.
You won't be able to just replace the failing disk without incurring data loss.
Are you sure that you're using RAID 0?
| 0.888889 |
Are you sure that you're using RAID 0?
|
How best to handle a popup gaining focus in the middle of the user typing?
|
Often I'll set some process off, then change focus to another program and be typing away in a textbox (for example), when the first thing pops up into view, maybe with a Yes / No box which I'd then accidentally interact with as I'm still typing.
I just accidentally sent a license agreement for something that was downloading & installing, to the printer as it popped up once it had downloaded, while I was typing a url into Chrome. If I didn't quickly cancel it I'd have had to wait while 53 pages printed while I reflected on what had happened.
What can application developers, or the OS itself do to minimize these problems?
|
Two things are possible:
Do not force the application to gain focus. Show the message and keep waiting till user switches to the application.
Implement blinking notifications. This is OS dependent. May or may not be feasible in other OS but in Windows operating system, there is system tray (systray in short). Application can be coded in such a way that if user attention is required and the application is not in view, application can put a blinking or baloon notification in the systray. Looking at that, user can switch to the application and respond to the confirmations / queries thrown by application
| 1 |
Implement blinking or baloon notifications.
|
When do I need to worry about thread-safety in an iOS application?
|
When writing the usual view controller code, can I assume that this will only be called from a single event-loop thread? What kind of classes do I need to make thread-safe? What are the usual situations where multiple threads are involved?
|
The Concurrency Programming Guide can be helpful.
| 0.888889 |
Concurrency Programming Guide
|
what is exactly the difference between the Selberg class and the set of Artin L-functions?
|
The question is in the title: from what I read in the answer to another question, Artin L-functions are conjecturally cuspidal automorphic L-functions for some algebraic group that can be transfered to $GL_{n}$. On the other hand, elements of the Selberg class are widely believed to be (cuspidal?) automorphic L-functions for $GL_{n}$. So where exactly lies the difference between those two sets of L-functions?
Thanks in advance.
|
As far as I know, the precise conjecture for what you are asking is:
All the elements of the Selberg class that are not Artin L-functions
are:
motivic L-functions of dimension bigger than 0.
transcendental L-functions
Note that Artin L-functions are the 0-dimensional motivic L-functions.
Also, transcendental L-function is an umbrella term for automorphic L-functions that are not motivic.
| 1 |
Motivic L-functions of dimension bigger than 0.
|
inserting period after every 3 chars in a string
|
I have this:
from __future__ import print_function
def f_comma(p_string):
v_string = p_string
if (type(v_string) == type(int()) or type(v_string) == type(long()) or
type(v_string) == type(float())):
v_string = str(v_string)
else:
l_string = list(v_string)
for v_index in range(3, len(l_string), 4):
l_string.insert(v_index, ',')
v_result = ''.join(l_string)
return (v_result)
print (f_comma('qwertyuiopaq'))
It seems that i can't figure it out why if i use a string longer than 11 chars the period stops inserting, but with only 11 chars it works fine. What i'm doing wrong in this piece?
|
You can insert a comma after every nth character like this:
>>> my_str = 'qwertyuiopaq'
>>> ','.join(my_str[i:i+3] for i in range(0, len(my_str), 3))
'qwe,rty,uio,paq'
This should work for any arbitrary length of strings too.
Edit: Written as a function in a similar style to @mhawke's answer, with an option to change the grouping/characters.
>>> def f_comma(my_str, group=3, char=','):
... my_str = str(my_str)
... return char.join(my_str[i:i+group] for i in range(0, len(my_str), group))
...
>>> f_comma('qwertyuiopaq')
'qwe,rty,uio,paq'
>>> f_comma('qwertyuiopaq', group=2)
'qw,er,ty,ui,op,aq'
>>> f_comma('qwertyuiopaq', group=2, char='.')
'qw.er.ty.ui.op.aq'
| 0.888889 |
Insert a comma after every nth character
|
Animation in UITableViewCell completes immediately
|
I have a subclass of UITableViewCell with button inside of it. The button have clear backgroundColor with some border. I want to do a fill in animation starting from the center of the button. My problem is that animation completes immediately. Here's my code, I've tried doing this in 2 different ways.
- (void)goingButtonAnimation {
UIView *goingButtonBackgroundView = [[UIView alloc] initWithFrame:CGRectMake(self.goingButton.center.x, self.goingButton.center.y, 0., 0.)];
goingButtonBackgroundView.layer.cornerRadius = 2.;
goingButtonBackgroundView.backgroundColor = [UIColor blackColor];
[self insertSubview:goingButtonBackgroundView belowSubview:self.goingButton];
[UIView animateWithDuration:2. animations:^{
goingButtonBackgroundView.frame = self.goingButton.frame;
}];
}
I've also tried this:
goingButtonBackgroundView.transform = CGAffineTransformMakeScale(0.1, 0.1);
[UIView animateWithDuration:2. animations:^{
goingButtonBackgroundView.transform = CGAffineTransformMakeScale(1.0, 1.0);
goingButtonBackgroundView.center = self.goingButton.center;
}];
But the animation completes immediately in each case. goingButtonAnimation method is called after tapping on self.goingButton
|
My problem was that after calling goingButtonAnimation I called [self.tableView reloadData]
| 0.888889 |
Using goingButtonAnimation
|
iOS7: UICollectionView appearing under UINavigationBar
|
I've been building on iOS 7 for a while now but I've yet to get this solved, I have a number of views with autolayout enabled that were created in Storyboard and are displayed with a standard UINavigationController. The majority are fine, but the ones based on UICollectionView always place themselves under the navigation bar, unless I set the translucency to NO. I've tried the edgesExtended trick but that doesn't seem to solve it, I don't necessarily mind having the translucency off but I'd like to solve it cleaner.
|
FYI if your UICollectionView is the root view in your view controller's hierarchy and your view controller has automaticallyAdjustsScrollViewInsets set to YES (this is the default), then the contentInset should update automatically.
However, the scrollview's contentInset is only automatically updated if your scrollview (or tableview/collectionview/webview btw) is the first view in their view controller's hierarchy.
I often add a UIImageView first in my hierarchy in order to have a background image. If you do this, you have to manually set the edge insets of the scrollview in viewDidLayoutSubviews:
- (void) viewDidLayoutSubviews {
CGFloat top = self.topLayoutGuide.length;
CGFloat bottom = self.bottomLayoutGuide.length;
UIEdgeInsets newInsets = UIEdgeInsetsMake(top, 0, bottom, 0);
self.collectionView.contentInset = newInsets;
}
| 0.666667 |
UICollectionView is the root view in your view controller's hierarchy
|
How does my app know what private key to use
|
I have an app that runs on GlassFish 3.x. It communicates to a remote server over https. In my cacerts file I've added the server certs. In my keystore.jks I added the private key the company running the remote server issued me. This works great on Glassfish 2.x, however on 3.x they remote server keeps complaining that the key I have is invalid.
If I remove the key from the keystore I get the same error. It's as if it's not even loading the key, which has got me wondering how does the app / container know which key I need
My connection code looks like this:
public class SSLSocket {
private static Logger logger = LoggerFactory.getLogger(SSLSocket.class);
private ConnectionProperties connectionProperties;
public TuSSLSocket(ConnectionProperties connectionProperties) {
this.connectionProperties = connectionProperties;
}
public SSLSocket getSSLSocket() throws Exception{
SSLSocketFactory factory = (SSLSocketFactory) SSLSocketFactory.getDefault();
SSLSocket socket = (SSLSocket) factory.createSocket(connectionProperties.getHost(), connectionProperties.getPort());
socket.setSoTimeout(90000);
return socket;
}
}
I set the Host and Port accordingly, but no where do I say go look for this alias in the keystore. So... how does the app know what alias to grab?
|
There are two ways to accomplish this
The first:
Open the following path from the admin console page.
configuration
your cluster/instance configuration.
jvm settings
jvm options
you will find this line some where in the list of items
-Dcom.sun.enterprise.security.httpsOutboundKeyAlias=s1as
Change the s1as value to the certificate alias you want to use.
The other option is to add a system property to your code
System.setProperty("com.sun.enterprise.security.httpsOutboundKeyAlias", "your certificate alias");
| 0.888889 |
Configure your cluster/instance configuration
|
Possessive form (of) with compound nouns
|
This is a main difference between the personality of good people and bad
people.
Is the sentence comparing personality of good people and personality of bad people? or comparing personality of good people and bad people?
How to avoid ambiguity when using of with compound nouns?
|
As I understand it, your question about the sentence
This is a main difference between the personality of good people and bad people.
involves determining whether "the personality of good people" is being contrasted with "bad people" or with "[the personality of] bad people." Structurally the sentence permits (with a little logical fudging) either reading, though I suspect that the author intends the second one.
That being the case, the biggest weakness of the sentence as written is that it seems to favor a logical reading that finds the intended contrast to be between "the personality of good people" (where "personality" is obviously a singular noun) on the one hand and "bad people" on the other. We can start to overcome that problem by changing personality to personalities:
This is a main difference between the personalities of good people and bad people.
At this point, we still have (from a strictly logical reading of the sentence) a contrast between "the personalities of good people" on the one hand and "bad people" on the other. But beyond that, we have a plausible set of parallels attaching to the stem word of: "good people" and "bad people." And whereas before that of linked problematically to a singular personality, it now links to the plural personalities—a better platform for the parallelism. And we can strengthen the parallelism of these phrases by adding the word of before "bad people":
This is a main difference between the personalities of good people and of bad people.
Now the parallel phrases "of good people" and "of bad people" attach to the stem word personalities—and a reader cannot logically misread the intended contrast as being between "the personalities of good people" on the one hand and "bad people" on the other, without ignoring the of immediately preceding "bad people."
As other answerers and commenters have pointed out, there are alternative ways to make the sentence unambiguously present a contrast between the two types of personalities. For example, you could say
This is a main difference between the personality of good people and the personality of bad people.
But the shorter form that I suggest is every bit as clearly parallel and yet (to my mind) somewhat less tedious.
Conversely, if you wanted to establish a contrast between "bad people" on the one hand and "the personality of good people" on the other, the simplest way to proceed would be to flip their order in your original sentence:
This is a main difference between bad people and the personality of good people.
Either way the things that the sentence is seeking to compare are clearly defined, and readers won't be tempted to misread the writer's meaning.
As a side note, I acknowledge that the form "the personalities of good people and of bad people" may suggest to some readers that the author is comparing multiple personalities of good people to multiple personalities of bad people, whereas the original wording seems to take the view that good people have one unitary personality and people a very different unitary personality. If this change runs afoul of the author's intentions, we could revise the wording (again) to say something like this:
This is a main difference between the personality of good people and that of bad people.
where the new parallels are "the personality of good people" and "that of bad people," both attached to the stem word between.
| 1 |
What is the difference between personality of good people and bad people?
|
Convert serial port returned byte to millisecond
|
Hey guys, here's my issue. Working with the iPort... one of the commands to send through the serial port is getplaystatus and 4 bytes are returned to describe the length of the song in milliseconds. An example is a song as 4:39 to it... the length returned from is an array
byte[] b = {0x00, 0x04, 0x67, 0x83};
So 4:39 in milliseconds is 279000.
Somehow those bytes need to equal 279000... and I've run out of ideas. Any help would be most appreciated. Thanks!
~Marty
|
Close, it's actually 288643. It's actually 4:49, isn't it?
You use the BitConverter class to convert them, but you might need to reverse them first:
if (BitConverter.IsLittleEndian) {
Array.Reverse(b);
}
int ms = BitConverter.ToInt32(b, 0);
| 0.777778 |
BitConverter.IsLittleEndian Array.Reverse
|
Can we represent this sequence as a function of n?
|
I have this sequence :
4,12,24,48,240,720,....
I order to find nth term of this sequence , can we represent this sequence as a function of n.
|
If we divide the terms by 4 we have $1,3,6,12,60,180...$ now we can proced to see a pattern, let's see the representation in prime numbers, $6=2\times 3$, $12=2^2\times 3$, $60=2^2\times 3 \times 5$ and $180=2^2\times 3^2 \times 5$, ...
So, taking $1=2^0$ and $3=2^0\times 3^1$ we have the list:
$2^0$
$2^0\times 3^1$
$2^1\times 3^1$
$2^2\times 3^1\times 5^0$
$2^2\times 3^1\times 5^1$
$2^2\times 3^2\times 5^1\times 7^0$
We see that the sum of the exponents of each line is $0,1,2,3,...$
When the sum of the exponents of each line is odd we add a new prime factor elevated to $0$.
Then the next two number in the sequence is:
$2^2\times 3^2\times 5^1\times 7^1=1260$
$2^2\times 3^2\times 5^2\times 7^1\times 11^0=6300$
| 0.555556 |
dividing the terms by 4 is a representation in prime numbers
|
Do we need a transit visa we have a 12 hour stop over and have booked a hotel, we are flying with AirIndia from Sydney to Rome return
|
I am traveling with my elderly parents, sister and her son. He is 19 years old. We are traveling to Rome, from Sydney return on Air India. We have a 12 hour stopover in Delhi, so I have booked a hotel without thinking about the transit visa. I have a New Zealand passport, my parents have both New Zealand and Australian Passports and I'm not sure what my sister's or nephew's passports are.
I would like to know if we need transit visas and how to get them before we depart Australia.
|
It looks like as New Zealand or Australia passport holders you can get a transit or visitor visa. Links provided by @pnuts in the comments are helpful.
The transit visa seems way cheaper than the regular visitor visa, at 28 USD, but there is a priori no procedure explained online.
The visitor visa costs 60 USD which is expensive compared with a hotel room price. According to the electronic visa website and Wikipedia, you should apply for it online and then obtain it on arrival. Note that your passport must be valid for 6 months after you leave India. You should apply between 4 and 30 days before entering India (actually the payment should be made at least 4 days in advance so i would do it early enough for the payment to be processed at least 4 days in advance) The procedure is explained there.
| 1 |
New Zealand or Australia passport holders can get a transit or visitor visa
|
PHP EDI X12 Parsing
|
I have a project to implement an EDI solution into an existing ecommerce-like website. There are only three EDI documents involved and only one company to transfer files with. They have strictly defined the X12 documents, and will be responsible for all of the GET/PUT's to an FTP site. The three documents are the Inventory Advice (inbound), Shipment Notification (inbound), and Invoice (outbound).
We do not want/need to implement a full-blown EDI management solution. My question is, am I crazy to think that this is a relatively simple parsing task using PHP? Does anyone know of any existing PHP libraries that might be useful (maybe X12 to XML)? My searches have come-up empty. I'd like to get started on my own right away if it is a realistic goal and no other resources are available.
|
The designer for the Oakland Data Transformer is free and this allows you to really understand the structure of the X12 document in the context of your sample document. You will need to contact Oakland Software support to get the required EDI definitions.
Depending on what you need, if you are just parsing the documents you should be able to do it pretty easily with PHP and understanding the context using the above product will take the mystery out of it for you.
Full disclosure: I run Oakland Software.
| 0.777778 |
Understanding the structure of the X12 document in the context of your sample document
|
linq to xml query with all attributes
|
I have a xml document like this
<Products>
<Product Name="Mobile Device" Code="10000000000000000006">
<Providers>
<Provider Name="VODA" Code="VODA">
<Menus>
<Menu Name="Home" Url="TopModelsNew.aspx" DisplayOrder="1" NewWindow="0"/>
<Menu Name="Top Queries" Url="TopIssues.aspx" DisplayOrder="2" NewWindow="0"/>
<Menu Name="Error Codes" Url="PCErrors.aspx" DisplayOrder="3" NewWindow="0"/>
</Menus>
</Provider>
</Providers>
</Product>
I want to find all the menu where Product Code="10000000000000000006" and Provider Code="VODA" in a list.
The result should be like
Name Url DisaplayOrder
Home TopModels 0
I was trying linq to xml as follows
XDocument xdoc = XDocument.Load(Server.MapPath("~/App_Data/LeftMenu.xml"));
var products = from product in xdoc.Descendants("Product") where
new{
.....
};
I am not able to find how to get the list.
|
XDocument xdoc = XDocument.Load(Server.MapPath("~/App_Data/LeftMenu.xml"));
var menus = from product in xdoc.Descendants("Product")
where (string)product.Attribute("Code") == "10000000000000000006"
from provider in product.Descendants("Provider")
where (string)provider.Attribute("Code") == "VODA"
from menu in provider.Descendants("Menu")
select new {
Name = (string)menu.Attribute("Name"),
Url = (string)menu.Attribute("Url"),
DisplayOrder = (int)menu.Attribute("DisplayOrder")
};
Result:
Name Url DisaplayOrder
"Home" "TopModelsNew.aspx" 1
"Top Queries" "TopIssues.aspx" 2
"Error Codes" "PCErrors.aspx" 3
| 0.777778 |
XDocument.Load
|
What makes LSBit steganography detectable? And what would help in concealing it?
|
In a project of mine I took a 24-bit bitmap image and I performed LSBit steganography over it (saved a black and white image inside each of the planes R, G, B) using pixel shuffling and xor encryption.
Is my stenography easy to detect? And what would it take to conceal it?
|
A general theoretical answer to the title's What makes LSBit steganography detectable? is that in normal images, the LSBit of a pixel in some channel is correlated to higher-order bits in the same pixel and channel, that pixel in other channels, and adjacent pixels, in ways that mere replacement of LSBit tends to strongly alter.
One simple way to improve that is adding noise or blurr to a degree such that the LSBit is nearly indistinguishable from random, in which case it can then be replaced by something equally indistinguishable from random (as resulting from good encryption) with little chance of detection versus an equally noisy/blurry image. Next step is changing only few bits at locations dependent on a key (towards that goal it is necessary to have a small payload, as previously pointed), and have the other pixels randomly noisy according to a good model of the natural image.
From a practical standpoint, sending uncompressed 24-bit bitmap images somewhat is a red flag that basic stego is in use. That would be somewhat less apparent with an additional step of JPEG lossless compression, or PNG or GIF conversion (lossy compression would destroy the hidden message given the LSBit encoding used; more sophisticated stenographic schemes survive that). Notice that sending noisy/blurry images without lossy compression is a waste of bandwidth, and could also raise alarm.
I suggest two "easy to detect" tests, to be applied comparatively on your image with stego (after decompression if a lossless compression step is added), and normal images that could be allegedly sent, at least including the one you start from.
Show as an 8-color image the 3 LSBits of each pixel; that can be done by changing each byte x in each RGB plane to ~((x&1)-1). It there something perceptibly remarkable for your image with stego? Update: a 64 or 512-color image using (x<<6)+32 or (x<<5)+16 might also be interesting. (note: the three expressions are for C, and assume truncation to octet. ~((x&1)-1) yields 0x00 if the low bit of x is clear, 0xFF otherwise).
Is the compression ratio of PNG markedly lower for your image with stego than for normal images?
Note that these tests can only demonstrate failure to be undetectable.
| 1 |
What makes LSBit steganography detectable?
|
Rice gets burnt and watery
|
I am following the recipe of the rice I am making which is:
Add 2 cups of water and heat
Add 1 teaspoon of salt and 1 teaspoon of butter
Add 1 cup of rice then wait for 18 to 20 minutes and it should be ready to serve.
But the problems with this are:
The rice is always watery
It is flavorless
Some rice gets burnt and makes it really hard to clean the pan
|
Assuming plain (American) white rice on a stovetop:
(Generally, American rice does not need rinsing for these applications)
From your description, it sounds like you are going for Steamed Rice; for that, here's what you want to do:
Bring your water, salt and butter to a boil, then add your rice. Stir it until it comes back to a boil. As soon as it boils again, turn your heat way down. Keep stirring until the heat is low enough that you feel safe that you can cover the pot without it hard boiling again. Cover and keep on low to medium-low heat or a moderate simmer (preferably without peeking) for 20 minutes (15 minimum). It is the steam that plumps the rice, so don't lift the lid! It may take some tweaking depending upon your specific equipment, but try to be patient. You may find that you like a little less water and a bit more time. When you do peek (hopefully after at least 15-20 minutes have passed) look for the water to be gone and for little holes or "divots" to be formed on the surface of the rice. If you still have water, cover again and keep cooking without lifting the lid for at least 5 more minutes. When it looks done, turn off the heat but still don't stir, you're better off just letting it sit for another 5 minutes - re-covered and with the heat turned off, then stir/fluff it.
If you find that your rice isn't done after 20-25 minutes with the lid on, bring up the heat a bit, but be careful. If your heat is too high, your rice can burn on the bottom. Within reason, if it's just a bit too low, it'll just take longer.
The lid is really key here. Do you have a tight lid for the pan that you are using? If not, we can help you improvise.
A slightly different method using the same ingredients is the Pilaf Method shown here in a great video from the love of my life, Alton Brown. 20 Minute Pilaf See the rice just before he fluffs it with chopsticks? Those are the holes/divots I referred to above in the explanation of the steaming method. In case the link goes bad, here's a description of the video: Bring 3 cups of water to a rolling boil. Meanwhile, in a saucepan with a tight lid, melt and lightly brown 2 Tbs of butter over high heat. Add 2 cups of rice (regular long grain, basmati or jasmine recommended) and saute for a couple of minutes, add 1 tsp salt (Alton uses kosher). When the rice smells "nutty" add the boiling water all at once (careful, it will boil rather violently). Cover and turn heat to low. No peeking, cook on low for 15 minutes. Fluff with chopsticks or a fork. Cover again for 5 minutes, no heat.
Note that Alton's pilaf also requires a tight fitting lid. If your lid isn't tight, try using aluminum foil to get a tighter seal.
Finally: With very small variations, these two methods of cooking rice will work fine for just about any type of rice. Some rice, particularly some rice harvested outside of the US should be thoroughly rinsed first. Check your label if you can or revisit this question if you're not sure if your rice should be rinsed. If you use rinsed rice you may find that you want to use slightly less water for cooking than instructed here.
You're using a 2 to 1 ratio for steaming rice, that's fairly typical but you might like a bit less water, just don't go lower than 1.5 to 1.
Brown rice works fine for these methods too but will take longer and require slightly more water.
The steaming method, particularly if you wait to "fluff" will produce a stickier rice, better for chopsticks :) and better to accompany food that has a sauce you want the rice to soak up. I prefer steamed rice to go with stir-fries, for example.
The pilaf method, particularly with medium to long grained rice will produce more individual grains. Nice with steak or baked chicken, something that isn't sauced.
| 0.888889 |
How do you use a steaming rice?
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.