summary
stringlengths 15
147
| text
stringlengths 1
19.3k
| answer
stringlengths 32
22.6k
| labels
float64 0.33
1
| answer_summary
stringlengths 5
164
|
---|---|---|---|---|
Does changing the gap between plates change the capacitor voltage? | Consider an ideal capacitor which has a length of \$\ell_1\$ between its plates. The capacitor terminals are open; they are not connected to any finite valued impedance. Its capacity is \$C_1\$ and it has an initial voltage of \$V_1\$.
What happens to the capacitor voltage if we make the gap between the plates \$\ell_2=2\ell_1\$ without changing the amount of charge on the plates?
My thoughts on this:
Increasing the gap will decrease the capacitance.
$$ C_2 = \dfrac{C_1}{2} $$
Since the amount of charge is unchanged, the new capacitor voltage will be
$$ V_2 = \dfrac{Q}{C_2} = \dfrac{Q}{\dfrac{C_1}{2}} = 2\dfrac{Q}{C_1} = 2V_1. $$
Is this true? Can we change the capacitor voltage just by moving its plates? For example, suppose that I'm wearing plastic shoes and I have some amount of charge on my body. This will naturally cause a static voltage, since my body and the ground act as capacitor plates. Now, if I climb a perfect insulator building (e.g.; a dry tree), will the static voltage on my body increase?
| The electric field between two parallel plates of area \$A\$ is roughly \$E = { Q \over \epsilon A} \$, hence the voltage at a distance \$x\$ apart will be \$V(x) = { Q x\over \epsilon A} \$.
So, doubling the distance will double the voltage.
The electric field approximation will degrade significantly as \$x\$ gets larger than some fraction of some characteristic dimension of the plates.
| 0.333333 | The electric field between two parallel plates of area $A$ |
SQL Server: update table from xml string | this is the first time I am working with an XML input in SQL.
I created the following procedure to insert all records from my XML string into my table which works well so far.
Can someone tell me how I have to change this so that it only inserts a record as new if the itemID (every record in my XML has this as well) does not yet exist in my table, column itemID - otherwise it should update the existing record with the new data from the XML.
I know how to use IF NOT EXISTS and UPDATE in general but am not sure how to realise this with an XML string as the input.
My procedure (so far):
ALTER PROCEDURE [dbo].[editor_UpdateQuestions]
@xml xml
AS
BEGIN
SET NOCOUNT ON;
INSERT INTO editor_Questions
(
categoryID,
question,
sortID,
modDate,
modBy
)
SELECT ParamValues.x1.value('categoryID[1]', 'int'),
ParamValues.x1.value('question[1]', 'nvarchar(1000)'),
ParamValues.x1.value('sortID[1]', 'int'),
GETDATE(),
ParamValues.x1.value('modBy[1]', 'varchar(50)')
FROM @xml.nodes('/ranks/item') AS ParamValues(x1)
END
Example XML input:
<ranks>
<item><itemID>25</itemID><categoryID>1</categoryID><question>some text</question><sortID>1</sortID><modBy>abc</modBy></item>
<item><itemID>12</itemID><categoryID>1</categoryID><question>some text 2</question><sortID>2</sortID><modBy>abc</modBy></item>
<item><itemID>9</itemID><categoryID>1</categoryID><question>some text 3</question><sortID>3</sortID><modBy>abc</modBy></item>
</ranks>
Many thanks in advance for any help with this, Tim.
| ;WITH new_Questions AS (
SELECT ParamValues.x1.value('itemID[1]' , 'int' ) AS itemID,
ParamValues.x1.value('categoryID[1]', 'int' ) AS categoryID,
ParamValues.x1.value('question[1]' , 'nvarchar(1000)') AS question,
ParamValues.x1.value('sortID[1]' , 'int' ) AS sortID,
GETDATE() AS date,
ParamValues.x1.value('modBy[1]' , 'varchar(50)' ) AS modBy
FROM @xml.nodes('/ranks/item') AS ParamValues(x1)
)
MERGE INTO editor_Questions AS old
USING new_Questions AS new
ON (new.itemID = old.itemID)
WHEN MATCHED THEN UPDATE SET
old.categoryID = new.categoryID,
old.question = new.question ,
old.date = new.date ,
old.sortID = new.sortID ,
old.modBy = new.modBy
WHEN NOT MATCHED THEN
INSERT ( itemId, categoryID, question, date, sortID, modBy)
VALUES (new.itemId,new.categoryID,new.question,new.date,new.sortID,new.modBy);
| 1 | MERGE INTO editor_Questions AS old |
Chicken Tikka Masala tastes a bit off | I have made chicken tikka masala recently and it turned out alright. I got the texture and look properly, but, however, the taste seems a bit off. I have used the chicken tikka masala, onions, cihlli powder, heavy cream, tomato puree and orange peppers, as per directions.
However the taste is not satisfying as I had in restaurants. Anyone can suggest anything to improve my taste? Any spices that I can add or something?
Thanks!
| You aren't getting the 'Indian restaurant' taste because you aren't using Indian restaurant techniques. Most Indian restaurant curries are based on a 'gravy' made with copious amounts of garlic, onions and ginger, stewed for several hours. They also use large amounts of ghee to add richness (and a boatload of calories), and finally they use marinaded chicken, cooked in a tandoor (a very hot, dry oven) which gives a unique flavour.
It is simply not possible to replicate the flavours at home without using the same ingredients or similar techniques. It is not something you can knock up in half an hour.
If you'd like to have a go at replicating a restaurant curry, try reading The Curry Secret by Kris Dhillion.
| 0.777778 | 'Indian restaurant' curries are based on a 'gravy' made with copious amounts of garlic, onions and |
Sharing JavaScript model code between server and client, is this approach valid? | I'm beginning learning Node.js and Backbone. I'd like to share some code between the server and the client (related to [1] and [2]). More in deep:
Share defaults values for a model. Defaults are used to populate forms (client-side), while they are enforced server-side
Share validation rules in order to be DRY and perform client/server validation
Share instance methods
So my idea is to use a factory object to encapsulate common code (defaults, validation rules, public instance methods) and adapt the factory object based on the environment (Node.js or AMD module).
This code is quick&dirty and may not work. Is this a good approach or just a waste of time?
(function (factory) {
if (typeof exports === 'object') { // Node.js
var config = require('../config/config.json'),
Sequelize = require('sequelize'),
_ = require('underscore');
var User = {
receiveSms: {
type: Sequelize.BOOLEAN, allowNull: false
},
receiveNewsletter: {
type: Sequelize.BOOLEAN, allowNull: false
}
};
// Add defaultValue for each returned by
_.each(factory.defaults, function (value, key) {
if(_.has(User, key)) {
User[key].defaultValue = value;
}
});
module.exports = function () {
(new Sequelize(config.database, config.username, config.password))
.define('User', User);
};
} else if (typeof define === 'function' && define.amd) { // AMD
define(['backbone', 'uderscore'], function (Backbone, _) {
return Backbone.Model.extend(factory);
});
}
}(function () {
return { // To be adapted
defaults: {
receiveSms: false,
receiveNewsletter: true
}
}
}));
| I think it's a better solution to use require.js (especially for using frameworks like underscore in multiple files). You should use a factory only for objects that change during the runtime. A shopping cart for example (but even in this example i think it's more appropriate to use a backbone collection that is given to your function as an argument when instantiated).
See more information here: http://requirejs.org/docs/node.html
| 1 | use require.js only for objects that change during runtime |
How to store length of time in a model with Rails? | I can think of two solutions:
1) Store hours, minutes, seconds, etc. in separate columns in the database
Downside: a lot of columns
2) Convert and store the number of seconds
We still want to be able to show seperate fields for hour, minute, second, etc. in the form. We could write virtual attribute for each of these and write a before_save callback that converts the timespan to seconds (still messy tho).
Am I missing some other obvious solution? How do you people do this?
| I prefer to have separate columns in the database if I'm receiving the input via 3 fields on the form - it keeps things much cleaner and simpler (and after all, nowadays a few extra columns in a table isn't much to worry about). Then all you need is a nice method to output the stuff nicely.
| 1 | I prefer to have separate columns in the database if I'm receiving the input via 3 fields |
Is Stormguard Warrior really that good? | I have an idea of build centered around the Crusader class, with some possible dips in Warblade/Swordsage to take advantage of the goodies in other disciplines (such as Ironheart Surge or Time Stands Still).
The dip in the Warblade class brings me the opportunity to take the Stormguard Warrior tactical feat, and I have seen it recommended a number of times specifically for its Channel the Storm option (ToB, p.36):
Channel the Storm: To use this option, you must choose to refrain from making one or more available attacks of opportunity against a single opponent. On your next turn, you gain a +4 bonus on attack rolls and damage rolls for each attack that you refrained from making against the same opponent. You gain this bonus only against an opponent that you refrained from making an attack of opportunity against in the previous round.
I am wondering if this feat is really that good. It seems that it requires a huge investment (in terms of feats) and it is unclear to me whether it really pays off.
The bonuses +4 AR/dmg per refrained AoO (which you have an infinite supply of (*)) do seem interesting, at first, however:
A prerequisite of Stormguard Warrior is Ironheart Aura, which in itself does not seem that interesting, especially for a Crusader (Thicket of Blade is not an Ironheart stance)
The bonuses gained can only be used against the opponent that generated them, and no other (it's a minor restriction, but worth keeping in mind)
An AoO is likely to do much more damage than 4, especially if using a two-handed weapon (even at level 1, we are looking at 1d10 + 6 ~= 11.5)
Thus, the two feats investment seems only worth it if one can generate more AoOs than one has available. In the recommendations I have seen, it is combined with Robilar's Gambit (-4 AR, 1 AoO per foe attack in melee) which itself requires Combat Reflexes. Dexterity is unlikely to be ignored (since it benefits Touch AC), and therefore we are looking at a minimum of 3 or 4 available AoOs per round...
Letting Combat Reflexes and Robilar's Gambit aside, is it really worth it investing in Ironheart Aura and Stormguard Warrior? Am I missing something?
(*) I have seen some debates where it is argued that refraining to take an AoO to fuel up Channel the Storm should use it up, which I ignore here. The feat is much worse in this case.
| Stormguard Warrior is an excellent feat – for building a character around
Stormguard Warrior can add huge amounts of attack and damage bonuses, but it requires that you be pretty dedicated towards generating attacks of opportunity to not take. Specifically, the feats Karmic StrikeCWar and Robilar’s GambitPHB2 are often used, because these feats allow you to take many more attacks of opportunity than you could otherwise (Karmic Strike allows you an AoO every time you’re hit, while Robilar’s Gambit allows you an AoO every time you’re attacked, whether they hit or not). Other ways of getting attacks of opportunity (defensive rebuke Devoted Spirit boostToB) or prevents others from avoiding them (thicket of blades stanceToB as mentioned, Mage Slayer featCArc) are also useful, but don’t add nearly as much as Karmic and/or Robilar’s.
But Ironheart Aura is pretty much a dead feat, yes, and without Karmic or Robilar’s, you’ll rarely see more than +4/+4 from Stormguard Warrior. +4/+4 for two feats isn’t entirely awful, of course; the Weapon Focus/Specialization line (which are awful) is four feats for +2/+4. If you have reach and thicket of blades, the +4/+4 seems pretty likely; using defensive rebuke can improve that dramatically. And it is pretty much expected that you’re using Power Attack with a big two-hander, so it’s really +0/+12. Basically, you’re trading extra attacks (attacks of opportunity) for more potent attacks in general (skip one AoO, get a full attack with +12 on each attack). So it’s not a terrible use of feats. Just not the highly-recommended one that it would be with Karmic and/or Robilar’s.
Also, note the Combat Rhythm option on Stormguard Warrior; it’s not nearly as explosive as Channel the Storm, but it is cool. Personally, I have always wanted to have that opportunity to combine it with avalanche of blades for hilarity. That’s not really an option for a crusader with a warblade dip, though.
The other thing to point out about Stormguard Warrior is that the Evasive Reflexes featToB uses the same “don’t take an AoO you could have, get something instead” mechanic, and like Stormguard Warrior, it doesn’t use up the AoO. You can use both Evasive Reflexes and Stormguard Warrior. This is particularly useful when you have thicket of blades – their 5-ft. steps provoke an AoO from you, which lets you 5-ft. step to keep up with them and gives you +4/+4. If that step was to try to get away from you so they could do something that provokes (say, cast a spell while you have Mage Slayer, or attack an ally after you hit them with defensive rebuke), you have either just prevented them from doing that, or are going to get pumped up even more.
| 0.888889 | Stormguard Warrior can add huge amounts of attack and damage bonuses . |
What filter should I use to avoid overly-whitened daylight images? | What filter should I use to avoid whitened images (blown highlights) caused by intense daylight? At the moment I am only using an UV Filter, but it doesn't solve the whole problem.
I am a newbie in photography, and I've recently bought a Nikon DSLR.
| Do you mean over-exposed? If so, use +/- button. That is Exposure-Compensation and lets you make things darker by going negative.
A UV filter does nothing for brightness, usually makes things worst only. Take off and replace with polarizer that darkens the sky (sometimes, if not cloudy).
| 1 | Do you mean over-exposed? |
Paradoxes without self-reference? | Most paradoxes involves self-reference, the only exception known to me is Yablo's paradox, however it is still debated if it is really without self-reference. So, I was wondering, are there other known paradoxes that works without self-reference?
| There's the Achilles and the tortoise paradox: In a race, the quickest runner can never overtake the slowest, since the pursuer must first reach the point whence the pursued started, so that the slower must always hold a lead.
The Dichotomy paradox is in some sense a particular case of the above: Suppose Homer wants to catch a stationary bus. Before he can get there, he must get halfway there. Before he can get halfway there, he must get a quarter of the way there. Before traveling a quarter, he must travel one-eighth; before an eighth, one-sixteenth; and so on.
| 0.888889 | In a race, the quickest runner can never overtake the slowest, because the slower must always hold a lead. |
Adding static route through group policy | We are trying to add a static route across all of our end user machines, we have setup a GPO object under Computer configuration > Policies > Windows Settings > Scripts (startup/shutdown) > Startup.
The command in the batch file is:
route add 172.17.10.0 mask 255.255.0.0 172.16.12.100 -p
We have then rebooted/forced group policy to update and upon running a 'route print' in command line there is no route added, however adding a route through command line works perfectly.
| I had the exact same problem, and my solution was the easiest "if not silliest" thing you can think of.
All I had to do to make the script work using Group Policy was to add entire command inside quotes ("), so the command route add 172.17.10.0 mask 255.255.0.0 172.16.12.100 -p should be "route add 172.17.10.0 mask 255.255.0.0 172.16.12.100 -p"
Agree with joeqwerty comment about fixing the subnet or the network ID.
| 0.777778 | "if not silliest" thing you can think of |
Parsing a Text to only see specific data | I have the following text lines:
.add 7971 [Player: Sunfire (Account: 11309) X: 5839.623047 Y: 600.437439 Z: 650.839722 Map: 571 Selected player: Llubia (GUID: 19369)]
.add 43956 [Player: Sunfire (Account: 11309) X: 5277.887695 Y: 2862.181641 Z: 446.735931 Map: 571 Selected none: (GUID: 0)]
.add 43956 [Player: Sunfire (Account: 11309) X: 5281.407715 Y: 2864.844482 Z: 446.735931 Map: 571 Selected player: Staticbaby (GUID: 19826)]
.add 43956 [Player: Sunfire (Account: 11309) X: 5231.464844 Y: 1437.029175 Z: 648.498535 Map: 571 Selected player: Sunfire (GUID: 15295)]
.add 44077 [Player: Sunfire (Account: 11309) X: 5231.464844 Y: 1437.029175 Z: 648.498535 Map: 571 Selected player: Sunfire (GUID: 15295)]
.add 49285 [Player: Sunfire (Account: 11309) X: 16225.323242 Y: 16252.759766 Z: 12.790466 Map: 1 Selected none: (GUID: 0)]
.add 44115 175 [Player: Elmasguapo (Account: 11309) X: 1659.845093 Y: -4198.589844 Z: 56.382870 Map: 1 Selected none: (GUID: 0)]
.add 34078 [Player: Sunfire (Account: 11309) X: 16227.969727 Y: 16280.081055 Z: 13.175169 Map: 1 Selected none: (GUID: 0)]
.add |cffffffff|Hitem:41427:0:0:0:0:0:0:0:80|h[Fuego de Artificio de Dalaran]|h|r 50 [Player: Sunfire (Account: 11309) X: 16221.392578 Y: 16260.944336 Z: 13.255954 Map: 1 Selected none: (GUID: 0)]
.add |cffffffff|Hitem:45932:0:0:0:0:0:0:0:80|h[Gelatina Negra]|h|r [Player: Sunfire (Account: 11309) X: 5874.347168 Y: 679.056763 Z: 167.483719 Map: 571 Selected player: Assasins (GUID: 19438)]
.add |cffffffff|Hitem:45932:0:0:0:0:0:0:0:80|h[Gelatina Negra]|h|r [Player: Sunfire (Account: 11309) X: 5873.767090 Y: 679.386841 Z: 167.435257 Map: 571 Selected player: Assasins (GUID: 19438)]
.add |cffffffff|Hitem:45932:0:0:0:0:0:0:0:80|h[Gelatina Negra]|h|r [Player: Sunfire (Account: 11309) X: 16226.880859 Y: 16247.247070 Z: 12.286857 Map: 1 Selected player: Irmtarget (GUID: 18521)]
.add |cffffffff|Hitem:45932:0:0:0:0:0:0:0:80|h[Gelatina Negra]|h|r [Player: Sunfire (Account: 11309) X: 16229.297852 Y: 16251.202148 Z: 13.081388 Map: 1 Selected player: Irmtarget (GUID: 18521)]
.add 41600 2 [Player: Sunfire (Account: 11309) X: 16223.138672 Y: 16250.496094 Z: 12.431313 Map: 1 Selected player: Eifreen (GUID: 20341)]
.add 41600 1 [Player: Sunfire (Account: 11309) X: 16223.138672 Y: 16250.496094 Z: 12.431313 Map: 1 Selected player: Eifreen (GUID: 20341)]
.add 40516 [Player: Sunfire (Account: 11309) X: 16223.138672 Y: 16250.496094 Z: 12.431313 Map: 1 Selected player: Eifreen (GUID: 20341)]
.add 44661 [Player: Sunfire (Account: 11309) X: 16223.138672 Y: 16250.496094 Z: 12.431313 Map: 1 Selected player: Eifreen (GUID: 20341)]
.add 40518 [Player: Sunfire (Account: 11309) X: 16223.138672 Y: 16250.496094 Z: 12.431313 Map: 1 Selected player: Eifreen (GUID: 20341)]
.add 44005 [Player: Sunfire (Account: 11309) X: 16223.138672 Y: 16250.496094 Z: 12.431313 Map: 1 Selected player: Eifreen (GUID: 20341)]
.add 45867 [Player: Sunfire (Account: 11309) X: 16223.138672 Y: 16250.496094 Z: 12.431313 Map: 1 Selected player: Eifreen (GUID: 20341)]
.add 45316 [Player: Sunfire (Account: 11309) X: 16223.138672 Y: 16250.496094 Z: 12.431313 Map: 1 Selected player: Eifreen (GUID: 20341)]
And I want to parse it so it outputs something like this:
Line 1 For example - 7971 Llubia
Line 3 For example - 43956 Staticbaby
Line 9 For Example - 45932 Assassins
And so on.. This is done in the terminal with commands like cut, grep, cat, etc..
UPDATE: Here is the whole file: http://paste2.org/p/1744102 to parse in that way.
UPDATE2: Please forgive me if I do not accept an answer just yet. Am waiting for the bounty option to appear since for me, stuff like this deserve a bounty. So I will add a bounty and give it to the correct answer or answers.
| awk '
# ignore lines with "none:" or "player:" in $(NF-2)
$(NF-2) ~ /^(none|player):$/ {
next # read next line
}
{
# remove dots from $2 in every line
gsub(/\./,"",$2)
}
/\|Hitem:/ {
# if it has "|Hitem:" in $2, remove everything
# before and after the colons
sub(/.+\|Hitem:/,"",$2)
sub(/:.+/,"",$2)
print $2,$(NF-2)
next # read next line
}
{
print $2,$(NF-2)
}
' your_file.txt
Line 380 has Selected player: (GUID: 6873)]. You have to decide what to do with such lines (ignore them? print the GUID instead?).
| 0.777778 | awk ' # ignore lines with "none:" or "player:" |
what age are you | Is the question of "what age are you" idiomatic,common or does it sound naturally in the meaning of " how old are you "
Can we say this structure could be used for materials as " how age is it "
|
Is the question of "what age are you" idiomatic,common or does it
sound naturally in the meaning of " how old are you "
Can we say this structure could be used for materials as " how age is
it "
"What age are you?" is definitely not idiomatic. Using it would mark you instantly as a non-native speaker. However, it makes logical sense and it would be understood.
"How age is it?" would be even worse. While most native speakers could likely figure out what this meant, it sounds simply wrong.
If you were asking a person about his or her age, you'd almost always say "How old are you?" or "What year were you born?" or "When you were born?" -- with the first one being by far the most common.
If you were asking about an object, you would usually say "How old is it?" But you might also say "When was it built?" (in reference to a building or structure) or "How long has it been here?" or "How many years has it been here?" or "How long has it been around?" -- again, the simple "How old is it?" would be most common.
| 0.888889 | How old is it? |
Private IP getting routed over Internet | We are setting up an internal program, on an internal server that uses the private 172.30.x.x subnet... when we ping the address 172.30.138.2, it routes across the internet:
C:\>tracert 172.30.138.2
Tracing route to 172.30.138.2 over a maximum of 30 hops
1 6 ms 1 ms 1 ms xxxx.xxxxxxxxxxxxxxx.org [192.168.28.1]
2 * * * Request timed out.
3 12 ms 13 ms 9 ms xxxxxxxxxxx.xxxxxx.xx.xxx.xxxxxxx.net [68.85.xx.xx]
4 15 ms 11 ms 55 ms te-7-3-ar01.salisbury.md.bad.comcast.net [68.87.xx.xx]
5 13 ms 14 ms 18 ms xe-11-0-3-0-ar04.capitolhghts.md.bad.comcast.net [68.85.xx.xx]
6 19 ms 18 ms 14 ms te-1-0-0-4-cr01.denver.co.ibone.comcast.net [68.86.xx.xx]
7 28 ms 30 ms 30 ms pos-4-12-0-0-cr01.atlanta.ga.ibone.comcast.net [68.86.xx.xx]
8 30 ms 43 ms 30 ms 68.86.xx.xx
9 30 ms 29 ms 31 ms 172.30.138.2
Trace complete.
This has a number of us confused. If we had a VPN setup, it wouldn't show up as being routed across the internet. If it hit an internet server, Private IP's (such as 192.168) shouldn't get routed.
What would let a private IP address get routed across servers? would the fact that it's all comcast mean that they have their routers setup wrong?
|
would the fact that it's all comcast mean that they have their routers setup wrong?
Set up wrong? Yes, private addressing should absolutely be filtered within the interior of their network. But if they've been a bit sloppy then it's possible if the path is all Comcast- in carrier networks, especially sloppy ones like Comcast, private addressing is filtered at the edge networking diligently, but not nearly as much at the core or access portions. In your case it appears that the entire route is Comcast-only, so it is 'reasonable' that this might actually be forwarded to a destination also within Comcast that actually answers for it. It isn't a clean networking implementation, to be sure, and you did go from the Baltimore area to Denver and finally to Georgia, but it is possible within a complete "autonomous system" that allows for it.
| 0.666667 | Private addressing should absolutely be filtered within the interior of their network |
Word for a result/achievement so exceptional that it is impossible? | I am looking for a word or phrase regarding something that is "impossible". I can't seem to put my finger on it, but I am trying to think of the word to describe something that is the top of the top, and thus impossible to achieve?
The only two words I have come up with are elusive and formidable, neither of which really mean what I want them to mean. I want something more clever to put it plainly.
| Unassailable sounds like it might fit the bill.
Impossible to dispute or disprove; undeniable: unassailable truths.
Not subject to attack or seizure; impregnable: an unassailable fortress.
thefreedictionary.com
Example sentence:
Liverpool football club are still looking unassailable.
Which is synonymous with:
Defeating Liverpool football club still looks impossible.
| 1 | False |
How should I store leftover rice noodles? | I seem to recall reading somewhere that you should store leftover cooked rice noodles in water. Is this right? I don't want them to bloat and become ruined.
I also seem to recall reading somewhere you could revive stuck pasta by running it in (cold?) water.
How should I store leftover cooked rice noodles to best preserve them for a day or two?
UPDATE: I tried storing them in cold water, and that's definitely not the way to go; the rice noodles bloated to about double their original thickness. They taste fine, just not what I was looking to accomplish.
| How are you eating them? For me, reheating these noodles automatically overcooks them and I can never get a good consistency out of repeats. I use leftover noodles one of two ways: in a salad or dropped in soup. For the former, I toss the leftovers in olive oil and store them in the fridge. The oil keeps a protective seal around the noodles so they keep their tooth. The next day, I chop some fresh vegetables and mix in the noodles, and season. In soup, there's no need to prepare them, just drop refrigerated noodle clusters in hot water and they separate. The result is soft noodles, which may not be your preference.
| 1 | How are you eating leftover noodles? |
How can I remove an element whose ID starts with "A" and ends with "Z"? | I have the following script
<script type="text/javascript">
$(document).ready(function(){
if ($("input[id^='ABCD']").$("input[id$='Z']")) {
$("input[id^='ABCD']").$("input[id$='Z']").remove();
}
})
</script>
And I want to remove the elements whose ID starts with "ABCD" and ends with "Z".
How can I do that?
| Here is another approach. It might be a little quicker if you're working with a lot of elements.
$('input').filter(function(){
return this.id.slice(0,4) === 'ABCD' && this.id.slice(-1) === 'Z';
}).remove();
Demo: http://jsbin.com/fahupube/1/edit?html,js,output
| 1 | Using a lot of elements can be a little easier |
What am I losing when using extension tubes instead of a macro lens? | After playing around with macro photography on-the-cheap (read: reversed lens, rev. lens mounted on a straight lens, passive extension tubes), I would like to get further with this. The problems with the techniques I used is that focus is manual and aperture control is problematic at best. This limited my setup to still subjects (read: dead insects) Now, as spring is approaching, I want to be able to shoot live insects. I believe that for this, autofocus and settable aperture will be of great help.
So, one obvious but expensive option is a macro lens (say, EF 100mm Macro) However, I am not really interested in yet another prime lens. An alternative is the electrical extension tubes.
Except for maximum focusing distance, what am I losing when using tubes (coupled with a fine lens, say EF70-200/2.8) instead of a macro lens?
| You'll also loose some light with extension tubes. Not to mention you'll loose the cool bokeh of the 100mm lens. Also, zoom lenses will do strange things with extension tubes, zooming out will dramatically change the focus, for instance. Also, from the experience of @rfusca, I understand that the range can be quite limited, maybe only a few inches, depending on the lens.
Still, the electrical connected ones can be a step somewhere between, and are much better than the screw on lenses that exist.
| 1 | Zoom lenses will do strange things with extension tubes |
Adjustment to road bike brakes for high grade downhill | I have a road bike with a front brake that wears a lot of brake pad when I ride downhill every day. I lose 900ft in elevation on steep grades with lots of stop signs and traffic lights. On top of that, it rains a decent amount and the rim brakes are terrible in that weather. I don't trust them downhill in the rain. Sometimes I just walk.
I feather the brakes going downhill, because otherwise I'm too fast to stop quickly for an errant car.
It'd be nice to not constantly replace pads, and have powerful stopping. How can I make this constant downhill more pleasant?
Thanks.
|
You can replace the pads (as stated elsewhere). There are a lot of variations in pad material, and a faster-wearing pad is not necessarily a better braking pad. Unfortunately, it's hard to find a good selection of pads, and even harder to get good info on which is suitable to which conditions.
You can use your rear brake more, especially for speed control, and save the front for more "serious" efforts. When I'm on a downhill (rarely as steep/long as yours, though) I like to alternate between front and rear brakes for speed control, and I do it more in bursts rather than with steady pressure. I'm not sure if this is "approved" technique, but it's what makes sense to me.
You can install a second set of calipers. This is often done on tandems, and can be done simply on some bikes/with great difficulty on others. (Of course, you'd need to figure out how to operate the extra set, without growing a third hand, and you do have to worry a little about the rim overheating.)
You can get disk brakes (though from the war stories I hear here it's not clear that they are really any better in such a situation).
| 1 | a faster-wearing pad is not necessarily a better braking pad . |
Dealing with digital circuits and their associated switching speed? | When designing a digital one-minute counting circuit I came across a difficult problem.
Basically, I designed the circuit to drive the (normally HIGH) clock of the 10s slot low if the 1s slot's current state was 9 (actually, just if the first and last bits are HIGH -> 1001)
The devices I am using are positive edge, so when the 1s slot returns to zero the condition is no longer satisfied - therefore the clock returns to a HIGH state and increments the 10s slot.
The problem is that I was getting double clock problems(7->8 transition and the designed clock mechanism).
It turns out that there was just enough delay in the switching between 7 -> 8 (0111 -> 1000) that the first/last bit HIGH condition is satisfied:
i.e., some combination occurs in the transition period to register a logical HIGH at the output
1001 1011 1101 1111
The temporary solution to the problem I came up with was to actually keep the clock for the 10s slot LOW until the condition where the 1s slot equals 0 (0000) is satisfied(So, essentially clock WHEN we get to the state as opposed to before). However, this solution requires too many gates (a 4-input NOR minimum). My previous design was actually fed from another part in the design that is already present, so it didn't require any additional circuitry.
Any ideas on a more efficient solution?
The IC's used in this design are the 74LS47 (7Segment decoder) and the 74LS163 (4-bit binary counter). The pull-down resistor inclusion is a mechanism to set the counters to 00 and hold while the switch is closed.
| The '163 is a synchronous counter (with synchronous reset), so there's absolutely no excuse for trying to use it with a "ripple"-style clock.
Instead, you should have the clock inputs of both counters connected to your clock source, and you should use the "Enable P" and "Enable T" inputs to control when the second counter advances.
| 0.888889 | '163 is a synchronous counter with synchronous reset |
How to change Default Screen Options in Wordpress | I'm looking for a way to change the default screen options in the post editor.
I want to hide certain options by default. I am putting together a family recipe site and don't want to overwhelm users with too many options. I don't want to log in as each user and changing their options manually. I've combed through WP core files and theme files and can't find very many references to screen-options. Is it defined somewhere in the database?
Thanks in advance.
| The default screen options are saved in wp_usermeta the meta_key is metaboxhidden_post.
I think the easiest way to set default options (or to hide specific boxes) would be to use a plugin like adminimize. I personally use the advanced custom fields plugin for this task (and a lot more).
| 0.888889 | The default screen options are saved in wp_usermeta |
Framing section headings | I'm attempting to put a frame around my section headings. I am using the package mdframed which adds functionality to the framed package. It basically draws a box around an object, in an environment. So I wonder how I can do this. Can I use \renewcommand, for example? I'd really like to use mdframed to create the frame.
| A very hands-on approach to modifying the sectional representation is possible by redefining \section as a whole. Vincent Zoonekynd's LaTeX website on sections does exactly this, and provides 37 different section definitions, including framing the title. Not always as pretty/clean as using a package (as in the other answers), but it does give the user control over every detail of the typesetting.
Here's example 31 in the form of an MWE, with modifications to use lipsum:
\documentclass{article}
\usepackage{lipsum}% http://ctan.org/pkg/lipsum
\makeatletter
\def\section{\@ifstar\unnumberedsection\numberedsection}
\def\numberedsection{\@ifnextchar[%]
\numberedsectionwithtwoarguments\numberedsectionwithoneargument}
\def\unnumberedsection{\@ifnextchar[%]
\unnumberedsectionwithtwoarguments\unnumberedsectionwithoneargument}
\def\numberedsectionwithoneargument#1{\numberedsectionwithtwoarguments[#1]{#1}}
\def\unnumberedsectionwithoneargument#1{\unnumberedsectionwithtwoarguments[#1]{#1}}
\def\numberedsectionwithtwoarguments[#1]#2{%
\ifhmode\par\fi
\removelastskip
\vskip 3ex\goodbreak
\refstepcounter{section}%
\hbox to \hsize{%
\fbox{%
\hbox to 1cm{\hss\bfseries\Large\thesection.\ }%
\vtop{%
\advance \hsize by -1cm
\advance \hsize by -2\fboxrule
\advance \hsize by -2\fboxsep
\parindent=0pt
\leavevmode\raggedright\bfseries\Large
#2
}%
}}\nobreak
\vskip 2mm\nobreak
\addcontentsline{toc}{section}{%
\protect\numberline{\thesection}%
#1}%
\ignorespaces
}
\def\unnumberedsectionwithtwoarguments[#1]#2{%
\ifhmode\par\fi
\removelastskip
\vskip 3ex\goodbreak
% \refstepcounter{section}%
\hbox to \hsize{%
\fbox{%
% \hbox to 1cm{\hss\bfseries\Large\thesection.\ }%
\vtop{%
% \advance \hsize by -1cm
\advance \hsize by -2\fboxrule
\advance \hsize by -2\fboxsep
\parindent=0pt
\leavevmode\raggedright\bfseries\Large
#2
}%
}}\nobreak
\vskip 2mm\nobreak
\addcontentsline{toc}{section}{%
% \protect\numberline{\thesection}%
#1}%
\ignorespaces
}
\makeatother
\pagestyle{empty}
\begin{document}
\section*{Introduction}
\lipsum[1]
\section{Suite}
\lipsum[2]
\section{Suite}
\lipsum[3]
\section{Fin}
\lipsum[4]
%\tableofcontents
\end{document}
| 0.777778 | redefining section as a whole provides 37 different sections definitions . |
why do hosting co charge so much just for RAM? | I'm a little confused, I realize hosting co. are there to make money, but why is it that RAM is so cheap these days and the monthly cost for just adding more ram is so much?
why doesn't someone come out and just break even on RAM and destroy the market? (someone has to, I mean there are so many companies...)
| Because;
Very often you're buying a virtual server,
These companies want as many virtual servers per physical server a possible,
While VMWare/Xen/whatever can easily time-slice all those low-CPU virtual servers even VMWare's memory overcommitment isn't as good as its vCPU equivalent,
So virtual server providers need to stuff their servers with memory,
Servers that take a lot of memory aren't cheap,
Bigger, more reliable, memory chips cost more than small, consumer memory - MUCH more.
and the most important reason - people will pay their rates for it, so why should they stop?
| 0.666667 | Why should they stop buying a virtual server? |
how to calculate intersection time and place of multiple moving arcs | I have rocks orbiting moons, moons orbiting planets, planets orbiting suns, and suns orbiting black holes, and the current system could have many many layers of orbitage.
the position of any object is a function of time and relative to the object it orbits.
(so far so good).
now I want to know for a given 2 objects(A,B), a start time and a speed, how can I work out the when and where to go. I can work out where A and B is given a time.
so i just need.
1: direction to travel in from A to B(remember B is moving(not in a straight line))
2: Time to get to b in a straight line.
travel must be in a straight line with the shortest possible distance.
as an extension to this question, how will i know if its better to wait, EG is it faster to stay on object A and wait for a hour when the objects may be closer, than to set off from A to B at the start.
Cheers, it hurt my brain.
| If your bodies are subject to complex orbits it may well be difficult or impossible to solve using a closed-form expression (solve an equation to get the desired results.
One approach would be to perform a mathematical simulation over time to arrive at a solution.
In your case, a body leaving A at a time t0 travelling in a straight line with velocity v will be somewhere on the circumference of a circle or (sphere in 3D) with radius vt (t=time since leaving). The centre of the circle will be the position of A at the time of launch (Apos(t0)). You can imagine this circle like a ripple on a pond getting bigger over time)
Assuming you can calculate the position of B at time t+t0 (Bpos(t+t0)), you can create a simulation with a loop to find out the earliest time that the growing circle intersects B's path
searching=true
t=0
while(searching){
if (distance between Apos(t0) and Bpos(t0+t)) < v*t then{
searching=false //found a solution
target_position=Bpos(t0+t) // can be used to find direction to head in
time_to_reach_B=t
}
else
t+=delta_t //a small time step (smaller = more accuracy)
}
You will of course have to add code to prevent an infinite loop in the case that there is no solution (or no solution to be found in reasonable time).
Depending on the complexity or B's motion and the value of delta_t, this algorithm is not guaranteed to find the ideal solution in every case, but should work well for the vast majority of cases.
| 0.888889 | Calculate position of A at time t0 (Apos(t0)) |
How to choose between multiple math postdocs offers? | I am trying to decide between some math postdoc offers, and I can't decide what is important for a postdoc position. I have talked to several senior mathematicians including my advisor, but they all seem to have different opinions. I just want to hear some more opinions on the following:
How important is prestige? Suppose that I have an offer from school X, which is fairly prestigious (something like top 10, which isn't a well-defined notion). Also suppose that I have an offer from school Y, which is not as prestigious but a better match research-wise. Suppose that the ranking of school Y is approximately n (again, not a well-defined notion). For which values of n should I choose school X over school Y? My goal is to become a tenure-track professor in a PhD-granting institution.
What makes a good postdoc supervisor? I can think of the following criteria: compatible research interests, being well-known in one's field, compatible personalities, generous with time, etc. Am I missing anything else?
| nagniemerg is absolutely right that at the end of the day, your results will be much more important than a name on your CV. I think being at a prestigious institution is very useful for getting a first look at your application (which is a f***ing valuable thing, as Rod Blagojevich would say); if the rest of what's there doesn't stand up, getting that look won't help much.
That said, I would think carefully about how sure you are that institution Y really will provide a better research environment. Prestige tends to correlate (far from perfectly) with having an active department with a lot of seminars and visitors, which can often be more valuable than day-to-day contact with a single advisor. Having higher-quality students and colleagues can make you a better researcher.
I also think there's a lot to be said for the uncertainty of life. Maybe you'll go somewhere and whoever you were going to work with will get a job somewhere else, or have a baby, or go on sabbatical. Maybe you'll start a collaboration with someone you don't even know exists yet. It's all very hard to predict, and on some level you have to go with your gut. You could do a lot worse than just going with the most prestigious option, but if other factors seem to point another direction, I don't think you should just ignore them.
EDIT: I wrote this is a bit of hurry last night, and I realize it might be a bit unhelpful. However, it's honestly quite difficult to say anything general, and you indicate that senior mathematicians who know you and know what your options are cannot come to a consensus. To me this indicates that probably you will not be able to conclusively figure out where is the better choice. This is not to say it doesn't matter, but once the uncertainties are sufficiently large, one might as well flip a coin (or at least flip a coin until you get the answer you want).
| 1 | a prestigious institution is very useful for getting a first look at your application . |
How do I find which elements in one array aren't in another? | I am new to programming and hence I am stuck on a basic level problem.
Following is code I wrote for comparison. But the result I get does not make sense to me. I would appreciate if someone could tell me what is going wrong.
There are two arrays: @array1 , @array2 of unequal length.
I wish to compare both and list down values not present in @array1.
my %temp = map {$_,$_}@array2;
for (@array1){
next if exists $temp{$_};
open (FILE, ">>/filename") or die "$!";
print FILE "$_\n";
close(FILE);
}
| Swap @array1 and @array2 in your code?
| 1 | Swap @array1 in your code? |
What is the difference between "Mongolian Grill" and "Hibachi"? | For years I have been frequenting Chinese restaurants that feature "Mongolian Grill" (or Mongolian BBQ depending on the location). Recently I tried a new place that had (what they called) "Hibachi", which looked very similar, and I originally mistook for 'the same'. When I inquired about the Mongolian grill I was informed that there is a difference. While the host went on about what those differences are I am afraid that the subtleties were "lost in translation".
Can someone clarify for me what the differences are?
| Hibachi are technically a traditional Japanese device used for heating one's house. They are a basic, heat-proof container that holds charcoal.
The cooking devices that many people refer to as "hibachi" are what the Japanese would call "shichirin":
I'm guessing that the term "hibachi" was popularized in North America because "shichirin" can be hard to pronounce for Anglophones.
Somewhere along the way, primarily in North America, the term "hibachi" also started to be used to refer to teppanyaki:
I'm not sure when or why this started; perhaps it has something to do with the fact that Banihana confusingly refers to their teppanyaki restaurants as "hibachi-style".
Among these, teppanyaki is most similar to Mongolian barbecue, in which meat is cooked on large, round, cast iron griddles:
(Images taken from Wikipedia.)
If you were to actually go to a Japanese restaurant and cook your own food over a shichirin, it would likely be referred to as "yakiniku", which is believed to have some origins in Korean barbecue.
Whereas teppanyaki has been a traditional Japanese cooking method for a long time, "Mongolian barbecue" was developed in the 1970s in Taipei, Taiwan. During that time, Japanese Teppanyaki was very popular in Taiwan, so many people speculate that was actually the inspiration for Mongolian barbecue. There are also some similarities between the Japanese dish "jingisukan" and Mongolian barbecue, however, jingisukan predates Mongolian barbecue.
| 1 | Hibachi are a traditional Japanese cooking device used for heating one's house |
Change published date to 12 hour time | Right now my nodes say published by "author name 19:02". How can I change it to display 12 hour time 7:02?
| It uses the default date format of the site, which is medium. You can configure that at admin/settings/date-time and choose a format which uses am/pm.
You can also implement hook_preprocess_node() in your theme or module and then override the 'submitted' variable set by template_preprocess_node(). That allows you to use a different date format just there.
| 0.888889 | Default date format of the site |
How can I fully automate the creation and configuration of a SharePoint virtual machine? | I typically require multiple SharePoint virtual machines for development purposes. I currently manually build these every time I need one, either starting from a fresh OS install or using sysprep when working with SharePoint 2010 and SQL Server 2008 R2. I currently use VMWare, but am open to VirtualBox or Hyper-V.
I'd like to be able to go from zero to a working VM with SharePoint, SQL and Visual Studio all through script. Is this a feasible task? Or are there more practical methods which would start from a VM with a fresh installation of an OS, and then use more standard unattended installs.
Although general, I'd like to know which direction to focus my efforts.
Thanks in advance,
vnat
| If you are using vmware server you can look into the snapshot feature to create a primary VM then take the snapshot as you have tweaked to your liking. Then you can utilize the snapshot manager to "revert" back to a clean vm when your project is complete.
If you are using the the vmware workstation then you would be best server to follow David's advice.
Virtualbox too has this ability and it is included free, so if cost is an issue perhaps that is a better choice.
| 0.888889 | vmware server snapshot to create primary VM |
Should I include high school details in Grad School Resume? | I was wondering if I should include my high school details in the resume of my graduate school application ? It's unclear about this bit since we are not actually submitting any proof of high school records during grad school application( they only ask for undergraduate details).
But my high school final examination details are particularly good (better than my undergraduate credentials infact!)
| Ordinarily the answer is no, because it is no longer relevant to your aptitude for college, let alone graduate studies.
But if you won some national (or even local) science fair award for research in your current (or a related field), that would be relevant.
| 1 | if you won a national (or even local) science fair award for research in your current (or related field) field, that would |
Given Ohm's law, how can current increase if voltage increases, given fixed resistance? | According to Ohm's law, V=IR (voltage equals current times resistance).
So if the voltage increases, then the current increases provided that the resistance remains constant.
I know that Voltage or potential difference means work done per unit positive charge in bringing that charge from one point to another.
So according to Ohm's law, if the work done per unit charge increases then current will increase. How can this be true? Point out my mistakes.
| I think you've answered that yourself. If you are putting more work into moving unit of charge, then that unit of charge is going to move faster (all else being constant). Current is the flow electric charge across a surface at specific rate (1 ampere = 1 coulomb per second) and hence - more voltage, more work, faster flow (rate), higher current.
| 1 | putting more work into moving unit of charge |
What is best practice for UX surveys of a mobile application? | I developed an Android application and I want to make a survey/questionaire about the usability, user interface, user experience etc. of my application to get some feedback from users. But I don't know which kind of questions to ask...
I would like to know If there are some links/tools/books that can help me.
| Well, the ideal way to discover usability issues with with in-person user testing, so if you think you could arrange a session with, say, five or six participants, that would be best. You can get much, much richer data that way - some usability issues are very difficult to capture by Q&A.
Still, questionnaires aren't useless - though they will be affected by response bias (as well as self-reporting issues, memory biases and 'response acquiescence', where participants will tend to agree with statement questions). What sorts of questions you ask will depend on the kind of application you're talking about, and issues you already expect to see, but some starting points are:
Did you always feel like you knew what to do and where to click?
Did you ever do something and got an unexpected result?
Did you feel you could trust the application and the organization behind it?
Did you find the application attractive?
Did this application act and feel like other, more familiar applications?
How quickly could you get what you wanted with this application?
As for designing the questionnaire, you might be interested in this article by Nokia on mobile questionnaires for smartphone apps.
| 1 | How quickly could you get what you wanted with in-person user testing? |
Change image levels quickly | I have an image with a few shades of grey in it. I need to change some of those shades into white. Is there anything more efficient than going through each pixel one by one and check its RGB values? Is it perhaps possible to somehow posterize the image with some built-in function?
| Blender is a bit limited as an image editor, you may find using an external image editor easier. One option is to use the compositor were masking nodes can be used to select a colour to use as a mask for other nodes.
As your asking with the tag of python, you can access the raw image data through bpy.data.images['img_name'].pixels[x]. This is a list of floats that makeup the pixel data, there are 4 per image pixel (red,green,blue,alpha). You can get the width and height through bpy.data.images['img_name'].size.
for p in bpy.data.images['img_name'].pixels:
if p < 0.45 and p > 0.48:
p = 0.2
| 1 | Blender is a bit limited as an image editor |
Does following "musical forms" suppress "creativity"? | I'm not a professional musician (actually, I'm a computer programmer), but I'm playing Guitar and Recorder, and I also sometimes write some themes coming to my mind.
Thus, let's assume that I'm a little novice composer. Now, when a theme comes to my mind (or a simple motif), I start developing it, based on my intuition, and based on my sensational analysis. I only extend it, the way it sounds good to me. In other words, I don't follow any kind of musical form to extend (I can't find a better word for it) my theme into a more complete piece.
On the other hand, when I give the extended song to my close friends, or my wife, or people close to me, they might like it, only based on its aesthetic value, not based on its musical and technical analysis. In other words, they say like "oh, it's beautiful".
However, when I try to put my song in a musical form, and to my opinion, make a highly technical piece, I feel that it looses its beauty (of course, IMO), and people around me say "the way before it was more beautiful".
Now, I have a question. Should we follow musical forms? Why we have to confine ourselves to musical form at all? Isn't it true that we only create music, because of its aesthetic value? Does following form suppresses creativity in art, which in turn suppresses beauty and ingenuity of our work of arts?
| If you're not following any existing form, it becomes encumbant on you to construct the form anew. Without form, you'll have real difficulty making the song listenable beyond a certain length. It's the same with programming. Beyond a few thousand lines, the lack of structure makes the entire enterprise unweildy.
So it is very useful to learn how to follow this or that form, so you can steal little bits of structure.
Eg. I had a little guitar riff that was very catchy. You could speed it up, slow it down, add drones, lead lines. But I could not, for the life of me, make it go anywhere. When I finally began to wonder why, theory showed the way. The riff was essentially a 2-measure chord progression: I / / / | V / / /. I couldn't start a new phrase (bridge/chorus/anything "different but the same") on V because I was already there. So I had to steal pieces from other forms: deceptive cadence or "sitting" on I the last time round (of some binary repetitions) [this one actually makes the "new phrase on V" possible].
On the otherhand, it can be very interesting to start out following a form, and then radically depart from it. So you will find it useful to be aware of forms, so you can make conscious choices about when to follow, when to lead.
In other words, Knowledge of Forms is the glue you put under your shoes in order to stand on the Shoulders of Giants.
| 0.888889 | How to follow a form? |
Error in dsPIC33 Family Reference Manual Oscillator? | I'm using an external 20MHz (categorized as high-speed or HS range) resonator and using PLL, but I'm not able to clock the device up anywhere near the max cpu speed advertised. How are you ever supposed to achieve 120MHz for F_SYS?
See section 7.7: Phase-Locked Loop, p.7-23:
Constraints:
0.8 MHz ≤ F_PLLI ≤ 8.0 MHz
120 MHz ≤ F_OSC ≤ 340 MHz
15 MHz ≤ F_SYS ≤ 120 MHz @ 125ºC
Equations:
\$F_{PLLI} = \dfrac{F_{IN}}{(PLLPRE + 2)}\$
\$F_{OSC} = F_{IN} \cdot \dfrac{(PLLDIV + 2)}{(PLLPRE + 2)}\$
\$F_{SYS} = F_{IN} \cdot \dfrac{(PLLDIV + 2)}{((PLLPRE + 2) \cdot 2 (PLLPOST + 2))}\$
If you can get to 340MHz, the highest you can go is if PLLPOST = 0: 340MHz / (2 * (0 + 2)) => 85MHz!
| You appear to have your \$F_{SYS}\$ and \$F_{OSC}\$ formulae mixed up, per the datasheet you cited.
\$F_{SYS} = F_{IN} \cdot \dfrac{(PLLDIV + 2)}{(PLLPRE + 2)}\$
\$F_{OSC} = F_{IN} \cdot \dfrac{(PLLDIV + 2)}{((PLLPRE + 2) \cdot 2 (PLLPOST + 1))}\$
By my math, with a 20MHz crystal and the following settings, you should get 240MHz at \$F_{SYS}\$ and 120MHz at \$F_{OSC}\$:
PLLPRE: 4
PLLDIV: 70
PLLPOST: 0
\$F_{SYS} = 20MHz \cdot \dfrac{72}{6} = 240MHz\$
\$F_{OSC} = 20MHz \cdot \dfrac{72}{(6 \cdot 2)} = 20MHz \cdot \dfrac{72}{12} = 120MHz\$
| 1 | F_SYS$ and $F_OSC$ formulae |
more fun with inside-table spacing --- setspace | vertical spacing is witchcraft, as far as I can tell. I have put in everything that I could think of that could possibly force the explain environment contents to be tightly vertically spaced. It works in the main text. The macros themselves inside the explain environment are working, too. alas, the environment definition itself does not when inside the table. huh?
\documentclass{article}
\usepackage{setspace}
\newenvironment{explain}{%
\medskip\par%
\renewcommand{\baselinestretch}{0.1}
\setstretch{0.1}
\large\mbox{X}\footnotesize
}{%
}
\setstretch{0.1}
\begin{document}
\begin{table}
\begin{explain}
This fails. This is the time. This is the time. This is the time. This is the time. This is the time. This is the time. This is the time. This is the time. This is the time. This is the time.
\end{explain}
\end{table}
\begin{table}
\renewcommand{\baselinestretch}{0.1}
\setstretch{0.1}
\large\mbox{Y}\footnotesize
This works. This is the time. This is the time. This is the time. This is the time. This is the time. This is the time. This is the time. This is the time. This is the time. This is the time.
\end{table}
\begin{explain}
This works. This is the time. This is the time. This is the time. This is the time. This is the time. This is the time. This is the time. This is the time. This is the time. This is the time.
\end{explain}
\end{document}
what did I do wrong (this time)??
| The line spacing of a paragraph is done, when TeX breaks the paragraph into lines. This happens at the end of the paragraph.
In the case of the question, environment explain uses \setstretch{0.1} and \footnotesize. At the end of the environment, the paragraph has not yet ended, but the environment does. Therefore the local settings of the environment are lost and the paragraph end by the next empty line uses the settings that are active after (= before, = outside) the environment.
As Barbara Beeton said in her comment, \par in the end part helps (if it is ok, if the environment ends the paragraph).
\newenvironment{explain}{%
\par
\medskip
... \footnotesize
}{%
\par
}
| 0.888889 | setstretch0.1 and footnotesize' |
Standard small header size | Currently, I'm using standard headers with a pitch of 2.54mm (0.1"). These are quite big on my boards. Are there any surface mount standard headers, say in 0.05"?
| Samtec has a pretty wide range of small headers. 0.050" pitch is a standard size. They probably go smaller as well.
A few examples:
male headers
surface mount sockets
| 1 | Samtec has a pretty wide range of small headers |
Can I make a graph of savings in Quicken? | I've used the "Reports and Graphs" section of Quicken in a very basic capacity to see where my money has been going -- "Income / Expenses" and "Spending by Category" mostly -- and I've been trying to branch out and try the other reports/graphs to get a better idea of my finances.
Here's what I'd like to do: See a simple graph that shows how much of my money went to Savings each month.
The closest I've found is the "Net Worth" chart, where the amount it goes up (or down) is the amount I've saved (or overspent). I'd like one that shows (Total Income - Total Expenses) over time. I've also tried the "Income/Expense" Graph, but that shows separate bars for income and expense, and I want to show a single bar (or a line graph would be nice too).
| I looked around and I don't think there's any way to do what you want completely in Quicken. This should get you the graph, though:
Go to Reports -> Reports and Graph Center in the main menu.
In the Quicken Standard Reports section, go to Net Worth.
Click the Customize button.
On the Customize Income/Expense by Category window, on the Accounts tab, click Clear All, and add back in the account(s) you want to track.
Click Show Report. Adjust the dates and periods to what you want (weekly, monthly, etc.)
Click Export and select Copy report to Clipboard.
Fire up your favorite chart-capable spreadsheet program (I used OpenOffice Calc) and paste the report in.
Now, create the change in net worth using the net worth figures. This is just a difference from period to period.
Create your chart of dates vs. this difference data (line chart, bar chart, etc.)
Here's what mine looked like (I whited out the numbers on the vertical axis):
Once this is done, it's faster in the future to add data to this chart.
| 1 | Quicken Standard Reports and Graph Center |
Clustering algorithm and distance function for sets | I am willing to run a clustering algorithm on data records consisting in sets each one representing the features enabled at a certain time.
Is there any clustering algorithm you would recommend me to try out? In my first tests I'm experimenting with K-means, but maybe there is something more suitable.
Is there any distance function that works well with sets? I guess that there is something better than the Euclidean distance but I don't have may clue on how the better metric could look like.
| I would start with distances such as proposed by James Li. They are sometimes known as fingerprint distances. Then, in my experience, it can be a good idea to use graph clustering, although this may depend on the number of features that you have. If this is large and dimensionality is thus large, and if 'set intersection' models data proximity well, then graph clustering is in my opinion the best approach. If the number of features is limited, graph clustering can still work well, but one should also consider the option of comparing feature vectors directly and use an algorithm such as OPTICS - perhaps you have already done that.
| 0.888889 | graph clustering can still work well if the number of features is limited . |
How do I fill a textbox with text if it is empty? | I use a TextChanged-EventHandler
I wrote a program in c# that creates a new TextBox on every button1_Click event
Now,I want each new TextBox (which was created) to show typed text.
How can I do this with EventHandler(TextChanged)?
namespace WindowsFormsApplication5
{
public partial class Form1 : Form
{
Int32 i = 1;
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
TextBox c = new TextBox();
this.Controls.Add(c);
c.Name = "x" + i.ToString();
c.Left = 3;
c.Top = 30 * i;
i++;
c.TextChanged += new EventHandler(c_TextChanged);
}
void c_TextChanged(object sender, EventArgs e)
{
textBox1.Text =
}
}
}
| the sender of your object should be the textbox. There you can get the text you want:
void c_TextChanged(object sender, EventArgs e)
{
TextBox box = sender as TextBox;
if (box != null)
{
textBox1.Text = box.Text;
}
}
| 0.888889 | Textbox sender |
How do I establish international copyright to my works? | What should I do to establish rights on my work? Does it depend on the country where it was created?
| Regardless of what country your in one of the first things you can do is establish evidence that shows when the work was created (or when you claim you created the work).
You can do this using the free online copyright protection service Myows.
This can't prove that you created the work but it can establish evidence that could be used if you ever needed to defend your copyright.
As soon as you upload an Original work on Myows, a copy of that work
is time- and date-stamped and saved on our secure servers.
Uploading your work on Myows provides you with valuable evidence as
well as an effective deterence measure designed to prevent theft.
| 1 | How to establish evidence that shows when the work was created (or when you claim you created the work) |
Core Plot ios animate scatter plot from plain, straight line to plot with actual data | I've been using Core Plot for my iPhone application and have been displaying a scatter plot. I was wondering if upon appearance of the view, there is anyway to have the scatter plot start off as just a horizontal line with all y-values the same, and then have some sort of 0.5 second, for example, animation that slowly moves each data point up or down to its appropriate position?? Or, more generally, if the scatter plot can be animated in any way using core plot? Thank you all in advance.
| There's nothing like that built in at the moment. Each plot is drawn in its own CALayer which can be animated like any other layer. For example, you can slide it into place or fade it into view.
| 1 | Each plot is drawn in its own CALayer |
Why do objects fall at the same acceleration? | I read these two posts and now I am more confused.
Do heavier objects fall faster?
Don't heavier objects actually fall faster because they exert their own gravity?
I was going to ask: if mass is an objects tendency to resist acceleration then why do two objects of different masses fall to the Earth at the same acceleration?
Then I read those posts and it seems that even though it is very small, the more massive object falls faster. Okay I understand, both objects attract each other.
If two cars of different masses collide doesn't the car with less mass accelerate more even though both cars received the same Force. Then that implies you need more force to accelerate a large mass than to accelerate a small mass. Because that is how I see it, the Moon attracts the Earth with the same Force as the Earth attracts the Moon but the Earth accelerates less due to its larger mass.
So then how is mass an object's tendency to resist acceleration? I am aware of $F_1 = F_2 = GMm/r^2$. So should we not really be able to see the difference in acceleration when dropping a massive object?
| I hope this doesn't confuse you, but in one sense, yes, heavier bodies do fall faster than light ones, even in a vacuum. Previous answers are correct in pointing out that if you double the mass of the falling object, the attraction between it and the earth doubles, but since it is twice as massive its acceleration is unchanged. This, however, is true in the frame of reference of the center of mass of the combined bodies. It is also true that the earth is attracted to the falling body, and with twice the mass (of the falling body), the earth's acceleration is twice as large. Therefore, in the earth's frame of reference, a heavy body will fall faster than a light one.
Granted, for any practical experiment I don't see how you'd measure a difference that small, but in principle it is there.
| 0.833333 | How do you measure a difference between a heavy body and the earth? |
Is it possible to "add cold" or to "add heat" to systems? |
Amanda just poured herself a cup of hot coffee to get her day started.
She took her first sip and nearly burned her tongue. Since she didn't
have much time to sit and wait for it to cool down, she put an ice
cube in her coffee and stirred it with a metal spoon. After a moment,
she felt the spoon warm up, but when she took another sip, the coffee
was cooler. She was pretty sure, the ice added cold to her coffee,
and the coffee added heat to her spoon.
Would you agree?
| The most important thing about feeling is that its relative and depends on the temperature of sensor point on skin. That's the reason we need thermometer to measure temperature with which everyone could agree.
Energy transfer is involved here, but it has very little to do with Amanda's feeling. Amanda's tongue and mouth was at high temperature due to initial sip which caused her to feel next sip cooler which was really cool due to addition of ice.
In case of spoon, spoon can't get hotter because heat of coffee (and some of heat of spoon) was consumed in melting ice. But, Amanda felt the spoon warmer because her fingers were relatively cold due to ice touch.
| 0.888889 | The temperature of the sensor point on skin is relative and depends on the temperature of sensor point |
Replacing the thermocouple for a multimeter? | I bought a no-name but decent multimeter, and it came with a thermocouple. Let's say I broke it in some way. Can I just replace it with any other thermocouple, or is each thermocouple calibrated for one specific model of a multimeter?
I have been looking at thermocouples, eg on eBay, e.g. this one. They write some specs but they don't write which multimeter it fits with?
So does any thermocouple fit with any multimeter (or digital thermometer)?
| There are a few different types of thermocouples. In general you can replace a thermocouple with the same type, but you can't with different a different type because the calibration constants will be different.
| 1 | There are different types of thermocouples |
Prevent a user from viewing another user's profile based on a field value | I'm a Drupal veteran, but this one has me stumped . . .
I have two Profile2 profiles, one for a company and one for a job seeker. In the job seeker profile, there is an entity reference field where they add companies they don't want to view their profile. The way companies finds people is by searching via Search API. Another way, would be by browsing. I need to block both ways. Basically, the job seeker should be invisible to the companies that they've blocked.
I have Panels, Panelizer, Rules, and Views all at my disposal and know how to use them, just not in this case. Or am I better going with my own custom module?
I saw this answer Hide Profile2 fields depending on it's value when viewing user profile and that's only for specific fields, I want to block the whole profile.
This question is along the same lines of mine, but I don't see a complete answer -How to filter a view based for the current user based the value of custom fields in his profile and fields in the list of items viewed
| You can add an 'access callback' function to the menu hook for the pages you want to block and inside that function perform your own checks against the currently logged in user. This also means you must block the page for anonymous users or the company can just logout and view the profile anyway.
For hiding in search results I see two options:
Easy solution
In search-result.tpl.php or hook_preprocess_search_results you check access and don't show it. Drawback is that the count of the total results wouldn't be correct anymore.
More advanced
Add an extra indexed field blockedcompanies which contains all ids of the blocked companies in Solr with hook_apachesolr_index_document_build. When searching: add a check on this field with hook_apachesolr_query_prepare.
| 1 | Add 'access callback' to the menu hook for the pages you want to block |
How do I deal with a slow and undedicated colleague in the team? | I have been working on a new project. The project works like this: The end user can access a webapp using a link and he can add multiple systems on his network and manage that particular systems details. My part involves the front end and the webserver, which is done in python. My python actually communicates with another project which is entirely done in c & c++. The c/c++ project is the main app which does all the functionality. My python sends the user request to it and displays the response from it to the user.
I am very familiar with my work and I will finish it soon. Since that's not much work in it. And I am a person who loves to work. I spends most of the time in office and only go home when I feel sleepy.
The c/c++ app is managed by another colleague who has 5+ year experience and can do things much faster than me, but he never does it. May be he doesn't like to do it. His app crashes often when my python communicate with it or returns wrong values. It's full of bugs. Since my app depends on it, I am having a hard time building it. Instead of fixing the bugs, he asks me to slow down my work. He asks me to tell manager that my work needs a lot of time. He is asking me to fool the manager and even forcing me to work slowly like him.
During project meeting, when manager asks him about the bugs he says that he fixed everything and it works fine. Since he is my colleague, I couldn't tell anything to the manager. I obviously need to have a good relationship with my colleagues more than my manager, since most of the time we will be with our colleagues, not with the manager.
I am not able to tell the manager anything regarding this, since if manager asks him why, then he may think I complained about him to the manager. And he keeps on lying in the meeting. And since he fixes the bug slowly, it even slows down my work. Now I thought of working on the front-end part of my app and finishing it off so that in the mean time he can make his project stable. Now he is asking me to tell the manager that my front end part require a lot of work and I may need more and more time, simply so that he can drag the project down. And the sad thing is our actual manager has gone to the US, so we have a temporary manager and this guy doesn't know about the project much, so the c,c++ just fools him.
Can anyone suggest me how I deal with this?
I wanted to finish off the project soon. How can I make him work even by maintaining a good relationship with him?
Responses to comments:
If he's really deliberately misleading the company, you should report him to management.
I am new to this company and the other guy has been there for many years. And I have just started knowing my colleagues. If I directly go and complaint him, I don't think so I can make good relationship with my other colleagues. Even he has the power to mislead them. I am not telling he is a bad guy, he can do the work, but he is not doing it.
Doesn't your company have any kind of bug tracking system ?
Here actual bug tracking system isn't there. The company tries to finish off the project as soon as possible and gives it to the QA. And then fixes the bugs reported by QA.
This is why companies should give employees stock / options or some sort of ownership. That way you can literally tell the guy "You are costing me monetary growth... don't you want to make money also?".
The company has the stock options they have given me a 2500 share, mostly he too would have got some more.
Seniority does deserve some benefit of a doubt. You really need to speak to him first and try to understand the problem. He may be out of his depth, you may be able to help him, there could easily be variables you are unaware of. It may be hard now, but you could easily make the situation a lot worse by jumping the gun.
I even does it, first his app wasn't handling multiple requests at a time, he was using a queue to handle the requests I sent to him. I even suggested to him some of my ideas on it. He said he already had these ideas, and will be executing them. His explanations was: "Everything require certain time to do and this is a project which may need two years to complete and we are asked to finish it in two months". I used to have a hard time coding during first few weeks because of this bug. But now he fixed it. But he is using a single queue for a user requests and that is now slowing down the app, since it processes one request at a time.
What is QA doing this whole time? Why aren't they reporting/confirming the status of the project(s)?
The manager is the person who decides when to give to the QA. As of now it has not yet given to QA. He said we should give it by this month end.
| First and foremost:
Since he is my colleague, I couldn't tell anything to the manager.
You absolutely can and should make sure your manager knows the truth, even if your co-worker is lying to his face. If you don't want to say anything in a meeting with all 3 of you in the room, that's totally understandable. But you should at least pull your manager (the real one, not just the temp) aside and let them know that your work is almost done and is waiting on bug fixes from the other developer's end before the whole application is ready for prime-time. Don't accuse your co-worker of lying, but don't sit there and let your boss operate with incomplete information.
Report your statuses honestly. If your work is being held up by bugs on another developer's end, document that you've found bugs in the C/C++ and have reported them (please tell me you're using some form of documentation that leaves a paper trail).
In the meantime, go ahead and wrap up your work, and let your boss know when you're done. If your manager wants to know why the rest of the project isn't up and running yet, you can refer him to the other developer, and maybe mention that it's probably very complicated/large/requires a lot of testing/other developer is very busy/etc. If you know C/C++, you can offer to help on the main application logic to get things moving with that as well. Yes, you'll be doing the other guy's work, but it makes it clear that you're the employee working hard and being productive, and the other guy isn't, not to mention making you even more valuable to your boss. It may even put some pressure on the other developer to step things up and get them done quicker.
| 1 | Don't accuse your co-worker of lying, but let your boss operate with incomplete information |
Moving a WP Multisite to a subdirectory | Firstly, I've read a number of posts on this process. However, for various reasons, the process remains difficult to implement or troubleshoot for lack of even abstracted examples, or maybe too abstracted. And there's a few "can not do" posts, nearly always followed up by "with 3.5, you now can" caveats, so whether one can remains ambiguous, though no doubt non-trivial.
Summary:
How to move a wordpress multisite (WPMS) from root.com to root/blogs?
For this example, we're moving a WPMS from "root.com" to "root.com/blogs"
I understand that I need to update the paths in the database and wp-config.php appropriately. It seems I may also have to update .htaccess? I'm also aware of the serialization issue with search/replace and mysql query updates.
I have a WPMS that I've updated to 3.5. I've found the following tables with domain and path info
Existing working configuration before move to subdirectory
1. wp_blogs
select blog_id, domain, path from wp_blogs;
+---------+-------------+--------+
| blog_id | domain | path |
+---------+-------------+--------+
| 1 | root.com | / |
| 2 | root.com | /matt/ |
+---------+-------------+--------+
2. wp_site
select * in wp_site;
+----+-------------+------+
| id | domain | path |
+----+-------------+------+
| 1 | root.com | / |
+----+-------------+------+
3. The blog_id corresponds to the wp_#_options tables which contain:
select option_name,option_value from wp_2_options
where option_name = 'home' or option_name = 'siteurl';
+-------------+--------------------------+
| option_name | option_value |
+-------------+--------------------------+
| home | http://root.com/matt/ |
| siteurl | http://root.com/matt/ |
+-------------+--------------------------+
4. In my wp-config.php I have the following WPMS-specific lines:
define('WP_ALLOW_MULTISITE', true);
define( 'MULTISITE', true );
define( 'SUBDOMAIN_INSTALL', false);
$base = '/';
define( 'DOMAIN_CURRENT_SITE', 'root.com' );
define( 'PATH_CURRENT_SITE', '/' );
define( 'SITE_ID_CURRENT_SITE', 1 );
define( 'BLOG_ID_CURRENT_SITE', 1 );
5. Lastly, in my .htaccess, I have:
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
# uploaded files
RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]
# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^[_0-9a-zA-Z-]+/(wp-(content|admin|includes).*) $1 [L]
RewriteRule ^[_0-9a-zA-Z-]+/(.*\.php)$ $1 [L]
RewriteRule . index.php [L]
Updates required to move the site
It seems to me that in order to move my site to the /blogs , I would:
1. Update wp_blogs to
mysql> update wp_blogs set domain=concat(domain, '/blogs'), path=concat(path, 'blogs/');
select blog_id, domain, path from wp_blogs where blog_id < 3;
+---------+-------------+--------------+
| blog_id | domain | path |
+---------+-------------+--------------+
| 1 | root.com | /blogs/ |
| 2 | root.com | /blogs/matt/ |
+---------+-------------+--------------+
2. Update wp_site to
update wp_site set domain=concat(domain, '/blogs'), path=concat(path, 'blogs/');
select * from wp_site;
+----+-------------+------------+
| id | domain | path |
+----+-------------+------------+
| 1 | root.com | /blogs/ |
+----+-------------+------------+
3. wp_#_options
+-------------+--------------------------------+
| option_name | option_value |
+-------------+--------------------------------+
| home | http://root.com/blogs/matt/ |
| siteurl | http://root.com/blogs/matt/ |
+-------------+--------------------------------+
4. wp_config.php
define('WP_ALLOW_MULTISITE', true);
define( 'MULTISITE', true );
define( 'SUBDOMAIN_INSTALL', false);
$base = '/blogs/';
define( 'DOMAIN_CURRENT_SITE', 'root.com' );
define( 'PATH_CURRENT_SITE', '/blogs/' );
define( 'SITE_ID_CURRENT_SITE', 1 );
define( 'BLOG_ID_CURRENT_SITE', 1 );
note: I'm not clear how this step is appropriately updated
5. .htaccess
I found vague "update .htaccess appropriately" instructions, but not specifics. Update RewriteBase? Which lines in .htaccess to I update when I move root.com to root.com/blogs?
Missing from the above process will be the paths founds in posts. My druthers are to use the search and replace tool for that, after I've made this more fundamental updates; or am I wrong?
Update bungeshea suggests that, yes, I point RewriteBase to the "blogs" subdirectory, i.e.,
RewriteBase /Blogs
Finally, if you don't know about http://interconnectit.com/products/search-and-replace-for-wordpress-databases/ you should. It's excellent.
| It looks to me as if you've solved your own problem - just follow your steps 1-4, and for step 5 update the RewriteBase in .htaccess. For updating the paths in posts, I like using the Interconnect IT sterilized search-and-replace tool.
| 0.888889 | Update the RewriteBase in .htaccess |
Programmatically and efficiently create a graphical ripple effect? | I was developing tower of defence game for a long time.
It was about to complete but I have to create ripple effect for one of the weapon that I have used.
First question I want to ask is that is it feasible to use ripple effect for such purpose?
Because suddenly fps goes down.
I have created ripple effect for live wallpaper. But I don't know how to create it for normal game activity.
I was not able to understand many things from it. If any one has some knowledge on this then please provide.
Edit :
I include the image for ripple effect that I think I have to use for weapon fire.
Also I include code that I use to create ripple effect. Similar code with some changes I used to create live wallpaper and it work perfectly. But in normal game activity I don't able to find my mistake. So please guide on this
@Override
public Engine onCreateEngine(EngineOptions pEngineOptions) {
return new org.andengine.engine.Engine(pEngineOptions) {
private boolean mRenderTextureInitialized;
private RenderTexture mRenderTexture;
private UncoloredSprite mRenderTextureSprite;
@Override
public void onDrawFrame(final GLState pGLState)
throws InterruptedException {
final boolean firstFrame = !this.mRenderTextureInitialized;
if (firstFrame) {
this.initRenderTextures(pGLState);
this.mRenderTextureInitialized = true;
}
final int surfaceWidth = this.mCamera.getSurfaceWidth();
final int surfaceHeight = this.mCamera.getSurfaceHeight();
this.mRenderTexture.begin(pGLState);
{
/* Draw current frame. */
super.onDrawFrame(pGLState);
}
this.mRenderTexture.end(pGLState);
/* Draw rendered texture with custom shader. */
{
pGLState.pushProjectionGLMatrix();
pGLState.orthoProjectionGLMatrixf(0, surfaceWidth, 0,
surfaceHeight, -1, 1);
{
this.mRenderTextureSprite
.onDraw(pGLState, this.mCamera);
}
pGLState.popProjectionGLMatrix();
}
}
private void initRenderTextures(final GLState pGLState) {
final int surfaceWidth = this.mCamera.getSurfaceWidth();
final int surfaceHeight = this.mCamera.getSurfaceHeight();
this.mRenderTexture = new RenderTexture(RippleEffectDemo.this
.getEngine().getTextureManager(), surfaceWidth,
surfaceHeight);
this.mRenderTexture.init(pGLState);
final ITextureRegion renderTextureTextureRegion = TextureRegionFactory
.extractFromTexture(this.mRenderTexture);
this.mRenderTextureSprite = new UncoloredSprite(0, 0,
renderTextureTextureRegion, RippleEffectDemo.this
.getEngine().getVertexBufferObjectManager()) {
@Override
protected void preDraw(final GLState pGLState,
final Camera pCamera) {
this.setShaderProgram(RippleShaderProgram.getInstance());
super.preDraw(pGLState, pCamera);
if (mCurrentWaveLength > 25)
mCurrentWaveLength -= 25;
else
mCurrentWaveLength = 0;
float currentTime = -0.001f * mCurrentWaveLength;
float aliveTimer = (float) mCurrentWaveLength
/ (float) mWaveLength;
GLES20.glUniform4f(
RippleShaderProgram.sUniformResolution,
(float) SCREEN_WIDTH, (float) SCREEN_HEIGHT,
RippleEffectDemo.this.mDropCenterX,
RippleEffectDemo.this.mDropCenterY);
GLES20.glUniform2f(RippleShaderProgram.sUniformTime,
currentTime, aliveTimer);
}
};
}
};
}
@Override
public void onCreateResources() {
this.mBitmapTextureAtlas = new BitmapTextureAtlas(
this.getTextureManager(), 512, 512);
this.mBackgroundTextureRegion = BitmapTextureAtlasTextureRegionFactory
.createFromAsset(this.mBitmapTextureAtlas, this,
"badge_large.png", 0, 0);
this.mBitmapTextureAtlas.load();
this.getShaderProgramManager().loadShaderProgram(
RippleShaderProgram.getInstance());
}
@Override
public Scene onCreateScene() {
final Scene scene = new Scene();
final int centerX = (int) ((CAMERA_WIDTH - this.mBackgroundTextureRegion
.getWidth()) / 2);
final int centerY = (int) ((CAMERA_HEIGHT - this.mBackgroundTextureRegion
.getHeight()) / 2);
backgroundSprite = new Sprite(centerX, centerY,
this.mBackgroundTextureRegion, this.getEngine()
.getVertexBufferObjectManager());
scene.attachChild(backgroundSprite);
scene.setOnSceneTouchListener(this);
return scene;
}
protected void onTap(final int pX, final int pY) {
// we do not support multiple wave
if (0 == mCurrentWaveLength) {
// so skip wave, if it is active
mCurrentWaveLength = mWaveLength;
this.mDropCenterX = (float) pX;
this.mDropCenterY = (float) pY;
}
}
@Override
public void onClick(final ClickDetector pClickDetector,
final int pPointerID, final float pSceneX, final float pSceneY) {
}
@Override
public boolean onSceneTouchEvent(final Scene pScene,
final TouchEvent pSceneTouchEvent) {
if (pSceneTouchEvent.isActionDown()) {
onTap((int) pSceneTouchEvent.getX(), (int) pSceneTouchEvent.getY());
return true;
}
this.mDropCenterX = pSceneTouchEvent.getMotionEvent().getX()
/ this.mCamera.getSurfaceWidth();
this.mDropCenterY = pSceneTouchEvent.getMotionEvent().getY()
/ this.mCamera.getSurfaceHeight();
return true;
}
public static class RippleShaderProgram extends ShaderProgram {
private static RippleShaderProgram INSTANCE;
public static final String VERTEXSHADER = "uniform mat4 "
+ ShaderProgramConstants.UNIFORM_MODELVIEWPROJECTIONMATRIX
+ ";\n" + "attribute vec4 "
+ ShaderProgramConstants.ATTRIBUTE_POSITION + ";\n"
+ "attribute vec2 "
+ ShaderProgramConstants.ATTRIBUTE_TEXTURECOORDINATES + ";\n"
+ "varying vec2 "
+ ShaderProgramConstants.VARYING_TEXTURECOORDINATES + ";\n"
+ "void main() {\n" + " "
+ ShaderProgramConstants.VARYING_TEXTURECOORDINATES + " = "
+ ShaderProgramConstants.ATTRIBUTE_TEXTURECOORDINATES + ";\n"
+ " gl_Position = "
+ ShaderProgramConstants.UNIFORM_MODELVIEWPROJECTIONMATRIX
+ " * " + ShaderProgramConstants.ATTRIBUTE_POSITION + ";\n"
+ "}";
// private static final String UNIFORM_TOUCH_COORDS = "touchCoords";
private static final String UNIFORM_RESOLUTION = "resolution";
private static final String UNIFORM_TIME = "time";
public static final String FRAGMENTSHADER = "precision mediump float;\n"
+
"uniform sampler2D "
+ ShaderProgramConstants.UNIFORM_TEXTURE_0
+ ";\n"
+ "varying mediump vec2 "
+ ShaderProgramConstants.VARYING_TEXTURECOORDINATES
+ ";\n"
+ "uniform vec4 "
+ RippleShaderProgram.UNIFORM_RESOLUTION
+ ";\n"
+ "uniform vec2 "
+ RippleShaderProgram.UNIFORM_TIME
+ ";\n"
+
"void main() {\n"
+ " vec2 tap = "
+ RippleShaderProgram.UNIFORM_RESOLUTION
+ ".zw;\n"
+ " tap.x = "
+ RippleShaderProgram.UNIFORM_RESOLUTION
+ ".x - tap.x;\n"
+ " vec2 tPos = -1.0 + 2.0 * tap.xy / "
+ RippleShaderProgram.UNIFORM_RESOLUTION
+ ".xy;\n"
+ " vec2 cPos = -1.0 + 2.0 * gl_FragCoord.xy / "
+ RippleShaderProgram.UNIFORM_RESOLUTION
+ ".xy;\n"
+ " cPos = cPos + tPos;\n"
+ " float cLength = length(cPos);\n"
+ " float radius = 18.0 * "
+ RippleShaderProgram.UNIFORM_TIME
+ ".y;\n"
+ " float amplitude = 0.05 * "
+ RippleShaderProgram.UNIFORM_TIME
+ ".y;\n"
+ " vec2 uv = gl_FragCoord.xy/"
+ RippleShaderProgram.UNIFORM_RESOLUTION
+ ".xy"
+ "+(cPos/cLength)*cos(cLength*radius-"
+ RippleShaderProgram.UNIFORM_TIME
+ ".x *4.0)*amplitude;\n"
+ " vec3 col = texture2D("
+ ShaderProgramConstants.UNIFORM_TEXTURE_0
+ ",uv).xyz;\n"
+ " gl_FragColor = vec4(col,1.0); \n" + // color
"}";
// ===========================================================
// Fields
// ===========================================================
public static int sUniformModelViewPositionMatrixLocation = ShaderProgramConstants.LOCATION_INVALID;
public static int sUniformTexture0Location = ShaderProgramConstants.LOCATION_INVALID;
public static int sUniformResolution = ShaderProgramConstants.LOCATION_INVALID;
public static int sUniformTime = ShaderProgramConstants.LOCATION_INVALID;
// ===========================================================
// Constructors
// ===========================================================
private RippleShaderProgram() {
super(RippleShaderProgram.VERTEXSHADER,
RippleShaderProgram.FRAGMENTSHADER);
}
public static RippleShaderProgram getInstance() {
if (RippleShaderProgram.INSTANCE == null) {
RippleShaderProgram.INSTANCE = new RippleShaderProgram();
}
return RippleShaderProgram.INSTANCE;
}
@Override
protected void link(final GLState pGLState)
throws ShaderProgramLinkException {
GLES20.glBindAttribLocation(this.mProgramID,
ShaderProgramConstants.ATTRIBUTE_POSITION_LOCATION,
ShaderProgramConstants.ATTRIBUTE_POSITION);
GLES20.glBindAttribLocation(
this.mProgramID,
ShaderProgramConstants.ATTRIBUTE_TEXTURECOORDINATES_LOCATION,
ShaderProgramConstants.ATTRIBUTE_TEXTURECOORDINATES);
super.link(pGLState);
RippleShaderProgram.sUniformModelViewPositionMatrixLocation = this
.getUniformLocation(ShaderProgramConstants.UNIFORM_MODELVIEWPROJECTIONMATRIX);
RippleShaderProgram.sUniformTexture0Location = this
.getUniformLocation(ShaderProgramConstants.UNIFORM_TEXTURE_0);
RippleShaderProgram.sUniformResolution = this
.getUniformLocation(RippleShaderProgram.UNIFORM_RESOLUTION);
RippleShaderProgram.sUniformTime = this
.getUniformLocation(RippleShaderProgram.UNIFORM_TIME);
}
@Override
public void bind(final GLState pGLState,
final VertexBufferObjectAttributes pVertexBufferObjectAttributes) {
GLES20.glDisableVertexAttribArray(ShaderProgramConstants.ATTRIBUTE_COLOR_LOCATION);
super.bind(pGLState, pVertexBufferObjectAttributes);
GLES20.glUniformMatrix4fv(
RippleShaderProgram.sUniformModelViewPositionMatrixLocation,
1, false, pGLState.getModelViewProjectionGLMatrix(), 0);
GLES20.glUniform1i(RippleShaderProgram.sUniformTexture0Location, 0);
}
@Override
public void unbind(final GLState pGLState)
throws ShaderProgramException {
GLES20.glEnableVertexAttribArray(ShaderProgramConstants.ATTRIBUTE_COLOR_LOCATION);
super.unbind(pGLState);
}
}
| The "ripple" effect you are showing is just a radial sinewave: sin(t), where t is the distance from some center.
Image from here
Doing this kind of deformation in a vertex or pixel shader is easy: just set up the center of the wave as a uniform variable waveCenter, then move every vertex in z (where z is the "up" direction) by MAGNITUDE*sin( FREQUENCY*t ), where t is the distance the vertex has from that waveCenter. FREQUENCY is how fast you want the wave to ripple. You can even make the wave fade out by dividing MAGNITUDE by the distance from the waveCenter.
| 0.888889 | Doing this kind of deformation in a vertex |
blank page shows up after adding \usepackage[pdfpagelabels]{hyperref} | I have index.tex that I made a copy of it. renamed the copy to index_bad.tex, and added the line
\usepackage[pdfpagelabels]{hyperref}
to its preamble. So the 2 files are identical other than this one change.
Then compiled index.tex with pdflatex 3 time and looked at the index.pdf, and it is ok. (i.e. no blank page).
Compiled index_bad.tex with pdflatex 3 times. Now index_bad.pdf has an extra blank page inserted between first section and the second section.
This is the general layout of the document:
\documentclass[12pt]{article}
\usepackage{tikz}
\usepackage{fancyvrb}
\usepackage{graphicx}
\usepackage[left=.7in,right=.5in,top=.7in,bottom=.9in]{geometry}
\usepackage[pdfpagelabels]{hyperref}
\begin{document}
....
\section{....}
\subsection{...}
\begin{Verbatim}[frame=single,framesep=1mm,samepage=true,fontsize=\footnotesize]
.....
\begin{Verbatim}[frame=single,framesep=1mm,samepage=true,fontsize=\footnotesize]
....
\end{document}
When including hyperref a blank page shows up between first section, and the second section. No blank page shows up when this package is not included.
question is why does this happen? and how to fix it?
Since this document includes 2 images and large verbatim, I've zipped the whole folder so it is all self contained.
Unziping the zip file will create a folder. Inside the folder there is index.tex and index_bad.tex and the 2 images used. Running pdflatex on the files will show the problem above.
The zip file is http://12000.org/tmp/072113/latex_problem.zip
Using TL 2013 on Linux mint virtual machine hosted on windows.
| As Werner has noticed, you have an overlarge page. TeX goes to the next page to set the oversized page, if the current page is not empty. That it, what happened here. The page is not empty, if package hyperref is loaded.
Package hyperref has to add anchors for the \section commands (otherwise the links would not have targets to jump to). It hooks into \refstepcounter for setting the anchor. Thus the example can be reduced to:
\documentclass[12pt]{article}
\usepackage{hyperref}
\showboxdepth=\maxdimen
\showboxbreadth=\maxdimen
\tracingonline=1
\begin{document}
Dummy page
\newpage
\refstepcounter{section}% anchor setting with hyperref
\showlists
\rule{1pt}{1.1\textheight}
\end{document}
The \rule ensures that the page is overlarge:
Overfull \vbox (54.85335pt too high)
Without hyperref there are two pages and the page is empty after \refstepcounter{section}:
### vertical mode entered at line 0
prevdepth 2.33331, prevgraf 1 line
! OK.
l.15 \showlists
With hyperref the result is three pages and the
page start after \refstpecounter is not empty and the anchor/link destination can be seen (driver pdftex):
### vertical mode entered at line 0
### current page:
\pdfdest name{section.1} xyz
prevdepth 2.33331, prevgraf 1 line
! OK.
l.15 \showlists
Thus the only unhappiness is that the page is broken between the destination and the section title. Fixing this would mean more digging/messing with internals, causing other incompatibilities.
BTW, you get the same behavior with other "whatits", e.g. index commands:
\documentclass[12pt]{article}
\usepackage{makeidx}
\makeindex
\showboxdepth=\maxdimen
\showboxbreadth=\maxdimen
\tracingonline=1
\begin{document}
Dummy page
\newpage
\index{foo}
\showlists
\rule{1pt}{1.1\textheight}
\end{document}
Result three pages with:
### vertical mode entered at line 0
### recent contributions:
\write3{\indexentry{foo}{\thepage }}
prevdepth 2.33331, prevgraf 1 line
! OK.
l.16 \showlists
Solution
The problem with the overfull \vbox needs to be resolved. A dirty way is:
\newpage
\enlargethispage{24.7852pt}
\section{Tikz solution}
| 0.888889 | How to set an overlarge page? |
How do you make a binary image in Photoshop? | I am trying to make a binary image. I want more than just the look of the image to be black/white, but I want the actual file to be a binary file. Every pixel should be either black, or white.
I don't just want a monochrome image. I can't have varying shades of gray, every pixel needs to be black or white.
Is this possible? I looked under Image > Mode but nothing there seems to indiciate a binary style image.
| Check out Image Trace in Adobe Illustrator.
I like using python and PIL, however.
from PIL import Image
image_file = Image.open("myimage.bmp")
image_file = image_file.convert('1') # convert
image_file.save('result.bmp')
| 1 | Image Trace in Adobe Illustrator |
How can I write HTML and send as an email? | I want to send HTML email from my Outlook or Yahoo, Gmail, Hotmail. I wasn't able to find any such option where I could write HTML which will then be rendered at the receiver's end. How can I do that?
| If you want to send HTML emails, you need to use a tool that let you write the content of the email yourself instead of relying on WYSIWYG editors.
The most part of mail clients doesn't allow this feature, mainly for security reasons.
With web email clients, such as Gmail, Yahoo or Hotmail, you can try to use the WebKit Inspector (in Safari and Chrome) or Firebug to edit the content of the email directly in the DOM, bypassing the interface restrictions. However, your code is likely to be sanitized by the application and it won't work as expected.
The best solution is to send the emails using a programming language (e.g. mail() in PHP or Pony in Ruby), or a mail service designed to handle HTML content such as MadMimi, Mailchimp, Campaign Monitor...
| 1 | How to send HTML emails using a programming language |
How could I launch the sequence of git commands from java application? | I need to add the file to the repository and then commit it from my java project. I use
Runtime.getRuntime().exec("C:\\Program Files (x86)\\Git\\bin\\sh.exe");
to start git but what should I do next?
| I code should be something like this:
public void gitCommands() throws IOException {
// Build command
List<String> commands = new ArrayList<String>();
commands.add("/bin/bash");
commands.add("-c");
commands.add("git add .");
StringBuilder out = new StringBuilder();
ProcessBuilder pb = new ProcessBuilder(commands);
pb.redirectErrorStream(true);
process process = pb.start();
//EDIT:
// get Exit Status
process.waitFor();
//go for next commands
.....
}
| 0.888889 | Public void gitCommands() throw IOException |
How can I get my SSL certificate signed by an CA for web application that runs on localhost | I have a web application that runs on localhost. I have a self-signed certificate for tomcat configured but when loading the website on firefox, I get a security exception. Can I get a CA to sign my SSL certificate so that this error is not thrown?
| You can create your own CA certificate, add that as a root CA on your machine then use that CA to sign your SSL certificate. http://msdn.microsoft.com/en-us/library/ms733813.aspx
Alternatively, assuming you own a domain name of some form, you could probably create an A record for localhost.yourdomain.com and point it to 127.0.0.1. You should then be able to get an SSL certificate signed for localhost.yourdomain.com, which you can then use instead of localhost (albeit only from your machine).
| 0.888889 | SSL certificate for localhost.yourdomain.com |
How do you import a Compositing Node Set-up? | I have a Compositing node set-up for a lomography effect that I want to export or append to other blend files. Is there a way to do this?
I tried grouping the nodes, but the group wasn't appearing anywhere when I tried to append them in. (Node setup attached for whatever it's worth.)
| You can do this by making these nodes into a custom Node Group and then appending it to the file. To do this select all the nodes, and press Ctrl+G. (I would recommend not including the Render Layer and Composite nodes, as they will be present in the new file)
Now you can go to your new file and select File > Append and then navigate to the proper .blend file and then into the NodeGroup folder. Select the desired node group, and click Append.
Now you can go into your node editor and use Shift+A > Group to select your node group. You can edit it using Tab.
| 1 | Create custom Node Nodes into a Node Group |
Hanging boot and cannot boot to disk | I'm having a very puzzling problem with my PC. Recently I have not been able to boot very consistently. The boot will hang during the Windows 7 splash screen and will not go further. The same thing happens when trying to run Startup Repair. At this point in time, I cannot boot, period.
I've tried booting in safe mode. Safe mode boot hangs after loading disk.sys and will not go further. I've tried using LKGC, which also had no affect.
Normally in this situation, I would do some hardware testing (memtest, chkdsk, windows recovery), but for some reason I cannot boot to any disks whatsoever. The DVD drive I'm trying to boot with is only a few weeks old (my old one died recently), and I've used these disks to boot with before, so I know they are good.
At this point, I'm a bit stymied as to what I should do next. I'm downloading Ubuntu now to try and backup some stuff, but again, I doubt the boot will be successful. If anyone has any advice on what to try now, I would really appreciate the help.
| Another option would be to boot from a usb stick, if your mobo supports it. Most major linux distributions support booting from usb. Also, several recovery tools are available and capable of usb booting.
| 1 | Boot from a usb stick |
100% Rye Pizza Base Recipes? | I'm looking for a 100% rye pizza base recipe. The recipes I can find all combine the rye with other flours (typically wheat based). I know it is possible to create 100% rye based pizza bases as I know of one pizza place in town that sells them.
I understand that they had to do something special to keep the pizza base from falling apart. I don't mind experimenting a bit to find a recipe that works, but I could use some ideas on where to start - what sort of ingredients might bind the rye so that it doesn't crumble as a thin pizza base and maintains a low glycemic index for my diabetic wife.
The only dietary requirements would be that the various ingredients maintain a low glycemic index or a specific ingredient with a high glycemic index can be counteracted by some other ingredient. And only using rye flour.
| Have you considered using 100% rye bread as your beginning and going from there, rather than pizza crust? Peter Reinhart's Bread Baker's Apprentice has a 100% rye sourdough bread that might suit your needs, although it will be a time consuming process. A preview is online in Google Books. The recipe is similar to a Neopolitan pizza dough - just basic ingredients with no fat. Because of this, I'd roll out the pizza very thin, New York style, for a crackling crisp crust. If you don't want to buy the book, many local libraries carry it in the US, at least.
| 0.888889 | How to use 100% rye bread instead of pizza crust? |
How to bone lamb breast | I've got a recipe that calls for a boned lamb breast. Unfortunately, the lamb my wife got from the butcher is not boned, so I need to remove the bones myself. However, I can't find any guidance on how to do this. Before I dive in and probably ruin a perfectly good lamb breast, can anyone offer any tips?
| If I'm correct, the cut you have should resemble a rack of ribs. If this is the case, you should be able to simply push the bones out, perhaps with a bit of loosening with a small sharp knife.
I assume you need it boned to facilitate stuffing, but on the off chance it's not, you could just slow-cook the lamb for 4 or 5 hours by which point the bones will just pull easily out of the meat.
| 1 | if boned, you should be able to slow-cook lamb for 4 or 5 hours . |
SQL Server 2000 - 'Performance: Deadlock' | We had to restart our SQL Server today, we had made no changes to it.
When it came back up we immediately started getting this error from the server
DATE/TIME: 2/27/2014 3:09:31 PM
DESCRIPTION: The SQL Server performance counter 'Number of
Deadlocks/sec' (instance 'Database') of object 'SQLServer:Locks' is
now above the threshold of 1.00 (the current value is 2.00).
COMMENT: (None)
JOB RUN: (None)
We ran the DBCC TRACEON (1204) command and have watched the log's but it's not reporting any deadlocks.
Any idea what could trigger this to just go off? We are getting the alert every minute yet can't find any actual deadlocks.
Edit: I should add that before this reboot we had never received this error
Edit 2: We used SQL Server Profiler as well to look for deadlocks, let it run for 5 minutes over which we received 5 error alerts and when we checked the details we had NO deadlocks found.
Edit 3: March 06/2014: Ran the query and it worked, but it reports what our other details have said that we have no locks we where still getting the error above the whole time.
Thanks again for all your help!
Edit 4: March 06/2014: I ran the query and here is a sampling of the result set, I will admit I am not exactly sure what I am looking at here, that is to say I am not sure if it shows me something that I can act on or not.
Edit 5: March 07/2014: Image below shows the Alert that generates this error all of a sudden.
Thanks
| While this counter says /sec, I believe it is a cumulative counter. If I'm right, this means you have had a TOTAL of 2 deadlocks since the service has been up.
I'm not at a machine where I can test this, but I suspect that if you simulate your own deadlock - once - you'll suddenly be getting 3.0 deadlocks "per second" until another deadlock occurs or you restart the service.
There are many scripts out there that will help you force a deadlock, basically:
-- window 1
Create table dbo.x(a int); create table dbo.y(b int);
Insert dbo.x(a) select 1: insert dbo.y select 2;
Begin transaction;
Update dbo.x set a = a + 1;
-- window 2
Begin transaction;
Update dbo.y set b = b + 1;
Update dbo.x set a = 5;
-- go back to window 1
Update dbo.y set b = 22;
Now, if the counter goes up to 3.0, you know what to do: go find that pesky alert and disable it, or keep getting the alert but become desensitized to it unless the number changes drastically.
| 1 | if you simulate your own deadlock, you'll suddenly get 3.0 deadlocks "per second" |
Is my session-less authentication system secure? | So, I've created an authentication system. Poured over it for any kind of security flaws and tested the crap out of it. I think it's fairly secure, but there is one "different" by-design aspect of it that's not usual of a web authentication system.
Basically, I wanted to make it so that authentication could be done without keeping track of each user's session. This means less load on the database, and trivial to scale and cache. Here are the "secrets" kept by the server:
A private-key is kept in the source code of the application
A randomly generated salt is kept for each user
To make it sessionless, but making forging cookies not easy, this is the format of my cookies
expires=expiretimestamp
secret=hash(privatekey + otherinfo + username + hashedpassword + expires)
username=username
(with otherinfo being things like IP address, browser info, etc and with hashedpassword=hash(username + salt + password + privatekey)
My understanding is that forging login cookies (not cracking the passwords) requires:
Source code access to the application, or a way to trick it to spit out the private key
Read-only access to the database to get the salt and hashedpassword
Whereas the traditional session method requires:
Write and read access to the database (to inject the session, or trick the web app into doing it for you)
Possibly source code access depending on how it works
Anyway, does this seem overly insecure to anyone? Are there any ways for me to improve on it and make it more secure(while keeping with the stateless/sessionless model)? Are there any existing authentication systems which use this stateless model?
Also, the hashing method can be basically anything, ranging from SHA256 to Blowfish
| This proposed system is a session handler used to maintain an authenticated state and your method of building session tokens is insecure.
For example, using SQL Injection you can read most of the secret data from the database. If you are using MySQL SQL Injection can be used to read files using the load_file() function which could be used to read the secret from a config file.
In general you should not reinvent the wheel when building a system. I am sure your platform comes with a secure session handler because just about every web application will need one.
Session ID's should be purely random values and an entropy pool like /dev/urandom is an excellent choice. Just because you are using the platform's session handler doesn't mean its configured properly. I recommend reading the OWASP Session Management Cheat Sheet.
| 1 | Session ID's should be purely random values and an entropy pool like /dev/urandom is an |
In X-Men: First Class, is Alex Summers related to Scott Summers? | If they are related, then what is his relation to Scott Summers and how does this explain the age gaps between Scott and Professor X?
| They are brothers in the original comics with Alex being the older brother, in X-Men:First Class, Alex was with Xavier before Xavier found Scott. At the end of X-Men: Origins: Wolverine when the Professor is waiting in a wheelchair after Logan frees the mutants from the island. Because Wolverine happened not so soon after First Class. So Alex met Xavier first, making him the older brother in the timeline between First Class and Wolverine.
| 1 | Alex is the older brother in X-Men:First Class . |
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.
| I know this from microsoft dhcp servers and its called DHCP device classes.
You can read more about that here (http://blogs.technet.com/b/teamdhcp/archive/2012/09/22/using-dhcp-policies-to-set-different-lease-durations-for-different-device-types.aspx) or just look for other information on this.
| 0.888889 | microsoft dhcp servers |
let you know a couple of facts OR bring couple of facts to your notice | Which of the following is more appropriate / polite?
I would like to bring a couple of facts (or things?) to your notice.
OR
I would like to let you know a couple of facts.
Please advise.
| I agree with check123. "Facts" can have a harsh, accusatory tone which could put the listener on the defensive. "Things" is usually a vague word to avoid, especially in writing, but it can be an acceptable way of toning down "facts," if the speaker wants to avoid sounding belligerent.
Yet there are other ways to accomplish the same thing. You could avoid the word "you" as well:
Let me state the facts...
or even,
Please allow me to give the facts...
also sound a bit more polite, and less confrontational.
| 1 | "Things" can have a harsh, accusatory tone if the speaker wants to sound belligerent . |
Where was the Scottish Skyfall scene filmed? | I know Scotland very well and have several theories of my own but can anyone tell me where this iconic shot was taken?
Ideally I'm after as accurate a location as possible as I'm fairly sure I can narrow it to one of two valleys (bonus points for a streetview link!)
| I believe that this could be the exact spot, it overlooks the farm that my great great grandfather was born and family lived on.
https://www.google.com.au/maps/@56.619486,-4.931301,3a,75y,264.51h,87.73t/data=!3m4!1e1!3m2!1sxkhirGtn7FM5HPEGHu_Qvw!2e0
You can see the little bridge that the road crosses is just to Bonds right in the movie shot. It is beside the River Etive in Glen Etive in the Highlands. You can see the same bends in the river and the valley looks the same etc.
| 1 | The road crosses the river in Glen Etive in the Highlands |
Email sent to store owner after a new account is created | We need the same email confirmation after a new account is created to be sent to the store owner email. Emails are sending fine to customer, but not sure if this is default functionality to send that email to store owner as well? If not, please advise how to make this happen.
| Use Magento Event/Observer functionality for this:
app/etc/modules/Namespace_Modulename.xml
<?xml version="1.0" encoding="UTF-8"?>
<config>
<modules>
<Namespace_Modulename>
<active>true</active>
<codePool>local</codePool>
</Namespace_Modulename>
</modules>
</config>
app/code/local/Namespace/Modulename/etc/config.xml
<?xml version="1.0"?>
<config>
<modules>
<Namespace_Modulename>
<version>0.0.1</version>
</Namespace_Modulename>
</modules>
<frontend>
<events>
<customer_register_success>
<observers>
<unic_observer_name>
<type>model</type>
<class>unic_class_group_name/observer</class>
<method>customerRegisterSuccess</method>
</unic_observer_name>
</observers>
</customer_register_success>
</events>
<helpers>
<unic_class_group_name>
<class>Namespace_Modulename_Helper</class>
</unic_class_group_name>
</helpers>
</frontend>
<global>
<models>
<unic_class_group_name>
<class>Namespace_Modulename_Model</class>
</unic_class_group_name>
</models>
<template>
<email>
<notify_new_customer module="Namespace_Modulename">
<label>Template to notify administrator that new customer is registered</label>
<file>notify_new_customer.html</file>
<type>html</type>
</notify_new_customer>
</email>
</template>
</global>
</config>
app/locale/en_US/template/notify_new_customer.html
Congratulations, a new customer has been registered:<br />
Name: {{var name}}<br />
Email: {{var email}}<br />
...<br />
app/code/local/Namespace/Modulename/Model/Observer.php
class Namespace_Modulename_Model_Observer
{
public function customerRegisterSuccess(Varien_Event_Observer $observer)
{
$emailTemplate = Mage::getModel('core/email_template')
->loadDefault('notify_new_customer');
$emailTemplate
->setSenderName(Mage::getStoreConfig('trans_email/ident_support/name'))
->setSenderEmail(Mage::getStoreConfig('trans_email/ident_support/email'))
->setTemplateSubject('New customer registered');
$result = $emailTemplate->send(Mage::getStoreConfig('trans_email/ident_general/email'),(Mage::getStoreConfig('trans_email/ident_general/name'), $observer->getCustomer()->getData());
}
}
Please Refer to this link, as it it the reference of the source code. It also shares that this code will not work on register while checkout, whereas the solution is share in the link.
Please click HERE for more info.
| 0.888889 | Use Magento Event/Observer functionality for a new customer |
How can I modify strings that are passed to cout? | Suppose I want to rot13 every string passed to cout (or another ostream), so that, say cout<<"Foo Bar Baz.;" (or even cout<<rot13<<"Foo Bar Baz.";) outputs Sbb One Onm.
How would I go about doing that?
(My first idea was to replace cout's streambuf with a streambuf-derived class that would do all the work. But seeing as the original streambuf is responsible for directing stuff to the console... that didn't work out at all.)
| Couldn't you wrap cout's streambuf in your own, forwarding all calls to the wrapped buffer?
You'd only need to do some encoding before forwarding the "put" calls into the wrapped streambuf.
It's a lot of work for a little rot13, though.
| 0.666667 | Can't you wrap cout's streambuf in your own, forwarding all calls to the wrapped buffer? |
Why does Wizards of the Coast print terrible MTG cards? | I understand that there needs to be a wide variety of power levels in Magic: The Gathering. Even bad cards will see play in limited formats, some because they fill a specific niche (flying removal, fat colorless flyer, providing a counter to certain decks), and others because those decks can't afford to be too picky. However, some cards are just unforgivably terrible. I'm talking about cards that you would only run in sealed if you had absolutely no other options:
Mindless Null: Black 2/2 for 3 with a big disadvantage
Defensive Stance: literally does nothing in exchange for you getting card disadvantage
Merfolk of the Depths: Would still be bad if it only costed 5...
Archangel's Light: 8 mana just to gain some life and put cheap cards back into your deck. And it's a mythic rare....
There are many more examples, but I think these best illustrate my case. Obviously I'd rather have these cards in the game than not have them at all, but I feel like Wizards of the Coast could have made Magic a more enjoyable game just by keeping the flavor and making all of these cards a tiny bit better...yet they didn't. Why?
| Unforseen interaction. I have looked at the comments on gatherer for each of your examples and have come up with specific instances where they would interact positively.
Defensive stance seems to work pretty well with:
Aura Gnarlid
It could be useful against weenie infect/wither/deathtouch creatures
Mindless Null: is immune to lure/forced blocking and at the same cost as scathe zombies.
Merfolk of the Depth: Suprise blocker that can trigger your evolve cards.
Archangel's light: I can see this really pissing off someone playing a mill deck. It would also combo decent with threshold cards.
| 0.888889 | Unforseen interaction with gatherer |
Relationship field - {count} of type, and {total_results} of type | I have a relationship field which contains a number of different pieces of content.
Each piece of content has a type property.
Is there anyway I can count the number of each of the types that is included in the relationship.
For example. 3 Product related items, and 2 Showcase related items.
I need to be able to get the {total_results} of each type.
This is what I'm trying to do...
{if "{related:panel_type}" == "products"}
{if "{related:count}" == "1"}
<ul class="p">
{/if}
// do stuff
{if "{related:count}" == "{related:total_results}"}
</ul>
{/if}
{/if}
{if "{related:panel_type}" == "showcase"}
{if "{related:count}" == "1"}
<ul class="s">
{/if}
// do stuff
{if "{related:count}" == "{related:total_results}"}
</ul>
{/if}
{/if}
So at the moment {total_results} is equal to 5 so my ul is not getting closed properly.
Does anyone have any ideas how I can get around this problem.
I would like to keep my markup inside the exp:channel:entries loop, and ideally use only one loop.
Any help, greatly appreciated
| Faffing about with loop counters is quite unpleasant and inelegant... these are the kind of problems you run into when your data-fetching is tightly coupled to your data-output. Instead put Stash to work. Here's how:
{!-- ============================================
STORE THE DATA into dynamic stash lists using context.
Avoid the temptation to put any markup here.
================================================== --}
{exp:channel:entries ...}
{related}
{exp:stash:append_list name="related-items" context="{related:panel_type}"}
{stash:the-title}{related:title}{/stash:the-title}
{stash:a-custom-field}{related:a-custom-field}{/stash:a-custom-field}
{/exp:stash:append_list}
{/related}
{/exp:channel:entries}
{!-- ============================================
ASSEMBLE THE MARKUP and OUTPUT THE DATA
================================================== --}
{exp:stash:parse process="end"}
{if {exp:stash:not_empty name="related-items" context="products"}}
<h2>Related Products</h2>
<ul class="p">
{exp:stash:get_list name="related-items" context="products"}
<li>{the-title} | {a-custom-field}</li>
{/exp:stash:get_list}
</ul>
{/if}
{if {exp:stash:not_empty name="related-items" context="showcase"}}
<h2>Related Showcase</h2>
<ul class="s">
{exp:stash:get_list name="related-items" context="showcase"}
<li>{the-title} | {a-custom-field}</li>
{/exp:stash:get_list}
</ul>
{/if}
{/exp:stash:parse}
If you were using a separate view template for your layout you wouldn't need the final stash:parse tag, but if you're setting and getting in the same template it helps to avoid parse order issues. (Full explanation and tutorials here: http://www.jamessmith.co.uk/articles/expressionengine-stash-tutorials)
| 0.777778 | STORE DATA into dynamic stash lists using context |
Simple way to delete users account? | Is there a simple way or code to delete the account from a user? I want to delete the username, email address, first_name, last_name and the profile-data.
I do have two apps
Thanks!
| Can You Explain What kind of application you Use? If you use some kind of database with your application then simply run delete query with some specific condition
| 0.888889 | Can You Explain What kind of application you use? |
What is the probability that Brian makes money on his first roll |
Brian plays a game in which two fair, six-sided dice are rolled
simultaneously. For each die, an even number means that he wins that
amount of money and an odd number means that he loses that amount of
money. What is the probability that Brian makes money on his first
roll?
To find the probability, do we need to find the even numbers only. There are 36 outcomes from the two dies. So is there an easy way to get the arrangements?
| Let the values of the dice in a roll be $a$ and $b$. You win money if ($1$) $a$ and $b$ are both even, ($2$) $a$ is even and $b$ is odd with $a>b$, or ($3$) $a$ is odd and $b$ is even with $a<b$.
For ($1$) there are $3$ even numbers in $1,2,\dots,6$, so there are $3^2=9$ ways for $a$ and $b$ to both be positive.
For ($2$) consider the three cases cases: $a=2 \implies b=1$; $a=4\implies b=1,3$; and $a=6\implies b=1,3,5$. Therefore, there are $6$ ways to get condition ($2$).
Condition ($3$) is the same as ($2$) by symmetry, so the probability to win money is
$$
\frac{3^2 + (2)(6)}{6^2} = \frac{21}{36} = \frac{7}{12}.
$$
We can easily generalize this to any $n$-faced pair of dice when $n$ is even. Notice that the triangular numbers appear when counting conditions ($2$) and ($3$). Therefore, the general probability is
$$
\frac{(n/2)^2 + 2T_{n/2}}{n^2} = \frac{n + 1}{2n}.
$$
| 1 | You win money if ($1$) $a$ and $b$ are both even, ($2$) |
tombstones and beer mugs | I'm trying to find an alternative to the standard tombstone qed symbol for more informal papers.
I initially thought of an empty square with Pub written inside, but what would actually be better would be a small beer mug symbol. (much like the one found in this set of icons http://dutchicon.com/iconsets/food-and-drinks-icons)
Unfortunately there doesn't seem to such a symbol in the comprehensive latex symbol list (although many funny symbols can be found there).
Has anyone thought about this? Is there any quick-and-dirty solution?
| How about a smiley face? :) There are some both in the wasysym and the marvosym package. I guess everyone is happy, when he arrives at the end of a demonstration. ;)
| 0.333333 | How about a smiley face? |
Group isomorphisms and a possible trivial statement? | I have the following set $G=\lbrace a,b,e \rbrace$ and I successfully computed the following Cayley-Table \begin{align} \begin{array}{|c|c|c|c|}
\hline
\circ& a & b & e \\ \hline
a& b&e &a\\ \hline
b& e &a &b\\ \hline
e& a& b&e\\ \hline
\end{array} \end{align}
Now $(G, \circ)$ forms a group. When talking about homomorphisms I learned that a mapping is considered a homomorphism if $\varphi: G \to G'$ is a mapping such that $\forall a,b \in G, \varphi(a \circ b) = \varphi(a) \circ' \varphi(b)$.
So I was asked to show that the group $(G, \circ)$ of order 3 is isomorph to the group $(G', \circ ')$ where $G' = \lbrace c,d,e' \rbrace$. So what I did was define the mapping \begin{align} \varphi: \begin{cases} &G \longrightarrow G' \\ &a \longmapsto c \\&b \longmapsto d \\ &e \longmapsto e' \end{cases} \end{align}
So it is trivial to notice that $\varphi$ is bijective. It also follows easily (I've done the calculations) that $\varphi$ is homomorphism, using the same Cayley table as above and replacing all letters by $c,d,e'$ respectively. Therefore $\varphi$ is an isomorphism.
My question now is, what have I done? If this approach was even remotely correct, then I wonder what my statement now is saying. I have found an isomorphism between $G$ and $G'$ and therefore they have the same structure. But I defined them from the beginning as groups of the same order and even used the same Cayley-table.
The only relevance I can see in this is that I made no statement about $c,d,e'$ at all, so I never said that they must be equal or even related to $a,b,e$.
To really hit the point home about my confusion and the triviality I see in what I have done let me get a bit more verbal. I consider the Cayley table above as regular grid, or as some sort of game in which for whatever reasons the field are labeled just as above. Now I meet my friend and replace the abstract letters $a,b,e$ by $c,d,e'$ and tell him, "look, game 1 and game 2 have the same structure!"... well, yes?
Also my tutor said that this doesn't work for groups of order 4, can someone maybe tell me why or link me something where I can read into that?
| Every group of three elements is isomorphic to one another, and is cyclic. Put differently, there is only one group of order $3$ up to isomorphism.
This is not true of groups of order four, of which there are two, up to isomorphism: The group $(\mathbb Z_4, +)$ and the Klein 4-group $\{e, a, b, c\} = \mathbb Z_2\times \mathbb Z_2$, in wich every element is of order $2$.
| 0.333333 | Every element is isomorphic to one another, and is cyclic |
Can monsters make multiple attacks in a single action? | In the bestiary for the new D&D Next playtest packets, some creatures look as though they get multiple attacks per round.
e.g.: An owl bear gets Melee Attack: Claws +5/+5 (etc.) and Bite +5 (etc.) along with a special power says that if both claw attacks hit,
then extra damage is done.
However, the basic rules don't seem to cover this situation. I can't tell if the owlbear is able to use both claws AND bite in one action, or if it can only use one claw OR a bite, or 2 claws OR A bite.
So, do monsters get multiple attacks per action? And what are the rules for the owl bear, or other monsters that have a +x/+x description for an attack?
One possible way to answer this question would be to explain how this worked in earlier editions of D&D. If you can tell from the rules test how this is supposed to work, that would be a better answer.
| Look at the monster's stat block. It gets multiple attacks if they have the ability "Multiattack" listed. Under the Multiattack heading, it will tell you which attacks can be combined in the creature's attack action.
| 1 | Multiattack can be combined in a creature's attack action |
ASA: How to connect server with a external IP address already assigned? |
Any ideas how this can be done on a ASA? There was a sonicwall in place but it just died and we do not have a replacement besides this ASA. The 24.172.x.132 is a spam filter and I can't change the IP address. It needs to be able to access one server in the LAN.
| A traditional DMZ would have a firewall between the DMZ and the internet, and one between the DMZ and the inside network. You can do this all on an ASA, but it depends on the model and licensing.
Internet
--------- Firewall
DMZ (with your spam filter)
--------- Firewall
Inside network
You could make that first firewall a software one, running on the spam-filter server.
So you could have the server on the Internet network as far as the ASA is concerned. If you have spare ports on your ASA you could just assign one to the outside network (so you have two) and connect your spam server to that. Then create a firewall rule allowing traffic from the spam-filter server into your inside network as required. If you don't have a spare port, you will need a switch before the ASA.
You could get more fancy using a DMZ vlan on the ASA itself, and use the ASA to firewall the spam-filter, and the inside network. This is probably the closest to what your Sonicwall was doing.
| 1 | a traditional DMZ would have a firewall between the Internet and the Internet - and one between the internet and the inside network |
Is there a way I can share the 3.42 GB download of Windows 8.1 from Windows Store? | Windows 8.1 is out, and I would like to know if it is possible to share the Windows 8.1 download upgrade between different computers so that I don't have to download it over and over again?
This might be helpful for people who are on a metered connection. Store is downloading 3.42 GB of data so it must be stored somewhere. Is there a way I can copy it to my other computers and start the setup so that I don't have to download it over and over again on each computer I own?
| I succeeded in installing Windows 8.1 without downloading it again. Here is how I solved it. Before you start, be sure to clear/delete the $Windows.~BT folder.
Then go to \Windows\SoftwareDistribution\Downloads and locate the folder that contains the WindowsStoreSetupBox.exe file and the *.esd file. Copy it to a different location (create a folder).
Then launch an elevated command prompt and go to the location where you copied the .esd file and the WindowsStoreSetupBox.exe.
Enter this carefully and exactly:
WindowsStoreSetupBox.exe /ClassId bd02c22b-1edf-476f-ab78-a72bdada6a47 /SessionId 1 /ReportId {3AB7C5F3-D1B0-4899-8FDD-565910F4D2F7}.1
It should now work a bit and create the $Windows.~BT again and it contains now a Sources folder. Go there and you will find install.esd and setuphost.exe. Launch the latter as administrator.
If everything is fine, a Windows 8.1 window will open. Follow the instructions, and you're good to go.
| 1 | Install Windows 8.1 without downloading it again |
What is the best introductory Bayesian statistics textbook? | Which is the best introductory textbook for Bayesian statistics?
One book per answer, please.
| Coming from non-statistical background I found Introduction to Applied Bayesian Statistics and Estimation for Social Scientists quite informative and easy to follow.
| 1 | Introduction to Bayesian Statistics and Estimation for Social Scientists |
Cannot access non-static field | I can't figure out why it's looking for something static:
public class DatabaseBase
{
private readonly string connectionString;
public DatabaseBase(string connectionString)
{
this.connectionString = connectionString;
}
}
public class MyDB : DatabaseBase
{
readonly string connectionString = ConfigurationManager.AppSettings["MyConnectionString"];
public MyDB() : base(connectionString)
{
}
}
I get Cannot access non-static field 'connectionString' in static context. I don't see anything static in the base Database class so why??
here's another example of when we did kinda the same thing:
partial class Database : DatabaseBase
{
static string DbConnectionString
{
get
{
if (dbConnectionString == null)
dbConnectionString =
ConfigurationManager.AppSettings["MyConnectionString"];
return dbConnectionString;
}
}
public Database() :base(DbConnectionString)
{
}
ok so why did it have to be a static string for the connection string to be passed?
| Your problem is in the MyDB constructor. The instance field (MyDB.connectionString) will not be initialized until the call to the base constructor returns, so everything inside base( ... ) is in the static context. Just work with it...
public class MyDB : DatabaseBase
{
static readonly string connectionString =
ConfigurationManager.AppSettings["MyConnectionString"];
public MyDB() : base(connectionString)
{
}
}
or better yet (as suggested by Simon Fox) ...
public class MyDB : DatabaseBase
{
public MyDB() : base(ConfigurationManager.AppSettings["MyConnectionString"])
{
}
}
| 0.5 | MyDB.connectionString will not be initialized until the call to the base constructor returns |
UIImage - should be loaded with [UIImage imageNamed:@""] or not? |
I am having number of images with in my application. ( images more than 50 - approximately & it can extend according to client's need )
Each image are very large round about - 1024 x 768 & 150 dpi
Now, I have to add all this images in a scroll view & display it.
Ok, My question is as follows.
According to me there are two options of loading large images
imageNamed:@""
load asynchronously when viewDidLoad Called.
Which is more preferable ?
imgModel.image=[UIImage imageNamed:[dMain valueForKey:@"imgVal"]];
or like this.
NSURL *ur=[[NSURL alloc] initFileURLWithPath:[[NSBundle mainBundle] pathForResource:lblModelName.text ofType:@"png"] isDirectory:NO];
NSURLRequest *req=[NSURLRequest requestWithURL:ur cachePolicy:NSURLCacheStorageNotAllowed timeoutInterval:40];
[ur release];
NSURLConnection *con=[[NSURLConnection alloc] initWithRequest:req delegate:self];
if(con){
myWebData=[[NSMutableData data] retain];
} else {
}
-(void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response {
[myWebData setLength: 0];
}
-(void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data {
[myWebData appendData:data];
}
-(void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error {
[connection release];
}
-(void)connectionDidFinishLoading:(NSURLConnection *)connection {
NSLog(@"ImageView Ref From - %@",imgV);
// my image view & set image
imgV.image=[UIImage imageWithData:myWebData];
[connection release]; connection=nil;
}
| Asynchronous loading is almost always preferred to prevent unresponsive user interfaces (especially in viewDidLoad).
Furthermore, if you have a large number of images (and they are large files), you probably only want to load the images that will be visible (plus some buffer) and load the additional images when they are scrolled to.
| 1 | Asynchronous loading is almost always preferred to prevent unresponsive user interfaces |
Should an adverb go before or after a verb? | For example:
The word rarely turns up outside of those contexts.
The word turns up rarely outside of those contexts.
Which one is correct and why?
| "Turns up rarely" appears to describe the way it turns up rather than how often.
"Rarely turns up" shows how often.
| 1 | "Turns up rarely" |
Difference between busses | I think I am confusing the difference between some of the of busses, such as IDE, SATA, USB, and PCI. What is the relationship between all four, how are they connected to each other? From what I read it seems like PCI connects them together as well as to the CPU, but it's not clear. Any help would be greatly appreciated. I am cross referencing this post with another I made about the Linux commands to browse them. http://unix.stackexchange.com/questions/27414/ide-and-pci-bus-commands
| This smells like a homework assignment. In any case, it should be easy to look up some introduction to each of these busses and then compare them. However, briefly:
IDE is a parallel bus used primarily inside computers to communicate with disk drives. It is carried on ribbon cables 2-3 inches wide.
SATA is the replacement for IDE. It is high speed serial, so uses a lot fewer wires.
PCI is the bus you physically plug I/O cards into in a PC. These are the cards with the tall thin metal faces that provide connections out the back via the "I/O slots". For example, you can get add on ethernet "cards" if you want your PC to have more than the one network connetion the comes on the motherboard.
USB is for external devices. Surely you've heard of this unless you've been living under a rock for the last 20 years.
As for compare and contrast, this is your homework assignment, not mine.
| 0.777778 | Comparing a parallel bus to a computer |
What is the best introductory Bayesian statistics textbook? | Which is the best introductory textbook for Bayesian statistics?
One book per answer, please.
| Its focus isn't strictly on Bayesian statistics, so it lacks some methodology, but David MacKay's Information Theory, Inference, and Learning Algorithms made me intuitively grasp Bayesian statistics better than others - most do the how quite nicely, but I felt MacKay explained why better.
| 0.777778 | David MacKay's Information Theory, Inference, and Learning Algorithms made me intuitively grasp Bayesian statistics |
Problem with Google Now in Tab 2 | I have a Galaxy Tab 2 7.0 which I have updated to the official jellybean provided by Samsung, it is supposed to have Google Now but I cant see the cards on opening the the app. Can anyone help me out by pointing out the way in which I can see the cards.
| Press home button and then slide to the search icon. You should be able to see "show more cards" button. If not then slide down to the very bottom of the screen, you will see three dots in the bottom-right corner. Click this, open Settings dialog and then click on Google Now tab. You will have the option to turn it on then. If it's not appearing check also TOP RIGHT corner of the screen for a switch available.
| 1 | Click "show more cards" button |
Which words may start with "al-"? | Is there a rule which determines whether it allowable for a word to be "merged" with "all" to make a new word starting "al-"
e.g.
1)All together -> Altogether
2)All right -> Alright
The first is generally accepted. Whereas I believe the second is technically not (certainly my English teacher used to condemn it).
| I'll quote what my NOAD says:
USAGE - The merging of all and right to form the one-word spelling alright is first recorded toward the end of the 19th century (unlike other similar merged spellings such as altogether and already, which date from much earlier). There is no logical reason for insisting that all right be two words when other single-word forms such as altogether have long been accepted. Nevertheless, although found widely, alright remains nonstandard.
So, although alright is "older", altogether is considered to be standard.
Plus, as the OALD states, altogether and all together are not synonyms:
Altogether and all together do not mean the same thing.
Altogether means ‘in total’ or (in British English) ‘completely’: We have invited fifty people altogether. ◇ I am not altogether convinced by this argument.
All together means ‘all in one place’ or ‘all at once’: Can you put your books all together in this box? ◇ Let’s sing ‘Happy Birthday’. All together now!
And, as @Matt Ellen reminded me (us), not even all right and alright are synonyms, see his comment.
Other terms are already, as mentioned above, and about the al- prefix, the Oxford English Dictionary, says:
obs. form of all, retained in comp. in albeit, almighty, almost, alone, already, although, always.
| 1 | Altogether and all together do not mean the same thing, see OALD's comment |
"Hirable" or "hireable" | What is the correct adjective form of the word hire? I have seen references to both hireable and hirable.
I checked using Google's Ngram viewer book search and it appears that both have been in use since the 1800s with hirable becoming a bit more popular in the past decade or so:
| Apparently the rule for attaching suffixes is as follows:
If suffix begins with a vowel (a,e,i,o,u,y)
Root will attach directly to it
If suffix begins with a consonant
Root will need a combining vowel before attaching to the suffix
As in Example word: cardiogram
Breakdown of word: cardi/o/gram
Root = cardi
Combining vowel = o
Suffix = gram
Note: Suffix begins with a consonant
Combining vowel is needed
While Example word: cardialgia
Breakdown of word: cardi/algia
Root = cardi
Suffix = algia
Note: Suffix begins with a vowel
Combining vowel is not needed
However, there are words that do not follow this rule: i.e. "Friend-ship", "Govern-ment"
So I would redefine the rule a bit, as it isn't actually mine's.
If suffix begins with a vowel , and the root word ends with a vowel or consonant, the suffix attaches directly.
If however, the suffix begins with a consonant, and the root word ends with a vowel, it will need a combining vowel. If however, the root word ends with a consonant, the suffix will attach with no combining vowel.
Which means your example would be written "hireable"
| 1 | If suffix begins with a vowel (a,e,i,o,u,y) Root will need a |
Why doesn't Perl's Spreadsheet::ParseExcel never return from $parser->parse('test.xls')? | The spreadsheet is Excel 97-2003 compatible and permissions 777
use strict;
use Spreadsheet::ParseExcel;
print "Content-type: text/html\n\n";
my $parser = Spreadsheet::ParseExcel->new();
print "<br>gets here:".__LINE__;
my $workbook = $parser->parse('test.xls');
print "<br>never gets here:".__LINE__;
| Do you use latest Spreadsheet::ParseExcel? Current version is 0.57.
I see that you run this as CGI. Can you run it from command line (locally, with same test file) and check if there is any error message?
Try also using eval (running from command line is still better) and check if $parser is defined:
print '$parser is undef<br>' unless defined $parser;
eval {
my $workbook = $parser->parse('test.xls');
};
print "Error message from eval: $@<br>";
Try another Excel file.
If error still is unknown and with specific Excel file, report bug in bug tracker.
| 1 | Can you run Spreadsheet::ParseExcel from command line? |
How to bindkey alt+key in OSX | I am using oh-my-zsh configuration which has some handy bindkey condiguration. For example: "^[B" backward-word. On Linux I can use it with ease, but on OSX when I press alt-B i get some chars instead moving cursor. Can I configure somehow shortcuts alt+key on OSX or is there any trick to use them of of the box?
| M-b and M-f should be bound to backward-word and forward-word by default:
$ zsh
$ bindkey | grep -- -word
"^W" backward-kill-word
"^X*" expand-word
"^[^H" backward-kill-word
"^[^_" copy-prev-word
"^[\$" spell-word
"^[." insert-last-word
"^[B" backward-word
"^[C" capitalize-word
"^[D" kill-word
"^[F" forward-word
"^[L" down-case-word
"^[S" spell-word
"^[T" transpose-words
"^[U" up-case-word
"^[_" insert-last-word
"^[b" backward-word
"^[c" capitalize-word
"^[d" kill-word
"^[f" forward-word
"^[l" down-case-word
"^[s" spell-word
"^[t" transpose-words
"^[u" up-case-word
"^[^?" backward-kill-word
You just have to change the meta key:
| 0.888889 | M-b and M-f to backward-word and forward-word by default |
Mercedes SLK (R170) convertible top/trunk release | I have a 1999 Mercedes SLK 230 (R170), with an interesting combination of problems:
A) The hydraulics for the convertible top are low (to the point where the top won't even start to open anymore),
B) The trunk latch is disconnected internally, so the trunk can't be opened.
If the top were still working, it can be opened partway to access the back of the trunk latch, and operate it manually... or if the trunk would open, I'd have access to the manual release for the top. But the combination of these two means I have no way to open either now.
So: Are there any other tricks I can use in this situation?
One possible idea: If I tear out the headliner (which I'd probably have to cut away, since the screws are only accessible with the top out), and disconnect the lines coming from the hydraulic pump, would this allow the top to move by hand? This seems plausible, but I don't want to destroy my headliner on a hunch... But, the only other idea I have at this point is drilling a hole behind the license plate to get to the latch, so I'm hoping to find another solution.
| Where is the hydraulic pump? Can you get at that to top up the fluid?
Another option might be to try and remove the rear trim panel (i.e. the bits behind the seats), and see if there is a way through the rear bulkhead into the trunk. Many cars have a non-solid bulkhead in order to save weight. You ought to be able to remove the trim without damaging anything.
| 1 | Where is the hydraulic pump? |
Sort Date Column in jqgrid | I am using ASP.NET MVC with JQGrid.
The issue now is, how can I sort the date column in the JQGrid? Any ideas?
| On the client side, you can use the sorttype and datefmt options to instruct jqGrid to sort these columns.
For example:
sorttype: "date", datefmt: "M d, Y at h:i"
| 0.666667 | Sorttype and datefmt options |
How to display zero value as blank cell in mac numbers 3.1 | How do I display zero value as blank cell in mac numbers 3.1 yet maintain a formula. I want a running balance column that only shows balance to the line of the last entry like a checkbook register.
Thanks.
| The easiest way is to use "Conditional Highlighting..." found under the "Format" menu.
Select the cell you want to have blank as zero then select "Conditional Highlighting" you then set a highlight when the cell is equal to zero. Choose "Custom Highlighting" at the bottom of the style list and then you can set the text colour to white. A "blank" cell on zero.
| 0.888889 | "Conditional Highlighting..." |
Address Windowing Extensions Overhead | I just found another SQL Server (2008r2) with AWE enabled on a 64-bit OS/SQL combination. Has anyone done an research as to the overhead created by enabling AWE on the 64-bit OS/SQL combination? It is mostly a question of curiosity, though it would be nice to be able to put into the analysis documentation. Thanks!
|
Has anyone done an research as to the overhead created by enabling AWE on the 64-bit OS/SQL combination?
This is one of the Myths that Paul Randal clearly debunks in his famous series - A SQL Server DBA myth a day
On 64-bit systems (2005+): AWE is not required (and in fact enabling it does nothing).
Also refer to Fun with Locked Pages, AWE, Task Manager, and the Working Set… by Bob Ward :
The AWE APIs for 32bit and 64bit SQL Server systems are used for different purposes. In 32bit it is really to extend memory access beyond 4Gb or to enable the AWE feature. For 64bit systems, it is to possibly gain performance and to “lock pages” for the buffer pool.
and
In fact, the code for SQL Server for 64bit systems ignores awe enabled sp_configure option. It is a “no-op” for 64bit SQL Server systems.
| 0.666667 | enabling AWE on 64-bit OS/SQL combination |
Making Simple IF Statements Shorter | If we assume we have this little snippet of code:
string str = "checked";
bool test1;
if (str == "checked")
{
test1 = true;
}
else
{
test1 = false;
}
Is it bad practice to change a simple statement like this to the following?:
bool test2 = (str == "checked");
Because they work exactly the same, and work as required, so I can't imagine how it would be. However, as a young, inexperienced programmer I am not aware of whether such a thing is frowned upon or not. Can anyone tell me, if this is NOT ok, why not?
The following test program:
using System;
public class Test
{
public static void Main()
{
string str = "checked";
bool test1;
if (str == "checked")
{
test1 = true;
}
else
{
test1 = false;
}
bool test2 = (str == "checked");
bool test3 = (str != "checked");
Console.WriteLine(test1.ToString());
Console.WriteLine(test2.ToString());
Console.WriteLine(test3.ToString());
}
}
Outputs:
True
True
False
Any insight etc is appreciated.
| I would be very annoyed at someone who used the long form when the statement is that simple.
It hints that the one who wrote it either doesn't understand boolean data types, or doesn't realize == is independent of if.
| 0.777778 | boolean data types are independent of if . |
How can I create a recurring task in Google Tasks? | There's a task that I need to do every Tuesday and Thursday. Is there a way to configure a recurring task in Google Tasks? I can't find it. :-(
| As of this moment, no. It seems they are working on it, since it ranked among the top five in a "top requests" survey.
| 1 | "Top Requests" survey |
What filter should I use to avoid overly-whitened daylight images? | What filter should I use to avoid whitened images (blown highlights) caused by intense daylight? At the moment I am only using an UV Filter, but it doesn't solve the whole problem.
I am a newbie in photography, and I've recently bought a Nikon DSLR.
| If you are indeed referring to your images having too much contrast to allow for both a properly exposed subject and sky, then there are a few options.
As Zak stated, you could use exposure compensation to darken the entire image (this might make the non-sky portion of the image too dark though)
Use a graduated neutral density filter. This will selectively darken one part of an image while leaving the other part alone. This is the old-school method. While it typically limits the transition between the filtered and unfiltered parts to a straight line, it does allow you to fix things at the time of the shot without having to spend time tweaking it on the computer afterwards.
HDR (High Dynamic Range) photography. This is the hi-tech way to do things. This requires that you take multiple shots of the same scene at different exposures and use software to combine them into one image where both the highlights and shadows are well-exposed.
| 1 | High Dynamic Range (HDR) photography |
How can I stop a running MySQL query? | I connect to mysql from my Linux shell. Every now and then I run a SELECT query that is too big. It prints and prints and I already know this is not what I meant. I would like to stop the query.
Hitting Ctrl+C (a couple of times) kills mysql completely and takes me back to shell, so I have to reconnect.
Is it possible to stop a query without killing mysql itself?
| If you have mysqladmin available, you may get the list of queries with:
> mysqladmin -uUSERNAME -pPASSWORD pr
+-----+------+-----------------+--------+---------+------+--------------+------------------+
| Id | User | Host | db | Command | Time | State | Info |
+-----+------+-----------------+--------+---------+------+--------------+------------------+
| 137 | beet | localhost:53535 | people | Query | 292 | Sending data | DELETE FROM |
| 145 | root | localhost:55745 | | Query | 0 | | show processlist |
+-----+------+-----------------+--------+---------+------+--------------+------------------+
Then you may stop the mysql process that is hosting the long running query:
> mysqladmin -uUSERNAME -pPASSWORD kill 137
| 1 | Mysqladmin -uUSERNAME -pPASSWORD |
Calculate integral for arbitrary parameter n in infinite square well problem | I'm continuing[1,2] the study of an infinite square well in the context of quantum mechanics.
Ultimate goal is to calculate the product $\Delta x\Delta k$, for various eigenstates, that is for various values of number $n$. I have finished with $\Delta x$, but I'm stuck with $\Delta k$.
ClearAll["Global`*"];
(* The length of the well *)
L = 1;
(* The eigenfunctions, n=1,2,3,... *)
u[n_, x_] := If[x <= 0 || x >= L, 0, Sqrt[2/L] Sin[n π x / L]]
(* The Fourier transform of eigenfunctions u[n,x] from the position
domain onto the momentum domain *)
φ[n_, k_] :=
Simplify[
FourierTransform[u[n, x], x, k, FourierParameters -> {0, -1}],
n ∈ Integers]
(* The probability density function η(n,k) *)
η[n_, k_] :=
FullSimplify[φ[n, k] \[Conjugate] φ[n, k],
{n ∈ Integers, k ∈ Reals}]
(* Calculate (Δk)^2 = <k^2> - <k>^2 = <k^2> *)
Integrate[
k^2 η[n, k], {k, -∞, +∞},
(* Edited: Was: {n ∈ Integers, n > 0}, but this edit didn't
fix the problem. *)
Assumptions -> n ∈ Integers && n > 0]
The problem is that Mathematica can't calculate the last integral for any arbitrary $n$, although it can, correctly, calculate its value for hardcoded $n$s. Like $n=1,2,...$.
My question is:
Do you have any idea on how I could calculate it, perhaps by rewriting it a bit, or by using some other trick? In case it helps, the result should be $n^2\pi^2$.
Note: Actually it can be calculated with Cauchy's residue theorem, but I'd like to avoid taking that route, if possible. Though, if it can't be done otherwise, I will post a solution with residual calculation so that this question has an answer.
Mathematica.SE related (to the physical problem) questions:
Is there a more mathematica-y way to label these plots?
Why does FourierTransform converge while same integral manually written does not?
| This is a stupid workaround. Anyway:
FindSequenceFunction@Table[Integrate[k^2 η[n, k], {k, -∞, +∞}, Assumptions -> {n == p}], {p, 5}]
(*
π^2 #1^2 &
*)
| 0.777778 | FindSequenceFunction@Table |
Autohotkey: task to copy from browser and paste on text editor | I'm trying to build a script that uses both a browser and a texteditor. The workflow I can summarize as follows:
Right click on a video for streaming
Click on the option to copy the redirection link
Switch to a text editor (Slickedit in my case)
Paste the copied link
Go back to the browser and await next command.
I want to automate this with a single key press while I am standing on the link with the mouse. This has been
my attempt:
^+!a::
Click Right, 392, 64 ;execute in browser
Click Left, 410, 79 ;
Send, !{Tab} ;switch to text editor
Send, ^V ;paste in text editor
Send, !{Tab} ;switch back to browser
return
The script isn't working correctly because it appears not to be executing the ^V command.
I suspect it's because it is executing it before Slickedit is even active. How can I syncronize
these KeyPreses so that they are executed at the right times? Also is there a nicer way for me to
switch to Slickedit without relying on the alt-tab?
| There are a few things you could use to make your script better. WinActivate, clipboard, and improved mouse movement seem to be good ones to add.
^+!a::
clipboard = ; clears clipboard
Click Right ; execute in browser
MouseMove, 18, 15, 50, R ; Moves mouse relative to start location
Click Left
ClipWait, 2 ; Waits 2 seconds for clipboard to contain something
WinActivate, Slickedit ; Switch to text editor
WinWaitActive, Slickedit
Send % clipboard ; paste in text editor
WinActivate, ahk_class Chrome_WidgetWin_1 ; or your browser of choice
Return
Use the included Window Spy to find the correct Window titles or classes to be used in the WinActivate commands.
| 0.888889 | WinActivate, clipboard, and improved mouse movement |
How do I create a great fantasy villain that inspires the party to rally against them? | In my early years of GMing it was simple enough to say that the badguys were evil and that was all the justification we needed. They are attacking the village because they are evil, they are stealing the princess because they are evil, etc.
Over time, my group needs have grown to need more complicated and detailed villains. It is important to consider motives. What is it that defines them as 'evil' to the party? In terms of a fantasy setting, what would you consider to be an interesting villain?
What qualities make a villain that inspires your party to rally against him? What kind of villains have worked for your games in the past?
Example:
A member of nobility is using trade connections to move valuable pieces of art into another country that is secretly paying him quite well and is framing a member of the party to take the fall. In addition, someone important to the party member has been taken hostage with a promise of release once they party member takes the blame for the crime.
| Providing context for your setting. Define enough of your cultures, religions, and society so that there is conflict. This will generate motives for PCs and NPCs alike.
For example all the gods in my setting hates demons which are considered universally evil. One of the common traits of my "evil" gods are extreme philosophies in dealing with Demons. For example Set believes in absolute order, a rigid hierarchy, blind obedience. Mitra likewise believes in order, hierarchy, and obedience but tempered with virtues like justice and mercy. So this aspect of my campaign setups a three way conflict. I had PCs utterly at odds with the Church of Set and yet had to ally because they discovered something demonic that was beyond their ability to handle. Then in the aftermath they are at odds again because of attitudes of the adherents of Set.
You don't have to be a Tolkien, a M.A.R. Barker (Tekemal) to do this. Just think about the consequences of some of the assumptions you and the rules make about the fantasy setting and write up it in a page or two.
Then fit your NPCs motivations within that framework and play it out from there. On the flip side give PCs a background embedded in that framework. Make their association with the various elements of the framework beneficial. This give a bigger chance that they will care about the Villain NPC's motives and truly despise him for it.
| 0.888889 | Define enough of your cultures, religions, and society so that there is conflict |
MSSQL Select with "vertical"-where | I don't really know how to explain except with "vertical where".
Imagine the following table:
TAGID|PRODUCTID|SHOP_ID
59 |3418-7 |38
61 |3418-7 |38
60 |4227-4 |38
61 |4227-4 |38
Now I want to return all product IDs, that have relation to the tag IDs: 59,61. In other words, values of product ID where rows exist for both tag IDs.
So I want to return 3418-7, but not 4227-4
How do I write this as simple as possible in a SQL statement?
This is the working statement I have so far, but I feel this could be done in a much smarter way:
SELECT
productid
FROM shop_tag_relations
WHERE
productid IN (select productid from shop_tag_relations WHERE tagid=59)
AND
productid IN (select productid from shop_tag_relations WHERE tagid=61)
GROUP BY productid,shop_id
| SELECT DISTINCT
a.PRODUCTID
FROM mytable AS a
INNER JOIN mytable AS b ON a.PRODUCTID=b.PRODUCTID
WHERE a.TAGID=59
AND b.TAGID=61
;
| 0.333333 | SELECT DISTINCT a.PRODUCTID FROM mytable AS a INNER |
Combined gas law in an open atmosphere | The question was asked about pressure vs. Volume increasing in an ideal gas as temperature is increased. My question then is this. What is the formula to determine how much volume and pressure will increase as temperature is increased?
Let me frame the question this way. PV/T=P2V2/T2 this formula works for a controlled system where more than one of these values can be maintained. If we apply a known amount of heat, say n, to the atmosphere, what formula would be used to calculate volume and pressure as the temperature is increased?
| At first I wanted to say that you should use the first law of thermodynamics. However both $P$, $V$ and $T$ are unknown if you would add a certain amount energy to an atmosphere.
I agree with udiboy that you should threat the atmosphere as an non-viscous fluid, which allows you to determine the pressure as a function of altitude. However for this to give an unique solution you still need to make some more assumptions, such as the temperature distribution, the molar mass of the gas, how fast the planet and atmosphere are rotating, ect.
| 1 | The first law of thermodynamics is to add a certain amount of energy to an atmosphere |
Which products should have FCC certification and about how much does that cost? | I'm aware that nobody actually does this at the hobbyist level, that successful commercial products have been launched without certification, and it's probably something I can't afford if I have to ask. However, I've always wondered about the ballpark cost. About how much does it cost to receive FCC certification?
| Where I used to work we saved a lot of money on CE testing by hiring the facility for half a day and doing our own preliminary testing. We fixed any problems, they were usually quite minor, and the equipment always then passed first time. You do need to have someone who knows how to drive the test instruments, of course.
| 0.888889 | How to drive test instruments? |
Apache access to NTFS linked folders in linux | Using Apache2/PHP in Debian jessie, when I want to make a new subsection in document folder of Apache (/var/www) I simply create a link to an external folder where my php files exist and simply change the owner and permissions of the folder as follow and it works perfect.
ln -s /home/myname/mynewcode /var/www/test1
chown -R www-data:www-data /home/myname/mynewcode
chmod -R 755 /home/myname/mynewcode
Then I could access http://localhost/test1
But when the real folder that I want to link it, is on a NTFS partition since chown and chmod do not work, I do modify the /etc/fstab by adding the following code, therefore my NTFS partitions will mount with the required permissions and owner.
UUID=XXDDXDDXDDDXDDDD /media/myname/lable ntfs user,exec,uid=www-data,gid=www-data 0 2
ln -s /media/myname/lable/mynewcode2 /var/www/test2
But still I do get the permission error from Apache2 and I don't know what to do!!
Forbidden
You don't have permission to access /test2 on this server.
Apache/2.4.10 (Debian) Server at localhost Port 80
| I cannot offer a 100% working solution but I have two points which you might want to check.
First, try adding umask to the fstab line. I think this causes the permission error. umask adds correct permission to all files (644) and directories (755) when mounting. You must remount the NTFS folder!
UUID=XXDDXDDXDDDXDDDD /media/myname/lable ntfs user,exec,uid=www-data,gid=www-data,umask=022 0 2
You need to make sure, the www-data user is able to cd into the destination folder:
sudo su www-data -s bash && cd /media/myname/lable
Second, make sure "FollowSymlinks" is allowed on the specific folder, I think you have that already, but try anyways:
<Directory "/media/myname/lable/">
Options FollowSymLinks +Indexes
AllowOverride None
Order allow,deny
Allow from all
</Directory>
<Directory "/var/www">
Options FollowSymLinks +Indexes
AllowOverride None
Order allow,deny
Allow from all
</Directory>
| 1 | Umask adds correct permission to files (644) and directories (755) |
Driving electric cars through large pools of water | The state of California is expected to be hit by a large storm in the coming days and there are frequently clogged drains in my town. I have an electric vehicle that seemed to handle driving through large puddles during the last storm but I was curious if anyone could tell me what the potential hazards are of driving an EV through a large standing pool of water.
I don't need to worry about getting water in the engine (I think) since there is no air intake. There are fans that cool the battery if it gets too hot but I don't think that will be a problem during this storm.
EDIT: I have a Ford Focus
| Electric cars use high tech lithium batteries. These batteries are dangerous in a variety of situations but they're also full of electronics to compensate. If anything at all bad happens (for example, a short circuit due to water) the battery itself will shut down, and you'll have to get the car towed.
Cars are expected to handle all kinds of weather and Ford is a reputable company. I would expect all high voltage power sources to be perfectly protected from water splashing up from the wheels which would mean shallow water is fine. If the water gets up into the doors though, then you might be in trouble.
Doing some research, I found someone who's nissan leaf that was submerged for an extended period it of time (the water was half way up the door, wheels totally under water) and the car computers had detected various faults and shut everything down. A mechanic cleaned things up as best they could and the car was able to start, but more errors were detected so they declared the car a write off.
My guess is that car could have been repaired if it was taken to a more competent mechanic, but most mechanics don't know anything about electric vehicles and they're not going to risk telling you everything is fixed when they honestly don't know.
Tesla says that there is no safety risk at all if the car is fully submerged in water, but obviously it would destroy the car just like happened with the Leaf. If the battery catches fire they recommend using "large amounts" of water to cool the batteries down. You're likely to need to keep the battery cool for up to 24 hours, so make sure you have a lot of water available to keep the batteries cool.
My understanding is water won't put out a lithium battery fire, but it should prevent the fire from spreading into neighbouring battery cells, and eventually the ones already burning will run out of fuel.
| 1 | nissan leaf submerged for extended period of time |
Subsets and Splits