summary
stringlengths 15
147
| text
stringlengths 1
19.3k
| answer
stringlengths 32
22.6k
| labels
float64 0.33
1
| answer_summary
stringlengths 5
164
|
---|---|---|---|---|
Estimating RPM to RCF in Methods from Older Papers | I'm attempting to replicate a cell biology method from a 1958 Laboratory Investigation paper. The protocol is for the isolation of an extracellular matrix protein, and a key step is a centrifugation carried out for 2 hours at 2300 rpm. Apparently it was not common practice to list make, model, and rotor size of centrifuges, so I am a little lost as to what settings to use on my own centrifuge to get the same rcf.
Are there any good starting points for estimating the proper settings? e.g. who the major centrifuge suppliers were at the time or what models would be seen as 'standard' for a cell biology lab?
| I am not sure about what they used in 1958 (perhaps Sorvall). However you may look at recent papers for ECM protein isolation (if that was your objective).
Have a look at this article.
From materials and methods:
ECM protein isolation.
Fibroblasts or A431 cells were removed from the
surface of the culture plate with 2 mM EDTA in PBS for 3–5 min at
37⁰C. Detached cells were discarded, and remaining ECM proteins
attached to the surface of culture plates were washed with the same
solution. Cell removal was controlled under the microscope. After
cells were completely removed, matrix proteins were covered with 5%
acetic acid and incubated at 4⁰C overnight. Then, acetic acid was
removed and exchanged with a buffer containing 125 mM Tris-HCl, pH
6.8, 0.1% SDS, 10% glycerol, 1% DDT, 0.05 mM PMSF, protease inhibitor cocktail (Roche, Germany), and incubated at 37⁰C for 1 h. Proteins
were removed with a scraper. The procedure was repeated three times.
All protein extracts, including acetic acid, were combined and ECM
proteins were precipitated by five volumes of acetone. After
incubation at –20⁰C overnight and centrifugation at 7000 g for 15 min,
the protein pellets were dissolved in an appropriate buffer for
further analysis by one- or two-dimensional gel electrophoresis.
In addition, we obtained a Triton X-100-soluble fraction of ECM
proteins. Cells were removed as described above; dishes were filled
with 1% Triton X-100 and incubated at 37⁰C for 30 min. The extraction
was repeated three times. The following procedure of ECM extraction
was the same as described above. Samples obtained from both fractions
were dissolved in a buffer for one-dimensional (Laemmli) or
two-dimensional (rehydration buffer containing 8 M urea, 2% CHAPS, 20
mM DDT, 0.1% Triton X-100) electrophoresis. Proteins that remained
after Triton X-100 extraction were dissolved in Laemmli sample buffer.
| 1 | ECM protein isolation from a culture plate |
When using the acronym package and the smaller option, how to avoid the tiny 's' in the plural acronym? | I'm using the acronym package, and using the smaller option because that is a typographic convention.
\documentclass[a4paper]{article}
\usepackage[smaller]{acronym}
\acrodef{DLL}{Dynamically Linked Library}
\begin{document}
The plural of \ac{DLL} is \acp{DLL} but that `s' just looks way too tiny.
\end{document}
Compiled with pdflatex:
But the plural form of the acronym (\acp) appends an s but this is much to small in my opinion, and looks off.
Should I try to fix this or this typographically accepted? I was thinking about a new command \DLLs (and \DLL) which added a normal 's' but that just feels dirty.
| According to the answer to this question: Plurals (from The Chicago Manual of Style Online), an acronym should be treated as a word with its own meaning, so (extrapolating) the "s" indicating plural should have the size of the lower-case "s" corresponding to the font size of the acronym.
Invoking the smaller option for the acronym package results in typesetting the acronym using \textsmaller from the relsize package. The "s" indicating the plural form will have the size of the lower-case "s" with \textsmaller, so I think that the right option would be to leave the size of the "s" as it is. Furthermore, increasing the size for the "s" could result in confusion if the size of the "s" is too close to the size of the singular form of the acronym.
However, if you really want to change the size of the "s" indicating plural forms , you need to redefine the internal commands \AC@aclp, and \AC@acsp. The simplest way to achieve this is to patch those commands through the etoolbox package. A little example, in which the "s" will have size given by \normalsize:
\documentclass{article}
\usepackage{etoolbox}
\usepackage[smaller]{acronym}
\makeatletter
\patchcmd{\AC@aclp}{\AC@acl{#1}s}{\AC@acl{#1}{\normalsize s}}{}{}
\patchcmd{\AC@acsp}{\AC@acs{#1}s}{\AC@acs{#1}{\normalsize s}}{}{}
\makeatother
\acrodef{DLL}{Dynamically Linked Library}
\begin{document}
The plural of \ac{DLL} is \acp{DLL}.
\end{document}
| 1 | Invoking the smaller option for the acronym package results in typesetting the acronym using textsmaller . |
Send & Delete in GMail | Is there any way to add "Send & Delete" button in GMail like "Send & Archive" which can be enabled in labs. any add-ons, extensions or greasemonkey script will do.
| There's nothing in Labs to do this at this time.
Depending on what you're after, you might be able to get close using filters. Create a filter that looks for a particular string in the content ("Contains:"). Make the string something innocuous that no one would ever think to put in a message (something like ///d\\\). Then set your filter to delete any such message.
When you send a message with that string in it the message will get labelled "Trash" (as if you'd deleted it yourself).
Two possible complications
If the recipient replies and quotes your "tag" the message will go straight to Trash. If they don't it won't
If you use this to reply to a message, the reply will go to Trash, but the original won't. It doesn't delete the whole thread
Depending on what you're trying to accomplish these may or may not be a problem.
| 0.777778 | Create a filter that looks for a particular string in the content |
What should I look for in a recording microphone for personal use? | I was browsing through mics on Amazon and quickly realized I was out of my depth. There are a couple closely related questions I am wondering about:
Are there different types of mics for (1) singing into at a concert, (2) singing into in a quiet room, and (3) picking up sound at more of a distance (e.g., singing and playing guitar and having both recorded with the one mic)? What are they?
I'm most interested in a mic for case (3). This is obviously not professional, I just want something with passable quality and not too much noise considering I'll be in a random room in a house or apartment. What kind of things should I look for in a mic to achieve that? What are the factors that most depend on price? (If it's feasible I'd like to try to fit it into my $50 contest reward.)
There are a few terms I saw like "moving coil", "condenser", and "dynamic" that I saw used to describe mics. If you could touch on these and any other relevant terminology that would be awesome.
| Great question. What all this really boils down to is the polar pattern or pickup pattern of the microphone. Some mics will pick up more sound from the front and less from the sides and rear. Mics that are extremely directional are good for rejecting the loud drums behind you and also rejecting the sound from a PA speaker that might be right in front of you. Many handheld mics have this type of cardioid or supercardioid pattern. Other specialty mics have different patterns that may pick up from all around or just from the front or back. These may be options for you, but won't be as flexible in the long run.
Once you decide on a pickup pattern for your needs, you can start looking at the mechanics of how the mic works - condenser, dynamic, ribbon ... all that stuff. You could stick a dynamic in front of you and your guitar and end up with a passable result. Personally, I'd go for a large diaphragm condenser since they seem to pick up a bit more of the bass and give a nice sound in a solo context. The range of choices is dizzying, so nail down a price range and pick one based on reviews and whatever else matters to you. More expensive mics have higher quality components that will produce a better sound. Audio equipment gets expensive fast and there's not much payoff over a certain level. You also have to think about WHERE you are recording, as room acoustics can 'cheapen' your sound.
You need to have something to plug this microphone into - typically called a preamplifier or preamp. These are built into mixers, computer audio interfaces or stand alone units. A shure 57 or 58 can really shine with a good preamp. If you plug it into a low quality preamp, you'll get a low signal, a noisy signal or a quiet/noisy signal - yuck. If you have a condenser microphone, the preamp will need phantom power in order for the microphone to work.
Some other ideas for you...
Another option might be a hand held recorder which can be carted around, run off battery power and then transferred to your computer for editing and distribution. Super easy and cheap. And you don't need a computer with you - which is always nice. Other options are recording with a phone using some kind of USB microphone.
I have a video demonstrating polar patterns here:
| 1 | polar pattern or pickup pattern of the microphone |
Directory.GetFiles string gives an error | I am creating a website using asp.net and c#
I need to access all files one by one in a directory. So I wrote the following code.
string[] ssImgs = Directory.GetFiles("images/movies");
Label1.Text = ssImgs[0];
Label2.Text = ssImgs[1];
But it gives an error. What is the correct way to do this? Thanks in advance.
| A little advice, when using the file system in ASP.NET, leverage Server.MapPath:
string[] ssImgs = Directory.GetFiles(Server.MapPath("~/images/movies"));
where ~/images/movies is the full relative path from the root of the web application.
Secondly, before just grabbing an index of the array, make sure it's actually there. It would be better to change your indexing code to something like this:
Label1.Text = ssImgs.Length >= 1 ? ssImgs[0] : "File 1 not found.";
Label2.Text = ssImgs.Length >= 2 ? ssImgs[1] : "File 2 not found.";
By making these two changes you won't have to worry about getting a DirectoryNotFound exception or an IndexOutOfRange exception.
| 1 | In ASP.NET, use Server.MapPath: string ssImgs = Directory.GetFiles |
I want to travel to the USA while working remotely for my non-US employer | I would like to travel in the USA for a period of 3 - 6 months. But I want to spend some time working for my employer (remote work) and getting paid by the employer. Is this possible under a tourist visa (B1/B2)?
I hope this is OK since I will not be getting paid by a US employer. I am in the IT trade so all that I will be needing is my own laptop and a connection to the internet. The money I earn would actually help me pay for the expenses I get during the holiday.
| Since so many people liked the comment I thought I'd turn it into an answer.
What you are describing is done all the time by the US and non-US employees on their vacations/holidays. Technically while you are doing work in while being on US soil you are not working in the US since you're not being employed by a US employer and your travel to the US is not employment related, so apply for a tourist visa and you should be fine.
To be more specific I found several sites explaining the differences between B1/B2 and H visas in more laymen's terms, so you can try to read up on that to make your determination:
Workpermit
Wikipedia
And last but not least
State Department
| 1 | What you are describing is done by the US and non-US employees on their vacations/holidays |
Georeferencing uneven/irregularly gridded rasters | I'm trying to take a set of NetCDFs and turn them into georeferenced datasets using GDAL.
However, the only Geospatial data is a set of 2-D lat/lon arrays. The projection type is not lat/lon. THe arrays give the lat/lon of every individual cell.
I can't use a geotransform to reference the data because of the irregular gridding.
How can I create a dataset (such as a GeoTiff) that properly references the data? Ideally I would then warp to some even grid.
EDIT: I tried using an even spread of Ground Control Points, but the resulting GeoTiff did not display correctly... Despite giving GCPs up to 90 deg lat, ArcMap claims the GTiff has an extent ending at 70 deg latitude...
EDIT: Thanks to everyone for their help. I was able to solve the issue using gdalwarp -geoloc as suggested. I created 3 VRTs (1 with cell values, 1 with latitude, 1 with longitude), and wrote the lat/lon vrts in a geoarrays in the data vrt metadata. Then using gdalwarp -geoloc worked like a charm.
The issue with extent was unrelated and due simply to the large difference between the original coordinate system and lat/lon. It was solved by explicitely stating the extent instead of having GDAL try to guess what it should be. (i.e. I added -te -180 0 180 90 to the gdalwarp line)
Thanks everyone!
| gdalwarp -geoloc allows you to use the complete 2d-array of latlon as georeference. With that, you can use any target CRS to reproject your data to a commonly used projection.
See my answer to this question for an example:
How to match a raster NetCDF data with a vector layer in QGIS?
| 1 | How to match a raster NetCDF data with a vector layer in QGIS? |
What size should I make the line art for a one-sheet poster? | I have very little experience in print, if someone could give me some advice on this matter: I have to illustrate a one sheet movie poster (27"*40"), and I was wondering if I can get good results (meaning good quality for print) working on a less bigger piece of paper, and resizing it to poster size later in photoshop. I don't think there'd a problem if I scan it in 300 dpi? It's just that I find it terribly difficult to get proportions right working on large pieces.
| Work at whatever feels comfortable to you if you are working with pen and paper. Then scan it as large as you can with as much PPI as you can.
When you scan the drawing, you can scan it at 500% or more and 1200PPI or more... which will allow you to properly size it for larger reproduction than the original drawing.
Of course, enlarging it when scanning may mean you need to clean it up a bit digitally to possibly sharpen it a bit.
| 1 | Scanning a drawing as large as you can with as much PPI as possible |
Session Fixation - Setting path to root without / | I have found an XSS vulnerability on the subdomain of a site I am testing, and using it I can set cookies for both the main site and all it's subdomains.
My url currently looks like this:
http://s1.example.com/u/%22%3E%3Cmeta%20http-equiv=Set-Cookie%20content=%22sid=1234;%20path=/;%20expires=Thursday,%2020-May-15%2000:15:00%20GMT;%20domain=example.com%22%3E
The issue is that for some reason or another, the character "/" is filtered out (no other characters are), meaning that although I can set cookies to the main site and all it's subdomains, I can only set them to the path /u/ as that is where the attack is launched from on the subdomain. Is there any way to set the path to / without actually using the /?
Thank you very much for any help!
| Try URL encoding the / character with the hex representation %2F.
| 0.555556 | URL encoding the / character with the hex representation %2F |
DataTreeListView shows no results | 'm using a custom control from the ObjectListView package. It's widely used by stackoveflow members so that's why i post it here.
But i find it very hard to show data results in the DataTreeListView control.
This is my code:
DataSet ds = LoadDatasetFromXml("FamilyTree.xml");
if (ds.Tables.Count > 0)
{
this.dataGridView1.DataSource = ds;
this.dataGridView1.DataMember = "Person";
this.dataTreeListView1.DataMember = "Person";
this.dataTreeListView1.DataSource = new DataViewManager(ds);
}
And this is the result:
I use the xml that's provided with the package, so that won't be the problem. I changed all the dataTreeListView propertys so they are just the same as the demo project.
I also tried it using Linq with an selfmade table but with the same results. The datagridview on the other hand works like a charm...
Does anyone have an idea?
| You are missing following code blocks:
dataTreeListView1.KeyAspectName = "Id";
dataTreeListView1.ParentKeyAspectName = "ParentId";
| 1 | dataTreeListView1.KeyAspectName = "Id" |
Arriving very late at hotels in Athens | This September, I will be flying into Athens at 10:45 PM. I'll be leaving to Santorini, then arriving back towards the end of the week via Piraeus at 11:45 PM.
Will arriving that late in town pose any problem traveling to Athenian Callirhoe Exclusiv near the Parthenon? Will checkin be a problem?
I see that the hotel is near a metro stop and a bus stop, so hopefully one of those will work.
| The last Line 1 metro leaves Piraeus at 00:15, so you're cutting it awfully close even if your ferry arrives precisely on time, and it doesn't pass very close to your hotel anyway (you'd need to transfer to Line 2).
Bus 040 from the port to Syntagma (near your hotel) runs every 30 min through the night, so it's probably a better bet.
As for the hotel, you should get in touch with them and make sure they understand you will be arriving very late, so they need to keep your room.
| 1 | Bus 040 from the port to Syntagma (near your hotel) runs every 30 min through the night, so it's |
Thousands of backlinks from Meetup.com | I have been wondering something for a while now. We have a manual penalty from Google on unnatural linking. When I check out "Links to your site" in Webmaster Tools we have 11,387 links from Meetup.com. Is this harming us? After clicking through some of the links randomly I have discovered it is from one of our dealers that sells our products. He is sponsoring different groups and so the ad appears, the problem is he is linking back to our site and not his own. The anchor text is all the same it never changes.
| Although your intentions are clear, still I think that that too many links from a single domain can harm your website rankings.
There are various strategies you can apply:
If the back links are coming from a dealer's selling items page, is
there any way that you ask him not to use your link any more?
You can start creating some more relevant back links to your website. In this way your back links will be diverted. Remember back
links diversity is very important.
Don`t know if you are able to do, if the link that you dealer is using has nothing to do with the website and he is just using as the promoting item, this is called a bad link. Removing bad links is better than creating some junk back links.
I hope this will help!
| 0.888889 | Removing bad links is better than creating some junk back links |
on mouse over background change in document.write | I need to change the background image on mouseover, but don't know how to do it as it is in a document.write that I did not write. Any help is appreciated. Here is what I have so far. I want B to be whats there normally and MO on the mouseover.
<script type="text/javascript">
function DrawRow (Link,Status) {
B = "../Images/GreenButton.png" ;
MO = "../Images/GreenButtonMouseOver.png" ;
color1 = "#66FF33"; color2="#000000"; color3="#000000"; color4="#000000"; color5="#000000";
//====================================================================================================================
// Check User Defined States By Rule
//====================================================================================================================
if ( Status4 ) { B="../Images/BlueButton.png"; MO="../Images/BlueButtonMouseOver.png"; color1="#FFFFFF"; }
if ( Status32 ) { B="../Images/LightGreenButton.png"; B="../Images/LightGreenButtonMouseOver.png"; C1color="#000000"; }
if ( Status2 ) { B="../Images/YellowButton.png"; MO="../Images/YellowButtonMouseOver.png"; C1color="#000000"; }
if ( Status1 ) { B="../Images/OrangeButton.png"; MO="../Images/OrangeButtonMouseOver.png"; C1color="#000000"; }
if ( Status8 ) { B="../Images/RedButton.png"; MO="../Images/RedButtonMouseOver.png";C1color="#FFFF00"; }
if ( Status16 ) { B="../Images/PurpleButton.png"; MO="../Images/PurpleButtonMouseOver.png"; C1color="#000000"; }
document.write( "<td ONCLICK=\"Jump('"+Link+"')\"onmouseover=\"this.style.cursor='hand'\" height='37' width='350' background='"+B+"' ><font color='"+color1+"'><p align='center'><b>"+T+"</b></td>" );
| Are you okay with adding some CSS?
<style>
#somename{
background-image:url("../Images/Green-360-Button.png");
}
#somename:hover{
background-image:url("../Images/Green-360-ButtonMouseOver.png");
}
</style>
And add id="somename" to the <td>
| 1 | How to add some CSS to CSS? |
Which is the older sense of the word "linguist"? | I have been listening to some rants on YouTube against people learning a bunch of languages calling themselves "linguists".
I'm personally interested in both linguistics and languages as a hobby but I have no official training and certainly no qualifications in either.
My instinct was that the ranter was kind of right in his opinion that people who speak many languages are not linguists. But I was uncomfortable with his opinion that you had to have certain pieces of paper to be called a linguist, I think "post doctorate" from memory.
So I looked up "linguist" in some imperfect online dictionaries and was surprised to find both senses. Here's the defs from oxforddictionaries.com (chosen at random):
A person skilled in foreign languages.
A person who studies linguistics.
Now I don't have access to a better dictionary on historical principles from my current location.
I would like to know which of these senses is the original one?
My original opinion was the latter sense but on thinking about it I now expect it to be the former. I doubt the word would be a back-formation from "linguistics".
As a side question, would the first sense now be considered to be colloquial or at least nontechnical or outdated?
|
linguistics (n.)
"the science of languages," 1847; see linguistic; also see -ics.
The scientific sense of linguist came long after the actual meanings of linguist. So linguist can be used for someone who studies/masters a language/languages.
There is also multilinguist who studies/uses several languages.
Multilingualism is the act of using polyglotism, or using multiple languages, either by an individual speaker or by a community of speakers. Multilingual speakers outnumber monolingual speakers in the world's population.
multilingual (adj.)
also multi-lingual, 1838, from multi- + Latin lingua "language," literally "tongue"
And lastly, there is polyglot who masters several languages. (though multilingualism can cover this also)
Polyglotism or polyglottism is the ability to master numerous languages. Multilingualism is a word with a similar meaning.
polyglot (adj.)
1650s, from Greek polyglottos "speaking many languages," literally "many-tongued," from polys "many" (see poly-) + glotta, Attic variant of glossa "language," literally "tongue" (see gloss (n.2)). As a noun from 1640s.
| 1 | linguist can be used for someone who studies/masters a language/languages |
Service Layer Pattern - Could we avoid the service layer on a specific case? | we are trying to implement an application using the Service Layer Pattern cause our application needs to connect to other multiple applications too, and googling on the web, we found this link of a demonstrative graphic for the "right" way of apply the pattern:
martinfowler.com - Service Layer Pattern
But now we have a question: what if our system needs to implement some business logic, only for our application (like some maintenance data for the system itself) that we don't need to share with other systems. Based on this graphic:
As it seems, it will be unnecesary to implement a service layer just for that; it will be more practical to avoid the service layer, and just go from User Interface to the Business Layer (for example). What should be the right way in this case to implement the Service Layer Pattern? What do you suggest us for a scenario like the one I told you?
Thanks in advance.
| As mentioned in the link you posted, the service layer defines an "interface" for clients by encapsulating the (complex) business logic and centralizing the control of transaction involving several resources. The service layer is not only used when you need to "share" services, it just makes it easier. But even with a single consumer, centralizing the control of transaction makes sense.
| 0.777778 | The service layer defines an "interface" for clients by encapsulating the business logic . |
Where is the Zora Queen? | When I go back to Zora's Cave, the Queen is gone. I am told that she is out swimming and very late. I went to the lake and swam around but when I came back, but she is still gone. How can I find her?
| After completing Hyrule Castle, a number of characters, including the Zora Queen, disappear from Hyrule. This is mostly for flavour and finding where she is isn't a sidequest.
The Zora Queen, like the other disappeared characters, is a Sage and you will rescue her after the Swamp Palace.
| 0.888889 | The Zora Queen disappears from Hyrule Castle |
What's the point in adding alt-text to an image? | When you add an image to a post via the helper bar, you get this:
![enter image description here][1]
[1]: http://i.stack.imgur.com/ve8n0.png
What purpose does the enter image description here text serve? I've not noticed anyway of seeing this text, except if I view the page source for the post.
| It adds the alt-text, which is basically a fallback if there is an issue fetching the image. If the image is not found, it'll show a white box with the alt-text in it.
On IE, the alt-text also gives a something similar to a title{*} tooltip, though this doesn't work on Chrome (or, IIRC, Firefox).
So it works exactly as it was intended.
*Curiously, webcomics still call it the "alt-text", even though they don't use the alt attribute. Remnants of a long-lost civilization when everyone used either IE or Netscape, I suppose :S
| 1 | alt-text adds a fallback if there is an issue fetching the image |
Which is better extrusion or assembly for creating blueprints? | When creating a a model of something that will be assembled, in particular furniture blueprints, which is a better approach?
To do many extrusions of the object or the create the pieces separately and join them in parent child relationships?
| I would create the pieces separately and then join them later. Here are some reasons why:
It allows you to preserve separation of concerns. This in itself has many benefits; for example, you could have different team members working on different parts.
It allows you to easily animate assembly instructions by simply moving the objects.
Logically, it makes more sense: the pieces are physically separate; in the real world, they are separate objects, so they should be in Blender as well.
You can join the pieces together at any time by selecting them and pressing CtrlJ or 3D View → Tool Shelf (T) → Join, and you can separate them again with Separate (P) → By Loose Parts while in edit mode.
| 1 | Separate by Loose Parts |
Set natbib options after loading natbib package | Is it possible to set (or change) the natbib package options after its loading (i.e. after the line \usepackage{natbib})?
The reason I need it is that I'm using a LaTeX style from a journal and it has a natbib option which means it "...handles reference entries in the author-year system by using the natbib package", according to the journal style documentation, and I need to tune some settings (like 'sort&compress', for example), but I do not know how to do that since I do not load the 'natbib' package directly.
I know there is a command \biboptions{} in Elsevier LaTeX style which does exactly what I want. But as far as I understand, this command is specific to their style and does not belong to the natbib package itself, or am I wrong?
P.S. I'm working with the Springer's 'SVJour3' document class currently. It is a widely used one, I believe. So, maybe someone can suggest me a way to sort the citations so that they do not look like [2,3,1] instead of [1-3] or at least [1,2,3] in the text?
Thank you!
| You can use \PassOptionsToPackage{OPTIONS}{PACKAGE} to set additional options which should be used when the package gets loaded. But you have to use it before the package gets loaded.
Or you could use PreventPackageFromLoading from the scrfile package, which is part of KOMA-Script. You could prevent the package from loading and later load it yourself after you reset the prevented packages with \ResetPreventPackageFromLoading. More in the KOMA-Script Guide (scrguide).
| 0.888889 | PreventPackageFromLoading from KOMA-Script |
How do you decide what to get first, Forge or Twilight Council? | Once you have a decently size ground force (~ 6 troopers?), you want to start upgrading them, right? Now ... if you're seeing some concrete threat like Mutas or Tanks, then you'll want a specific upgrade like Blink or Charge.
But ... assuming you haven't found any concrete intel at this point, what do you lay down first, Twilight Council or Forge?
While Forge in itself isn't that expensive, you can't seriously plan to build both Forge and Twilight Council and and have enough minerals / gas left to buy upgrades at both.
One advantage of Twilight is of course enabling High/Dark Templars. So ... how (and when) do you decide which of them to get first?
| Basically, you get both around the same time => As soon as your natural starts mining.
While getting blink or upgrades from one base is certainly possible, it will cut heavily into your already very limited army production.
After that it depends on what army composition your want to have, what race the opponent has and how you want to play (turtle style or heavy aggression).
Personally, i would most of the time go with forge first for +1 weapons against Zerg/Protoss and +1 armor against Terran and once the upgrade is started it's time for the Twilight Council followed by blink and +2.
However, getting Blink earlier allows you to play more aggressive, especially in PvP, so it's not a bad choice to go blink first.
In summary: It's situational.
| 0.888889 | blink or upgrades from a single base |
What is the Goal of "Hot Network Questions"? | There has been a tug-of-war in the hot-questions list.
Community members like JonW seem to be unhappy with the traffic that it brings to their site:
'But we want to encourage people to post, that's the whole point of the HQ list!' I hear you cry. I disagree. We want to encourage people to the site not just to that question.
The SE Community Team seems to have a different opinion as Shog9 points out (emphasis mine):
the results have been... Not great so far: a significantly smaller number of people are clicking through to randomly-selected questions than to the top questions, which hints that the algorithm may've been doing a better job of identifying general-interest questions across topics than some expected.
Disclaimer: This should not be taken as a slight of the community team whatsoever, nor do I think this is some cause for revolt or a boxing match as the below prose may indicate. These are just poorly applied literary tools to emphasize the drastically different approaches to the same list between two groups.
In the Red Corner, the Community Members
The goal of the hot questions should be to drive up interest in the site. The hot questions should be a lure to encourage SE network users to contribute to other content, not just do a drive-by on the hot question.
In the Blue Corner, the Community Team
The goal of the hot questions should be to drive traffic to general-interest questions. After all, the Hot Network Questions used to be more accurately named as "Popular Questions".
What is the Goal of Advertising Network Questions?
Before discussing how to calculate hotness, or how the list should be ordered, we need to come to an agreement on what the heck we are actually trying to achieve. Once we know what we are looking to accomplish, we can find the best way to do that.
The list of questions from a variety of sites is in a great location screen-wise, it is readily accessible and does get a lot of eyes on it. But as with any marketing, the goal isn't just to grab eyes, it's to grab the right eyes.*
* I have nothing against left eyes. Most of my friends have left eyes too. And they are awesome. But in the context right eyes are not a geospatial thing, but rather in the 'correct' sense.
So what are the right eyes? What type of people do we want to attract to our site? What would we determine as 'success'? How can we measure that success?
Please do not limit yourself to the very narrowly scoped topic above. Think outside the box if you'd like. On every page across the network we have a nice piece of real estate for showing off the rest of the network. How can that space best be used if not on a list of questions picked by an arbitrary algorithm?
| Pity the poor community members of Workplace. They already have to deal with an endless supply of questions from the clueless who think that the rest of the world owes them a job and pats on the head. These are not necessarily bad questions, but they attract awful answers. Well, maybe they are not bad questions. They are made up of grammatical sentences. They seem to narrate reality as the OP sees it. Sometimes they even offer an opportunity for a really good answer, giving the OP a dose of much-needed reality. However, for every sensible answer offered by a person who has a clue, it seems like there are two or three from the orbit of Jupiter. Does this make them bad questions? Or does it just mean that a community that has taken on the job of TWP has a whole lot of work to do.
These questions are the reality TV of Stack Exchange. Broadcasting them creates work for the community, because it attracts an extra crop of drive-by dweeb answers. So I don't think that Shog9's notion that these questions are the entire fault of the community for failing to police questions is, in fact, entirely fair.
| 0.777778 | Does it mean that a community that has taken on the job of TWP has a whole lot to do? |
Capture all queries that use hints | How can I capture or list all queries that use hints and have executed since the last instance restart?
I am using SQL Server 2005 Standard Edition.
| That's not possible in retrospect.
You need to actively log the queries with SQL Profiler where you can export and filter on the queries with hints. Or use server-side trace for long running traces.
You can come close by inspecting the cached execution plans.
This will show most queries but remember that some aren't cached and that sql server can remove them from the cache if it's under pressure. Use this query to list them:
SELECT [cp].[refcounts]
, [cp].[usecounts]
, [cp].[objtype]
, [st].[dbid]
, [st].[objectid]
, [st].[text]
, [qp].[query_plan]
FROM sys.dm_exec_cached_plans cp
CROSS APPLY sys.dm_exec_sql_text ( cp.plan_handle ) st
CROSS APPLY sys.dm_exec_query_plan ( cp.plan_handle ) qp ;
You can use a where clause with a regex (clr function) so that false positives are minimized close to 0.
| 1 | SQL Profiler can export and filter on queries with hints |
Why is Diet Coke more expensive than regular Coca-Cola and other soft drinks in Indonesia? | Here is a photo of a menu in Bali, Indonesia:
The Diet Coke is 14,000 rupiah. The regular Coca-Cola, and other soft drinks, are 10,000 rupiah. It isn't just this restaurant, the same is true of virtually every restaurant I have been to.
Why is Diet Coke more expensive than regular Coca-Cola in Bali (or Indonesia, if this is not limited to Bali)?
| Because people are willing to pay more, price is set at the highest level that does not depress demand too much.
It may be that locals will drink the cheaper coke, but travellers are willing to pay more for the Diet, so allowing the market to be segmented.
| 1 | Price is set at the highest level that does not depress demand too much |
What is the reason to use an isolation amplifier? |
In a work place PC has a data acquisition card which is 16 bit and has 16 single ended channels. One of the channels is outputting a constant DC voltage which can be controlled by a user via a program in the PC.
The output voltage is feeding a VFD. The VFD takes the voltage value and controls the frequency of the AC motor depending on the voltage applied.
There is an isolation amplifier between DAQ analog output and the VFD as in the figure.
When I measure the analog output of the DAQ and the output of the isolation amplifier with a voltmeter I see the same value.
What might be the reason then for this amplifier?
| Isolation amplifier has an amplifier and isolator in one package. The reason of using isolation amplifier here is to minimize return loss and amplify the power at the same time
| 1 | Isolation amplifier has amplifier and isolator in one package |
When to use tools vs custom development? | To learn dependency injection in a current side-project, I am writing my own dependency injection container.
But this has lead me to wonder, at what point is it worthwhile to use a third party product vs "roll my own"? What would be the kind of questions you would ask to figure this out?
| To really understand a tool, I do like to create my own version of said tool. It helps me understand what the tool is actually doing and the hard parts of the problem it is trying to solve. Understanding those things can help you make better decisions about how to use the tool.
That being said I would rarely recommend using the roll-your-own over the tool in a real project. A few reasons for this are:
Your version has only had you use and test it
It's hard to hire people that have knowledge of your custom tool
You're the only person who can fix it if there's a problem
| 0.777778 | How to use a roll-your-own tool |
How should I rewire a miswired 3-way switch? | I have a 3 way switch that was wired incorrectly when the switches were replaced with a different color switch. Is there a methodical way for me to identify which wires represent which piece of the system so I can correct the bad wiring?
Currently if switch 1 is on, switch 2 can turn light on or off. If switch 1 is off, then switch 2 does nothing.
| Yes. You will need some basic testing equipment; a multimeter should do. There will be a live wire coming in one box, and two traveller wires also in that box (usually a black/white pair.) The traveler pair will go to the other box.
Use your multimeter to figure out what is live whe nothing else is. This is the hot 'in' wire. The next two wires are the traveler. The third wire in the other box at the far end of the traveler is the wire that goes to the Fixture. It sounds like the traveler on the far side of the box might have gotten swapped with one of the wires to the fixture. Just take it apart, figure out which wire is supposed to be which, and put it back together right.
| 0.777778 | What is live wire coming in one box? |
Is OTP useful in modern electronic communication? | I have seen from time to time questions about various OTP schemes and "OTP" (i.e. stream cipher) schemes. The most common OTP troubles appear to be:
How to extend size of previously generated key or how to generate key.
How to get key material securely to the recipient.
In electronic communication or storage encryption OTP appears scheme that is impossible to make work and if it works benefits are not clear. Requirement that the key needs to be the same size than input seems to be unbearable for many of modern use cases for encryption.
Is there any practice where OTP is useful in modern cryptography except:
As a component used on some proofs.
As a example ideal of encryption algorithm.
I.e.: Is it possible to base on OTP and provide the "information theoretic" strength to hashing (apparently not), authentication, etc.
| The OTP is more a theoretical construction than a real world construction. The OTP suffers from three core problems:
Key Generation.
Key Distribution.
Key Destruction.
Let's deal with each one in turn.
Key Generation
Key generation is surprisingly difficult. In order to get the full security proof for the OTP, you need to each bit to be independent of every other bit and for there to be no bias whatsoever in the output.
Now practically every hardware RNG you're going to get does not fufil this in practice. They almost always run the bits through a hash function or some sort of entropy extraction routine. However, these routines do not carry a security proof that they preserve the underlying independent non-bias nature of the bits passed to them.
It's quite possible that if you the entropy extraction routine over enough bits, that a very small bias would be observed. However, any such bias, no matter how small would destroy the OTP security proof.
So you need to design your own RNG using only de-biasing techniques that maintain the security proof. Worse, you need to build an RNG with no detectable bias whatsoever over gigabits of output.
Key Distribution
Key distribution is a pain because the key has to be as long as the message. This immediately raises the question of why bother with encryption if you already have a secure channel of transmitting the key. Even with this massive key you haven't authenticated the cipher-text! You need provisions for that too.
This limits the OTP to scenarios where you want to time-shift a secure channel. It works okay in scenarios like the following. If Alice lives in Hong Kong and Bob lives in New York, they can meet twice a year and exchange a gigabyte or two of pad and be on their way.
Even if you're using QKD you've just moved the problem elsewhere. The problem now moves from a key distribution problem to an engineering problem. You've got to make a QKD device that is 100% reliable, doesn't have any side channel attacks, and is not susceptible to induced errors. Such as slightly overpowering/underpowering device to get duplicate photons, shinning a laser at the device to subtly break it or some other error inducing attack.
You've got many of the same problems of hardware quality as you had with the PRG. Good luck with that!
Key Destruction
Once you've used the key you have to make sure it is properly destroyed in both places. This is again more tricky than it seems at first.
If you don't do this properly and you use the key-stream twice, you have no security at all. If the program that manages the pad for you suffers some sort of error and fails to delete the used portion of the pad then re-use becomes quite likely.
Worse, because the pad is the same length as the message there's quite a lot of key stream to leak. This can leak in a number of ways. Parts of the key stream might have been paged to disk, for example, during encryption/decryption process.
An attacker could then decipher parts of your ciphertext by simply XORing bytes from your recovered hard-drive against the ciphertext.
Conclusion
The reason that the OTP isn't really fielded is that despite its strong security proof, the practical considerations around it actually render it insecure.
This is actually quite common in cryptography. Things with strong security proofs tend to be unworkable.
For every section of my reply, there is a documented case where precisely the problem I've raised has led to OTP messages being compromised.
OTPs are really hard to use properly and are typically less secure overall than a conventional scheme.
Small secrets, by virtue of them being small, are less likely to be leaked, easier to generate, easier to destroy and easier to transmit. All of these properties make them more secure.
| 1 | The OTP is more a theoretical construction than a real world construction . |
Important non-technical course for programmers? | What kind of non-technical training course do you suggest for a programmer? Example could be public speaking course, presentation skill, English, business writing, or anything not related to programming or software engineering itself.
| According to me Painting and Cooking. It makes us become more patient, and it allows us to relax.
| 1 | Painting and Cooking makes us more patient |
Find volume of cask | I was given the following question:
A wine cask has a radius at the top of $30 cm$ and a radius at the middle of $40 cm$.
The height of the cask is $1m$.
What is the volume of the cask in litres, assuming the shape of the side is parabolic?
I have to come to parabolic function of
$$y = \frac{-1}{250}(x-50)^2+40$$
The derivative of $y$ is:
$$\frac{dy}{dx} = \frac{2}{5} - \frac{x}{125}$$
Then I integrate and end up with an expression the length of $\pi$. Am I on the right track?
| We place the centre of the cask at the origin, and assume that the cask is symmetrical about its mid-plane.
Consider the parabola $y=40-kx^2$. At $x=50$ we want $y=30$. So $k=\frac{10}{2500}=\frac{1}{250}$.
We will rotate this parabola about the $x$-axis. The resulting solid is the cask.
It is useful to integrate from $x=0$ to $x=50$, and double. By the usual formula, the volume, in cubic cm, is
$$2\int_0^{50}\pi\left(40-\frac{x^2}{250}\right)^2\,dx.$$
Remark: Kepler once wrote a little book about how to compute the volumes of Austrian wine casks. The book did not sell well, and Kepler had to go back to casting horoscopes and theorizing about the motions of the planets.
| 0.888889 | How to compute the volumes of Austrian wine casks |
How to export PNG to be compatible with all browsers | I recently found our that some PNG files render a slightly different shade of color in Safari. (I think this is because Safari can't render PNG Gamma channel properly or what).
How do I export the PNG images so that they work perfectly fine throughout all the browsers.
(preferable using Adobe Photoshop)
| The slightly different shade is caused by browser applying gamma correction to colors in PNG, but not to any other colors.
To work around it:
Save image as sRGB with gamma 2.2 (that's the default in almost all programs, so if you don't have config options for it, you don't have to do anything).
Use image optimizer to strip gamma information from the file (that prevents browsers from trying to "correct" the file).
You'll find more information about cross-browser compatibility in PNG that works article.
| 1 | gamma correction to colors in PNG |
First package for typesetting commutative diagrams | What was the first package for typesetting commutative diagrams in Latex and when was it made available?
| You can find a comparison between packages for commutative diagrams in a very nice paper by Gabriel Vicente Feruglio on TUGboat, issued in 1994.
According to the bibliography, the first available package (besides using directly picture mode) was the one by John Reynolds, diagmac.sty issued in 1987 and still available as diagmac2 (some patches were introduced by Bob Tennent in order to make the package use pict2e facilities).
The porting of AMS-TeX to LaTeX pushed several people to do the switch and this prompted the development of the other packages described in Feruglio's paper.
| 1 | Comparison between packages for commutative diagrams in a nice paper by Gabriel Vicente Feruglio |
Using "it's" vs. using "it is" at the end of a sentence |
Possible Duplicate:
Is there some rule against ending a sentence with the contraction “it's”?
Why is it that the following sounds incorrect:
"Would she know where it's?"
But this sounds fine:
"Would she know where it is?"
| Because you don't contract away a stressed syllable. It's counter to the very nature of contraction.
See also the answer to Is there some rule against ending a sentence with the contraction "It's"?
| 1 | Is there some rule against ending a sentence with the contraction "It's"? |
Show UILabel with complete text or hide it | I have a UI label say "ABCDEFGH". In iPhone 6 etc wider devices I can show the complete text. In small screen devices like iPhone 5, I see text as "ABCD...". I want the following:
if(complete text can be shown)
{
// show UILabel with text
} else // if text can not fit in, "ABCD..." case
{
// hide the UILabel
}
How can I do this?
| call the sizeToFit function on the UILabel. If it's size is longer that the maximum, hide it...
| 1 | the sizeToFit function on UILabel |
Should a call to action float in a long page? | I was reading this excellent site http://www.goodui.org/ when one of the points made me think
Repeating your call to action is a strategy that is more applicable to
longer pages, or repeating across numerous pages. Surely you don't
want to have your offer displayed 10 times all on the same screen and
frustrate people. However, long pages are becoming the norm and the
idea of squeezing everything "above the fold" is fading. It doesn't
hurt to have one soft actionable item at the top, and another
prominent one at the bottom. When people reach the bottom, they pause
and think what to do next - a potential solid place to make an offer
or close a deal.
While I think this is a good solution in which you have a reasonably sized page where you can reach the top or bottom in three-four scrolls, what if you have a really long page. Do we really know if users will scroll all the way to the bottom and then make a decision ? In that case wont it be better to have a floating call to action button which allows them to do an action at any point of time ?
Please do note I am not suggesting this button should hide any text or content but it would float at the side where it is visible but not in the way.
Please note I did see these questions and go through the answers in detail
Fixed/floating button on mobile app
Should I add a floating, fixed feedback button on the pages of my website?
However they don't apply to my question specifically.
| Most definitely yes. Web apps keep getting more complex, longer and require more cognitive load than ever before. It's quite common to use the OK Cancel both at the top and at the bottom of the page. It's redundant, alright, but it makes it easier for the user. An even better solution your suggesting is the floating buttons. They are accessible at the same place everywhere on the page. I'd love to see Microsoft implement this floating call to action button in their next SharePoint release!
One got to be careful implementing it and not hide too much of the content. It's inevitable to hide some while floating, or at least make the content area smaller, especially on smaller screens. But done right - this can set a new convention on the UX scene.
| 0.888889 | How to use the OK Cancel in SharePoint? |
Can an untapped creature "become untapped?" | If an untapped creature is targeted with an "untap target creature" spell or ability, will it be considered becoming untapped?
| Unless specified as part of the target (e.g. "target tapped creature"), targeting doesn't check or care whether that thing is already tapped, so you can target an untapped creature with Savage Surge. That's why cards like Devout Invocation and Clock of Omens specify that those permanent must be untapped.
However, if a trigger looks for something that "becomes untapped" like the new inspiration cards, it require a change in the tapped/untapped status, just like cards like Brink of Disaster or Chronic Flooding (Compare with Bramble Elemental and its "becomes attached" trigger).
| 0.888889 | Targeting doesn't check or care whether that thing is already tapped |
How to prevent the "Too awesome to use" syndrome | When you give the player a rare but powerful item which can only be used once but is never really required to proceed, most players will not use it at all, because they are waiting for the perfect moment. But even when this moment comes, they will still be reluctant to use it, because there might be an even better moment later. So they keep hoarding it for a moment which will never come.
In the end, they will carry the item around until it is outclassed by other, more readily available resources, or even until the very end of the game. That means that such one-shot items don't provide any gameplay-value at all. They are simply too awesome to use.
What can you do to encourage the player to make use of their one-shot items and not hoard them?
| A simple solution would be to make this special item available in-game for a limited time.
For instance in 2012 Jagex (creator of Runescape) added a special item called the "DeathTouched dart" it could kill any opponent with just one hit. It has been said that it will be removed on some unspecified date.
http://runescape.wikia.com/wiki/Deathtouched_dart
That way, most players used their darts and their purpose has been fulfilled.
Another example from my game experience comes from an old game called "Star Wars Jedi Outcast Academy II", I remember that I aquired some rare items like Seeker drone, which were supposed to help you fight your enemies. Due to their rarity I have kept them until the end of the game, hoping they can help me fight the final boss, but to my dissapointment it hasn't even left a scratch on him. In that case I would simply make them more common.
| 1 | "DeathTouched dart" can kill any opponent with just one hit . |
Why ducklings are yellow? | Why ducklings are yellow, what the evolutionary background for this? How could it help to survive?
UPDATE
I agree with comment below,
I did remember then that ducks are wild animals too (when I asked the question I imagined domesticated ducklings as widely pictured in media), but anyway it is interesting to know why the domesticated ducklings are yellow now. What is the reason of selection drove such coloration to young ducks or yellow pigment is just a side effect?
| It doesn't need to help it survive, evolution has no intent and not all traits are advantageous. It might just be random, genetic drift or something, a bottleneck effect, any of these things.
In the wild the yellow ones will hardly live long enough to reproduce though.
| 1 | Evolution has no intent and not all traits are advantageous |
How do I turn off my Raspberry Pi? | Should I just pull the plug? Or is it best if I exit LXDE and any other running processes first?
| I've used that shutdown.py solution too.
You'll still need to find a physical switch and solder it to pins 6 and 8 of header 5. I took mine from an an old broken Arduino board. I've also drilled a small hole in the case to make sure that I can push the button with a small wooden pin when the case is closed.
This is how it looks like:
| 1 | Shutdown.py is a shutdown switch for Arduino |
Why is my CV 145% complete? | On Careers, when filling out my CV, it is listed as being 145% complete. Could someone tell me why this is?
| The over 100% is intentional -- just indicates that you've gone the "extra mile" beyond the minimum required.
| 0.888889 | Over 100% is intentional . |
Create post thumbnails from images stored outside of uploads directory | I am redoing some of my older blogs and I noticed with the new themes most of them take advantage of featured images which is fine. The problem is a lot of my older posts that was never set either because I did not use it or because it didn't exist.
Now I know of the featured thumbnail plugin the regenerates your posts and it grabs the images from your post and makes a thumbnail which is great and that works, but I have some posts where the images were not stored in the uploads folder where the plugin seems to be looking and those posts fail.
Any thoughts on how I can get these featured images without going through every single post manually?
| You need to first download those external images then you can attach and set them as the post thumbnail.
To download and attach you can use the media_handle_sideload() function.
I wrote a plugin that will search through all your posts and pages and download and attach any external image into the media library. It also has the option of setting the first image as the featured image.
http://wordpress.org/extend/plugins/media-tools
| 0.888889 | Download and attach external images to media library |
What kind of dose can you expect from a radioactive lens? | I read that lens makers used to use radioactive glass to increase the refractive index property of their lenses.
How radioactive are they?
Here are some example dosages; where would looking through the viewfinder for an hour fit?
http://xkcd.com/radiation/
| Typical lens radiation was apparently approaching 1 mR/hr at the surface of the lens and tapers off rapidly with distance. I'm not sure exactly where it lands in your chart, but the same source states that a chest xray is about 10 mR.
| 1 | Typical lens radiation was apparently approaching 1 mR/hr at the surface of the lens |
Can a smaller sensor's "crop factor" be used to calculate the exact increase in depth of field? | If APS-C and similar crop-sensor digital cameras have a focal length multiplying effect such that a 50mm lens has an apparent focal length closer to the field of view of an 80mm on a full frame camera, and yet at the same time the depth of field for the smaller sensor camera is more like the depth of field a 50mm lens would produce on a full frame camera (using the same aperture), then this would seem to suggest the concept of an "aperture dividing effect."
In other words, a 50mm f/1.8 lens on an APS-C camera would act more like a 80mm f/2.8 (approx. 1.8 * 1.6x) lens in 35mm equivalent — for depth of field, not considering exposure.
Can someone with a better understanding of the physics involved clarify this for me. I've never seen this concept explicitly mentioned anywhere, so I am a bit suspect of it.
| Yes, a sensor's crop factor can be used when calculating the change in depth of field (DoF) of a lens compared to that lens' use on a full frame (FF) camera. But it will not always lead to an increase in the DoF. If shot from the same distance and displayed to the same size, the DoF for the crop body camera will be reduced (because the virtual image projected on the sensor, including the circles of confusion, will be enlarged to a greater degree). If, on the other hand, you adjust your shooting distance to frame the subject similarly the DoF will increase.
There are so many variables to deal with in this question and most of the answers assume several without specifying those assumptions. This leads to gross misunderstandings about the relationship of focal length, aperture, sensor size, shooting distance, display size, viewing distance, and even the visual acuity of the viewer to Depth of Field (DoF). All of these factors combined will determine the Depth of Field of an image. This is because DoF is a perception of what range of distances from the focal plane are in focus. Only one distance from the focal plane is actually in focus such that a point light source will theoretically produce a point of light on the focal plane. Point light sources at all other distances produce a blur circle that varies in size based on their proportional distance to the focal plane as compared to the focus distance. DoF is defined as the range between the near and far distance from the focal plane that the blur circle is still perceived as a point by the viewer of an image.
We ask questions such as, "How does depth of field change when using the same lens on a camera with a different sized sensor?" The correct answer is, "It depends." It depends on whether you shoot from the same distance (and thus change the framing of the subject) or shoot from a difference distance to approximate the same framing of the subject. It depends on whether the display size of the image is the same or the display size of the image is changed by the same proportion as the different sensor sizes. It depends on what changes and what stays the same in regard to all of the factors cited above.
If the same focal length is used at the same subject distance with the same aperture using the same sensor size with the same pixel density and printed at the same resolution on the same size paper and viewed by persons with the same visual acuity then the DoF of the two images will be the same. If any one of these variables change without a corresponding change to the others, the DoF will also be changed.
For the rest of this answer we will assume the image viewing distance and the visual acuity of the viewer are constant. We will also assume that apertures are large enough that diffraction does not come into play. And we will assume any printing is done on the same printer at the same number of dpi but not necessarily the same ppi and not necessarily on the same size paper.
For the sake of simplicity, let's consider a couple of theoretical cameras. One has a 36mm X 24mm sensor with a resolution of 3600 X 2400 pixels. This would be an 8.6MP full frame (FF) sensor. Our other camera has a 24mm X 16mm sensor with a resolution of 2400 X 1600 pixels. This would be a 3.8MP 1.5x crop body (CB). Both cameras have the same pixel size and pixel pitch. Both cameras have the same design and sensitivity at the pixel level. In other words the center 24mm X 16mm of the larger FF sensor is identical to the smaller CB sensor.
If you attach the same 50mm lens to both cameras and take a photo of the same subject from the same distance at f/2 (assuming all other settings are the same) and crop the FF sensor image to 2400 X 1600 pixels and print both images on 6" X 4" paper, the two images will be virtually identical, and the DoF will be the same in both photos.
If you attach the same 50mm lens to both cameras and take a photo of the same subject from the same distance at f/2 (assuming all other settings are the same) and print all of both images on 6" X 4" paper there will be some noticeable differences. The image from the FF camera will have a wider field of view (FoV), the subject will be smaller and the DoF will be greater than the image from the CB camera. This is because the FF image was printed at 600 ppi and the CB image was printed at 400 ppi. By enlarging each pixel from the CB camera by 50%, we also enlarged the size of each blur circle by the same amount. This means that the largest blur circle projected on the CB sensor that will be perceived as a point is 33% smaller (the reciprocal of 3/2 is 2/3) than on the FF sensor. If we had printed the FF image on 9" X 6" paper and the CB image on 6" X 4" paper the DoF would have been the same (both printed at 400 ppi), as would the subject sizes in both prints. If we then trimmed the center of the 9" X 6" print to a 6" X 4" print we would again have near identical prints.
If we attach the same 50mm lens to both cameras and take a photo at f/2 of the same subject from different distances so that the subject size is the same and print both images on 6" X 4" paper there will be some noticeable differences. The perspective will have changed because the CB image was taken at a greater distance from the subject. The subject will appear compressed in the CB image compared to the FF image. If background details are visible the background will also appear closer to the subject than in the image from the FF sensor. Because the 50mm lens was focused at a 50% greater distance, the DoF also increased by 50%. If the subject was at 10' using the FF camera and 15' using the CB camera here are the resulting DoF calculations:
50mm @ f/2 from 10' on FF: 9.33' to 10.8'. DoF of 1.45' (17.4"). The DoF ranges from 8" in front of to 9.6" behind the 10' point of focus (PoF).
50mm @ f/2 from 15' on CB: 14.0' to 16.2'. DoF of 2.18' (26.16"). The DoF ranges from 12" in front of to 14.4" behind the 15' PoF.
These calculations are based on a circle of confusion (CoC) of .03mm for the FF camera and .02mm for the CB camera. This is because we are printing at 600 ppi for the FF and 400 ppi for the CB (and the pixels are the same size for both- 0.01mm or 10µm).
In reality, we all know the pixels on most FF sensors are larger than the pixels on most newer CB sensors. They range from 6.92µm on the 18MP FF Canon 1D X to 7.21µm on the 16MP D4 to 4.7µm on the 36MP FF Nikon D800. The crop bodies go from 4.16µm for the 18MP Canon 7D to 3.89µm for the 24MP Nikon D7100 (the D7200 will be around 3.0µm) to 5.08µm for the 14MP Sony SLT Alpha 33. In all cases the pixel size is considerably smaller than the generally accepted CoC of .03mm (30µm) for FF cameras and .02mm (20µm) for 1.5x CB cameras. For 1.6x CB Canon cameras 0.019 (19µm) is generally used. The largest size pixels Canon has used in the last decade or so was 8.2µm for the 12.8MP FF 5D and the 8.2MP APS-H 1D mkII. What all this means is that at the pixel peeping level, focus blur will be visible even for objects within the accepted DoF because the accepted blur circle is anywhere from 4 to 7 times larger than the pixels on current DSLRs. To calculate DoF at the pixel level you would need to use a CoC the size of your camera's pixels which would be much narrower than most DoF calculators use.
| 0.833333 | How does depth of field change when using same lens on a full frame (FF) camera? |
Does 'The plot thickens' make the game easier or harder? | Just curious for games going forward.
Because the expansion allows you to see how people have played on missions, can reveal people's cards, etc, it seems like these are all an advantage mostly to the resistance.
In people's experience - does it make it easier for the resistance?
| There is a slight advantage to The Resistance but the plot cards mostly just throw a monkey wrench into the pattern of the game. When you play a game like this repeatedly, you as a group can fall into the same rhythm. Plot cards are designed to interrupt that rhythm. They cause the game to have more chaos and that chaos can in theory help both sides.
| 1 | Plot cards interrupt the rhythm of the game |
iPhone app - Persistent hamburger menu vs last page visited | I'm wondering which option is best for an iPhone app using a hamburger menu (placed at the top left):
The menu is persistent on every single page even when the user goes
to a sub-level.
When the user goes to a sub-level, the hamburger menu is replaced by a back button or a button whose label is the name of last page visited.
Both. The menu is persistent on every page and a back button appears when needed.
Thanks for your help :)
| Use "back" button on sub-level pages and make menu accessible for the users with swipe gesture on all pages.
| 0.777778 | Use "back" button on sub-level pages and make menu accessible with swipe gesture |
What are the chances of something *not* occurring? | Suppose I'm gambling using a strategy of doubling my bet whenever I lose to recoup my losses from previous bets. If my initial bet is 1/2048 of my capital, I can bet 10 times before I run out of money. Statistics says that the chances of this happening are ~1/718. As the law of large numbers states, though, this is in no way a guarantee that such an outcome will manifest in any certain number of iterations.
Is it possible, therefore, to calculate the chances that this doesn't happen? For example, is there an equation we can put x (the number of bets) into and determine the likelihood of this 1/718 chance not occurring? My chances of losing within the first ten bets would be extremely small, and my chances after ten thousand would be pretty high, so is there any way to calculate the middle ground?
|
What bets are you making that the chance of losing ten bets out of ten is about 1/718?
I'm pretty sure the law of numbers doesn't actually state what you say it does. (The claim is nevertheless true, though - it's not certain at any finite $n$.)
$P(E)+P(\overline{E})=1$ (where $\overline{E}$ is the complement of $E$, or 'not-$E$'). So if the 1/718 chance of losing it all in ten bets was accurate, then the chance of not losing it all in ten bets is $1-\frac{_1}{^{718}}$. It's a direct consequence of the axioms of probability - see the second item here (the notation there - $\Omega\backslash E$, essentially "everything but $E$" - is the same thing as $\overline E$).
| 1 | What is the chance of losing ten bets out of ten? |
Can a PC have more than one Default Gateway? | I know that a PC can have multiple network adapters each of which with different network identifiers (IP,MAC etc.).
My question is, can a certain PC have more than one active default gateway? And if so, how does the PC (or better say the OS) knows to what adapter use for any given packet?
| On Windows (at least Vista), having multiple default routes on the same interface with different metrics is fine. Windows will automatically switch to the route with the next highest metric if the lower metric router goes down. If there are multiple default routes with the same metric, Windows randomly selects one to use.
This allows you to have redundant routers without configuring failover on the routers.
On Linux, this does not work. You can have multiple default routes with different metrics, but currently the Linux kernel ignores the metric value. If the default router with the lowest metric disappears, traffic will not flow.
| 0.888889 | Multiple default routes with different metrics on Windows (at least Vista) |
jQuery - Apply styling to all vertical TD in table on hover | If you hover over a price, you will notice the price and 1st child of .catTr td is highlighted. None of the others are. The goal is to create a very clear grid of what is being selected.
How can I get it to apply the same styling to every child td in the column with class tr.cat ?
Live Link: http://www.sinsysonline.com/cameron/nick/repair/price.html
HTML:
<table id="prices">
<tr>
<td class="clear"></td>
</tr>
<tr class="head">
<td class="clear"></td>
<td class="head">
<a href="desktop.html"><h3>Desktop</h3></a>
</td>
<td class="head">
<a href="laptop.html"><h3>Laptop</h3></a>
</td>
<td class="head">
<a href="server.html"><h3>Server</h3></a>
</td>
</tr>
<tr id="priceRow">
<td class="clear"></td>
<td class="price">
<h2>Testing</h2>
</td>
<td class="price">
<h2>Testing</h2>
</td>
<td class="price">
<h2>Testing</h2>
</td>
</tr>
<tr class="catTr">
<td class="category">
<a href="services_hwrep.html">Hardware Repair</a>
</td>
<td>
<a href="services_hwrep.html"><img src="../css/images/check.png" /></a>
</td>
<td>
<a href="services_hwrep.html"><img src="../css/images/check.png" /></a>
</td>
<td>
<a href="services_hwrep.html"><img src="../css/images/check.png" /></a>
</td>
</tr>
<tr class="catTr">
<td class="category">
<a href="services_netts.html">Network Troubleshooting</a>
</td>
<td>
<a href="services_hwrep.html"><img src="../css/images/check.png" /></a>
</td>
<td>
<a href="services_hwrep.html"><img src="../css/images/check.png" /></a>
</td>
<td>
<a href="services_hwrep.html"><img src="../css/images/check.png" /></a>
</td>
</tr>
<tr class="catTr">
<td class="category">
<a href="services_netts.html">Network Troubleshooting</a>
</td>
<td>
<a href="services_hwrep.html"><img src="../css/images/check.png" /></a>
</td>
<td>
<a href="services_hwrep.html"><img src="../css/images/check.png" /></a>
</td>
<td>
<a href="services_hwrep.html"><img src="../css/images/check.png" /></a>
</td>
</tr>
<tr class="catTr">
<td class="category">
<a href="services_netts.html">Network Troubleshooting</a>
</td>
<td>
<a href="services_hwrep.html"><img src="../css/images/check.png" /></a>
</td>
<td>
<a href="services_hwrep.html"><img src="../css/images/check.png" /></a>
</td>
<td>
<a href="services_hwrep.html"><img src="../css/images/check.png" /></a>
</td>
</tr>
<tr class="catTr">
<td class="category">
<a href="services_netts.html">Network Troubleshooting</a>
</td>
<td>
<a href="services_hwrep.html"><img src="../css/images/check.png" /></a>
</td>
<td>
<a href="services_hwrep.html"><img src="../css/images/check.png" /></a>
</td>
<td>
<a href="services_hwrep.html"><img src="../css/images/check.png" /></a>
</td>
</tr>
<tr class="foot">
<td div class="clear"></td>
<td class="foot">
<a href="contact.html" class="action_button">Contact Us</a>
</td>
<td class="foot">
<a href="contact.html" class="action_button">Contact Us</a>
</td>
<td class="foot">
<a href="contact.html" class="action_button">Contact Us</a>
</td>
</tr>
</table>
jQuery:
<script>
(function() {
$('tr.catTr td').not('.category').hover(function(){
var priceSel = $(this).index();
$('tr#priceRow td').eq(priceSel).addClass('price_hover');
$('tr.catTr td').eq(priceSel).addClass('vertFilt');
$(this).closest('tr').find('td.category').addClass('category_hover');
},function(){
var priceSel = $(this).index();
$('tr#priceRow td').eq(priceSel).removeClass('price_hover');
$('tr.catTr td').eq(priceSel).removeClass('vertFilt');
$(this).closest('tr').find('td.category').removeClass('category_hover');
});
})();
</script>
Live Link:
http://www.sinsysonline.com/cameron/nick/repair/price.html
Now, how to highlight EVERY equivalent child in the column....
I know I need to do something with .each(), but I'm unsure where to put it...
| To add a class for an entire column use td:nth-child(n) where n is the column number. In your case, the columns you want to highlight vary from 2-4. You also need to prevent the head, foot, etc. elements from being highlighted, so use .not().
$('table#prices tbody td:nth-child(3)')
.not('.head,.price,.foot,.category_hover')
.addClass('vertFilt');
So, for your situation, try this:
$('tr.catTr td').not('.category').hover(function(){
var priceSel = $(this).index();
$('table#prices tbody td:nth-child('+priceSel+')')
.not('.head,.price,.foot,.category_hover')
.addClass('vertFilt');
...
},function(){
var priceSel = $(this).index();
$('table#prices tbody td:nth-child('+priceSel+')')
.not('.head,.price,.foot,.category_hover')
.removeClass('vertFilt');
...
| 0.888889 | td:nth-child(n) where n is the column number |
Adding custom icon and marker data together using Mapbox | I am new to mapbox and I have a simple question. I have made a feature layer and a list of custom icons. How do I add the two together?
My feature layer is formatted as below:
L.mapbox.featureLayer({
"type": "Feature",
"geometry": {
"coordinates": [
'.$long.','.$lat.'
],
"type": "Point"
},
"properties": {
"title": "'.$business_name.'",
"description": "'.$address_1.', '.$address_2.', '.$address_3 .', '.$postcode .'"
}
}).addTo(map);
And example of my custom marker is below
var accomodation = L.icon({
iconUrl: '/img/pins/day-and-night/accommodation.png',
iconSize: [46, 62],
iconAnchor: [8, 60],
});
Any help would be perfect.
Thanks
| From your code, I assume you are talking about mapbox.js, which is a derivative of leaflet.js
If so, I think what you are looking for is leaflet layer groups
So, in your case...
var featureLayer = L.mapbox.featureLayer({
"type": "Feature",
"geometry": {
"coordinates": [
'.$long.','.$lat.'
],
"type": "Point"
},
"properties": {
"title": "'.$business_name.'",
"description": "'.$address_1.', '.$address_2.', '.$address_3 .', '.$postcode .'"
}
});
var accomodation = L.icon({
iconUrl: '/img/pins/day-and-night/accommodation.png',
iconSize: [46, 62],
iconAnchor: [8, 60],
});
var layergroup = L.layerGroup([featureLayer, accomodation]);
layergroup.addTo(map);
| 0.888889 | var featureLayer = L.mapbox.featureLayer |
Implementing application logic on model layer (MVC) | I keep on reading that the biggest layer in the MVC pattern should be the model. I've also heard that we should avoid putting logic on the controller layer. However, as my ASP.Net MVC 5 application is getting larger, I see that I'm getting heavy views, heavy controllers, and... extremely tiny models (they're not more than references to my SQL tables).
Yes, I admit, I could never manage to put any logic on my model.
I like the MVC pattern, and my website is working good, but I keep on thinking that I'm surely not doing things right...
Can you show me some useful links about how to write MVC code properly? Rick Anderson's (Microsoft) MVC 5 tutorial is fine, but once again, his models are very tiny...
| In my applications I put as much logic as possible in the domain models. On top of that there is an application layer which interacts with the database and domain models to perform application specific operations. The controller actions have as little code as possible and just call methods in the application layer.
In addition I usually have a view model for each view. Any logic that you have making your views "heavy" would go there.
One of the main reasons I try to put as much logic as possible in the domain models is to make unit testing easier. Logic in the application layer usually involves the database, which you will need to mock in order to test. Moving logic to the domain models makes testing easier and makes you code more reusable.
This is a pretty complex issue. I have an in depth blog post on the question if you're interested.
This answer is also pretty close to what I would suggest.
| 0.777778 | How do I put as much logic in the domain models? |
Respberry Pi fails to boot with custom kernel | I'm trying to cross compile my kernel with touchscreen enabled, however my Respberry Pi fails to boot with the custom kernel.
I was trying to compile the kernel on my ubuntu 10.4 (x64) with different config files but after transferring the files to my Pi I was no longer able to boot it.
These were the steps I followed as per various descriptions:
apt-get install gcc-arm-linux-gnueabi make ncurses-dev ia32-libs
Then I downloaded the kernel source rpi-3.10.y and the tools
export KERNEL_SRC=/home/marco/kernel/linux-rpi-3.10.19
export CCPREFIX=/home/marco/kernel/tools/arm-bcm2708/arm-bcm2708-linux-gnueabi/bin/arm-bcm2708-linux-gnueabi-
export MODULES_TEMP=/home/marco/kernel/modules/
Get .config file from the running raspberry and transfer to the ubuntu machine
zcat /proc/config.gz > myconfigfromrpi.config
In the kernel source folder
make mrproper
cp ../myconfigfromrpi.config ./.config
make ARCH=arm CROSS_COMPILE=${CCPREFIX} oldconfig
make ARCH=arm CROSS_COMPILE=${CCPREFIX} menuconfig
Using editor I changed the line to be "CONFIG_LOCALVERSION"="+MW" and continue
make ARCH=arm CROSS_COMPILE=${CCPREFIX}
make ARCH=arm CROSS_COMPILE=${CCPREFIX} INSTALL_MOD_PATH=${MODULES_TEMP}
modules_install
In the folder /tools/mkimage
./imagetool-uncompressed.py ${KERNEL_SRC}/arch/arm/boot/Image
The I transfer the new kernel as kernel_new.img to Respberry into folder /boot/ and update the config.txt accordingly.
Transfer content of folder /lib/firmware/ to Respberry into folder /lib/firmware/
Transfer folder /lib/firmware/modules/3.10.19+mw to Respberry into folder /lib/modules/
Did I miss something or do I something wrong?
| This:
> apt-get install gcc-arm-linux-gnueabi
Will be a toolchain targeting the more common ARMv7 architecture. It probably does not properly support the ARMv6 Broadcom SoC used on the pi, but you could try by adding:
CCFLAGS += -mcpu=armv6j -mfpu=vfp -mfloat-abi=hard
| 0.777778 | Install gcc-arm-linux-gnueabi |
Understanding the static keyword | I have some experience in developing with Java, Javascript and PHP.
I am reading Microsoft Visual C# 2010 Step by Step which I feel it is a very good book on introducing you to the C# language.
I seem to be having problems in understanding the static keyword. From what I understand this far if a class is declared static all methods and variable have to be static. The main method always is a static method so in the class that the main method exists all variables and methods are declared static if you have to call them in the main method. Also I have noticed that in order to call a static method from another class you do not need to create an object of that you can use the class name.
What are the advantages of declaring static variables and methods?
When should I declare static variable and methods?
| The static keyword in C# is refering to something in the class, or the class itself, that is shared amongst all instances of the class. For example, a field that is marked as static can be accessed from all instances of that class through the class name.
public class SomeObject
{
//Static Field
static int Foo = 3;
//instance field
private int _Foo2 = 4;
//instance property
public int Foo2{get{return _Foo2;}set{_Foo2 = value;}}
//static constructor
public static SomeObject CreateSomeObject(int fooValue)
{
SomeObject retVal = new SomeObject();
retVal.Foo2 = fooValue;
return retVal;
}
//Parameterless instance constructor
public SomeObject()
{
}
public static int Add(int x)
{
//Static methods can only deal with local variables, or fields that
// are also static in the class. This one adds x to the static member foo
return x + Foo;
//Foo2 is not accessable here!
}
//Instance method
public void AddSomething(int x)
{
//Add x to the property value of Foo2
return x + this.Foo2;
//Note that Foo *is* accessable here as 'SomeObject.Foo'
}
}
I can honestly say that I have never used a class marked as static with the exception of creating extention methods (Quick tutorial on extension methods).
Anyways, there are specific design patterns for utilizing static methods, such as factory pattern and singleton pattern, but the important thing to remember is that static methods and constructors do not deal with any specific instance of a class (unless you pass one in). So utilizing static methods is more of a stateless implementation of a methods, e.g. to do calculations or to do a comparison between objects. The "Main" method you are refering to is always static, but to see it from a different point of view, see this article.
To follow up with this, here is how the difference between static and instantiated methods, fields and properties are called.
public static void Main(string[] args)
{
//This is a static method that starts a thread in an application
// space. At this point not everything actually has to be static...
//Here is an instantiation with a parameterless contruction
SomeObject obj = new SomeObject();
//Here is an instantiation using a static contructor (factory)
SomeObject obj2 = SomeObject.CreateSomeObject(3);
//Getting field value from static field
// Notice that this references the class name, not an instance
int fooValue1 = SomeObject.Foo;
//Getting property value from instance
// Note that this references an object instance
int fooValue2 = obj2.Foo2;
//Instance method must be called through an object
obj2.AddSomething(4); //if default constructor, would return 8
//Static methods must be called through class name
SomeObject.Add(4); //Returns 7
}
Also, check this post out for a deeper look into static classes.
| 0.888889 | static methods can only deal with local variables, or fields that // are also static in the class |
Appcache for dynamic site | I am trying to use HTML5 Appcache to speed up my web-mobile app by caching images and css/JS files. The app is based on dynamic web pages.
As already known – when using Appcache the calling html page is always cached -> bad for dynamic websites.
My solution - Create a first static page and in this page call the manifest file (manifest="cache.appcache") and load all my cached content. Then when the user is redirected to another dynamic page the resources will already be available. (Of course this second dynamic page will not have the manifest tag).
The problem is that if the second page is refreshed by the user, the resources are not loaded from the cache; they are loaded directly from the server!
This solution is very similar to using an Iframe on the first dynamic file. I found that the Iframe solution have the exact same problem.
Is there any solution for that? Can Appcache really be used with dynamic content?
Thanks
| I had a hell of a time figuring out how to cache dynamic pages accessed by a URI scheme like this:
domain.com/admin/page/1
domain.com/admin/page/2
domain.com/admin/page/3
Now the problem is that the appcache won't cache each individual admin/page/... unless you visit it.
What I did was use the offline page to represent these pages that you may want to allow a user to access offline.
The JS in the offline page looks up the URI and scrapes it to find out which page it should show and fetches the data from localStorage which was populated with all the page data when the user visited the admin dashboard before being presented with the links to each individual page.
I'm open to other solutions but this is all I could figure out to bring a bunch of separate pages offline with only visiting the single admin page.
| 0.888889 | How to cache dynamic pages accessed by a URI? |
C++ new memory allocation fragmentation | I was trying to look at the behavior of the new allocator and why it doesn't place data contiguously.
My code:
struct ci {
char c;
int i;
}
template <typename T>
void memTest()
{
T * pLast = new T();
for(int i = 0; i < 20; ++i) {
T * pNew = new T();
cout << (pNew - pLast) << " ";
pLast = pNew;
}
}
So I ran this with char, int, ci. Most allocations were a fixed length from the last, sometimes there were odd jumps from one available block to another.
sizeof(char) : 1
Average Jump: 64 bytes
sizeof(int): 4
Average Jump: 16
sizeof(ci): 8 (int has to be placed on a 4 byte align)
Average Jump: 9
Can anyone explain why the allocator is fragmenting memory like this? Also why is the jump for char so much larger then ints and a structure that contains both an int and char.
| There are two issues:
most allocators store some additional data prior to the start of the block (typically block size and a couple of pointers)
there are usually alignment requirements, e.g. Linux typically allocates to at least an 8 byte boundary, OS X allocates to at least a 16 byte boundary
So you'll nearly always get some kind of gap between successive allocations.
Of course you should never rely on any specific behaviour for something like this, where the implementation is free to do as it pleases.
| 0.666667 | Linux allocates to at least an 8 byte boundary, OS X allocates at least 16 byte boundaries |
EE control panel dashboard search field | the search field in EE's dashboard doesn't seem to find anything. what is this field supposed to search?
| I'd recommend using Switchboard as I guess it will give you more of the functions and results you'd expect from a search in the CP.
| 0.777778 | Switchboard will give you more functions and results from a search in the CP |
Why am I getting a redefinition error? | I'm following the tutorial here: http://iphone-3d-programming.labs.oreilly.com/ch01.html#ch01_id36002837
When I try to run the program, I get an error saying "Redefinition of 'void RenderingEngine1::OnRotate(DeviceOrientation)"
Here's the code. The function is at the end of it:
#include <OpenGLES/ES1/gl.h>
#include <OpenGLES/ES1/glext.h>
#include "IRenderingEngine.hpp"
class RenderingEngine1 : public IRenderingEngine {
public:
RenderingEngine1();
void Initialize(int width, int height);
void Render() const;
void UpdateAnimation(float timeStep) {}
void OnRotate(DeviceOrientation orientation) {}
private:
float m_currentAngle;
GLuint m_framebuffer;
GLuint m_renderbuffer;
};
IRenderingEngine* CreateRenderer1()
{
return new RenderingEngine1();
}
struct Vertex {
float Position[2];
float Color[4];
};
// Define the positions and colors of two triangles.
const Vertex Vertices[] = {
{{-0.5, -0.866}, {1, 1, 0.5f, 1}},
{{0.5, -0.866}, {1, 1, 0.5f, 1}},
{{0, 1}, {1, 1, 0.5f, 1}},
{{-0.5, -0.866}, {0.5f, 0.5f, 0.5f}},
{{0.5, -0.866}, {0.5f, 0.5f, 0.5f}},
{{0, -0.4f}, {0.5f, 0.5f, 0.5f}},
};
RenderingEngine1::RenderingEngine1()
{
glGenRenderbuffersOES(1, &m_renderbuffer);
glBindRenderbufferOES(GL_RENDERBUFFER_OES, m_renderbuffer);
}
void RenderingEngine1::Initialize(int width, int height)
{
// Create the framebuffer object and attach the color buffer.
glGenFramebuffersOES(1, &m_framebuffer);
glBindFramebufferOES(GL_FRAMEBUFFER_OES, m_framebuffer);
glFramebufferRenderbufferOES(GL_FRAMEBUFFER_OES,
GL_COLOR_ATTACHMENT0_OES,
GL_RENDERBUFFER_OES,
m_renderbuffer);
glViewport(0, 0, width, height);
glMatrixMode(GL_PROJECTION);
// Initialize the projection matrix.
const float maxX = 2;
const float maxY = 3;
glOrthof(-maxX, +maxX, -maxY, +maxY, -1, 1);
glMatrixMode(GL_MODELVIEW);
}
void RenderingEngine1::Render() const
{
glClearColor(0.5f, 0.5f, 0.5f, 1);
glClear(GL_COLOR_BUFFER_BIT);
glPushMatrix();
glRotatef(m_currentAngle, 0, 0, 1);
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_COLOR_ARRAY);
glVertexPointer(2, GL_FLOAT, sizeof(Vertex), &Vertices[0].Position[0]);
glColorPointer(4, GL_FLOAT, sizeof(Vertex), &Vertices[0].Color[0]);
GLsizei vertexCount = sizeof(Vertices) / sizeof(Vertex);
glDrawArrays(GL_TRIANGLES, 0, vertexCount);
glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_COLOR_ARRAY);
glPopMatrix();
}
void RenderingEngine1::OnRotate(DeviceOrientation orientation)
{
float angle = 0;
switch (orientation) {
case DeviceOrientationLandscapeLeft:
angle = 270;
break;
case DeviceOrientationPortraitUpsideDown:
angle = 180;
break;
case DeviceOrientationLandscapeRight:
angle = 90;
break;
}
m_currentAngle = angle;
}
| remove the body
class RenderingEngine1 : public IRenderingEngine {
public:
...
void OnRotate(DeviceOrientation orientation) {}
...
-> void OnRotate(DeviceOrientation orientation);
| 0.888889 | Remove the body class RenderingEngine1 |
yum hangs on installing a specific package | tried to install squid with command
yum install squid
and it consistently hangs on
Running Transaction
Installing: squid ##################### [1/1]
Had no problems with hundreds of other packages. Does anyone have an idea on what could be the problem?
edit: tried both: yum clean all + changing mirror, and rebuild rpm, doesn't help.
Thanks.
| I would try Keith's suggestion of "yum clean all" first. If that doesn't work, I have encountered a situation like this when there is actually an issue with the RPM database.
You can try to rebuild the RPM database by doing:
sudo rm -f /var/lib/rpm/__db.* (you could move them to a temporary directory to be cautious)
sudo /bin/rpm --rebuilddb
After that completes, try the "yum install squid" again.
| 0.888889 | "yum clean all" |
Hide "Close Window" option from taskbar | I want to make a window that has an icon on the taskbar, but does not have the option to be closed from there. I could simply intercept WM_CLOSE, but then a non-functional option still remains on the window's taskbar menu. There are other questions on stackoverflow pertaining to that method, but none that describe how to hide the option itself. How can I accomplish this?
| The Taskbar button uses the same menu that is assigned to the window itself. There is no way to differentiate whether the menu is being invoked by clicking on the Taskbar versus clicking on the window (or even if it is being invoked by mouse or keyboard, for that matter). If you disable the "Close" item, the user would not be able to close the window at all. So just don't do it.
| 0.888889 | Clicking on Taskbar versus clicking on window |
when two associations are equal? | <|a -> 2, b -> 3|> == <|b -> 3, a -> 2|> returns False; can anybody explain why? If I am not mistaken here these two associations would be identical from the practical point of view.
| Perhaps as Pickett describes the developers do not consider these associations Equal since that function performs other conversions like:
Quantity[5, "Percent"] == 0.05
True
But perhaps Equal has not been (properly?) extended to associations yet as 2.0 and 2 are Equal but these are not:
<|a -> 2|> == <|a -> 2.0|>
False
Depending on what you are doing this might be useful, but beware it does not have early exit (short-circuit) behavior:
eq[{x_}] = False;
eq[{x__}] := Equal[x]
one = <|a -> 2, b -> 3|>;
two = <|b -> 3, a -> 2.0|>;
And @@ Merge[{one, two}, eq]
True
| 0.888889 | Equal has not been extended to associations yet . |
Why are the two buttons on the apple TV remote shaped differently (Menu & Play/Pause) | On the apple TV remote, I have realized that the two buttons have a different physical design. The menu button goes invward (convex) and the play/pause one is flatter/goes more outward.
I tried to figure out why with my common sense, but failed. Does someone know?
| So in the dark, you'll know which is which without looking at it.
| 1 | Which is which without looking at it? |
Should I write a recommendation letter for a student at a previous job/institution? | I receive requests for recommendation many times, but I have received one from a student belonging at a previous affiliation of mine, asking for a favourable letter in view of their achievements.
I am aware of the fact that if I comment on the performance of the student, it could be used against me, since it is good practice to "erase" all the material, marks, personal information of the students and staff relationship at a previous job. So I am hesitant to go in that direction. On the other hand, I could comment only very generally on the skills of the student, which could backfire their application to a new job
Differently from this question I am not looking for a recommendation, but giving one...
| You may want to ask the student to send you any material that you need for writing your reference, for example grade sheets and a CV. Bringing in your personal experiences with the student in addition shouldn't be a problem at all. After writing the reference letter, you should erase all confidential material that the student sent you... :)
| 1 | You should erase all confidential material that the student sent you |
Directory.GetFiles string gives an error | I am creating a website using asp.net and c#
I need to access all files one by one in a directory. So I wrote the following code.
string[] ssImgs = Directory.GetFiles("images/movies");
Label1.Text = ssImgs[0];
Label2.Text = ssImgs[1];
But it gives an error. What is the correct way to do this? Thanks in advance.
| There are two potential issues here.
If you doing have using System.IO; in your file, the Directory class will not be found by the compiler.
The way you're specifying your path ("images/movies") will be relative to the current working directory, which is likely not the proper directory. You should use Server.MapPath or the Path class to build a full path to the proper folder, so you can specify the correct folder with a full, absolute path.
| 0.888889 | How to specify a path to the proper folder? |
Show UILabel with complete text or hide it | I have a UI label say "ABCDEFGH". In iPhone 6 etc wider devices I can show the complete text. In small screen devices like iPhone 5, I see text as "ABCD...". I want the following:
if(complete text can be shown)
{
// show UILabel with text
} else // if text can not fit in, "ABCD..." case
{
// hide the UILabel
}
How can I do this?
| You can get Screen's size like this :
CGSize screenSize = [[UIScreen mainScreen] bounds].size;
And then put an if statement like this :
if (label.frame.size.width>screenSize.width) {
//Use smaller label }
else {
//use bigger label }
| 0.777778 | Screen Size: CGSize screen Size |
Should I tell other interviewers where else I've interviewed? | I am currently travelling for faculty interviews. Some professors and other interviewers have asked me where else I have interviewed. Should I tell interviewers where else I've interviewed?
Intuitively I would like to give them less information, but I also don't want to appear guarded and defensive as a person, either.
| At least in Germany, interviews for academic positions are more like dating than like normal job interviews. If you are good, the department will worry about being rejected as much as you do. If they offer you the position and then you don't accept, they are losing time - they may not be able to fill the position in time -, and it's also bad for their reputation. Each time someone gets an offer from universities A and B and chooses to accept the offer from A, this contributes to the reputation of A and harms the reputation of B.
Whether it's good for you if the committee at one university know where else you have applied and how you are doing there, depends very much on the relative reputations of these universities and how they are judging you. You want them to think that you are the perfect fit, not that you are overqualified and therefore likely to reject their offer (doing well with an application at a much better university) or underqualified and going to harm their reputation that way (as could happen if they make you an offer and at the same time you are rejected by a university with much lower reputation).
| 1 | If you are good, the department will worry about being rejected as much as you do. |