summary
stringlengths 15
147
| text
stringlengths 1
19.3k
| answer
stringlengths 32
22.6k
| labels
float64 0.33
1
| answer_summary
stringlengths 5
164
|
---|---|---|---|---|
Random Forest to estimate land use in past with Landsat | I am new in Machine Learning and in R. I am working in my Master thesis. I am trying to estimate the LULC of the years 1984, 1990, 2000, 2011, 2014 for characterizing the forest dynamics. I have for each year the bands corresponding to Landsat imageries. The images were corrected and I have calculated vegetation index (NDVI, EVI, SR) and Tasseled Cap Components(Brightness, Greenness, Wetness). All this was performed using i.landsat.toar, i.vi and i.tasscap commands in Grass 7, respectivelly.
I have as reference the year 2009 since there is a orthophoto and LiDAR data. Using the orthophoto I digitized training polygons for 5 classes (1. Crops, artificial, bareland; 2. pinus forest; 3. Mixed forest; 4. Quercus and 5. Shrubs).
I fitted a model using Random forest and my intention is to classify the other year datasets wich have 5 reflective bands, 3 vegetation indexes and 3 tasseled Cap Components as predictor variables.
The performance of the model is quite good, OOB 10.45% but within classes the Mixed forest achieved about 30 % of error. Thus, when I use the model to classify the other years the misclassification is very high.
Am I doing anything worng? Is the Random forest useful for this purpose? Is there any software, method or algorithm that i could use to estimate the landuse?
| It is a difficult thing that you are attempting. Small subtle changes in reflectances caused by different acquisition dates will cause major errors to arise when using your approach. You will have to do more preprocessing of your data, in order to have your approach be reliable.
Normalizing the other years to your reference will most likely help, but it may not be enough.
Another approach would be to create training areas for each timestep and accept that the images are not directly comparable, but instead compare finished classifications. This obviously adds to the amount of user dependency and thus makes the study less reproducable.
| 0.888889 | Small changes in reflectances caused by different acquisition dates will cause major errors to arise when using your approach |
Self-managed IRA account brokerage as an HSA? | Most specific than this question, I'm desperately seeking a TD Ameritrade or E-Trade type online brokerage that offers self managed HSAs to accompany an HDHP. I cannot find one.
Is there another key word that I should be looking for? Can any IRA be used as an HSA and I just don't realize it, assuming I do the right paperwork?
If there are no such options, are there legal reason why there cannot be? Are there financial disincentives making such offerings unappealing to brokerages?
Thanks!
| Here is a Directory of HSA Administrators
A google of HSA administrators turns up quite a list. These accounts are separate from IRAs, and an IRA can't substitute. The HSA is required to have the HDHP and the insurer running it should be offering you the linked HSA partners as they are closely tied.
| 1 | The HSA is required to have the HDHP and the insurer running it |
How to remove color cast from HSV information | I have hue, saturation and value of a color (HSV color-space). The color has to be set on a device that displays them incorrectly. If I specify white it displays light magenta. However, if you specify some green it displays the best white it can (let's say: gray). How do I remove this color cast? Actually: How do I create a color cast in the HSV numbers to compensate for the wrong display?
My approach was the following. But it lead to a skip of some magenta colors, when I ran through the whole rainbow with a saturation of, say, 0.8 (interval 0 to 1):
Shift magenta to the beginning of the hue scale (60 degrees forward) and thus the hue of the current color
Calculate the distance to move in the direction of green. With a saturation of 1 that means to move completely to green (180 degrees).
This is the formula: distance = (180 / 360 - shifted_hue) * (1 - saturation)
Then add the distance to the shifted hue (possibly resulting in a subtraction).
Shift the hue scale back by 60 degrees.
As said, this is leading to an ugly skip of some magenta colors, because the lower the saturation the bigger the gap at magenta.
Do you know of a better algorithm?
| It is not necessary that your device's color mismatch can be corrected with a simple shifting of the Hue component (except of course if you are absolutely sure that this is the case with your equipment).
In general, to correct the response of the device you somehow need to recover the mapping that it already performs between reference and observed colors and then see how it can be corrected by some curve (monotonic or not).
For this purpose you will need a colour chart (and ideally, an instrument such as this one).
(Please note that it is best that this correction is applied at the system level, i.e. your application will still be sending some "color demand" normally, without correcting it but that demand would undergo some correction prior to display automatically by the system.)
At the very basic level, you can send a simple reference image to your display and then try to adjust its R,G,B settings (if there are any) so that the colours seem to display properly (according to your eyes that is)
If you have a system that is not capable of applying such profiles but you still must apply some color-correction you could try matching the relative distances of the colours with a known target (or image in your case) and then (if required) try to correct towards absolute colours by shifting (with trial and error).
Take an evenly lit image of the colour chart with a good digital camera, color correct it (to reduce any effects of the lighting or sensor used to acquire your "reference" image) and feed it to your display. Take an image of the display (ideally in the same lighting conditions), apply the same color correction with the profile from the first step (and for the same reasons) and then examine the relative color correspondence between any two colors from the color chart image and two colors from the color chart display image to recover the mapping. (A piece of software that might be of help in this process is LPROF)
| 0.888889 | Correction of color mismatch with a simple shifting of Hue component |
Why is this type of hesitation considered unethical? | In two previous questions, it was clearly agreed that hesitating before playing a singleton specifically, and hesitating during play as a bluff generally constitute "wrongful/unethical hesitation." As an advanced beginner, I don't understand this rule at all.
I know that at the highest level, the best way to play and not give away any information about your holding to the opponents is to play each card at a nice even tempo. I am not a world class player; I am not even an advanced player (if I endplay you, I promise it wasn't intentional). As such, I frequently need to pause and calculate what to play, even in situations where the correct play should be obvious.
Knowing that I will inevitably need to pause and consider a play and that that pause will provide my opponents with the information that I had a potentially difficult decision to make, why is it considered unethical for me to occasionally insert a similar pause before a routine play?
It isn't as if I could use such a pause to reliably signal something to my partner. In fact, this strategy removes the temptation for partner to draw unauthorized inferences from my pauses.
| It's related to the 'secret agreements' with partner in this way - Dummy has KJ. Declarer leads toward it, and has a the AQ guess. If you hesitate as if thinking of hopping up with the ACE, declarer will be fooled ( what else could you be thinking of?) but your partner won't , he's looking at the ACE !! Similarly, if dummy J43 of trumps and declarer, holding AK1076, leads the J and his right hand opponent hesitates as if he was thinking of covering with the Queen ( what else could he be thinking of?) then declare will be fooled but your partner can't be - he's looking at the Queen!. You were never at risk for fooling your partner.
| 1 | Declarer is fooled but your partner can't be |
Running Linux inside Windows XP, ie no dual booting | What are the best options that allow running a Linux distribution, such as Ubuntu inside Windows XP, i.e. within a window?
By "best" I mean quick startup time, low memory requirement, good graphical performance, easy access to the main (host) Windows XP file system.
I know about Wubi and standard Ubuntu with the dual boot capability, but I'd prefer to be able to switch from XP to Linux without a reboot. I know the Linux experience may not be ideal this way, but it would be pefectly good for my needs.
I've downloaded VirtualBox and the latest Ubuntu and will try the virtual machine approach; however are there any specifically customised Linux versions for this purpose?
I think this would be a great way for people new to Linux to get used to the OS while still having the "safety net" of Windows.
| Maybe this will help you: Portable Ubuntu Remix
| 1 | Portable Ubuntu Remix |
Why is the potential function defined differently in physics and calculus? | I am very familiar with the concept of a potential function, and potential energy, from calculus-based physics.
For instance, if we have the familiar force field $\mathbf{F} = -mg \,\mathbf{j}$, then a potential function is given by $U = mgy + C$. (Since potential energy is relative, we have an infinite number of potential functions.)
Notice that the gradient of the potential function is the negative of the force field: $$\nabla U = \nabla(mgy + C) = mg \,\mathbf{j} = -\mathbf{F}.$$
That was perfectly fine with me. But now in vector calculus, I am reading that the potential function $f$ of a vector function $\mathbf{F}$ is such that $\nabla f = \mathbf{F}$. A negative sign appears to have been lost when migrating from physics to calculus.
It seems confusing to call $f$ a "potential function", since it cannot be interpreted as potential energy in the real world. So why is the calculus nomenclature as it is (i.e., why not call this something else and then say the potential function is the negative of it)?
| Recall where the negative sign comes from in physics -- it is simply due to your coordinate system and point of view. The difference is analogous to the difference between work done by gravity and work done on gravity.
| 1 | Difference between work done by gravity and work on gravity |
How to choose between multiple math postdocs offers? | I am trying to decide between some math postdoc offers, and I can't decide what is important for a postdoc position. I have talked to several senior mathematicians including my advisor, but they all seem to have different opinions. I just want to hear some more opinions on the following:
How important is prestige? Suppose that I have an offer from school X, which is fairly prestigious (something like top 10, which isn't a well-defined notion). Also suppose that I have an offer from school Y, which is not as prestigious but a better match research-wise. Suppose that the ranking of school Y is approximately n (again, not a well-defined notion). For which values of n should I choose school X over school Y? My goal is to become a tenure-track professor in a PhD-granting institution.
What makes a good postdoc supervisor? I can think of the following criteria: compatible research interests, being well-known in one's field, compatible personalities, generous with time, etc. Am I missing anything else?
| At the end of the day, the quality of your research is more important than prestige. I would go with the university that is a better research match.
As for what makes a good postdoc supervisor. I think this depends completely on the individual and how one conducts research. The two extremes are: hands off -- I have plenty of ideas and give me something to work on.
The best is a combination of the two. This shows you are able to work independently and work well with others.
| 0.888889 | What makes a good postdoc supervisor? |
In a C# ASP.NET view, how can I wrap numbers after a comma? | At the moment I have something that looks a little like this
@string.Format("{0:#,###,###.##}", "9999999999")
which will display the value as: 9,999,999,999
However sometimes I have only a small DIV to display this large number. So I want to wrap the number after the commas.
I did try this
@string.Format("{0:#,###,###.##}", @lot.MinDecrement).replace(",", ",< wbr>")
I just tried to see if it would but a break in the word, but this doesn't work and actually puts in the string.
Does anyone know how I can simply make the text wrap if it needs to, after a comma?
Thanks
| I found a way to do this by simply adding Html.Raw at the beginning on the String format. So like this
@Html.Raw(string.Format("{0:#,###,###.##}", "9999999999").replace(",", ",<wbr>"))
This seems to work exactly how I want it, but thanks everyone
However - Not supported in IE
- Looking for another alternative
| 1 | How to add Html.Raw to String format |
Stopping a DC motor using an H-bridge: forward+backward vs. 'brake' | Using an H-bridge, you can stop the DC motor at a certain position by applying a 0101 or 1010 signal to the 4 terminals.
You can also stop it at a certain position by driving it forward then backward at very high frequency which make the 'juggling' unnoticed and the motor looks like stationary.
Ignoring all other aspects and focusing on stopping the motor at a specific position...which of these two methods is better?
| Assuming you can measure the actual motor position, juggling forward and backward directions will be better in terms of stopping at the right place - use the position error to control the ratio of forward to reverse drive.
This does involve a lot of switching noise and high currents during deceleration : you may wish to employ resistive braking to lose most of the motor's speed, then switch to active drive to the final position.
| 0.888889 | juggling forward and backward directions |
Solspace Calendar ICS for single event | Is it possible to have an .ics file to download a single event in a calendar? right now downloading the .ics downloads the entire calendar
{exp:calendar:icalendar
event_id="{segment_3}" dynamic="on"
{/exp:calendar:icalendar}
I figured something like the above would only export the one event using the dynamic on and event id but it downloads the entire calendar
| Well..
https://solspace.com/docs/calendar/icalendar/
All of the parameters listed in Calendar:Events are available for use here.
and then..
https://solspace.com/docs/calendar/events/#event_id
Have you tried hard coding a known (and open) event_id?
| 1 | Calendar:Events is available for use here |
Reverse iteration from a given map iterator | I want to find an element in the map using map::find(key), and then iterate the map in reverse order from the point where I found the element, till the beginning (i.e. until map::rend()).
However, I get a compile error when I try to assign my iterator to a reverse_iterator. How do I solve this?
| Make the conversion explicit:
std::map<int, int> SomeMap;
for ( int i = 0; i < 10; i++)
SomeMap[ i ] = i;
std::map<int, int>::iterator it = SomeMap.find( 5 );
std::map<int, int>::reverse_iterator itr( it );
for ( itr; itr != SomeMap.rend( ); itr++ )
std::cout << itr->first << std::endl;
| 0.888889 | Make the conversion explicit |
How do people know what they can get out of trade up contracts? | I hear people say "I can get this or that out of these skins" but how do you know what you can get out of a skin?
| The comment from GiantTree is correct, however I am answering here so the question can be closed and to give a more specific answer. Trade up Contracts give out skins based on what skins you put in. The output skin is both one grade higher than the inputs (Industrial will give you a Mil-Spec, Mil-Spec will give you Restricted, etc) and must be from one of the collections of the skins input.
For example, you could put in 5 Glock 18 Catacomb skins and 5 AK-47 Elite Build skins. Both of those skins are Industrial Grade skins, Catacombs is from the Chroma collection and Elite Build is from the Chroma 2 collection. Thus, you can get out of it any Mil-Spec skin from either Chroma or Chroma 2 (namely, Dual Berettas Urban Shock, Desert Eagle Naga, MAC-10 Malachite, Sawed-Off Serenity, AWP Worm God, MAG-7 Heat, CZ75-Auto Pole Position, UMP-45 Grand Prix).
Most of this information is available on the wiki plus additional information regarding exclusions and exceptions.
| 0.777778 | Trade up Contracts give out skins based on what skins you put in |
How to export a single huge table from SQL Server? | I'm given the task to export the content of a huge table from a production database and to import the data into a database at a remote location.
The Table has about 45,000,000 rows. using about 4 GB space in the database.
Its 10 Columns are of type int, datetime and varchar(n) <= 255, but some of the varchar fields contain newlines and the usual field separators used by bulkcopy.
I guess export to Excel is no option due to the number of rows.
Export with SSIS to Flatfile is possible (took about 30 minutes), but reimport is not automatic, since some fields where spitted.
My current idea is
create a new database on the production server (using same
collations as the production database)
Set its recovery mode to simple
copy the data with
Select * into copy_of_table from prod_db..big_table
Detach mdf file from this new database and ship it to the other
location
Drop adhoc database
I assume that inserting into a database with simple recovery model generates only minimal logging on the new database and this way is one of the fastest possible to export the data and the impact to the production database is the least possible.
| Your method will work fine, I would pre-allocate the data file on the new database so it won't need to autogrow. A backup would work just as well as detaching. And the destination server will need the same or higher version of SQL.
| 0.666667 | SQL backup and detaching on new database |
Is it better to put "Preview" on an iFrame with a specific height or just show it in full? | We have a page that shows a preview of another page (newsletter) on an iFrame. Now we have two ways of displaying this:
Give the iFrame a specific height so that the user can scroll up / down within the iFrame to see the embedded page fully.
Dynamically resize the iFrame to the height of the embedded page so that it actually gets displayed in full (without the iFrame
scrollbars).
Is #1 better so that the users can access the buttons at the bottom easily (button is "Next") without scrolling 'till the end of the embedded page? (Although the disadvantage is that iFrame scrollbars are ugly.)
OR
Is #2 better so that the users actually feel like they're just seeing 1 whole page (and no scrollbars)? (Although the disadvantage of this would be the page could be very long depending on newsletter's height. But one can argue that newsletters are seldom very long and that users do scroll down.)?
| I agree with Michael regarding his suggestion and about iFrames. From the original question, I recommend going with option 2. Adding a sticky bar across either the top or the bottom of the browser in a contrasting colour would help to modernize the experience.
Similar to Themeforest:
http://themeforest.net/item/micron-retina-responsive-multipurpose-theme/full_screen_preview/6949939
See how they have their main sell bar at the top but it doesn't impede on the experience of the preview?
In terms of specifically email, I believe MailRox does the same thing. The preview is within the screen with the tools at the top.
Having 1 set of scrollbars (specifically the browser scrollbars) is more ideal.
| 1 | Adding a sticky bar across either the top or bottom of the browser |
Java - Is the Point class's hashCode() method any good, or should I override it and write my own? | Is there any way to actually see the source code of standard java classes by the way? I'm making a hash table of points (HashSet<Point>) and I want to make sure that it will hash well, but I can't see what Point's hashCode() method actually looks like, so I don't know how good it really is. Can anyone help me? Should I override it? And if so, is there an easy way to do this without creating a whole new java file/class?
| If you're searching for the hashCode() of java.awt.Point, it is defined in java.awt.geom.Point2D.
/**
* Returns the hashcode for this <code>Point2D</code>.
* @return a hash code for this <code>Point2D</code>.
*/
public int hashCode() {
long bits = java.lang.Double.doubleToLongBits(getX());
bits ^= java.lang.Double.doubleToLongBits(getY()) * 31;
return (((int) bits) ^ ((int) (bits >> 32)));
}
Note that the question "Will it hash well?" is hard to answer, it depends primarily on usage pattern.
You can access the source code of nearly all "standard Java classes", just search for the src.zip file in your JDK installation directory (or use an IDE like Eclipse/NetBeans and click F3 on the class name).
| 0.666667 | HashCode() of java.awt.Point |
Does an illustration of Tochee from the Commonwealth Saga exist? | One specific creature from the Commonwealth Saga has caught my interest -- Tochee. My imagination is really bad, and I can not hold all the descriptive details in mind at once. I have tried to find some illustration, but unsuccessfully. All I found was this non-Tochee :
http://www.flickr.com/photos/rickpickett/7464577876/
Can anyone help me by pointing me in the right direction?
Off-topic: I would highly appreciate if anybody could make a drawing from the descriptions given in the Tochee link :o)
| There's a very extensive description of the Tochee on the Hamilton-verse wiki;
The body is about three and a half yards long, coming up to a human’s
chest and shaped similar to a squashed egg. The hide is a dark caramel
bristly fur and looks like it is two sizes too big – the whole body
looks like it is covered in wrinkles and creases. Black fronds grow
out of these creases like seaweed but look leathery and dead in the
icy conditions of the Ice Citadel world. These fronds later recover
into their multicoloured feather state after leaving the ice planet.
Its mouth is a small lip-sphincter that forms a snout on the conical
end of the body with extremely sharp teeth arranged in a circular
array. The organs it uses to both see and communicate with are located
a yard or so back from the mouth. It is a curved pyramid made up from
three oval sections of translucent black flesh, with the one in front
twice as long as the other two so it could follow the body profile. It
communicates by creating images in the ultra-violet spectrum on the
forward eye. Two fat ridges of rubbery flesh ran along its underbelly
and rippled like snakes to push the body along. A second pair of more
bulbous ridges extended from its back, shorter than those on the
underbelly and extending only a little further than the eye. These can
change into various shapes and can help to lift objects too heavy for
human arms.
Following the description you end up with something like this...
And yes, I do realise the awesomeness of my artistry. It's a gift and I try not to abuse it.
| 1 | The Tochee is about three and a half yards long, coming up to a human’s chest and shaped similar to |
Is it worth bringing a flash for a backpacking trip? | I'm going on my honeymoon to Thailand, Cambodia and Vietnam in June for 4 weeks.
I'll bring my Canon t3i + 15-55mm and a 55-250mm lens.
This will be my first travel like this and I definitely want to take some awesome pictures.
I don't have a Flash and I want to buy a Canon Speedlite 430EX when the time comes.
The question is... Is it Worth it to buy this flash for this kind of travel?
| As always, this kind of questions depends on what you plan to photograph. If we are talking about the deep-blue sea, palms along the sandy beach, Thai temples and street traffic, then, probably, you will not need a flash.
If you are going to take pictures of people - street traders, monks, life saviors on the beach- if you are planning to enter low-ceiling houses of the locals, perhaps talk them into a "folk" scene, then a flash would come in handy.
Flash could also be useful if you decide to photograph local food. Anywhere where you go with bad lighting and close-up shots, you might need a flash.
Me personally, I am a landscape photographer. I have not needed a flash in the past 5 years, since I always stick to nature and urban architecture. People appear in my photographs so rarely that even if I made one or two photos during a trip, the flash would definitely not have been worth the fuss.
| 1 | If you are going to take pictures of people, talk them into a "folk" scene, then a flash would come |
What are the uses for a roasting pan? Do I really need a roasting pan? | We registered for a roasting pan and it has been sitting around taking up a lot of space. Do I really need this or is this a "one-tasker" as Alton Brown would say?
I understand that the roasting rack allows the juices to drip down. I've had lots of success roasting chickens just in a baking pan with 2" high sides.
| I use mine, but I'm known for 20+ pound hunks of meat...In that case it's pretty much a requirement, both for the dripping, etc and for just being big and sturdy enough to handle the weight.
If you're not cooking anything that big, I wouldn't worry about it. Throw some starch in the pan to soak up the grease, and move on, or go old school, and cook it right on the rack with a Yorkshire pudding underneath to catch the drippings.
| 1 | Cook 20+ pound hunks of meat with a Yorkshire pudding . |
In Mass Effect 3, I did not get a choice of game mode; is it because I imported a ME2 character? | I just started a new game in Mass Effect 3, on the Xbox 360, by importing my existing ME2 character.
I have just witnessed the attack on the council at the very start, and now just got to the point where I can bring up the in-game menu.
I have not yet seen a choice of game mode (i.e. action, role playing, or story), as advertised for the game.
Was that choice made for me when I imported? If so, what am I actually playing? I'm hoping role playing (which was my intent), but how can I verify this?
| If you import an ME2 character you automatically use the roleplaying mode (the one with combat and dialog choices), only if you create a new character do you get the choice in the beginning. The roleplaying mode is the one closest to how the previous Mass Effect games worked, so the game assumes that players that import a character would like to play that mode.
| 1 | When you import an ME2 character you automatically use the roleplaying mode . |
Install old version of Wine | Recording to this page https://appdb.winehq.org/objectManager.php?sClass=version&iId=9597&iTestingId=56155, I should install older version of wine (max. 20041019), in order to run D2GS (game server).
Can anyone help me with that?
As I've heard, the easiest way is with PlayOnLinux, but I'm looking for a direct way of installation.
Thanks!
| 1 First run apt-get install build-essential.
This will provide you necessary development tools from respective repositary and which are not included in default Ubuntu system.
[2] Download the wine_0.0.20041019-1.3.tar.gz from sourceforge.net
and extract the file.
[3] Open terminal and enter the following commands:
$cd wine-20041019
$./configure
This should do the trick for you.
| 0.888889 | apt-get install build-essential |
How to mount a ham? | I bought a Serrano ham on sale. It's the whole pig's leg, and it comes with a kind of a stand. However, the stand was delivered in pieces like IKEA furniture, but unlike IKEA, it has no manual explaining what goes where.
I'm especially puzzled about the large ring and the small trapez-without-base shaped pieces. Once must go up to hold the ankle, the other one down to hold the haunch. But which goes where, and how do I fasten the ham to the metal? Do I have to screw the metal screws through the bone?
The picture shows all parts delivered, only the inbus key is not in the frame. I put the trapezoid part onto the lower hole and started fastening it with a pointy screw; it's quite a long screw (7-8cm).
| This should help, it's not precisely exact, but you can probably figure it out from here.
| 0.777778 | This should help, it's not precisely exact, but you can probably figure it out from here |
SQL Server. Join/Pivot/Performance help please | I've created this view that is painfully slow to query and creating performance issues. I think I need to utilize PIVOT but I can't really wrap my head around it...
Here's what I've got currently.
select
p.instrumentsettingsid,
sum(case when p1.id is null then 0 else 1 end) as 'Cash',
sum(case when p2.id is null then 0 else 1 end) as HighInterest,
sum(case when p3.id is null then 0 else 1 end) as 'ML Loan',
sum(case when p4.id is null then 0 else 1 end) as 'Investment Note',
sum(case when p5.id is null then 0 else 1 end) as 'Trading',
sum(case when p6.id is null then 0 else 1 end) as 'DD Trading',
sum(case when p7.id is null then 0 else 1 end) as 'ML Trading',
sum(case when p8.id is null then 0 else 1 end) as 'NMLTrading',
sum(case when p9.id is null then 0 else 1 end) as 'Individual Custody',
sum(case when p10.id is null then 0 else 1 end) as 'ML Individual Custody',
sum(case when p11.id is null then 0 else 1 end) as 'Custody',
sum(case when p12.id is null then 0 else 1 end) as 'ML Custody Trading',
sum(case when p13.id is null then 0 else 1 end) as 'Portfolio',
sum(case when p14.id is null then 0 else 1 end) as 'ML Personal Portfolio',
sum(case when p15.id is null then 0 else 1 end) as Other,
i.status
from
(select distinct instrumentsettingsid from res_db..instrumentproducttypepermissions) p
inner join res_db..instrumentsettings i on p.instrumentsettingsid = i.id
left join res_db..instrumentproducttypepermissions p1 on p.instrumentsettingsid = p1.instrumentsettingsid and p1.enabled = 1 and p1.producttypeid = 1
left join res_db..instrumentproducttypepermissions p2 on p.instrumentsettingsid = p2.instrumentsettingsid and p2.enabled = 1 and p2.producttypeid = 2
left join res_db..instrumentproducttypepermissions p3 on p.instrumentsettingsid = p3.instrumentsettingsid and p3.enabled = 1 and p3.producttypeid = 3
left join res_db..instrumentproducttypepermissions p4 on p.instrumentsettingsid = p4.instrumentsettingsid and p4.enabled = 1 and p4.producttypeid = 4
left join res_db..instrumentproducttypepermissions p5 on p.instrumentsettingsid = p5.instrumentsettingsid and p5.enabled = 1 and p5.producttypeid = 5
left join res_db..instrumentproducttypepermissions p6 on p.instrumentsettingsid = p6.instrumentsettingsid and p6.enabled = 1 and p6.producttypeid = 6
left join res_db..instrumentproducttypepermissions p7 on p.instrumentsettingsid = p7.instrumentsettingsid and p7.enabled = 1 and p7.producttypeid = 7
left join res_db..instrumentproducttypepermissions p8 on p.instrumentsettingsid = p8.instrumentsettingsid and p8.enabled = 1 and p8.producttypeid = 8
left join res_db..instrumentproducttypepermissions p9 on p.instrumentsettingsid = p9.instrumentsettingsid and p9.enabled = 1 and p9.producttypeid = 9
left join res_db..instrumentproducttypepermissions p10 on p.instrumentsettingsid = p10.instrumentsettingsid and p10.enabled = 1 and p10.producttypeid = 10
left join res_db..instrumentproducttypepermissions p11 on p.instrumentsettingsid = p11.instrumentsettingsid and p11.enabled = 1 and p11.producttypeid = 11
left join res_db..instrumentproducttypepermissions p12 on p.instrumentsettingsid = p12.instrumentsettingsid and p12.enabled = 1 and p12.producttypeid = 12
left join res_db..instrumentproducttypepermissions p13 on p.instrumentsettingsid = p13.instrumentsettingsid and p13.enabled = 1 and p13.producttypeid = 13
left join res_db..instrumentproducttypepermissions p14 on p.instrumentsettingsid = p14.instrumentsettingsid and p14.enabled = 1 and p14.producttypeid = 14
left join res_db..instrumentproducttypepermissions p15 on p.instrumentsettingsid = p15.instrumentsettingsid and p15.enabled = 1 and p15.producttypeid = 15
group by p.instrumentsettingsid, i.status
Can someone who knows about SQL please tell me (show me?) how I can make this faster/less hideous please.
Also those 15 account names are hardcoded, in a perfect world it would get the product name from the table producttypes
Sorry to ask such an annoying question.
Thank you!
| Use:
SELECT p.instrumentsettingsid,
i.status,
SUM(CASE WHEN p.producttypeid = 1 THEN 1 ELSE 0 END) as 'Cash',
SUM(CASE WHEN p.producttypeid = 2 THEN 1 ELSE 0 END) as HighInterest,
SUM(CASE WHEN p.producttypeid = 3 THEN 1 ELSE 0 END) as 'ML Loan',
SUM(CASE WHEN p.producttypeid = 4 THEN 1 ELSE 0 END) as 'Investment Note',
SUM(CASE WHEN p.producttypeid = 5 THEN 1 ELSE 0 END) as 'Trading',
SUM(CASE WHEN p.producttypeid = 6 THEN 1 ELSE 0 END) as 'DD Trading',
SUM(CASE WHEN p.producttypeid = 7 THEN 1 ELSE 0 END) as 'ML Trading',
SUM(CASE WHEN p.producttypeid = 8 THEN 1 ELSE 0 END) as 'NMLTrading',
SUM(CASE WHEN p.producttypeid = 9 THEN 1 ELSE 0 END) as 'Individual Custody',
SUM(CASE WHEN p.producttypeid = 10 THEN 1 ELSE 0 END) as 'ML Individual Custody',
SUM(CASE WHEN p.producttypeid = 11 THEN 1 ELSE 0 END) as 'Custody',
SUM(CASE WHEN p.producttypeid = 12 THEN 1 ELSE 0 END) as 'ML Custody Trading',
SUM(CASE WHEN p.producttypeid = 13 THEN 1 ELSE 0 END) as 'Portfolio',
SUM(CASE WHEN p.producttypeid = 14 THEN 1 ELSE 0 END) as 'ML Personal Portfolio',
SUM(CASE WHEN p.producttypeid = 15 THEN 1 ELSE 0 END) as Other,
FROM res_db..instrumentproducttypepermissions p
JOIN res_db..instrumentsettings i ON i.id = p.instrumentsettingsid
WHERE p.enabled = 1
AND p.producttypeid BETWEEN 1 AND 15
GROUP BY p.instrumentsettingsid, i.status
No need for the LEFT JOIN...
Also those 15 account names are hardcoded, in a perfect world it would get the product name from the table producttypes
Dynamic columns requires dynamic SQL.
| 1 | SUM(CASE WHEN p.producttypeid = 1 THEN 1 ELSE 0 END) |
The mechanics of Aspects on weapons/armor? | Fate Core suggests one way to differentiate weapons and armor is by giving each one an Aspect. Daggers could be Quick, for instance, and maces could be Armor Piercing. I really like this idea. My question is, how would this actually work mechanically? I'm trying to picture how this would tie into "Creating an Advantage" or how it would modify attack rolls or shifts.
A few examples to help fuel thinking caps:
Quick Dagger vs. Heavy Greatsword?
Long Spear vs. Balanced Longsword?
Any thoughts?
| It would simply give you excuses for invokes and compels, based on the aspect text. Nothing less, nothing more.
— Wesroth attacks Quadron using his longsword, with Fighting 3
— Ok but Quadron has a Long Spear, here's a compel for you, this fate point says Wesroth spends this exchange trying to close in with Quadron, struggling to find an opening.
— Good call, but no, I refuse your compel. Here's a fate point, Wesroth does manage to attack despite the long spear
Wesroth:Attack: [Roll + + - ·] + [Fighting 3] = +4(Great)
Quadron:Defend: [Roll + - · ·] + [Fighting 2] = +2(Fair)
— Whoops, that's physical stress box #2 for me …err… Quadron. Fortunately Quadron can take it and live.
— Not so fast, Wesroth has a Balanced longsword, and I invoke it. He feints an attack but flips the sword and uses the pommel to push Quadron's spear aside, easily getting inside his guard. That brings my roll into a fantastic +6. I guess that's a #4 stress box, which Quadron doesn't have
— Oh cr*p! …
… and it goes on like this
| 1 | Wesroth attacks Quadron using his longsword |
How is a transition between drywall and wood typically handled? | I just finished sheet rocking my living room and am stuck at a stand-still. My ceiling is 12' feet high at the tallest point and slopes down to 8'. That said, at the 12' wall, the sheetrock only goes up 8' and is then met by a lap and gap type wood, which then continues up to the ceiling. The wood then slopes (on the wall). At the 8' point of the ceiling, the sheetrock butts up to the ceiling.
My question is...How would I install a crown moulding or transition piece at the point where the sheetrock meets the wood? The previous owners had a painted 1x4 where the paneling (now sheetrock) met the wood. However, I am wanting something a bit nicer than just a 1x4 transition.
Either I am the only person out there with a room like this or I am searching incorrectly on Google. Does anyone have any ideas or pictures on this? I can definitely provide pictures if needed. I am tempted to pull the wood all the way to ceiling and continue the sheetrock all the way up. Any advice would be much appreciated!
| Here's a few options I can think of.
Lap joint
If the wood is a bit thicker than the drywall, you could use a router to remove some of the material on the back side of the lowest plank (may require installing an additional plank, or extending the drywall). Then allow the lowest plank to lap over the drywall. Make sure you leave enough of a gap between the two materials, to allow for expansion and contraction.
Transition
Another option would be to use a transition strip, like the ones commonly used in flooring. You'd use T-molding if the materials are even with each other, or a reducer if they're not.
Molding
A simple 1x4 like the previous owners had, or a more decorative piece of molding could be used.
| 1 | Lap joint If the wood is a bit thicker than the drywall, you could use a router to remove some of the material |
How to create an entity with a composite primary key containing a generated value | Using Hibernate + annotations, I'm trying to do the following:
Two entities, Entity1 and Entity2.
Entity1 contains a simple generated value primary key.
Entity2 primary key is composed by a simple generated value + the id of entity one (with a many to one relationship)
Unfortunately, I can't make it work.
Here is an excerpt of the code:
@Entity
public class Entity1 {
@Id @GeneratedValue
private Long id;
private String name;
...
}
@Entity
public class Entity2 {
@EmbeddedId
private Entity2PK pk = new Entity2PK();
private String miscData;
...
}
@Embeddable
public class Entity2PK implements Serializable {
@GeneratedValue
private Long id;
@ManyToOne
private Entity1 entity;
}
void test() {
Entity1 e1 = new Entity1();
e1.setName("nameE1");
Entity2 e2 = new Entity2();
e2.setEntity1(e1);
e2.setMiscData("test");
Transaction transaction = session.getTransaction();
try {
transaction.begin();
session.save(e1);
session.save(e2);
transaction.commit();
} catch (Exception e) {
transaction.rollback();
} finally {
session.close();
}
}
When I run the test method I get the following errors:
Hibernate: insert into Entity1 (id, name) values (null, ?)
Hibernate: call identity()
Hibernate: insert into Entity2 (miscData, entity_id, id) values (?, ?, ?)
07-Jun-2010 10:51:11 org.hibernate.util.JDBCExceptionReporter logExceptions
WARNING: SQL Error: 0, SQLState: null
07-Jun-2010 10:51:11 org.hibernate.util.JDBCExceptionReporter logExceptions
SEVERE: failed batch
07-Jun-2010 10:51:11 org.hibernate.event.def.AbstractFlushingEventListener performExecutions
SEVERE: Could not synchronize database state with session
org.hibernate.exception.GenericJDBCException: Could not execute JDBC batch update
at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:103)
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:91)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:254)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:266)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:167)
at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:298)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1001)
at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:339)
at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:106)
at test.App.main(App.java:32)
Caused by: java.sql.BatchUpdateException: failed batch
at org.hsqldb.jdbc.jdbcStatement.executeBatch(Unknown Source)
at org.hsqldb.jdbc.jdbcPreparedStatement.executeBatch(Unknown Source)
at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:48)
at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:247)
... 8 more
Note that I use HSQLDB.
Any ideas about what is wrong ?
| Do as follows whether you want this kind of behavior (You nedd to use property access instead of field one)
Parent.class (Notice a property of Type MutableInt and addChild as a way to set up both sides)
@Entity
public class Parent implements Serializable {
private MutableInt id = new MutableInt();
private List<Child> childList = new ArrayList();
@OneToMany(mappedBy="parent")
@JoinColumn(name="PARENT_ID", insertable=false, updatable=false)
@Cascade(CascadeType.SAVE_UPDATE)
public List<Child> getChildList() {
return childList;
}
public void setChildList(List<Child> childList) {
this.childList = childList;
}
@Id
@GeneratedValue
public Integer getId() {
return id.intValue();
}
public void setId(Integer id) {
this.id.setValue(id);
}
@Transient
public MutableInt getIdAsMutableInt() {
return id;
}
/**
* Add convenience method
*
* A way to set up both sides (You have a bi-directional relationship, right ???)
*/
public void addChild(Child child) {
if(child.getChildId() == null)
child.setChildId(new Child.ChildId());
child.getChildId().setParentIdAsMutableInt(id);
getChildList().add(child);
child.setParent(this);
}
}
Child.class (Notice static inner class )
@Entity
public class Child implements Serializable {
private ChildId childId;
private Parent parent;
@EmbeddedId
public ChildId getChildId() {
return childId;
}
public void setChildId(ChildId childId) {
this.childId = childId;
}
@ManyToOne
@JoinColumn(name="PARENT_ID", insertable=false, updatable=false)
public Parent getParent() {
return parent;
}
public void setParent(Parent parent) {
this.parent = parent;
}
/**
* Composite primary key class MUST override equals and hashCode
*/
@Embeddable
public static class ChildId implements Serializable {
private MutableInt parentId = new MutableInt();
private Integer chId;
public void setParentIdAsMutableInt(MutableInt parentId) {
this.parentId = parentId;
}
@GeneratedValue
public Integer getChId() {
return chId;
}
public void setChId(Integer chId) {
this.chId = chId;
}
@Column(name="PARENT_ID")
public Integer getParentId() {
return parentId.intValue();
}
public void setParentId(Integer parentId) {
this.parentId.setValue(parentId);
}
@Override
public boolean equals(Object o) {
if(!(o instanceof ChildId))
return false;
final ChildId other = (ChildId) o;
return new EqualsBuilder()
.append(getChId(), other.getChId())
.append(getParentId(), other.getParentId()).isEquals();
}
@Override
public int hashCode() {
int hash = 5;
hash = 11 * hash + getParentId().hashCode();
hash = 11 * hash + getChId().hashCode();
return hash;
}
}
}
And to test
Session session = configuration.buildSessionFactory().openSession();
session.beginTransaction();
Parent parent = new Parent();
parent.addChild(new Child());
session.save(parent);
session.getTransaction().commit();
You need a MutableInt because of Integer is immutable instance. But your MutableInt field is encapsulated by a Integer property. See carefully
| 1 | Integer property access |
About redundant code when I use shortcode to output the HTML from a variable | I use shortcode to output the following html in a variable, but there are too many redundant code such as br and p tags, how to remove them? Thanks!
HTML MAKEUP
$return_html.='<div class="portfolio-item" id="portfolio-'.$post->ID.'"><a class="overlay'.$class.'" href="'.$url.'" title="'.$post->post_title.'"><h3>'.$post->post_title.'</h3><p class="intro">'.van_truncate($post->post_content,100).'</p></a><div class="tools"><a href="'.$url.'" class="zoomin'.$class.'" title="'.$post->post_title.'">ZoomIn</a><a href="'.get_permalink($post->ID).'" class="info">Info</a></div>
<a href="'.get_permalink($post->ID).'" class="item"><img src="'.get_template_directory_uri().'/images/pixel.gif" data-url="'.$thumbnail_url[0].'" class="scrollLoading" /></a></div>';
Current shortcode function
add_shortcode('portfolios', 'van_portfolios_shortcode');
function van_portfolios_shortcode( $atts, $content) {
extract(shortcode_atts(array(
'number'=>'9',
'slug'=>''
), $atts));
$str=van_portfolios($slug,$number,false);
return $str;
}
function van_process_shortcode($content) {
global $shortcode_tags;
// Backup current registered shortcodes and clear them all out
$orig_shortcode_tags = $shortcode_tags;
$shortcode_tags = array();
add_shortcode('portfolios', 'van_portfolios_shortcode');
// Do the shortcode (only the one above is registered)
$content = do_shortcode($content);
// Put the original shortcodes back
$shortcode_tags = $orig_shortcode_tags;
return $content;
}
add_filter('the_content', 'van_process_shortcode', 7);
Correct makeup is
<div class="portfolio-item">
<a class="overlay" href="#">
<h3>...</h3>
<p>...</p>
</a>
<div class="tools"><a href="#" class="zoomin" rel="lightbox">ZoomIn</a><a href="#" class="info">Info</a></div>
<a href="#" class="item">...</a>
</div>
Output:
<div class="portfolio-item">
<a class="overlay" href="#">
<br /><!--This <br />is redundant code-->
<h3>...</h3>
<p>...</p><p><!--This <p> is redundant code-->
</a>
<div class="tools"><a href="#" class="zoomin" rel="lightbox">ZoomIn</a><a href="#" class="info">Info</a></div>
<p><!--This <p> is redundant code--><a href="#" class="item">...</a>
</div>
| This is because the content of a post - and therefore your shortcode - is run through the wpautop() function which generates the <p> and <br /> tags in order to space out the post properly.
Shortcodes are run at priority 11, which is after wpautop() on priority 10. We can change the piority that this shortcode is run before wpautop():
// This will do nothing but will allow the shortcode to be stripped
add_shortcode( 'foobar', 'shortcode_foobar' );
// Actual processing of the shortcode happens here
function foobar_run_shortcode( $content ) {
global $shortcode_tags;
// Backup current registered shortcodes and clear them all out
$orig_shortcode_tags = $shortcode_tags;
remove_all_shortcodes();
add_shortcode( 'foobar', 'shortcode_foobar' );
// Do the shortcode (only the one above is registered)
$content = do_shortcode( $content );
// Put the original shortcodes back
$shortcode_tags = $orig_shortcode_tags;
return $content;
}
add_filter( 'the_content', 'foobar_run_shortcode', 7 );
Code thanks to @Viper007Bond [source]. Remember to replace the function and filter names with ones relating to your shortcode!
| 0.888889 | Shortcodes run by wpautop() on priority 11 |
How to use Java to read/write data to/from the header pins? | I just got Java running on my Raspberry Pi which took a lot more screwing around than i had hoped. I want to be able to read/write data to/from the header pins from Java. How can I do this? Do I need to write a driver or some sort with C first in order to get the data from the header pins? I am running an instance of Soft-float Debian “wheezy." Is this even possible to do in Java? Are there any workarounds that I should know about? Thanks for reading!
| If you did not already foud your solution, the Pi4J Library, based on Wiring for the Raspberry Pi, offers - also on an early development stage - acces to GPIO, I2C and SPI. And Rs232, not to forget!
Serviceprovider for several IO-boards (Olimex etc.) are included.
Most interesting: Event driven processing (GPIO-Interrupts).
see: http://pi4j.com
rgds
| 1 | Acces to GPIO, I2C and SPI |
What to do about students who ask for help too often? | For my writing courses, about 5% of students will come to me prior to deadlines asking for help with their paper. I see no problem advising students, as I often similarly came for help when I was an undergraduate. Recently, though, I found an increase in students who apparently just want to abuse this:
Students will bring me some plagiarized work, showing it to me early, as a sort of test if I will notice. It seems difficult to punish plagiarism when the paper is not yet submitted.
Students will bring in papers again and again, with little changes put in at each stage, hoping their minimal effort each time will be sufficient to reach their goal of a "D".
I've tried stopping students, but then they are angry when they see the "F" that they hoped I would help them get away from. While most of these students are probably just incredibly lazy, there is a chance that some among them are genuinely trying to improve, but just struggling a great deal, and I can't see it.
How might I go about blocking such abuses?
| Another strategy is to provide more guidance about what sort of help you'll provide and how they should ask for it. Possibilities:
The first time you bring your paper to my office [or during specific dates], we will focus only on whether you have answered the question.
I will be happy to discuss aspects X and Y, but never Z.
Bring the rubric with you. Be prepared to explain which part of the
rubric you most need to address in your draft, and why. We'll focus on that part of the rubric during our meeting.
Before you bring your paper to me, prepare a list of specific questions you would like me to answer. Bring two copies of the list, one for each of us.
Before you bring your paper to me, show it to someone at the writing center. Bring with you your notes from that visit and the draft you showed to them, along with the draft where you implemented those suggestions.
Always bring two copies of your draft--one for each of us. Be prepared to write detailed notes on your copy. (Then you can keep your copy and you'll be able to bring it out the next time and say--ok, what did you change? Or you can compare it to the draft they turn in to see if they made significant changes. And if they plagiarised it, you'll have a record.)
Each time you show me your paper, I will expect you to create a checklist of things you will address. The next visit, you need to demonstrate that you have completed those things by bringing a draft with changes marked and annotated.
Another thing you can do is assign "draft" deadlines as well as final deadlines for everyone, then give the feedback you think is important on the drafts (maybe using a rubric) and not meet incessantly with a few students.
Another thing you can do--particularly with very structured papers that you have assigned before--is provide to the class a list of the common problems students have. Then when a student shows you a draft, you can initiate a discussion about which common problem the student thinks it illustrates and what can the student do to address it?
Another thing you can do is limit the number of times you will look at a draft, or the period of time during which you will look at a draft.
I have had a similar problem with students wanting me to grade work before they turn it in for a grade--not just on writing, but with all kinds of assignments. Sometimes they are so lost they are completely stuck. Other times, they seem to be trying to minimize their workload by increasing mine. ("Just tell me in exacting detail what to do, I'll do that and no more, you'll give me an A.") But what I want is for them to learn how to assess their own writing!
Whatever strategy you use, when you meet with students, try to elicit their comments. If you give a suggestion, and they nod, then ask them how they expect to apply it. What changes will they make to a particular sentence or paragraph? Are there any other places in the text they should also make that change to--which ones, and why? If they are to provide more evidence, ask them where they intend to search and how. Then you can better assess whether they understand what you've told them and whether they can actually do it.
I often ask students about how they produced the draft. Which parts were the easiest and which parts were the hardest, and why? Which parts do they like best? Which parts do they think need the most revision? Sometimes I ask them to imagine a reader--if they were to show their paper to (mom, roommate, employer, etc.), which part would be the most controversial? What would need the most explanation? If their reader disagrees, what would that person likely argue back? The more they talk about their writing, the more opportunity you have to say, "Yes! What you just said--write that down. Now do that!"
Another benefit of getting students to talk about their draft is that it is tough to talk about something you didn't write. If they let you know they copied passages, you can remind them (or explain how) to cite them properly. If they pretend they wrote every word, you have a different problem to address.
| 0.888889 | How do you get students to talk about your writing? |
Which products should have FCC certification and about how much does that cost? | I'm aware that nobody actually does this at the hobbyist level, that successful commercial products have been launched without certification, and it's probably something I can't afford if I have to ask. However, I've always wondered about the ballpark cost. About how much does it cost to receive FCC certification?
| As a rough estimate, the cost is $10k-20k, plus your labor cost.
In the US, all products containing electronics that oscillate above 9 kHz must be certified. The law that governs this is FCC Part 15. The lawyers call this "Title 47 CFR Part 15," meaning that it is the 15th subsection of the 47th section of the Code of Federal Regulations. In Europe, there is a similar regulation called CISPR 22. The requirements are almost the same, but slightly stricter about emissions at certain frequencies.
You can read 47 CFR 15 online. It's not as incomprehensible as you might expect. It seems overwhelming, but if you read the first few PDF's, you'll realize that most of it irrelevant for any single product.
Within 47 CFR 15, there are two classes of testing: Class A and Class B. Class A is an easier test to pass, intended for devices that are used in industrial settings. Class B is stricter, intended for devices that are targeted at consumers.
There is additional testing for "intentional radiators," meaning radios, Wi-fi, Bluetooth and such. There may be an exception if your device is intended for use as a component in a larger system (like a microprocessor or memory card in a PC), but I'm not sure of the legal details there.
The major expense is renting the test chamber. This is what's called an "anechoic chamber," instrumented with a pile of sensors for detecting electromagnetic radiation. To my knowledge, these cost around $1000/hour, and each testing session takes 2 or 3 hours. It's unlikely, but not impossible, that you will pass on the first try.
Here's a decent picture of a test chamber. The one I've been in was actually much larger, like a squash court. I think it was an Intertek facility in Menlo Park, CA.
Unless you're experienced with emissions testing, it is worth hiring an expert, which costs around $500/hour. They can tell you things like, "Put a ferrite bead on that power cable, and that will reduce the emissions at this frequency." The folks I've worked with arrive with a bunch of ferrite beads and inductors (and maybe caps?) of various sizes that you can use in the chamber to hack your device into compliance.
(Perhaps it goes without saying, but I'm an engineer, not a lawyer. I have taken a few products through Part 15, but not in the last couple of years.)
If you're thinking about doing this, start by reading EMC for Product Designers by Tim Williams. I'd avoid the books by Mark I. Montrose; I found them less helpful and more expensive.
| 0.777778 | In the US, all products containing electronics that oscillate above 9 kHz must be certified |
Using jdbc-user-service inside user-service-ref | I am using spring security and for database based authentication I used following configuration and its working fine
<authentication-manager alias="authenticationManager">
<authentication-provider>
<jdbc-user-service data-source-ref="dataSource"
users-by-username-query="SELECT ...... U.email_address=?"
authorities-by-username-query="SELECT ... U.email_address=?">
</authentication-provider>
</authentication-manager>
now I wanted to add extra info to the session and came across Adding user to session, spring security default login, I tried it and now I have a problem.
XML says I cant use user-service-ref and jdbc-user-service combined. Is there a way to sort it out or else what I have to do if I have to use user-service-ref tag only to authenticate users? What can be the other way to add extra info say a whole Users object to the session.?
Your help will be appreciated.
| After hours of searching and experimenting I was able to do it like this.
Make a new service say MyUserService that will implement org.springframework.security.core.userdetails.UserDetailsService and has annotation @Service. UserDetailsService only has one method loadUserByUserName. Implementation of this method will be in MyUserService. It will look like this.
@Service
public class MyUserService implements UserDetailsService {
@Override
public UserDetails loadUserByUsername(String arg0)
throws UsernameNotFoundException {
MyUser user=new MyUser();
/*get details of user and authorities from database whose username is
arg0 and place them in user instance */
return user;
}
}
MyUser is also a new class that implements org.springframework.security.core.userdetails.UserDetails and all its methods are implemented inside MyUser class. It will look like this.
public class MyUser implements UserDetails {
private static final long serialVersionUID = 1L;
/*All the variables their getter setters that you wish to store in session. And
implementation of all the methods of UserDetails go here.*/
}
Define a bean like this
<bean id="customUserDetailsService" class="org.aurora.timeexpense.service.MyUserService"/>
Where org.aurora.timeexpense.service.MyUserService is the path of my defined service that implements UserDetailsService.
4.And Spring Security Configuration will go like this
<authentication-manager alias="authenticationManager">
<authentication-provider user-service-ref="customUserDetailsService">
</authentication-provider>
</authentication-manager>
You are good to go.
| 0.888889 | Implementation of org.springframework.security.core.userdetails.UserDetailsService |
Create Accounts and Contacts from single csv import | I have limited experience with the Data Import Wizard but I'm curious if it allows me to create new accounts and contacts from a single csv import.
Rather then importing accounts from a csv, capturing the new SFDC accountID, updating the contacts csv file with the accountID and importing the contacts csv.
Can that be consolidated into a single csv with account and contact fields and imported through the data import wizard?
| Yes, the account and contact import wizards can create and update accounts and contacts in a single pass. There are two types of wizards, one for administrators for all users, and one for regular users with permission to import records under their ownership only.
| 1 | Account and contact import wizards can create and update accounts and contacts in a single pass |
Is it possible to setup a web tab in Salesforce which will go to this KB without needing to login using username and password? | We have a Web KB that is built in PHP. Is it possible to setup a web tab in Salesforce which will go to this KB without needing to login using username and password?
I initially thought that SAML may help and that I can use salesforce as identity provider. However, the Service Provider PHPKB does not support SAML.
I am thinking of getting session ID from salesforce and pass it to KB for autohentincation.
However, I don't know how to do it. just a theory
| There are multiple approaches possible depending on what level of configurability/ code access you have on the PHP side and how you want to integrate with Salesforce.
There's a PHP Toolkit for Force.com which supports multiple authentication schemes including LDAP, Radius, Active Directory etc. This link provides a good tutorial on how to deal with auth part when integrating an external PHP app with Salesforce.
There's also an option to use Force.com Canvas for your external PHP applications. Canvas apps usually authenticate via either oAuth or signed requests. You can read more about it here.
If you have tried these and are facing any issues, please let me know and I may be able to help further.
| 1 | How to deal with auth when integrating an external PHP app with Salesforce |
In TOS, how many shuttlecraft were aboard the U.S.S. Enterprise NCC-1701? | In the original series, how many shuttlecraft made up the normal complement aboard the U.S.S. Enterprise NCC-1701? The numbering convention I found on Memory Alpha goes up to NCC-1701/12, listing both active and destroyed, with the Galileo accounting for 3 of the 10 shown. How many were supposed to be onboard?
| except during "The Enemy Within" when nobody mentions using shuttlecraft to erscue Sulu's group from the planet without using the dangerous transporter. Thus everyone must have known that, for various reasons, there were no shuttles available. In that episode the Enterprise was carrying a lot fewer shuttles than normally.
| 0.888889 | Shuttlecraft to erscue Sulu's group without using dangerous transporter |
Are scientifically detached professors referred to as ‘clinical’? | I have come across this term fairly often, where full/associate/assistant professors are referred to by the term ‘clinical’. Given that their departments had nothing to do with medicine, I thought the term referred to the second meaning of clinical:
scientifically detached; strictly objective
Is this interpretation correct? If yes, isn’t such a branding offensive?
| Clinical Law Faculty usually supervise one or two law clinics where law students can get practical experience getting indigent or immigrant clients. In this case, "clinical" means that their responsibilities are mainly focused in the teaching and running of said clinics and that they are not full faculty in the law school in terms of voting and tenure rights.
Clinical Writing Faculty is a term I've recently come across for some professional staff (with PhDs) who work in university writing/tutoring clinics. They help students with their essays and may also teach some composition courses. These people are also not full faculty in terms of voting and tenure rights.
Note: "Adjunct" is not appropriate for these faculty as they are often full time with renewing terms. "Visiting" is inappropriate as they are on renewing terms that could span decades of service. "Staff" is inappropriate as they have terminal degrees and are teaching/supervising students. "Professor of Practice" is a mostly equivalent term to "clinical faculty," again with the emphasis on teaching rather than research.
| 0.666667 | Clinical Law Faculty is not full faculty in law school in terms of voting and tenure rights . |
Sodium Bisulfate vs Sodium Bisulfite | I'm wanting to do a follow up to this Q&A in the cooking stack regarding browning avocados. I specifically want to expand my experiment to to include the options in Wayfaring Stranger's Answer. Unfortunately, I managed to get the wrong stuff, and shipping rules make exchanging it problematic.
I am the proud owner of $500~\mathrm{g}$ of sodium bisulfate ($\ce{NaHSO4}$), instead of sodium bisulfite ($\ce{NaHSO3}$).
Dammit Jim! I'm a cook not a chemist!
What I have learned is that that both compounds are used as food additives towards the same end, and that my stuff has a slightly higher LD50. That's it.
Can anyone advise as to substituting my compound for the other? I'm not interested in tasty guacamole at this point, I'm really only looking at browning. If I'm trying to more or less duplicate the more successful experiments of the University of Florida, should I start with the same ratios? Or more or less of the additive? I can get sodium metabisulfite (also an anti-oxidant food additive) locally, if that would be a better option.
EDIT: So far, answers have all been consistent in that I have a half-kilo of white powder that is useless to me. I will make a trip to the wine-making shop and acquire some sodium metabisulfite. That still leaves me with the question of how much? The University of Florida got the results I'd like to duplicate with $30~\mathrm{mg}$ of sodium bisulfite per $100~\mathrm{g}$ of avocado. Should I start with the same ratio of sodium metabisulfite?
| Sulfate will not provide the antioxidant effect you seek. Metabisulfite has antioxidant effect.
| 1 | Metabisulfite does not provide the antioxidant effect |
What are the components needed for this receiver? | I want to build a simple crystal radio receiver. I do not want amplify the signal received. I want to detect the presence of a transmitted signal, and then use the presence of the received signal as a trigger to switch on another device (battery powered).
My knowledge is VERY basic, and I have been trying to learn more. I have found a schematic on the web.
http://www.circuitdiagram.org/how-to-make-build-crystal-radio.html
Is this design suitable for my intended purpose? (minus the Earpiece)
From what I can tell, this receiver is made up of an inductor, a variable capacitor, and a diode. I am assuming my circuit would need a transistor switch as well. What else would I need? (I have assumed here that the antenna is part of the inductor coil - is that correct?)
I am looking for components I can use to make up this circuit.
I want to receive the signal across a range of 60 feet and I want the circuit to be small (>1cm). What else do I have to ascertain in order to start searching for the components I need?
If anyone can to suggest suitable inductors, capacitors and/or diodes - this novice would be grateful!
| Since you are trying to switch on battery power, you have battery power available. So use it.
Your design brief contains two completely incompatible requirements; powered from the signal, and small size. To get significant power from the signal, you need to collect significant signal; and that means a large antenna.
The classic AM band "crystal set" circuitry you are studying needs about a hundred foot wire antenna to collect enough power to run sensitive headphones. At which point you might as well run the wire to the transmitter!
At higher frequencies you can reduce the antenna size to some extent but if you need the antenna to be small you MUST expect the received power to be very low, and need amplification.
Even your transistor switch is an amplifier, so admit it; there will be amplification. Then focus on the least power you need to power that amplifier - off the battery. One way might be to use a very low power micro like the MSP430 (under 1 microamp in the right usage pattern) to turn the receiver on very briefly every few seconds, to see if a signal is being transmitted.
| 0.888889 | How to switch on battery power? |
Why did Voldemort assume that no-one knew about Room of Hidden Things? | Voldemort hid one of his Horcruxes inside Hogwarts. It seemed to be relying on security through obscurity as far as protecting it. But as we know, it ended up not being so secure because it wasn't so obscure - Harry Potter knew about the Room of Hidden Things.
My question is, the way Rowling describes this hints at the fact that Riddle had an assumption that very few people would ever stumble upon that room. *WHY???
First, let's show Harry's theory on what Voldemort was thinking, how and why:
Here's Harry understanding Voldemort's thinking in HP7 once he figured out where the Diadem was (bold emphasis mine):
Tom Riddle, who confided in no one and operated alone, might have been arrogant
enough to assume that he, and only he, had penetrated the deepest mysteries of
Hogwarts Castle. Of course, Dumbledore and Flitwick, those model pupils, had never
set foot in that particular place, but he, Harry, had strayed off the beaten track in his
time at school – here at least was a secret area he and Voldemort knew, that
Dumbledore had never discovered –
...and later on, with Harry explains the location to Ron/Hermione:
“He hid it exactly where I had my old Potions book, where everyone’s been hiding stuff for centuries. He thought he was the only one to find it. Come on.”
“And he never realized anyone could get in?” said Ron, his voice echoing in the silence.
“He thought he was the only one,” said Harry.
.
Yet, from available evidence, that seems to be a completely wrong assumption, even at Voldemort's time.
Let's examine that last quote again, with emphasis on other info available:
“He hid it exactly where I had my old Potions book, where everyone’s been hiding stuff for centuries.” ...
...
“And he never realized anyone could get in?” said Ron, his voice echoing in the silence.
“He thought he was the only one,” said Harry. “Too bad for him I’ve had to hide stuff in
my time... this way,” he added. “I think it’s down here... “
They sped off up adjacent aisles; Harry could hear the others’ footsteps echoing through the towering piles of junk, of bottles, hats, crates, chairs, books, weapons, broomsticks, bats...
.
OK, so if there's a truckload (or train-load, by the description) of stuff in that room, isn't the only reasonable conclusion: "the room is a fairly popular destination with plenty of people who've found their way there in the past, and therefore, likely, plenty who will in the future"?
Doesn't matter what your arrogance level is, the evidence seems to point to only one conclusion - it's quite fine as a place to temporarily bury your dirt so teachers won't tag you for your misdeeds, but this is NOT the place to hide something that you want permanently safe!
So why did Voldemort make such a moronic mistake?
| I think Voldemort's arrogance has to be included in the equation. Voldemort truly believed that he was the only person to discover the Room of Hidden Things/RoR/CaGR, whether that seems logical or not. After escaping Gringotts and jumping off the dragon into the lake, Harry finds himself inside Voldemort's head, able to read Voldemort's thoughts about the Horcruxes:
[Voldemort] As for the school: he alone knew where in Hogwarts he had stowed the Horcrux, because he alone had plumbed the deepest secrets of that place ...
And Hogwarts ... but he knew that his Horcrux there was safe, it would be impossible for Potter to enter Hogsmeade without detection, let alone the school. Nevertheless, it would be prudent to alert Snape to the fact that the boy might try to re-enter the castle ...
Deathly Hallows - Page 444 - British Hardcover
Harry says, "He thinks the Hogwarts one is safest, because Snape’s there, because it’ll be so hard not to be seen getting in, I think he’ll check that one last, but he could
still be there within hours –'
I also think Voldemort was emotionally compelled to hide at least one Horcrux in Hogwarts. Hogwarts -- not unlike for Harry -- was the only place Tom Riddle/Voldemort ever considered a home. Given his propensity for attachment to things (Hogwarts, Founders' items, the snake Nagini) rather than people, it makes sense that 1) he would want to hide a Horcrux in the place that he considered home and 2) due to his emotional attachment to Hogwarts, he could have very well thought that the castle itself claimed him as its ultimate master. If so, then of course no one else would have discovered the Room of Hidden Things, because Hogwarts belonged to Voldemort (in his mind) and Voldemort alone. This represents a twisted sense of entitlement, the inability to see others as equals (seeing people as unskilled in achieving the high level of magical power that he himself had), and unable to imagine that any wizard other than himself could possibly discover or work out the secrets contained within the castle. So, to answer the question, the reason Voldemort made such a moronic mistake in leaving the diadem Horcrux essentially in plain view is because his thinking is distorted and skewed -- for he recognises no other as an intellectual equal or someone to learn from (he already believes he knows it all -- and is full of logic and thinking errors.) Once again, Voldemort underestimates that which he does not value, and there is so much that he does not value that his perception of the world is myopic, imbalanced, and not reflective of reality.
| 1 | Voldemort's arrogance has to be included in the equation . he believes that he was the only person to |
Ma'ayanah Shel Torah on the Festivals and 613 Mitzvot? | On the title page of Ma'ayanah Shel Torah, it says that the series covers the Parshiot, Haftarot, Festivals, and 613 Commandments. I have the 5 volumes on the Parshiot and Haftarot, but they do not cover the Festivals. There is no section for the 613 Commandments either, but some are covered in the Parsha.
Is there a Ma'ayanah Shel Torah on the Festivals?
| Seemingly not. The Hebrew and English Wikipedia articles say that תורה קוואל and its translation מעינה של תורה cover the parashiyos and haftaros, implying that those are the only sections.
Those are all hebrewbooks.org has, too.
| 0.888889 | Hebrew and English Wikipedia articles say that and its translation cover parashiyos and haftaros |
how to make blocks like "redstone" working in a minecraft-like game when the block is very far-away from your character | I'm working on a 2D minecraft-like game, I use chunks to save my world and each chunk has 128*128 blocks in it.
And infinite chunks can create an infinite world.
Memory should never be infinite and only several chunks near the character shown in the screen can be loaded into memory. How can I handle logic based blocks like red stone signals when they are in chunks far away and so not loaded in memory?
| I will just focus on just one topic in this answer: If you want to unload distant circuits to save CPU time and/or memory, what will happen to complex circuits that spred across multiple chunks?
Igore this problem. Easy to implement, but unsatisfactional behaviour.
Let player be aware of this problem, and give him a tool to display chunk bounds. I think there was such item in one of Minecraft's mods. Player then can build circuits only on one chunk if he needs to.
Create some connective block, when placed, it will guarantee that all circuits in a set redius will be always loaded/unloaded at the same time. Assuming that radius is smaller than chunk size, one such block will connect maximally 4 chunks together. However overusing these blocks can lead to infinitely many connected chunks.
In Tekkit mod, there was World Anchor block, that kept surrounding chunks loaded all the time. Good choice if you want to have some machinery running away from player.
Summary: Depends on what you need, I wouldn't be afraid of combining 2, 3 or 4 (or all) together, you can also nerf 3 to connect maximally N chunks.
| 1 | What happens to complex circuits that spred across multiple chunks? |
Does this C++ static analysis rule make sense as is? | I'm implementing some C++ static analysis rules, and one of them prohibits a function from returning a reference or pointer to a reference parameter of the function, i.e. the following are all non-compliant:
int *f(int& x) { return &x; } // #1
const int *g(const int& x) { return &x; } // #2
int& h(int& x) { return x; } // #3
const int& m(const int& x) { return x; } // #4
The justification given for this is that "It is implementation-defined behaviour whether the reference parameter is a temporary object or a reference to the parameter."
I'm puzzled by this, however, because stream operators in C++ are written in this way, e.g.
std::ostream& operator<<(std::ostream& os, const X& x) {
//...
return os;
}
I think I'm pretty confident that stream operators in C++ do not in general exhibit implementation-defined behaviour, so what's going on?
According to my understanding as it is at present, I would expect #1 and #3 to be well-defined, on the basis that temporaries cannot be bound to non-const references, so int& x refers to a real object that has lifetime beyond the scope of the function, hence returning a pointer or reference to that object is fine. I would expect #2 to be dodgy, because a temporary could have been bound to const int& x, in which case trying to take its address would seem a bad plan. I'm not sure about #4 - my gut feeling is that that's also potentially dodgy, but I'm not sure. In particular, I'm not clear on what would happen in the following case:
const int& m(const int& x) { return x; }
//...
const int& r = m(23);
| In C++11, #2 and #4 can be made safe if there are also rvalue reference overloads. Thus:
const int *get( const int &x ) { return &x; }
const int *get( const int &&x ) { return nullptr; }
void test() {
const int x = 0;
const int *p1 = get( x ); // OK; p1 is &x.
const int *p2 = get( x+42 ); // OK; p2 is nullptr.
}
So although they are dodgy, they do have safe uses if the programmer knows what they are doing. It'd be draconian to forbid this.
(Perhaps safer would be if the const rvalue reference overload was made private, left undefined, or otherwise caused a compile-time or link-time error. This is especially true for the #4 case, where we return a reference but there is nothing good to return a reference to and the language doesn't allow references to null.)
| 0.777778 | In C++11, #2 and #4 can be made safe if there are also rvalue reference overloads |
House rules to make the cloister less of a game winning tile in Carcassonne? | In my experience, cloister tiles in Carcassonne are often "too lucky". If you draw a cloister tile in the beginning of the game, it will typically still require an investment of quite a bit of "meeple" time to obtain the full 9 points, which makes it a fair trade-off. However, after about half of the game, it's relatively likely that you can "parachute" a cloister tile in some spot and get 8 or 9 points immediately. This adds a lot of randomness to the game.
What house rules work well to diminish this effect?
| One option that I've used before is to disallow placing cloister tiles in spots where they are adjacent to more than three existing tiles.
| 1 | Disallow placing cloister tiles in spots where they are adjacent to more than three existing tiles |
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?
| Like mentioned, it's primarily to differentiate them without a visual. Another reason, and probably less so is that since the menu button is concave you're less likely to accidentally trigger it. So if you're playing a video and you accidentally trigger play/pause it's not so bad whereas triggering menu will take you out of the video completely.
Car remotes often follow a similar pattern. The unlock button is concave and the lock button is convex.
| 1 | When playing a video, the menu button is concave . |
Question: Graph Theory and Trees | In a group of 2n schoolchildren each one has at least n friends. On an outing, the teacher tells them to hold hands in pairs. Show that this can be done with each child holding a friend’s hand, and that if n > 1, the choice of friends can be made in at least two different ways.
This was on a previous exam, and I have yet to receive the solutions for it. Can anyone help?
| By a theorem of Ore (proof here), if every pair of non-adjacent vertices of a graph on $m$ vertices has degrees adding up to at least $m$, then the graph is Hamiltonian. This applies to the schoolchildren, with $m=2n$. So they can be ordered into a Hamiltonian cycle (a path will do), $c_1,c_2,\dots,c_{2n}$, where each $c_i$ is friends with $c_{i-1}$ and $c_{i+1}$. Now pair $c_1$ with $c_2$, $c_3$ with $c_4$, and so on.
Dirac's Theorem, a special case of Ore's Theorem, is strong enough to solve this problem. A proof is here.
EDIT: Dirac's Theorem states that if each of the $m$ vertices of a graph has degree at least $m/2$, then the graph is Hamiltonian. This is exactly the hypothesis satisfied by the schoolchild graph.
| 0.777778 | if each pair of non-adjacent vertices of a graph has degrees adding up to at least $m$ |
What is the best way to paste code into a Trello card? | When I try to paste code in Trello, I get very weird formatting after saving, but it seems like it does format for code, I just can't get it to work right. What is the best way to paste code into Trello?
Currently I'm just putting links to Gist, but I would prefer to just paste it straight in there.
| Include formatted code by wrapping it in three backticks (```) at the beginning and end of the block, or by starting a line with four spaces. Note that the triple backticks have to be on a separate line and ensure you have a blank line before and after the code block.
| 0.888889 | Include formatted code by wrapping it in three backticks at beginning and end of block . |
Adding elements into associative array in javascript | I'm trying to add elements into an Associative Array, which is colors = []
I want it to have the ["id":selected_color] but my browser keeps crashing (an infinite loop somewhere?)
I'm not sure if I'm adding the elements into the array correctly.
What is happening is that I'm clicking on a span element, which has its ID value set to a hexcode value, and I'm trying to capture that value and associate it with the selected._color
<script type="text/javascript" src="jquery-1.6.2.js"></script>
<script type="text/javascript">
var selected_color = "";
var colors = [];
$(document).ready(function() {
$(".color_cell").click(function(){
// ADD MY COLOR TO SELECTED COLOR'S ASSOCIATIVE ARRAY
colors[$(this).attr("id")] = selected_color;
console.log($(this).attr("id"));
$(this).css({'background-color':'white'});
$(this).unbind('click');
updateDisplay(colors);
alert("hi");
});
$(".btnColor").click(function(){
// MAKE SELECTED COLOR BE ME
alert("hey");
selected_color = $(this).attr("id");
}); // end button handler
}); // end ready()
function updateDisplay(colors) {
jQuery.each(colors, function(key, value) {
//it seems to crash here...
$("#storage_display").html("var "+$("#storage_display").html()+" " +value);
});
};
</script>
| Apart from everything that was mentioned before ID attributes must begin with a letter A-Z or a-z . That might crash your browser.
Also if you are only storing colors in your array why not use just a normal array? (as James suggests)
| 1 | Why not use just a normal array? |
.NET class library DLL refresh | I'm using class library in .NET.
I'm generating DLL but it is being generated without the refresh file, so I can not update it automacatilly in my project.
How do you generate the refresh file with the DLL when compiling?
Or have a way to automatically update the DLL without refresh file?
| While adding references to a dll/library, You can add your library project as a Project reference.
This way, it will automatically get compiled/refreshed when you compile the main project.
If you are asking about getting the latest files from Source Control, before compiling then you will have to write pre/post build events.
| 0.888889 | Add dll/library references to a project |
Create a table that fills a page with empty rows | I'm trying to create an inventory sheet for our lab, and as such I need a large blank table. Is there a better way to do this then copy and pasting \midrule&&&\\ over and over again?
I'd like to look like this, but automatically repeat the blank cells until the page is full:
%Page layout here
\documentclass[letterpaper, 12pt,twocolumn]{article}
\usepackage[left= 2 cm, right=2 cm, top = 2 cm, bottom = 2 cm]{geometry}
%Font stuff here
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
%Goddamn tables.
\usepackage{booktabs} %Makes the pretty table based on wikibooks example
\begin{document}
\centering
{\large
\begin{tabular}{c|c|c|c}
\toprule
Date & User & Amount Used & Procedure\\
\phantom{2015-3-17} & \phantom{NAME} & (mg) & \phantom{XXX3-33}\\
\midrule
&&&\\
\midrule
&&&\\
\midrule&&&\\
\midrule&&&\\
\midrule&&&\\
\bottomrule
\end{tabular}
}
\end{document}
Note: I'm just using Booktabs to add the midrule, that can be dropped. This is just going on a clipboard on the wall, it can be ugly as you want. I'm just sick of fighting with Word's hellish layout tools.
Edit: There is this answer that places blank lines in the middle, but I don't understand the code nearly enough to modify it to fill to the end of the page.
| David Carlisle has gotten me most of the way to a solution, so I thought I'd post it:
%Page layout here
\documentclass[letterpaper, 12pt,twocolumn]{article}
\usepackage[left= 1 cm, right=1 cm, top = 2 cm, bottom = 1 cm]{geometry}
\newlength\linefillheight % vertical distance between lines
\setlength\linefillheight{1cm}
\newlength\wcolone %first column width
\setlength\wcolone{\dimexpr.125\textwidth-4mm\relax}
\newlength\wcoltwo %second column width
\setlength\wcoltwo{\dimexpr.125\textwidth-4mm\relax}
\newlength\wcolthree % third column width
\setlength\wcolthree{\dimexpr.125\textwidth-4mm\relax}
\newlength\wcolfour % third column width
\setlength\wcolfour{\dimexpr.125\textwidth-4mm\relax}
\newcommand\linefill{\leavevmode
\rule{\wcolone}{0.4pt}\hspace*{4mm}\rule{\wcoltwo}{0.4pt}\hspace*{4mm}\rule{\wcolthree}{0.4pt}\hspace*{4mm}\rule{\wcolfour}{0.4pt}}
\makeatletter
\def\fillwithlines#1{%
\begingroup
\ifhmode
\par
\fi
\hrule height 0pt
\nobreak
\cleaders\hbox to \hsize{\hskip \@totalleftmargin
\vrule height \linefillheight depth 0pt width 0pt
\linefill} \vskip #1 \hbox{}%
\endgroup}
\makeatother
\begin{document}
\noindent\begin{minipage}[c][1cm][t]{\textwidth}
\parbox{\dimexpr\wcolone+4mm\relax}{\textbf{\centering Date}}%
\parbox{\dimexpr\wcoltwo+4mm\relax}{\textbf{\centering User}}%
\parbox{\dimexpr\wcoltwo+4mm\relax}{\textbf{\centering Amount Used\\mg}}%
\parbox{\dimexpr\wcoltwo+4mm\relax}{\textbf{\centering Procedure}}%
\end{minipage}
\fillwithlines{\dimexpr\textheight-1cm\relax}
\noindent\begin{minipage}[c][1cm][t]{\textwidth}
\parbox{\dimexpr\wcolone+4mm\relax}{\textbf{\centering Date}}%
\parbox{\dimexpr\wcoltwo+4mm\relax}{\textbf{\centering User}}%
\parbox{\dimexpr\wcoltwo+4mm\relax}{\textbf{\centering Amount Used\\mg}}%
\parbox{\dimexpr\wcoltwo+4mm\relax}{\textbf{\centering Procedure}}%
\end{minipage}
\fillwithlines{\dimexpr\textheight-1cm\relax}
\end{document}
Based on this answer. However, I'd like to be able to centre the column headers and draw a line down the middle, if anyone could help with this.
some minor tweaks:
\documentclass[letterpaper, 12pt,twocolumn]{article}
\usepackage[left= 1 cm, right=1 cm, top = 2 cm, bottom = 1 cm]{geometry}
\newlength\linefillheight % vertical distance between lines
\setlength\linefillheight{1cm}
\newlength\wcolone %first column width
\setlength\wcolone{\dimexpr.125\textwidth-4mm-1.25pt\relax}
\newlength\wcoltwo %second column width
\setlength\wcoltwo{\dimexpr.125\textwidth-4mm-1.25pt\relax}
\newlength\wcolthree % third column width
\setlength\wcolthree{\dimexpr.125\textwidth-4mm-1.25pt\relax}
\newlength\wcolfour % third column width
\setlength\wcolfour{\dimexpr.125\textwidth-4mm-1.25pt\relax}
\newcommand\linefill{\leavevmode
\rule{\wcolone}{0.4pt}\hspace*{4mm}\rule{\wcoltwo}{0.4pt}\hspace*{4mm}\rule{\wcolthree}{0.4pt}\hspace*{4mm}\rule{\wcolfour}{0.4pt}}
\makeatletter
\def\fillwithlines#1{%
\begingroup
\par
\hrule height 0pt
\nobreak
\cleaders\hbox to \hsize{%
\vrule height \linefillheight depth 0pt width 0pt
\hss\linefill\hss} \vskip #1 \hbox{}%
\endgroup}
\makeatother\showoutput
\setlength\columnseprule{1pt}
\begin{document}
\noindent\begin{minipage}[c][1cm][t]{\linewidth}
\parbox{\dimexpr\wcolone+4mm\relax}{\centering\textbf{Date}}%
\parbox{\dimexpr\wcoltwo+4mm\relax}{\centering\textbf{User}}%
\parbox{\dimexpr\wcoltwo+4mm\relax}{\centering\textbf{Amount Used\\mg}}%
\parbox{\dimexpr\wcoltwo+4mm\relax}{\centering\textbf{Procedure}}%
\end{minipage}
\fillwithlines{\dimexpr\textheight-1cm\relax}
\noindent\begin{minipage}[c][1cm][t]{\linewidth}
\parbox{\dimexpr\wcolone+4mm\relax}{\centering\textbf{Date}}%
\parbox{\dimexpr\wcoltwo+4mm\relax}{\centering\textbf{User}}%
\parbox{\dimexpr\wcoltwo+4mm\relax}{\centering\textbf{Amount Used\\mg}}%
\parbox{\dimexpr\wcoltwo+4mm\relax}{\centering\textbf{Procedure}}%
\end{minipage}
\fillwithlines{\dimexpr\textheight-1cm\relax}
\end{document}
In chat you said you wanted single column with 7 headings...
\documentclass[letterpaper, 12pt]{article}
\usepackage[left= 1 cm, right=1 cm, top = 2 cm, bottom = 1 cm]{geometry}
\newlength\linefillheight % vertical distance between lines
\setlength\linefillheight{1cm}
\usepackage[T1]{fontenc}
\newcommand\linefill{\hspace{\stretch{.5}}%
\rule{.1\textwidth}{0.4pt}\hfill
\rule{.1\textwidth}{0.4pt}\hfill
\rule{.1\textwidth}{0.4pt}\hfill
\rule{.1\textwidth}{0.4pt}\hfill
\rule{.1\textwidth}{0.4pt}\hfill
\rule{.1\textwidth}{0.4pt}\hfill
\rule{.1\textwidth}{0.4pt}\hspace{\stretch{.5}}%
}
\makeatletter
\def\fillwithlines#1{%
\begingroup
\par
\hrule height 0pt
\nobreak
\cleaders\hbox to \hsize{%
\vrule height \linefillheight depth 0pt width 0pt
\linefill} \vskip #1 \hbox{}%
\endgroup}
\makeatother
\setlength\columnseprule{1pt}
\begin{document}
\noindent\begin{minipage}[c][1cm][t]{\linewidth}
\parbox[t]{\dimexpr\linewidth/7\relax}{\centering\textbf{Date}}%
\parbox[t]{\dimexpr\linewidth/7\relax}{\centering\textbf{User}}%
\parbox[t]{\dimexpr\linewidth/7\relax}{\centering\textbf{Amount Used\\mg}}%
\parbox[t]{\dimexpr\linewidth/7\relax}{\centering\textbf{Procedure}}%
\parbox[t]{\dimexpr\linewidth/7\relax}{\centering\textbf{User}}%
\parbox[t]{\dimexpr\linewidth/7\relax}{\centering\textbf{Amount Used\\mg}}%
\parbox[t]{\dimexpr\linewidth/7\relax}{\centering\textbf{Procedure}}%
\end{minipage}
\fillwithlines{\dimexpr\textheight-1cm\relax}
\end{document}
| 0.888889 | %Page layout here documentclass |
Shalom alecha rebbi (u'mori) | What is the significance of the time it takes to say Shalom Alecha Rebbi (U'mori)?
| I once heard from my rabbi in high school that it was about 3 seconds. Not sure the source, but it always made sense to me. Witnesses also must recite their identical testimony within that same timeframe.
| 1 | Witnesses must recite their identical testimony within the same timeframe |
Do Americans pronounce "Ellen" and "Alan" in the same way? | Do Americans pronounce "Ellen" and "Alan" in the same way? I am especially concerned with the first vowel.
EDIT:
Here is a quote that may be a case in point:
Being a Brit also, the names "Ellen" and "Alan" tend to sound the same
when spoken with an American tongue. It was just unfortunate that the
child was very tom boyish and had an ambiguous sounding name
Context: discussion on why they chose a boy-looking girl for the movie "Fatal Attraction"
Link: http://www.imdb.com/title/tt0093010/board/thread/186160978?d=186229310&p=1#186229310
| Americans don't pronounce them exactly the same.
However, some American dialects change the pronunciation of /æ/ before /l/ in a way that I believe makes it sound more like /ɛ/ to foreigners. In fact, in a few New Zealand and Australian dialects, these vowels become identical before /l/; see salary-celery merger; this merger would indeed also merge Allen and Ellen, but I don't believe it has happened in any American dialects.
UPDATE: the OP was asking why some Brits heard "Allen" when the actors in Fatal Attraction were saying "Ellen". I believe the pronunciation of /ɛl/ is nearly the same in the U.S. and the U.K., but if you're listening to an unfamiliar dialect, you rely more on context, and my guess is that the people watching got the name wrong because they were relying more on context and the girl playing Ellen looked somewhat like a boy.
| 1 | American dialects change pronunciation of // before /l/ |
What's the difference between Fermi Energy and Fermi Level? | I'm a bit confused about the difference between these two concepts. According to Wikipedia the Fermi energy and Fermi level are closely related concepts. From my understanding, the Fermi energy is the highest occupied energy level of a system in absolute zero? Is that correct? Then what's the difference between Fermi energy and Fermi level?
| Fermi level as a state with 50% chance of being occupied by an electron for the given temperature of the solid and at absolute zero temperature occupancy is 100%.
Fermi energy is the corresponding energy of Fermi level.
| 1 | Fermi level as a state with 50% chance of being occupied by an electron for the given temperature of the solid |
Is it worth bringing a flash for a backpacking trip? | I'm going on my honeymoon to Thailand, Cambodia and Vietnam in June for 4 weeks.
I'll bring my Canon t3i + 15-55mm and a 55-250mm lens.
This will be my first travel like this and I definitely want to take some awesome pictures.
I don't have a Flash and I want to buy a Canon Speedlite 430EX when the time comes.
The question is... Is it Worth it to buy this flash for this kind of travel?
| The first thing i'd say is that its pretty sunny there, generally speaking.
If your outdoors during the day, chances are low you'll need a flash at all.
In June normally all Thailand except the southern Gulf is in monsoon. The southern Gulf's (Samui and neighbours plus adjacent mainland coast) usual wet season is Oct into Jan. I can't speak for what the day light is like during that time however.
The recommended range for the flash isn't more than about 100mm, past that, its usefulness is limited. Using the integrated diffusion panel allows extended wide-angle coverage to 14mm.
It wouldn't hurt to have a better flash than the integrated one but it all depends on what you'll be shooting. With the 15-55mm lens i'd expect the integrated flash to do good enough.
It really depends on what you'll be shooting and what you'll be using the flash for. I used a couple of generic hand-held flashes for light painting in caves in Thailand. I thoroughly recommend them for this purpose!
Check out the DPreview link here for details about the flash and base your recommendations around that.
Hope that helps!
PS: Interstingly, I just came back from Thailand. All my camera gear got destroyed cause my peli-case leaked -_- Watch out for the water!
| 1 | Is there a flash in Thailand? |
Prepare SD card for Wifi on Headless Pi | I need to SSH my Pi over wifi but because it is a model A board (using a usb hub is not possible - ever) and I have no ethernet, i can't configure the Pi to connect to my secured wifi network. I want to have the SD card plugged into my laptop and I want to edit a file with the wifi configuration information in it so my Pi will connect to my network automatically at start-up so I can then SSH it to get control. I know how to enable SSH on a headless system thanks to this answer.
Edit.
Ive been searching around and I'm wondering if I'm able to just edit the file /etc/network/interfaces while the SD card is in my PC and put in all the network ssid, psk and wlan0 stuff in it. Will this work? Thanks
| I think all these answers are missing the point that the RPi model A HAS NO Ethernet, no wi-fi, so no matter what you do, unless you get an external dongle, you wont be able to connect to the RPi through ssh.... your best bet is either to use it directly on a TV or to use it through the serial port on the headers, or as I said, get an external dongle for wifi.
| 1 | RPi model A HAS NO Ethernet, no wi-fi, so unless you get an external dongle, you wont |
How to deploy webpart on production (not debugging) server? | I've created a web part, debugging it on a test Sharepoint 2010 install on my local workstation. I'd like to test it on our production server. It seems that I won't be able to use Build --> Deploy to accomplish this, and I have to deal with my assembly and .webpart file.
What are the steps to accomplish this?
| SharePoint solution packages consist of a .WSP file that you can create using Visual Studio (or manually if you so wish).
Before deploying to a production environment, I recommend you take a look through Deploy solution packages (SharePoint Server 2010).
Basically you need to add your solution to the solution database of a SharePoint Server farm using the Add-SPSolution PowerShell cmdlet, then deploy the solution using either Central Administration or the Install-SPSolution PowerShell cmdlet.
Both installation options above provide a choice of installing to either a single Web application, or all Web applications.
| 0.888889 | SharePoint solution packages consist of .WSP file that you can create using Visual Studio |
How long does it take for a calf to be full grown in Harvest Moon A New Beginning? | How long does it take for a calf to be full grown in Harvest Moon A New Beginning?
And for that fact, what about the other animals? (chicks, sheeps, you get the deal)
| According to this source, cows have a pregnancy period of 21 days, followed by another 20 days until adolescence. While the source is somewhat incomplete, I would hazard a guess that sheep and alpaca have the same pre-adolescent period since they share the same pregnancy period of 21 days.
Chickens, on the other hand, have an incubation period of 7 days (since you put eggs in the hatcher, rather then get them pregnant), followed by 8 days until adolescence.
Note that this source is incomplete for higher quality breeds such as Jersey cows and Silkie chickens, but from my experience with previous games in the series (such as Tale of Two Towns), they should share the same pregnancy/incubation/adolescence period as the base livestock.
| 1 | Cows have a pregnancy period of 21 days, followed by another 20 days until adolescence |
Good/functional but can do better | I'm looking for an aphorism communicating the thought that "this works, but we can do better". Some high-falutin language like Shakespeare or Blake would be ideal.
| Not quite Shakespearean, but you could say
Although the <product> is good as it is, there is still room for improvement.
| 1 | The <product> |
Intangibility in Marvel Heroic Roleplaying | I am playing the Breakout event, as Spiderman (stop reading if you don't want spoilers!). We just met Zzzax, and I decided to attack him by web-throwing a huge metal pipe through him. I managed a Total 28, effect d10 action and aimed for Physical Stress.
The Watcher did a Reaction Roll, and got a Total 2, Effect d4 Reaction (yes, it is possible, only one die not an opportunity).
But the Watcher activated its "Grounded" Limit: Zzzax ignored all Stress, and became grounded through the pipe. And here is the disagreement:
His point of view: Since Zzzax has Intangibility d10, he ignores all physical attacks, the only way to defeat him is to activate his Limit and then over-complicate him. He activated the Limit because my roll was so high that it should have a result. He still has Intangibility even though his Power Set is shut down.
My point of view: Activating a Limit doesn't allow you to randomly ignore an attack. I can't ignore an attack and become Exhausted instead. Intangibility is just a die to add to Reaction rolls, not an automatic effect that allows you to ignore everything, that requires an SFX like Immunity(Physical attacks).
I went with his interpretation (and built a Faraday cage through web and pipes), but I still think that it was not right.
So how does Intangibility work? Is it an automatic effect, even without Immunity/Invulnerability SFXs, or is it just a resistance, allowing you to be attacked normally?
| Some powers do have, within their description, effects beyond their mechanical ones. Durability is a common example: at d10, you're not just rolling an extra die; you're proof against small-arms fire. Intangibility is similar; at d10, only "super-high density" substances can touch you, which wouldn't ordinarily include a thrown pipe. Though I disagree with Lonnie's interpretation, his conclusion is correct: you need to come up with a narratively plausible way to take him out.
Since you ended up Complicating him out, we never get to see whether the Watcher would have spent from the Doom Pool to turn the Electrical Body power set back on. Your actions did take Zzzax out of the fight, at least for a while, which seems pretty good for a thrown object from Spider-Man.
| 0.777778 | How to take Zzzax out of the fight? |
Migration Assistant fails on Ethernet Mavericks-to-Mavericks migration | I have the following setup and am attempting the use Migration Assistant over Ethernet:
Source machine: Early 2009 24-inch iMac running OS X 10.9
Destination
machine: Latest MacBook Pro Retina running OS X 10.9
Connection: direct Ethernet cable between machines
When I use Migration assistant following Apple's documentation I pass through the confirmation code step on both machines, and then get as far as the "Checking Source Machine" screen on the destination, and am stuck there for about 10 minutes, at which point the destination machine jumps back to the language selection setup page, and the source machine says "This machine is attempting to reconnect to your other Mac".
At this point I'm at a dead end: Attempting to proceed through the setup again on the destination gets me nowhere, and the only option on the source machine is "Cancel Transfer", which quits Migration Assistant there and ends the whole process.
On the source machine I've turned off LittleSnitch, which I normally have running, turned off Apple's firewall, and enabled file sharing.
What am I missing? Are there other settings somewhere that I need to check? I've also tried using FireWire to connect my machines, but have a different set of issues there.
| Here are the points which don't block Migration Assistant on the source Mac side:
Firewall on
File Sharing off
FileVault on
Here are 2 key points which blocks the reachability of Migration Assistant on the source Mac side:
IPv6
IPv6 off
This isn't the default configuration. But within enterprise large networks it
is a usefull practice to avoid IPv6 problems when your infrastructure and
your other computers don't manage it yet.
If IPv6 is off on the source Mac, just turn it on before firing the installation process from the target Mac.
Firewall setting
If your firewall setting on the source Mac is set so that it won't automatically accept connection from signed software (as in this screen capture)
then "Migration Assistant" will fail (the connection will fail, and the source Mac won't display the code to confirm it is the right source).
You just have to turn this switch on before firing the installation process from the target Mac.
Of course, this setting won't be correctly transfered by the Migration Assistant since it would block it.
Beware if you want to make different tests!
Once the source Mac has been seen on the network (or direct connection) any configuration change on the source side won't be seen on the target side.
To see any configuration change of the source side the installation process of the target side must be restarted at the boot step from
disk.
The back button isn't sufficient.
The Migration Assistant on the source Mac can detect this failure factor and could warn us that it will fail with a clear warning window
rather than to play with the rotating gearing.
| 0.888889 | Migration Assistant on the source Mac side |
Why do I have to explicitly add perl before the script for getops to run properly? | When i run my script like so:
C:\>perl script.pl -f file
It works fine. But, if I just do:
C:\>script.pl -f file
then I don't get any errors but getopts doesn't assign anything to $opt_f
This works just fine on perl 5.8 Windows XP, but it doesn't work on perl 5.12 on Windows 7.
There aren't any other versions of perl installed (its a new OS build).
Code:
use Getopt::Std;
our ($opt_f);
getopts('f:');
print "input file is: $opt_f \n";
print "$0\n
Run with:
C:\> perl get.pl -f sadf
input file is: sadf
get.pl
Run without:
C:\>get.pl -f sadf
input file is:
Nothing!
EDIT: fixed and this question was a repeat...
http://stackoverflow.com/questions/1695188/how-do-i-make-perl-scripts-recognize-parameters-in-the-win32-cmd-console
The OP of that post figured it out.
I had to do the same but also recreate the assoc in the gui (in addition to in the reg and on the command line with ftype.)
| fixed and this question was a repeat... http://stackoverflow.com/questions/1695188/how-do-i-make-perl-scripts-recognize-parameters-in-the-win32-cmd-console
The OP of that post figured it out.
I had to do the same but also recreate the assoc in the gui (in addition to in the reg and on the command line with ftype.)
Thanks everyone for your help!
| 1 | How do I make perl-scripts-recognize-parameters-in-the-win32-cmd |
USB host power dc/dc converter chip | I'm looking for a (cheap, surface mount) single-chip dc/dc converter to power a USB connection. I'm thinking that with so many USB chargers available, there might be a chip available specifically targeted at just that market. So far I haven't found any, because I'm swamped with retail devices and battery charge controller chips which run FROM USB. I want to run USB from a battery. For the purposes of this question, the battery will be a 3.7v LiPo.
Does anyone know such a chip? I know I can get 5V dc/dc power converters, I'm looking to see if I can do better by finding one specifically targeted at usb host application.
While USB loads can vary, it should at least handle the typical standard USB-host load current of 500mA.
| A search found TI has an line of USB Switches with integrated Boost Converters (one with an added 3.3v LDO out as well)
http://www.ti.com/paramsearch/docs/parametricsearch.tsp?family=analog&familyId=3189&uiTemplateId=NODE_STRY_PGE_T&paramCriteria=no
The TPS2500 and TPS2501 are the same except for a power save mode on the 2500. 1.8v to 5v input, regulated 5v out with selectable current limiting. Current output up to 1.4A on a single current limited output.
The TSP2505 has two individually limited outputs, an aux 5v out, a 3.3v ldo, and can source up to 2.3A between the aux and usb outputs.
| 0.666667 | USB Switches with integrated Boost Converters |
Can you approximate Cardiac Output by Ohm's law? | I found this sentence from my notes which I cannot understand
PR < CO, CO $\uparrow$, PR > CO $\downarrow$
where
\item CO = AP / PR, Cardiac Output = Arterial P / Peripheral Resistance
I cannot understand the first sentence.
I cannot understand how you can deduce by Ohm's law the relationship.
What is the point of the first sentence?
| I don't get the first sentence either, since PR and CO in your notation are in fundamentally different units. It's like saying '4 Celsius < 5 meters.' You will have to think about what you are implicitly holding constant and ignoring in that relationship to make it meaningful. I suspect the first sentence is just emphasizing the inverse relationship between CO and PR (PR goes up, CO goes down, etc).
As for Ohm's law, absolutely! You have it written right there. I assume Cardiac output is the flow rate of fluid in a blood vessel, and AP is arterial pressure, and PR is peripheral resistance. Stated another way,
$\textrm{Flow} = \frac{\textrm{Pressure}}{\textrm{Resistance}}$,
which is exactly Ohm's law. Frequently electrical current is described with a Hydraulic analogy, with pressure$\rightarrow$voltage, fluid flow$\rightarrow$current, and flow resistance$\rightarrow$electrical resistance. It makes a lot of sense, since electric current is literally flow of electrons. Poiseuille's Law that makes this analogy rigorous, deriving an Ohmic relationship between those variables. Interestingly enough, Poiseuille derived the law in the context of blood flow, making it particularly applicable.
| 0.888889 | Ohm's law: inverse relationship between CO and PR |
Constantly lag in opengl application | I'm getting some repeating lags in my opengl application.
I'm using the win32 api to create the window and I'm also creating a 2.2 context.
So the main loop of the program is very simple:
Clearing the color buffer
Drawing a triangle
Swapping the buffers.
The triangle is rotating, that's the way I can see the lag.
Also my frame time isn't smooth which may be the problem.
But I'm very very sure the delta time calculation is correct because I've tried plenty ways.
Do you think it could be a graphic driver problem?
Because a friend of mine run almost the exactly same program except I do less calculations + I'm using the standard opengl shader.
Also, His program use more CPU power than mine and the CPU % is smoother than mine.
I should also add:
On my laptop I get same lag every ~1 second, so I can see some kind of pattern.
| There are many reasons for a jittery frame rate. Off the top of my head:
Not calling glFlush() at the end of each frame
other running software interfering
doing things in your code that certain graphics drivers don't like
bugs in graphics drivers
Using the standard windows time functions with their terrible resolution
Try these:
kill as many running programs as you can get away with. Use the process tab in the task manager (CTRL-SHIFT-ESC) for this.
bit by bit, reduce the amount of work your program is doing and see how that affects the frame rate and the smoothness of the display.
if you can, try enabling/disabling vertical sync (you may be able to do this in your graphic card's settings) to see if that helps
add some debug code to output the time taken to draw each frame, and see if there are anomalies in the numbers, e.g. every 20th frame taking an extra 20ms, or random frames taking 100ms.
| 0.888889 | jittery frame rate in graphics drivers |
Disable the save button until changes are made? | We have a list of complicated things, which the user can click on to get a new view in which they can edit all the details stored for that thing.
The edit view already has a Cancel exit mechanism (default for all our edit forms) and it has a save button (which both saves and exits back to the list).
Should the Save button be disabled until changes are made to any of the details?
| You're assuming users never save changes to data they haven't changed. They do - all the time. Partly as an unconscious reflex, partly because they can't always remember what they've edited, and partly because they fear the risk of losing their work so much, they save religiously.
I exit forms via the save function all the time. It's a hard-learned habit, and a form that didn't support that workflow would seem jarring. It'd also make me distrust the application (what if the form simply hasn't detected my changes? what if the save button is missing because the application is broken?).
I wouldn't like it. But I'm not your user. Try some A/B testing some time and find out for yourself.
| 1 | How to save changes to data they haven't changed |
A question on unbounded operators | Assume that $H$ is a separable Hilbert space.
Is there a polynomial $p(z)\in \mathbb{C}[x]$ with $deg(p)>1$ with the following property?:
Every densely defined operator $A:D(A)\to D(A),\;D(A)\subset H$ with $p(A)=0$ is necessarily a bounded operator on $H$.
That is the polynomial-operator equation $p(A)=0$ has only bounded solution.
| You mean an infinite-dimensional separable Hilbert space. The answer is no.
Suppose $p(z)$ has distinct roots $\alpha_1, \alpha_2$. Define a sequence $x_1, x_2, \ldots$ in the unit sphere of $H$ such that
$x_1,\ldots, x_n$ are linearly independent for all $n$.
$\|x_i - x_{i+1}\| \to 0$ as $i \to \infty$.
the sequence is dense in the unit sphere of $H$.
Define $A$ on the linear span of the sequence so that $A x_i = \alpha_1 x_i$ if $i$ is odd, $\alpha_2 x_i$ otherwise.
On the other hand, if $p$ has only one root, say $p(z) = (z - \alpha)^d$, then
with the same sequence as above take $A x_i = \alpha x_i + x_{i+1}$ for $i$ not divisible by $d$, $\alpha x_i$ otherwise.
| 0.888889 | Suppose $p(z)$ has a distinct root |
Highlight a column in equation or math environment | While explaining the idea product of two negative numbers I wanted to highlight a vertical part of the display to emphasize on the factors that are being multiplied by:
\documentclass[letterpaper]{article}
\usepackage{fullpage}
\usepackage{amsmath,amssymb,amsthm,enumitem}
\newcommand{\red}[1]{%
{\color{OrangeRed}#1}}
\begin{document}
\begin{equation*}
\left.\begin{array}{cc}
-2\cdot \red{2}=& -4 \\
-2\cdot \red{1}=& -2 \\
-2\cdot \red{0}=& 0
\end{array}\right\} \text{\small Product increases by 2 each time.}
\end{equation*}
\end{document}
This gives:
So I chose to use a color but then I had also wanted to achieve something like the following:
I am not interested in the yellow red bordered box. What am looking for is an arrow pointing on the red numbers with a vertical border around them as shown and the possibility of adding a node with text in the same format shown aligned with the word "Product".
Edit
Can I use this method to achieve this:
| To accomplish this task you can make use of the tikzmark macro. This solution allows to get:
The code:
\documentclass[letterpaper]{article}
\usepackage{fullpage}
\usepackage{amsmath,amssymb,amsthm,enumitem}
\usepackage{xcolor}
\newcommand{\red}[1]{%
{\color{red}#1}}
\usepackage{tikz}
% to change colors
\newcommand{\fillcol}{white}
\newcommand{\bordercol}{red}
%% code by Andrew Stacey
% http://tex.stackexchange.com/questions/51582/background-coloring-with-overlay-specification-in-algorithm2e-beamer-package#51582
\makeatletter
\tikzset{%
remember picture with id/.style={%
remember picture,
overlay,
draw=\bordercol,
save picture id=#1,
},
save picture id/.code={%
\edef\pgf@temp{#1}%
\immediate\write\pgfutil@auxout{%
\noexpand\savepointas{\pgf@temp}{\pgfpictureid}}%
},
if picture id/.code args={#1#2#3}{%
\@ifundefined{save@pt@#1}{%
\pgfkeysalso{#3}%
}{
\pgfkeysalso{#2}%
}
}
}
\def\savepointas#1#2{%
\expandafter\gdef\csname save@pt@#1\endcsname{#2}%
}
\def\tmk@labeldef#1,#2\@nil{%
\def\tmk@label{#1}%
\def\tmk@def{#2}%
}
\tikzdeclarecoordinatesystem{pic}{%
\pgfutil@in@,{#1}%
\ifpgfutil@in@%
\tmk@labeldef#1\@nil
\else
\tmk@labeldef#1,(0pt,0pt)\@nil
\fi
\@ifundefined{save@pt@\tmk@label}{%
\tikz@scan@one@point\pgfutil@firstofone\tmk@def
}{%
\pgfsys@getposition{\csname save@pt@\tmk@label\endcsname}\save@orig@pic%
\pgfsys@getposition{\pgfpictureid}\save@this@pic%
\pgf@process{\pgfpointorigin\save@this@pic}%
\pgf@xa=\pgf@x
\pgf@ya=\pgf@y
\pgf@process{\pgfpointorigin\save@orig@pic}%
\advance\pgf@x by -\pgf@xa
\advance\pgf@y by -\pgf@ya
}%
}
\makeatother
\newcommand{\tikzmarkin}[1]{%
\tikz[remember picture with id=#1]
\draw[line width=1pt,rectangle,rounded corners,fill=\fillcol]
(pic cs:#1) ++(0.065,-0.15) rectangle (-0.05,0.32)
;}
\newcommand\tikzmarkend[2][]{%
\tikz[remember picture with id=#2] #1;}
\begin{document}
\begin{equation*}
\left.\begin{array}{cc}
-2\cdot \tikzmarkin{a}\red{2}=& -4 \\
-2\cdot \red{1}=& -2 \\
-2\cdot \red{0}\tikzmarkend{a}=& 0
\end{array}\right\} \text{\small Product increases by 2 each time.}
\end{equation*}
\end{document}
Notice that you need to compile twice.
Explanation
Inside the tikzset there is the definition of the style of the picture to be drawn (remember picture with id) then the definition and the writing on the the .aux of the id and position of the mark. Anyway, to get a better explanation, you can refer to http://tex.stackexchange.com/a/50054/13304. Finally, the commands that you need to use inside your document, \tikzmarkin and \tikzmarkend are defined.
EDIT: insertion of the annotation
For this purpose I adopted the same trick of Mark a pseudocode block and insert comments near it: the insertion of an anchor inside the \tikzmarkin macro to subsequently used it as reference to insert the annotation. What changes in the previous MWE?
In the preamble you should add:
\usetikzlibrary{calc} % <= needed for some computations
\usepackage{lipsum} % <= needed to insert some text later
The \tikzmarkin should be improved as:
\newcommand{\tikzmarkin}[1]{%
\tikz[remember picture with id=#1]
\draw[line width=1pt,rectangle,rounded corners,fill=\fillcol]
(pic cs:#1) ++(0.065,-0.15) rectangle (-0.05,0.32) node [anchor=base] (#1){}
;}
where the relevant new part is just node [anchor=base] (#1){}.
Finally, the document:
\begin{document}
\begin{equation*}
\left.\begin{array}{cc}
-2\cdot \tikzmarkin{a}\red{2}=& -4 \\
-2\cdot \red{1}=& -2 \\
-2\cdot \red{0}\tikzmarkend{a}=& 0
\end{array}\right\} \text{\small Product increases by 2 each time.}
\end{equation*}
% To insert the annotation
\begin{tikzpicture}[remember picture,overlay]
\coordinate (aa) at ($(a)+(1.825,-1.65)$); % <= adjust this parameter to move the position of the annotation
\node[align=left,right] at (aa) {\small{Annotation}};
\path[-latex,red,draw] (aa) -| ($(a)+(0.15,-1.3)$);
\end{tikzpicture}
\linebreak
\lipsum[1]
\end{document}
The last part is the one needed to insert the annotation: first I defined a coordinate where to insert it based on the anchor previously saved (to accomplish this, it is important that the tikzpicture has as options remember picture,overlay). The last command:
\path[-latex,red,draw] (aa) -| ($(a)+(0.15,-1.3)$);
draws the arrow: the starting point is the coordinate of the annotation and the final point should be computed knowing that the reference anchor a is placed on the top left of the red rectangle.
This will lead to:
One final remark: I think should be better to insert a \linebreak after the tikzpicture to avoid that the annotation will be placed too nearly the subsequent text.
| 0.666667 | How to insert a tikzmarkin macro? |
What is the best way to show the user large amounts of data? | I am working on an application with a team that has roughly 2 years of data. This data is shown through multiple visualization methods. Part of the application is a settings panel, which lets the user control various things about the application (How much data they see, color schemes, etc.)
In the settings panel, one of the options allows the user to view their data in table format (report style). Because there is about two years worth of data, it's been broken up in to Month and Year increments. If the user wants to export a particular month, they can export that data to a .csv which can then be opened in a third party program like Excel or Calc. This is what it currently looks like with the entire visualization screen:
Close up view:
Even with the data broken up, there is still a substantial amount in each table (probably about 150 rows). This means the user still has to scroll to view the data. My co-workers think this is the best option, however I want to take a different approach.
I personally think that everything in the settings should be something to change the way the data looks or to get some of the data to take somewhere else.
My solution would be to show the user some sample data (maybe 3-4 rows), then give them the option to export as the main function (as opposed to reading it in browser). I think this makes more sense since the user won't have the ability to sort, select, change, etc. like they would in Excel. Mine would look something like this:
It's not perfect, but it should give you a general idea of the look I'm going for. So down to the actual question...
Question
Which scenario makes more sense?
Display this much data to the user in browser (in a settings panel)
Give the user sample data and let them export it and do what they please with it
| Your question is not which A or B is better, but: What end user does with provided data and how use it (broder context)?
Data is a source for decisions, so you need to know if end user needs to:
find a single row to spot an anomaly or analyse particular part (add filters)
recognize a pattern or min/max value (add sorting)
analyse whole set or local min/max (pagination vs scrolling)
makes decision right here and now (no exporting) or used data as a part of reporting system for further calculations or engineering (add export)
search for trends or patternss (add charts) or looks for averages (add summaries at top)
| 0.777778 | What end user does with provided data and how use it |
Why do read links turn purple? | Today I saw a post on Facebook that had this pun:
Clicked links turn purple because blue + "read" equals purple
Is there any specific reason why a link is blue and when it is clicked/read, it turns to purple?
Do these colors have any meaning?
| There can of course be more than one reason in favour of a decision, whether conscious or unconscious, yet more against bad alternatives (so they get rejected before we even see them) and hence I reckon the other answers here are also partially true. Indeed, quite likely so, since there's an answer here that talks about TimBL while I'm going to talk about Mosaic, which was independent from him.
One stated reason for Mosaic choosing the colour, is that 4-bit colour was still common, and so designs would need to consider how well they would look on such displays. Most such displays used two sets of colours, one of which was of the sequence:
0) Black 1) Blue 2) Red 3) Magenta 4) Green 5) cyan 6) yellow 7) white
(Note the fun way the mixing of colours and adding of numbers has the same results).
Then there would be another set of the same colours, but lighter (sometimes "light black" would mean grey, sometimes "dark white" would mean grey, sometimes both).
Of this sequence, the colours were darkest to lightest in that order (still true of the equivalents in sRGB, NTSC and other richer colour-spaces, though the exact proportions are generally different). Indeed the scheme was designed so you could depend on different relative shades when used with a monochrome display (black and white, black and green or black and orange).
Hence the darkest colour other than black (already used for normal text) that therefore offered the next-greatest contrast against a white or (as used by said Mosaic browser) grey background, was blue. Hence what would later (when attributes for describing colours where added to HTML) be called #0000FF was the standard link colour. (#000080 would also have been available, but not as distinguished from the black of unlinked text).
Red is well-known as a means of emphasis, it would be an appropriate choice for an active link (and was used as such, though I'm pretty sure not until later on, with Netscape Navigator 2.0 if memory serves, since before <frame> and javascript an active link didn't mean much as the page was going to unload anyway), but inadvisable for a visited link, which if anything should be de-emphasised compared to unvisited. After red, the next brightest colour, and so the next most appropriate for text other than blue and black was magenta, but the darker #800080 (purple) was sufficiently different to both blue and black to be distinguished from them, and again the darker choice and hence that which stood out best against a light background.
| 1 | Mosaic chose a 4-bit colour for a monochrome display |
How to mount a NTFS USB harddrive to Mac OS X that was unsave removed from Windows? | I have a hard drive that gets plugged into several machines. One MacBook Pro running Mac OS X, some Ubuntu and Fedora Installations and sometimes Windows XP or Vista. Therefore, I formatted it NTFS to be able to read and write on it no matter which machine is used. On Mac OS I installed MacFUSE to do this.
The Problem is, when the USB device is removed from a Windows box, without using the "remove hardware" function from the task bar, the drive is locked. When I wnat to mount it in Mac OS, I get an error message and have to connect it to back to Windows and cleanly unmount it.
So, my question is: Is there an easy way to use the drive on every computer / OS without mounting problems?
| You'll have to have a Windows system handy to have unlocked. That's the only way I've heard of fixing this issue.
On a related note, unsafely removing a drive from MacOS X can lead to locking, for which I could not find a Mac-native solution. That was hell in a handbasket to fix.
| 0.888889 | Unlocked MacOS X drive |
Using a ski helmet for winter biking | I am curious if anyone uses a skiing helmet for winter biking? Would this be safe? Are skiing helmets designed to protect you from the same kind of accidents that you would have on a bike?
My thinking is that a ski helmet would:
Help to keep your ears warm
Would fit well with ski goggles (which fit poorly with my bike helmet)
Not have air vents in it which make you cold in the winter
| If you're thinking about wearing a ski helmet for biking, for what it's worth the Snell RS-98 recreational skiing and B-95 biking helmet standards are nearly identical, word for word, including things like visibility requirements and anatomical coverage. There are some small differences in the drop test. The energy of the flat anvil drop test in the B-95 standard is 110J vs. 100J for the RS-98 ski standard. The hemispherical anvil drop test is 80 J for RS-98 and 72 for B-95. Bike helmets are tested against the point of a right angle "kerbstone" anvil, but ski helmets are tested against an "edge anvil" 6.3mm wide -- basically a decapitating machine -- and at higher forces than the kerbstone test too. Both bike and ski helmets have to be tested after being chilled and soaked, but bike helmets have to be tested after being cooked at 50 C (122 F).
The reasonable conclusion is that a Snell certified ski helmet is probably a suitable choice for winter biking, but should not be used after exposure to extreme heat. Yes, a certified ski helmet might pass the 100J flat anvil test but not the 110 J test, but it probably does.
As for ASTM 2040, who can say? It's not available for free inspection. But it appears that the requirements for recreational ski helmets and bike helmets are pretty close.
| 1 | Snell RS-98 and B-95 biking helmet standards are nearly identical, word for word . |
Downloading specific yeast genes in an automated manner? | I have 6 genes of Candida albicans yeast namely orf19.723, orf19.5908, orf19.610, orf19.2119, orf19.4998 and orf19.4056. And I have found the corresponding ortholog genes from Broad Institute website of other 16 species of yeast. So I have all gene names. Now how would I specifically download these genes and from where can I do this, preferably in an automated manner?
Also is there any standard naming convention? Because the ORF names given have other names too like BCR1, EFG1 and NDT80.
The list of gene names I have :
The orthologs of C. Albicans with S. cerevisiae
orf19.2119 YHR124W
orf19.4998 YBR033W YKL034W
orf19.5908 YBR083W
orf19.610 YMR016C YKL043W
orf19.723 NONE
orf19.4056 YMR136W
The orthologs of C. Albicans with S. paradoxus
orf19.2119 spar33-g1.1
orf19.4998 spar197-g23.1 spar324-g3.1
orf19.5908 spar200-g4.1
orf19.610 spar184-g1.1 spar324-g10.1
orf19.723 NONE
orf19.4056 spar165-g2.1
The orthologs of C. Albicans with S. mikatae
orf19.2119 NONE
orf19.4998 smik146-g12.1 smik109-g17.1
orf19.5908 smik83-g2.1
orf19.610 smik571-g2.1 smik109-g10.1
orf19.723 NONE
orf19.4056 smik1535-g1.1
The orthologs of C. Albicans with S. bayanus
orf19.2119 sbayc514-g9.1
orf19.4998 sbayc611-g22.1 sbayc652-g20.1
orf19.5908 sbayc678-g131.1
orf19.610 sbayc638-g23.1 sbayc652-g27.1
orf19.723 NONE
orf19.4056 sbayc657-g41.1
The orthologs of C. Albicans with S. castellii
orf19.2119 Scas697.24
orf19.4998 Scas625.4
orf19.5908 Scas718.27 Scas635.12
orf19.610 Scas106.1 Scas709.52 Scas625.8
orf19.723 NONE
orf19.4056 Scas680.22d
The orthologs of C. Albicans with C. glabrata
orf19.2119 CAGL0L13090g
orf19.4998 CAGL0L01947g
orf19.5908 CAGL0M01716g CAGL0F04081g
orf19.610 CAGL0M07634g CAGL0L01771g
orf19.723 NONE
orf19.4056 CAGL0I00902g CAGL0L06776g
The orthologs of C. Albicans with S. kluyveri
orf19.2119 SAKL0E11330g
orf19.4998 SAKL0A09812g
orf19.5908 SAKL0B06578g
orf19.610 SAKL0D13442g
orf19.723 SAKL0A03476g
orf19.4056 SAKL0E04862g
The orthologs of C. Albicans with K. lactis
orf19.2119 KLLA0F24420g
orf19.4998 KLLA0F25674g
orf19.5908 KLLA0E12507g
orf19.610 KLLA0F04840g
orf19.723 NONE
orf19.4056 KLLA0F17116g
The orthologs of C. Albicans with A. gossypii
orf19.2119 AGR347W
orf19.4998 AFR275W
orf19.5908 AER177W
orf19.610 ABR055C
orf19.723 NONE
orf19.4056 ADR249W
The orthologs of C. Albicans with K. waltii
orf19.2119 Kwal33.14699
orf19.4998 Kwal26.8099
orf19.5908 Kwal27.12423
orf19.610 Kwal26.8176
orf19.723 NONE
orf19.4056 Kwal47.17849
The orthologs of C. Albicans with C. tropicalis
orf19.2119 CTRG01097.3
orf19.4998 CTRG03636.3
orf19.5908 CTRG02294.3
orf19.610 NONE
orf19.723 CTRG00608.3
orf19.4056 CTRG04523.3
The orthologs of C. Albicans with L. elongosporus
orf19.2119 LELG01178
orf19.4998 NONE
orf19.5908 LELG02666
orf19.610 LELG05390
orf19.723 LELG03123
orf19.4056 LELG01761
The orthologs of C. Albicans with C. parapsilosis
orf19.2119 CPAG04608
orf19.4998 NONE
orf19.5908 CPAG01691
orf19.610 CPAG00178
orf19.723 CPAG00564
orf19.4056 CPAG05034
The orthologs of C. Albicans with D. hansenii
orf19.2119 DEHA2A07282g
orf19.4998 NONE
orf19.5908 DEHA2G13794g
orf19.610 DEHA2E10978g
orf19.723 DEHA2E05984g
orf19.4056 DEHA2E07172g DEHA2F25916g
The orthologs of C. Albicans with C. guilliermondii
orf19.2119 PGUG02096.1
orf19.4998 NONE
orf19.5908 PGUG04378.1
orf19.610 PGUG03651.1
orf19.723 PGUG05571.1
orf19.4056 PGUG05533.1
The orthologs of C. Albicans with C. lusitaniae
orf19.2119 CLUG00404
orf19.4998 NONE
orf19.5908 CLUG04694
orf19.610 CLUG02047
orf19.723 CLUG00627
orf19.4056 CLUG05535
| These sequences do not have any standard i.d. The information in Saccharomyces Genome Database is also obsolete (2005) and does not have these identifiers.
These sequences can be found here (in the same site).
Each species has a short name:
ORGANISM Short Name
S.cerevesiae Scer
S. bayanus Sbay
S. paradoxus Spar
A. gossypii Agos
.... and so on.
First letter of genus name in uppercase + first 3 letters of species name in lowercase.
The fasta file (for all ORFs) is:
www.broadinstitute.org/regev/orthogroups/nt/<Shortname>.fasta
From there you can use grep to retrieve the sequence.
So, if you have saved shortnames and gene names two separate files you can do something like this:
for shortname in `cat shortname.txt`; do wget -O tmp.fa "http://www.broadinstitute.org/regev/orthogroups/nt/"$shortname.fasta; grep -A 1 -f ids.txt tmp.fa >> $shortname"_Select.fa"; done
| 0.888889 | Saccharomyces Genome Database has no standard i.d. |
Angular $http promise not resolving | I am currently working on building a login flow in AngularJS 1.3. My problem is that the promise return from an $http call is not resolving the code inside of its '.then'.
I am working to handle error messages that come back from the server, specifically to handle any 401 errors which are returned when the user has input the wrong username or password. However, when a 401 is returned, the .then never resolves itself and the code within them never runs.
The relevant code is as follows:
The controller for the login form as a login function on its scope, as follows:
$scope.login = function() {
$scope.authError = null;
// Try to login
var promise = session.login($scope.user);
promise.then(function(loggedIn) {
// THIS CODE NEVER RUNS
if ( !loggedIn ) {
$scope.authError = localizedMessages.get('login.error.invalidCredentials');
}
}, function(x) {
$scope.authError = localizedMessages.get('login.error.serverError', { exception: x });
});
};
I have a session factory that takes care of the login and other session based needs. The code for login is:
login: function(credentials) {
var $http = $injector.get('$http');
var url = ENV.apiEndpoint + "/sessions";
var newSession = $http.post(url, credentials);
return newSession.then(function(data) {
session.set(data.token);
//THIS CODE ONLY RUNS ON A SUCCESS RESPONSE
if(session.isAuthenticated()) {
closeLoginModal(true);
}
return session.isAuthenticated();
});
}
I have placed comments in the code where the problem is. I am at a loss as to why this code isn't working. From my understanding of promises, then 'then' should resolve no matter what the response was, success of error.
I have an interceptor running, but I have tried disabling it with no luck to the end result.
Am I missing something?
| If your login (server-side) returns an HTTP error code, like a 401, this should resolve to an error, e.g., the second function passed to then. If you don't pass one it should bomb out; that's why your higher-level error function gets called.
| 0.333333 | If your login (server-side) returns an HTTP error code, this should resolve to an error |
Tables with a lot of rows - where should the delete option be? | Question regarding how to handle large tables with many rows:
Where should the delete option be? I see many examples placing the delete icon or text on the far-right of the row. Is this best practice? Is it always advisable to swap row delete to checkbox selection/batch delete?
If a table row has multiple available actions such as [Edit | Publish | View History ] etc, should these items be grouped into a single "Actions" row item?
|
Where should the delete option be? I see many examples placing the delete icon or text on the far-right of the row. Is this best practice? Is it always advisable to swap row delete to checkbox selection/batch delete?
I believe the far right location is because you don't want user to accidentally click on delete.
It depends. For a really long (tall) table, try using a sticky table header so it's always viewable.
If a table row has multiple available actions such as [Edit | Publish | View History ] etc, should these items be grouped into a single "Actions" row item?
Again it depends. If you really want to use buttons then group them. Otherwise small 16px by 16px icons in one table cell could suffice for each action if there's space.
| 0.777778 | Where should the delete option be? |
Are human males and females more genetically different than members of other species? | I'm looking at this Ted talk about a Saudi Arabia woman who dared to drive a car in the last few years. This reminds me that until the last century or so, women (all over the world?) enjoyed less rights and might've been pigeonholed into roles predetermined by society. Those roles might've encouraged certain traits, and discouraged others. Those who did not conform might've been punished, like the woman in the talk above received death threats and was jailed.
This sounds to me like selective pressure, did it really exist, and did it have any effect on the genetics/traits of modern women?
This makes me interested in the question - compared to other species, are men and women more genetically different because of selective pressure put on women to conform to male-dominated world for thousands of years before 19th century?
| I'm not sure I buy your premise: firstly, the degree and form of male-female differentiation in social roles has varied widely across time and culture in human history so I doubt it forms a uniform evolutionary driver such as you describe. Secondly, the degree of male-female differentiation appears to me to be much greater in species such as gorillas, lions and peacocks than it does in humans so I'm not convinced that humans would stand out on this front as a species we'd expect to have greater genetic differences.
Even so, the only genetic difference between male and female humans is the Y-chromosome. The X appears in both males and females and doesn't have exclusively female lineage so it can't acquire separate genes for male and female. The Y chromosome contains very few genes so its not capable of manifesting a major genetic gap and because there is no recombination in the Y chromosome it is not a fertile ground for new genes anyway.
So males and females have essentially the same genes. However, this isn't the whole story because how, when and whether genes are expressed is about as important as what genes are encoded anyway. It is these differences that enable big differences between the sexes not actual coding differences.
| 1 | Y-chromosome is the only genetic difference between male and female humans |
Presentation of Case Sensitive fields in standard layouts | Say I have a field that contains data that is sensitive to errors like telling the difference between an I and l. That's I and l, which may appear identical depending on the font your browser is using. 0 and O (0 and O) is another common example of characters than can be difficult to distinguish.
If I show this field on a standard page layout users won't be able to easily pick the differences between the characters. The default font-family for a dataCol td is Arial, Helvetica, sans-serif.
How can I change the font-family for this field in a standard layout?
If I was using this field in a Visualforce page in an apex:outputText I could use the style attribute to change the font-family.
| Create an inline VF page for your standard layout which renders the field as per your font requirements. You can make this as small as a standard field on the layout and enable the Label for the VF page to be displayed, thus giving the VF page label the field label, the appearance you get is much the same as the standard layout displaying the field.
| 0.888889 | Create an inline VF page which renders the field as per font requirements |
How can I keep Mail.app's archive from becoming too big? | I'm trying to reduce my hard drive space used to prepare for a move to an SSD. I've got a wonderful application called DaisyDisk that allows me to visualize data segments on my hard drives.
I have three internal drives, and for the time being I'd just like to slim down the size of my startup disk, so I can move it to a smaller SSD.
By far the largest segment of my hard drive is a section under Macintosh HD/Users/joelglovier/library/Mail/V2/Mailboxes. This directory is over 75GB. You can see the visualization from DaisyDisk here: http://cl.ly/E7OJ
I found this directory before, when trying to slim down my hard drive, and simply deleted it's contents, then changed my settings in Mail.app to not archive attachments, thinking that would resolve the issue.
However, some months later this directory has again creeped up to a ginormous size.
Can anybody please help me understand what this directory is for, and how to permanently reduce it's size - via Mail.app settings, or whatever I need to change to stop it from becoming so huge.
Thank you!
Note: I'm on OSX Lion 10.7.3 using Mail.app ver 5.2.
EDIT: SO I dug through the files in the directory in question. There was one particular mailbox in /Library/Mail/V2/Mailboxes called "Recovered Messages (account name).mbox" which contained a very strange subdirectory structure of a single email duplicated thousands of times under different subdirectory structures. For example, there was a subdirectory in it that had /1, /2, /3, etc., and each one of those directories had /attachments and /messages. The /attachments on each had hundreds of subdirectories each containing this one same attachement from a particular email, and the /messages under each had hundreds of copies of the email all with different numerical file names. But the weird thing is ALL were from the same exact email.
| Go ahead and delete that "recovered" folder, and there is also going to be an .OfflineCache folder that needs to be removed. Note the period at the beginning of the file name; you will either need to show invisible files or use Terminal to delete that folder.
This most often happens when an unsuitable large file is attached to a message. With GMail for example, any attachment over 20MB will be rejected. Mail sees the rejection by the mail server and tries to recover from it by sending the message again. Over time, these half-attempts to send mail stack up and start using all your drive space.
If you want a quick and easy way around the problem, remove the account in Mail's preferences, then re-add it. This will discard the offline cache for the account and free up your mangled space, at the expense of having to re-download the real messages.
And in the future, don't sent huge attachments. Use a specialized service like Dropbox instead.
| 0.888889 | Delete a "recovered" folder and delete it . |
Does exporting 3dsMax Student Edition meshes to an obj file remove the licensing information? | I'm trying to migrate my asset meshes from 3dsMax 2012 student edition to Blender so that I can ditch 3dsMax for Blender. I would like to do so legally for my non-commercial release of a future mod. I am not sure what kind of conversion will remove any licensing data associated with my models (from 3dsMax) as I want it to be clean enough for public release from Blender. I once read that converting by exporting it to .obj format will clear it of any 3dsMax trace.
If there is any simple solution it will be greatly appreciated.
| I have unfamiliar with the any license or Terms of Service agreement of any edition of 3DS Max, and I am not a lawyer, and don't play one on the internet.
Having made those disclaimers, it is my understanding that the producers or Vendors of a software program do not have any legal interest in any output file (in this case a mesh) that you produce with your software. Just as Micro$oft does not have any intellectual property rights in a novel you create with their word processing software, the purveyors of 3DS Mas probably do not have any intellectual property rights in your meshes. The only exception of which I am aware to this general principle is if the file format to which you are exporting is proprietary, in which case the file format might be copyright. But even then, while the file format might be subject to copyright, that copyright applies to the file format, not the file content.
However, the format to which you expect to export, ~.obj, is an open format, and is not controlled by the purveyors of 3DS Max, so there is unlikely to be any associated licensing data.
ns
| 0.666667 | Micro$oft does not have any intellectual property rights in a novel you create with their word processing software |
Replacing a PERC S300 | The PERC S300 card that came with our Dell PowerEdge T110 servers is Windows only (see here). As a result, we're looking for an alternative that works under Linux.
We had planned to use software RAID under Linux. However, the hard drives are SAS-only, that is, we can't just put SATA cables in and hook them up to the motherboard.
Is the best solution here to buy SAS to SATA cables, hook them up to the motherboard and power, and use the drives that way?
| If the motherboard ports are SATA-only, you won't be able to run SAS disks from them.
Your best bet is a dedicated HBA. If you're looking for basic hardware RAID OR the ability to present raw disks to the OS for software RAID, try an LSI controller like the 9211-4i or 9211-8i. That's 4 or 8 internal ports, depending on what you need. You'd probably want to look at: http://store.lsi.com/store.cfm/Host_Bus_Adapters/9211_Adapters/LSI00191
| 0.888889 | SAS disks from motherboard ports are SATA-only. |
What exactly is 'anti-aliased image generation'? | I tried to google it, but didn't quite get it. Any help and/or examples?
Thank you!
| An alias, in signal processing which is what we're dealing with when we are talking about images, is when a signal is sampled at a resolution that makes it impossible to recreate the original signal exactly.
Take this 1-dimensional case:
The original signal is the purple sine wave, and the blue dots are where it has been sampled. The blue line is the recreation of that signal based purely on those four samples - it is an alias of the original signal.
In 2D image processing, this aliasing tends to appear as "jaggies":
The line in image on the left is meant to be a perfectly straight line, but scaling it up has made it look less like a line. One way of improving the look of the line would just be to sample it at a higher resolution, the ideal resolution is called the Nyquist frequency, which is half of the highest frequency in the original signal. (In the case above there is no way of reproducing the signal perfectly because of its infinite frequency components).
Anti-aliasing (AA) is a general term for improving the recreation of a signal, without sampling it at a higher frequency. So linear interpolation (or a box filter) is a simple AA technique, but there are myriad other filters that have different properties and have to be chosen depending on the type of signal you're trying to recreate, the amount of memory/processing power you have to hand, and the sort of results you'd be happy with.
| 1 | Anti-aliasing is a general term for improving the recreation of a signal without sampling it at a higher frequency . |
How do you get your Steam games to run on Ubuntu through Wine or something similar? | Ok, I was kind of surprised that this hadn't been asked here before, but maybe it's too technical for this site. You guys decide.
I've heard lots of different stories about setting up Wine on Ubuntu, WineTricks, PlayOnLinux etc., but never a 'This is the best way to do it for Steam and Steam games' thread.
So has anyone had any real success getting their Steam games to run on Ubuntu through Wine or something similar? If so, could we get some specific steps?
| Steam works very well in plain Wine.
I actually paid for Crossover games since they provide commercial support and fix reported bugs in supported games extremely fast. Plus they push fixes back into Wine.
| 1 | Steam works very well in Wine |
How to calculate the size of the image circle at infinity focus? | How can I determine the diameter of the image circle (i.e. the diagonal size of CCD required to fully utilise a telescope's optics) at near-infinity focus? I have looked around online and found this calculator, but I am more interested in how the figure was calculated than knowing the figure itself.
Background: I am new to astrophotography and recently bought a Celestron Nexstar 130 SLT telescope with a Barlow lens, T-adaptor and T-ring to connect it with my Nikon D80 to take photographs of the night sky in prime focus. The telescope dimensions are 130mm aperture and 650mm focal length. With the 2x Barlow lens (required to diverge the focus enough to mount the camera outside the optical tube assembly) it effectively becomes a telescope with 1300mm focal length. I can measure a picture of an object with known angular size (e.g. the moon) and use crop factors to establish a ratio, but this method doesn't help me understand how a bigger/newer telescope would fare on the same CCD.
Edit:
Since this question now has a bounty, I would like to emphasize the real question is How to calculate the size of the image circle at infinity focus?, and not the follow-up question of
Would the image circle size decrease if I was able to ditch the Barlow lens?
| You can think of a lens focused at inifinity as simply a pinhole for the purpose of figuring out what gets projected where. Consider this simplified diagram of a camera:
The box is the camera, the fat line on the left the image plane (where the sensor or film is), and the small hole at right represents the effective point thru which the lens projects the outside view onto the image plane. In this drawing, F is the focal length and S is the size of some projection onto the image plane. From basic high school geometry, the tangent of the view angle is S/F:
tan(Ang) = S/F
Therefore obviously
Ang = arctan(S/F)
Yes, it really is that simple. You didn't say how big the sensor is in your camera, so I'll use a 35mm frame, which is 36x24mm. The largest circle it can fit is therefore 24mm in diameter or 12mm in radius. You say your final effective focal length is 1300mm. Arctan(12mm/1300mm) = 0.529°. That was the angle from the center to the edge, so double that to make the total view angle of the largest circle on your sensor, which is 1.06°.
To put this in perspective, the view angle of the moon is about 0.5° (it varies, but this is within its variation). That means for a 1300mm lens and a "35mm" sensor, the moon will fill about half the height of the image.
For a cropped sensor, it would appear bigger. Actually, the projection of the moon onto the sensor is the same regardless of how big the sensor is, but for a smaller sensor it takes up a proportionately bigger portion of the frame. This would be reflected in the equations above in that the 12mm value would be smaller, since this was the radius of the largest circle that could fit into the sensor frame.
Also note that the simplified geometry of a camera diagrammed above works for the effective focal length. This will be the actual focal length when the lens is focused at infinity, but can be different when the lens is focused close, depending on the lens design. However, you are asking about astrophotography, so the focus will always be at infinity and I won't go into that further.
| 1 | a lens focused at inifinity is a pinhole for figuring out what gets projected on the image plane . |
How do you say x in x language? What's the English/Spanish word for x? | Is it correct to ask "how do you say 'tower' in Spanish?" or should we actually ask "what's the Spanish word for 'tower'?" Some people say that if I ask "how do you say..." the answer would be softly, loudly etc., as if how was functioning as an adverb of manner and that was its only function. So, the correct question would be "what's the Spanish word for..."
What do you think? is there any grammar rule that could help me understand the difference between these two questions?
| As Kristina says, what's the word for... asks for a specific word, while how do you say... could be a word or a phrase.
Both ways are perfectly fine and idiomatic. A pedant myself, the argument "how asks for an adverb of manner" sounds like a joke to me, wordplay, not something one would say in all seriousness. You can express a "manner" in more ways than just by a single adverb; a sequence of sounds (like a phrase) is a manner or way to express a thought, a way of saying something.
| 1 | What is the word for... asks for a specific word, while how do you say? |
How to formally state that parents have not raised their children well | I'm writing an article about the family and how it can change a person's life in the future.
I need a word that tells the readers about a family in which the parents have not been good enough to teach their kids social skills and generally those things they will need in the future to be able to live well.
The word must be formal (and polite).
I searched the dictionary for some words, but I'm not sure if they are the right words to be used with family. I found the following:
Inefficiency, incompetence, inadequacy, ineptitude, inefficacy
None of the dictionaries I checked (Longman and Oxford) mention whether or not this is the right word to be used with family. Ineptitude of family?
| I suggest uncouth, uncivil, mannerless
uncouth is defined as Lacking good manners, refinement, or grace.
I'm not sure there's a polite way to say it though.
dysfunctional sounds more polite but it is a more general term; there are many different ways that a family can be dysfunctional.
| 1 | Uncouth, uncivil, mannerless uncouth is defined as Lacking good manners, refinement or grace |
Origin and meaning of "The eagle flies at midnight" |
The eagle flies at midnight.
What's the origin and meaning of this idiom?
| It's one of the stereotypical spy code phrases used in bad and/or spoof movies. I've seen it credited to Top Secret, but not having seen that movie, I can't vouch for the assertion.
I've also seen it as "the rooster crows at midnight", or "the eagle flies at noon". Alas, my Google-fu is not up to finding a definitive source.
| 1 | "The rooster crows at midnight" or "the eagle flies at noon" |
core file size with ulimit | My question is probably not related to Ubuntu in particular, but since my desktop running this OS, I came to this forum.
I am trying to change the core file size using ulimit -c command as follows:
$ ulimit -a
core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 7959
max locked memory (kbytes, -l) 64
max memory size (kbytes, -m) unlimited
open files (-n) 1024
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) 8192
cpu time (seconds, -t) unlimited
max user processes (-u) 1024
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited
Changing the limitation:
$ ulimit -c unlimited
Observing the result:
$ ulimit -a
core file size (blocks, -c) unlimited
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 7959
max locked memory (kbytes, -l) 64
max memory size (kbytes, -m) unlimited
open files (-n) 1024
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) 8192
cpu time (seconds, -t) unlimited
max user processes (-u) 1024
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited
Indeed the limit is changed.
However, when I open another terminal and check the value, I still see zero value in core file size.
Questions:
Are changes made using ulimit command affect only current process, i.e. in this case the bash?
I launch a program from shell as a fore- or-background process. Does the ulimit change apply for new process ?
How can I make that all user processes are affected with this configuration ?
| ulimit is a shell builtin, and thus only affects the current shell, and processes started by that shell:
$ type ulimit
ulimit is a shell builtin
From man ulimit:
The ulimit utility shall set or report the file-size writing limit
imposed on files written by the shell and its child processes (files of
any size may be read). Only a process with appropriate privileges can
increase the limit.
So, yes, child processes are affected.
To set limits permanently or for all processes, edit /etc/security/limits.conf and reboot. The examples in the manpage are fairly good. You just need to add something like:
username - core unlimited
| 0.888889 | ulimit is a shell builtin, and thus only affects the current shell |
c# parsing json: error reading json object | I'm having some issues with fetching json values in c#.
http://i.stack.imgur.com/Uxn8e.png
Here is the code in question:
var json2 = new WebClient().DownloadString("http://fetch.json.url.here" + Input_Textbox.Text);
JObject o2 = JObject.Parse(json2);
string he_ident = (string)o2["he_ident"];
string le_ident = (string)o2["le_ident"];
Console.WriteLine(he_ident);
Console.WriteLine(le_ident);
Line 204 is: JObject o2 = JObject.Parse(json2);
The json is this: [{"le_ident":"06L","he_ident":"24R"},{"le_ident":"06R","he_ident":"24L"},{"le_ident":"07L","he_ident":"25R"},{"le_ident":"07R","he_ident":"25L"}]
I've also tried with just one set of le_ident and he_ident, such as [{"le_ident":"06L","he_ident":"24R"}] but it sill throws the same error.
Any ideas?
| That JSON is a list not a dictionary.
So what you need to do is this:
string he_ident = (string)(((ArrayList)o2)[0])["he_ident"];
(Or simply loop through the list)
The JSON data:
{"le_ident":"06L"}
Should work with the code you have there.
| 0.888889 | JSON data: he_ident = (string) |
How to change questions to indirect speech if we are asking about personal information? | I want to to know how to change questions to indirect speech if we are asking about personal information? E.g "What's your name?" said John to the man.
"How old are you?
What's your job?
| John asked the man his name, age and occupation.
John asked the man for his name, his age and what he did for a living.
etc.
| 1 | John asked the man his name, age and occupation |
Do parallel realities take precedence over time travel in the Star Trek Universe? | The 2009 Star Trek movie and its pending sequels are based on the concept of parallel realities introduced in the season 7 Next Generation episode "Parallels," laying out that anything that could happen has happened in a parallel universe. The Enterprise and its crew from the most recent movie are part of a parallel reality that was created when Nero and Spock came back through the black hole created by red matter in an attempt to stem the destruction caused by a supernova. For clarification, this crew will be referred to as Chris Pine's and the older movies as Shatner's.
In the movie Star Trek IV: The Voyage Home, a probe shows up in 2286 at Earth looking for whales that had disappeared decades before. Shatner's crew is faced with travelling back in time to try and retrieve two humpback whales in order to stop the cylindrical probe from destroying Earth. They do this using a Klingon Bird-of-Prey that was stolen in the previous movie, going back to 1986 to find the whales.
I think it's safe to assume that in Pine's reality, the probe will probably make an appearance again, since the destruction of whales probably wouldn't change. So Pine's crew will also be faced with the dilemma of travelling back to find humpbacks (although probably without using a Klingon ship).
If Pine's crew also goes back to the same instant in 1986 as Shatner's crew to find whales (which seems highly improbable given that hitting the same time period as Shatner would be ridiculous), would they run into Shatner's crew or would it create another parallel reality stemming from 1986? If it created another reality, that seems like some kind of backwards causality since the event that would be causing the new stem wouldn't be the instant before the ships arrived but an event in the future. Would time travel trump the parallel universe and both Kirks would be there at the same time?
| I'm not sure if this is actually a parallel reality or a new timeline. The difference between the two I must admit goes over my head right now. However there is two main differences in the Pine Line (I'm coining that phrase) one events have been changed drastically; technology is more advanced and with the destruction of Vulcan certain elements of stories will not play out the same. That being said you are right the Entity that speaks whale is most likely sure to return which brings me to the second point. Old Spock is there and knows all about this.
I can't find a date for the whales extinction but if they are still around I'm sure he will make a priority of saving them. If they are not he knows advanced technology and will be able to give ample warning to the Pine Line to prepare and maybe even bring back the whales from the past. After all the Earth was under attack last time which is why the Shatner Line was saved by the Enterprise crew who were on exile on the planet Vulcan which is no more.
One of the advantages of the Pine Line is that it actually gets to retell the story without dismissing the original fan loved series or movies. However many things are changed and Nimoy Spock can be sort of a McGuffin used to fix or explain away serious consistences such as what will happen when the whales come.
| 0.888889 | What is the difference between the Pine Line and the Shatner Line? |
what does $this->getUrl('fastorder/index/saveOrder') refers to | i am new to magento and i didn't understand purely about the structure of magento
what problems me is this
$this->getUrl('fastorder/index/saveOrder')
i need to find where this line refers to used in the following code
<form id="fastorder-form" action="<?php echo $this->getUrl('fastorder/index/saveOrder')?>" method="post">
because my form post values to this location and i need to do few modifications.
I appreciate the help, thanks
| $this->getUrl('fastorder/index/saveOrder') is create a url.
According to magento,this give url which
Like: YourSiteUrl/FronteNameOFAThridPartetensin/index/savOrder
Then
fastorder: it identifier of a module router
Goto app/code/(community or local)/TheModuleNameSpace/MouleName/etc/ and open config.xml
then here you find
<routers>
<fastorder><!-- this call in getUrl (fastorder),it call as router name -->
<use>standard</use>
<args>
<module>TheModuleNameSpace_MouleName</module>
<frontName>fastorder</frontName><!-- frontend name -->
</args>
</fastorder>
</routers>
May be router name and frontend name it depend on development. Actually fronted name show when url route
controller: IndexController.php
Action Name: saveOrderAction()
| 1 | GetUrl (fastorder) |
Throwing a ball upwards in an accelerating train | If I throw a ball upwards to a certain height in an accelerating train, will it end up in my hand? At the moment I release the ball, it will have a velocity equal to that of the train at that instant. But because the train is accelerating, the train will have a greater velocity and thus the ball will travel lesser distance and should fall behind me. Is my reasoning correct?
| Yes your reasoning is correct,from the point of view of train the ball will travel in a tilted parabolic path as direction of apparent gravity will be different in the train and will not end up in your hand
| 0.888889 | The ball will travel in a tilted parabolic path as direction of apparent gravity is different in the train |
How to determine directions of vectors of an electromagnetic wave | I did an exercise which probably is quite popular,
in which you draw an electromagnetic wave and prove that it should
propagate at the speed of light $1 \over \sqrt {\mu_0\epsilon_0}$ using Farday's law and Ampere's law.
Basically if this is the wave:
Let's say the E-field (red) is in the X direction, the B-Field (blue) is in the Y direction,
and the velocity of the wave is in the Z direction.
You take for example for ampere's law a surface in the ZY plane with a length L
equal to the amplitude of the wave,
and a width equal to $\lambda\over 4$
You do a similar thing with Faraday's law and you get the speed of light,
assuming you know that the E-field and B-field propagate in this manner.
I got the right answer but I wondered about this:
Let's say I only had the E-field and I know the wave propagates at the speed of light, I assume this is enough information to draw the B-field at each point.
But how will I know the direction? Both Faraday's law and Ampere's law say you need a closed loop integral and the rules I've been taught say
you go over the loop in a clockwise direction for example and take the
normal to the surface according to the right hand rule etc.
But clockwise and counter-clockwise direction don't really give me much information in this case, so how can I determine the direction of the B-field
if I only have the E-field?
| If you're careful about how you define the surface, then you will get the correct direction out of Maxwell's equations. In vector calculus (and generally in math and physics), a surface has an orientation, which also specifies the orientation of the loop that forms its boundary. So you can't just pick a direction to go around the loop at random. The direction in which you go around the loop is related to the orientation of the normal vector to the surface.
Of course, you don't actually need to do a surface integral to figure this out. The electric and magnetic fields in an EM wave (at any given position and moment in time) are related by the equation
$$\mathbf{B} = \frac{1}{c}\hat{\mathbf{k}}\times\mathbf{E}$$
where $\hat{\mathbf{k}}$ is a unit vector that points in the direction of propagation of the wave. If you don't know which direction the wave is moving, you can't tell which way the magnetic field points.
| 0.888889 | How to define a surface? |
In Alien Frontiers, how does Raider's Outpost work after a ship has been teleported to another Orbital Facility? | Scenario setup:
A player uses the Raider's Outpost by docking a 3-4-5 set of ships.
Same player uses an Orbital Teleporter to move the 5 ship to another Orbital Facility.
Do the 3 and 4 ships remain in the same position after the 5 is moved, or do they shift? What if the 3 or 4 were moved instead?
A higher value set of ships is required to use the Raider's Outpost when it is occupied. If the 5 ship had not been teleported, a 4-5-6 set would be required. However since the 5 ship has been moved, it's not clear what is now required to use the Raider's Outpost. Since it only has the 3-4 ships remaining, is a 3-4-5 set sufficient? Or is it played as if the 5 ship were still there, meaning a 4-5-6 set is required?
| Actually, there has been official errata posted on this very question:
Bumping Ships from The Raiders' Outpost
A question has been raised about how the "Bump Rule" works for the Raiders' Outpost if one or more ships in the original run have been removed, either by the Plasma Cannon, the Orbital Teleporter, or by losing control of the Relic Ship. Does the new run have to be bigger than the original run or just bigger than the ship that are left over?
Here is the text from the rulebook...
Raiders’ Outpost
You must dock a set of three sequentially numbered ships to use the Raiders’ Outpost. There are docking ports for one set of three ships. If the Raiders’ Outpost is occupied, you may dock a higher-value sequence here and move the original ships to the Maintenance Bay.
While docked at the Raiders’ Outpost you may steal a total of four resources from any mix of players or one alien tech card of your choice from one player. If you steal an alien tech card that you already have, the stolen card is discarded immediately and you gain no benefit from doing so.
Example : If a 1-2-3 is docked at the Raiders’ Outpost and the next player rolls a 2-3-4 then that player may remove the 1-2-3 and dock their 2-3-4 at the facility to conduct their own raid. If another player rolls a 3-4-5 or a 4-5-6 then they may remove the 2-3-4 and dock their own sequence and conduct their own raid.
The addition of a second example should clear up this question.
Example 2: RED has docked a 3-4-5 at the Raiders' Outpost. On his turn GREEN uses the Plasma Cannon to send the 5 back to the Maintenance Bay, leaving a 3 and 4 on the Raiders' Outpost. To dock a higher-value sequence at the Raiders' Outpost GREEN must use a run of three ships that totals more than the sum of the ships currently docked there. The remaining ships total 7 so GREEN may not dock a 1-2-3 since they only total 6. GREEN may dock a 2-3-4 (total 9), a 3-4-5 (total 12) or a 4-5-6 (total 15) to use the Raiders' Outpost.
Errata can be found on BoardGameGeek.
| 1 | What is the "Bump Rule" for Raiders' Outpost? |
How do the sensors in Star Trek receive information faster than light speed? | I was just watching an old Star Trek Voyager episode and Harry Kim said roughly "Captain, another super nova exploded just 0.36 lightyears away!". My question here is how something can happen 0.36 lightyears away and still be considered just.
I can accept that they travel faster than light, by using subspace; something I imagine as a fourth dimension in space. So they still are slower than light in four dimensional space, but appear to to travel faster than light in three dimensional space.
So, is there any reasonable explanation for this statement or is it simply bogus in the script?
| Sending information takes less energy than moving a starship. So subspace radio waves and other scanning waves can be sent at much faster speeds than you could move the starship.
Think of it as the difference between a jet plane, travelling at a few hundred miles an hour, and a radio wave, travelling at the speed of light.
A subspace radio wave travels at warp 9.9997 or 23 lightyears an hour (TNG technical manual page 111)
At 0.4 lightyears a minute, a scanning pulse sent from the ship 2 minutes before, would have only just returned.
| 0.888889 | Sending information takes less energy than moving a starship |
viewForAnnotation detail disclosure changing current location as well as pins | In my viewForAnnotation method I am adding a detail disclosure button to the right of the pin, however it changes the showsUserLocation to be a red pin, with a disclosure button to the right of the "Current Location" text.
How can I stop the current location symbol from being a pin? Without the method it is fine.
- (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation {
static NSString *identifier = @"MyLocation";
MKPinAnnotationView *annotationView =
(MKPinAnnotationView *)[mapView dequeueReusableAnnotationViewWithIdentifier:identifier];
if (annotationView == nil) {
annotationView = [[MKPinAnnotationView alloc]
initWithAnnotation:annotation
reuseIdentifier:identifier];
} else {
annotationView.annotation = annotation;
}
annotationView.enabled = YES;
annotationView.canShowCallout = YES;
// Create a UIButton object to add on the
UIButton *rightButton = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
[rightButton setTitle:annotation.title forState:UIControlStateHighlighted];
[annotationView setRightCalloutAccessoryView:rightButton];
return annotationView;
}
| add in the beginning of the method
if (annotation == mapView.userLocation) {
return nil;
}
| 0.888889 | add in beginning of method if (annotation == mapView.userLocation) |
Does Windows XP Mode require its separate serial/license? | I just did a Windows Anytime Upgrade from Home to Ultimate. Which to my surprise was very quick and smooth. Anyways, I want to install Windows XP Mode to help with answering questions related to Windows XP on Super User and other Stack Exchange sites.
Before I download the 500MB file from Microsoft's site, I want to know if it prompts for a serial number? If it does, do I need to buy a Windows XP license? If doesn't require a new license but still require a serial number, do I use the Windows 7 Anytime Update from Home to Ultimate key?
| No serial prompt at all assuming you have a valid copy of Windows 7. You will be prompted for genuine Windows 7 license validation when downloading.
| 0.888889 | No serial prompt assuming you have a valid copy of Windows 7 |
Remove digit mark from float and convert to integer | Let's say that I have these variables:
float xx= 99.33f;
int yy=0;
I want to convert xx to yy by removing the digit marks, so that yy will be the number 9933, preferably with a single line statement. How is this possible?
| Just the easiest way that comes up for me, but I assume that there could be easier ways to do that. But you can make it like a function.
String s = Float.toString(xx);
String[] temp=s.split("\\.");
yy=Integer.parseInt(temp[0]+temp[1]);
| 0.777778 | String s = Float.toString |
Delete causes StaleStateException | We a re using Grails which of course uses hibernate for its O/R. In one instance we have multiple requests trying to delete the same object. The first thread will delete and the second thread that tries to delete the object throws a StaleStateException. This is as expected. According to doc:
http://docs.jboss.org/hibernate/envers/3.6/javadocs/org/hibernate/StaleStateException.html
This exception: Also occurs if we try delete or update a row that does not exist.
Now, in our case it is not an exception. We don't care it has already been deleted. We don't want to have to put in a check before the delete and we just want to put in exception handling because it is not really an exception.
What we would really like to do is not have this exception throw if a delete is attempted and the object is not there.
Is there any way to do this with Grails / Gorm?
The best ideal I have is to do the delete with just a bit of SQL of HSQL rather than use a hibernate / grails API.
Any better ones?
| Try to catch the exception in the thread:
try {
YourDomain.withTransaction { status ->
...
yourDomainInstance.delete()
...
}
} catch (org.springframework.dao.OptimisticLockingFailureException olfe) {
log.warn(olfe.toString())
} catch (org.hibernate.StaleStateException staleStateException) {
log.warn(staleStateException.toString())
}
| 0.833333 | Try to catch the exception in the thread |
business-class fiber to the home | Suppose you're some sort of crazy nerd fellow and you live in an area that's absolutely covered in fiber optics and network facilities. What kind of cost / infrastructure would be needed to hook in somewhere and get you're internet connection directly from a local datacenter?
| Move.
Move either to someplace with Verizon FIOS service, or close to someplace where you can just throw it over the fence. Some guy's grandmother had 40Gbps three years ago that way. http://www.theregister.co.uk/2007/07/12/swedish_woman_has_fastest_internet_connection/
Just how fat a pipe do you need? Point to point wireless can offer good service up to 15Mbps, and of course there are various "normal" wired options.
| 1 | Point to point wireless can offer good service up to 15Mbps |
How do I apply my copyright information from XMP automatically with DigiKam? | I have an xmp file with my copyright information provided by the Creative Commons license wizard. How can I configure DigiKam to automatically apply this information to every image I import?
|
As the other answer already said, add a copyright metadata template in Settings.
After import mark all images in the folder and then
go to metadata/tags sidebar and add the information you want
OR open the batch manager (ctrl-B) and apply your metadata there.
I do not know whether you can do it directly on import. It might be possible.
| 1 | Add copyright metadata template in Settings |
Make the compare list work without filling the log_* tables? | The Magento compare list feature only works, when the log_* tables are being filled. If they are not, the compare list is global, which means, whenever a customer adds to the list, every other customer can see that recently added item. I disabled (and cant enable) this feature by putting this in my local.xml:
<controller_action_predispatch>
<observers><log><type>disabled</type></log></observers>
</controller_action_predispatch>
<controller_action_postdispatch>
<observers><log><type>disabled</type></log></observers>
</controller_action_postdispatch>
Removing this makes the compare list work right away. The question is, is there a workaround for that? Is there a way to make the compare list work and not fill the log_* tables?
Thanks!
| Sadly the compare items are tightly linked to the visitor information.
The table catalog_compare_item has a column for visitor_id which when you disable the observers mentioned in your question, is set to 0 and so all visitors can see these items.
When you add an item to the compare list the visitor is linked into that item.
Mage_Catalog_Model_Product_Compare_List::addProduct calls the protected function _addVisitorToItem which gets the visitor id set from the log/visitor and attaches this to the item, as well as the customer id when you are logged in.
protected function _addVisitorToItem($item)
{
$item->addVisitorId(Mage::getSingleton('log/visitor')->getId());
if (Mage::getSingleton('customer/session')->isLoggedIn()) {
$item->addCustomerData(Mage::getSingleton('customer/session')->getCustomer());
}
return $this;
}
Without limiting the compare functionality to logged in customers only I cannot see a way around filling these log tables as Magento needs to know what visitor is actually requesting the items to be compared.
| 1 | compare items are tightly linked to the visitor information |
Numerical differentiation methods | Is it possible to write code in Mathematica that implements various differentiation methods (like forward, central, extrapolated, etc.)?
| In my experience almost all finite difference formulas can be implemented very efficiently using ListCorrelate. Let's look at how to implement a few difference formulas in 1D with periodic boundary conditions on a uniform mesh with spacing h:
Central Difference
CDx[v_List, h_]:=ListCorrelate[ {-1, 0, 1}/(2 h), v, 2];
Backward Difference
BDx[v_List, h_] := ListCorrelate[{-1, 1}/(h), v, 2];
Forward Difference
FDx[v_List, h_] := ListCorrelate[{-1, 1}/(h), v];
We can check that they are performing the correct behavior via a simple symbolic test
v = Table[x[i], {i, 1, 5}];
CDx[v, h]
BDx[v, h]
FDx[v, h]
FiniteDifferenceDerivative Function
With that said, there is also a very nice function hidden inside of the NDSolve context called FiniteDifferenceDerivative. Search for "tutorial/NDSolveMethodOfLines" inside of the Documentation Center and look for the section "Spatial Derivative Approximations". This function allows for differentiation on a nonuniform mesh. The user must supply a grid and values. For example the 2D Lapacian operator is implemented via:
lap[vals_, {xgrid_, ygrid_}] :=
NDSolve`FiniteDifferenceDerivative[{2, 0}, {xgrid, ygrid}, vals] +
NDSolve`FiniteDifferenceDerivative[{0, 2}, {xgrid, ygrid}, vals]
Let's test it out:
n = 16;
h = 1.0/n;
xgrid = Table[x, {x, 0, 1 - h, h}];
ygrid = Table[y, {y, 0, 1 - h, h}];
vals = Table[Sin[2 Pi x]*Sin[2 Pi*y], {x, xgrid}, {y, ygrid}];
valsDiff = lap[vals, {xgrid, ygrid}];
(* Plot to see solution *)
ListPlot3D[vals]
ListPlot3D[valsDiff]
| 0.777778 | How to implement finite difference formulas in 1D with periodic boundary conditions |
How replicas are formed in Frequency domain when a signal is sampled in Time Domain? | I know that sampling in one domian [time or frequency] gives raise to replicas in another domain[frequency / time]. How replicas are formed. What is this Time domain periodicity and frequency domain periodicity here in sampling.
| Sampling in one domain implies periodicity in the other. For example the Discrete Fourier Series (which the FFT is a special case off), requires both time and frequency domain signals to be discrete and periodic.
This really isn't a topic that can be exhaustively discussed on board like this. I would recommend spending some quality time with good text book such as this http://www.amazon.com/Digital-Signal-Processing-Alan-Oppenheim/dp/0132146355 or http://www.dspguide.com/
| 0.666667 | Sampling in one domain implies periodicity in the other |