summary
stringlengths 15
147
| text
stringlengths 1
19.3k
| answer
stringlengths 32
22.6k
| labels
float64 0.33
1
| answer_summary
stringlengths 5
164
|
---|---|---|---|---|
Nikon D3000 Blurry Pictures. Focus Issue?
|
Here are two examples:
Both pictures are in NEF format here.
The pictures have not been modified in any way except except for being resized and converted to PNG.
Just for kicks (and to prove I'm not crazy) I sharpened the butterfly image via "unsharp mask." It's not a pretty result but I just wanted to demonstrate "sharp" vs. "blurred."
Kind of annoying because I've ruined many epic shots with this odd focus problem.
My original Film SLR was a Minolta Dynax 505si Super 35mm (or in the same family, I think) and it performed marvellously. I used it for about 4 or 5 years all throughout high school and then (as an avid film photographer) begrudgingly made the switch over to digital in college. But the Minolta definitely gave me experience in photography and people genuinely enjoyed my photographs.
Early on, I don't know if I was just enamoured with the idea of vibrant digital images from an SLR or if I just didn't notice enough, but I don't remember a whole lot of images that came out blurry in the beginning. Maybe 60% of them (a liberal estimate). I accidentally deleted about a year's worth of early pictures so I'm unable to tell now.
The preview in the viewfinder doesn't appear to be blurry at all; then again, there's a huge different between the 3" preview screen and my 20" computer monitor.
Here are things I've tried:
Using a tripod (although, as you can tell, the issue is not a motion blur issue).
Tried different aperture settings (for example, the landscape image is f/22).
Tried different ISO.
Manual focus.
Auto focus.
Manually "de-focusing" the object (focusing behind it and focusing in front of it). Although, with the picture of the butterfly, this doesn't seem to be the case: it has varying depth of field and even the supposedly "in-focus" butterfly is out of focus.
Changing the "sharpening" property via the camera: Menu > Set Picture Control > (picture control -- e.g. "Neutral") > Sharpening
Went into a physical repair shop and they did test images. They didn't seem to find a problem, patted me on the head, and told me to be a good photographer and use the autofocus.
Letting someone else take the picture.
Chromatic aberration correction (typically through Digikam)
Different Lenses. The two below are using my AF-S Nikkor 18-55mm 1.3.5-5.6 G lens. I have a AF-S Nikkor 55-200mm 1.4-5.6G ED telephoto and get the same result (sometimes result is worse -- can post an example if needed).
And, oh, yeah, I even sent it into Nikon...three times. They said they fixed the problem. But, you know how those things go...
Oddly enough I've looked up reviews for my camera and both lenses and couldn't find many (if any) reviews stating blurry pictures for every picture.
A few thoughts:
Could whichever photo editing program I'm using be the cause of the blur? I used Linux so I've used Digikam (my favorite), F-Spot, and the Gimp.
Maybe it's normal for digital pictures to be blurry compared to film? Digital doesn't use crystals like film, so the opposite should seem true. I wonder this because a lot of work has gone into sharpening tools like unsharpen mask.
Sorry for the long post and various photo examples. Thanks in advance!
|
I see no problem in either of these images. They both appear correct. Lenses are not 100% sharp to begin with and on cheaper lenses it is not atypical for the resolution of the camera to outpace the resolution of the lens, particularly on entry level and kit lenses like the two you are using.
This is even further compounded by using high aperture on a crop body camera. The smaller point you try to focus light on, the more of an issue diffraction becomes when shining the light through a small hole. The smaller the hole, the more impact diffraction has and this reduces what level of quality is possible to capture. Try shooting at or above f/8 or so and diffraction limiting shouldn't be a problem. You might be able to go a bit higher than that based on your resolution, but I didn't do the calculations to figure out exactly when it is a problem. (There are calculators online if you want to check exactly when it should theoretically start being an issue.)
The first one certainly has a shallow depth of field, but it appears as sharp as expected for your choice of aperture and lens. Your unsharp masked version seems over-sharpened. It over-exaggerates the edges and makes things "jump out" more, but is unnaturally so.
| 1 |
Lenses are not 100% sharp to begin with and not atypical for the resolution of the camera to outpace the resolution
|
GIN/GiST Full Text searches through openlayers, geoserver and postgres
|
I have a a web app that automatically maps recent tweets and allows you to search for certain keywords. it uses Postgres for the database, geoserver as the server, and openlayers as the cartographic library. Right now tweet keywords are done using the ILIKE query.
This works pretty well if the keyword i'm looking for is a commonly used word, like 'love' , 'friend', 'OMG', etc. but less common words like "geospatial" need to search through a lot more data in order to find the last n instances of the word. This is dead slow.
To combat my slowness I'm building a GIN index on my tweet field in postgres. Two days later and i'm still waiting for the index to complete. Once it's built though, I'll try a few queries using SQL view parameters and hopefully this will dramatically speed things up.
Even if this approach works though, it's not going to be all that useful if the index takes so long to create -- the maintenance of it will not be able to keep up will the incoming flood of data. I think I will try out the GiST index next and see how long it takes as I understand it is much faster to this build index.
Beyond this, what can I do next? Do options like Solr work with Geoserver?? Are there any common approaches to this type of problem and data size/rate?
|
It sounds like you could do it with with Solr. However, I would use ElasticSearch its easier to get started with. Since you are working with points it seems like a good fit.
You would use it standalone as a datasource to Openlayers, it doesn't act act as a "store" to geoserver.
| 0.777778 |
ElasticSearch does not act as a "store" to geoserver
|
Sloshing Sound Under Dash
|
I have a 2011 Suzuki SX4 Crossover AWD with MT. Sometimes when I start it up, begin moving forward, or quickly decelerate I can hear what sounds like water (or some other liquid) moving from one place to another (can't quite tell where) under the dash or maybe just behind the firewall. I took it to the Suzuki service center (almost 2 hour drive from my home), and they told me that the A/C coolant was low. They refilled it and sent me on my way. However, I still hear the sloshing sound behind the dash. Does anyone have any ideas on what this might be? Thanks.
ADDITIONAL INFO
I've recently noticed that when this "running water" sound occurs that it is more prominent when the engine is running faster (e.g. during acceleration). This leads me to believe maybe this has something to do with the water pump, or some other liquid pump, that is run by the engine and not moving enough liquid to fill the pipe, hence a sloshing / running water sound.
|
Your AC drain may be stopped up. Your AC evaporator condenses water when the warm moist air passes over it, this happens in the normal operation of the AC. There is a drain that is suppose to drain the water outside the car, when it gets stopped up water collects in the evaporator case under the dash, it will eventually drain somewhere, most likely on your carpet inside the car, in the mean time you will be able to hear it sloshing around.
Look under you hood, or from the underside of the car for a rubber tube sticking out of the firewall, you can unplug it with a coat hanger, or piece of wire.
The picture below may be what you have, if not it will at least give you an idea of what you are looking for.
Picture Source
| 0.888889 |
AC evaporator condenses water when warm moist air passes over it .
|
Is it the same screwdriver?
|
In the Day of the Doctor the War Doctor sets a program running on his screwdriver which 11's then has then completed.
However 10 burnt out his Screwdriver in "Smith and Jones" working on the MRI machine and 11 lost his screwdriver in the "11th Hour"
If that's the case how can the program still be running?
|
The TARDIS Data Core Wiki mentions that in the Eighth Doctor novel Alien Bodies in which The Doctor uses his Mark One Sonic Screwdriver which was last seen used by the Second Doctor in Episode 3 of The War Games and allegedly destroyed centuries ago from the perspective of the Eighth Doctor.
When his companion Samantha Jones asked how this is possible, he replies:
It's a Time Lord tool. Time doesn't work the same way for Time Lord tools.
Which suggests that what we saw and interpreted as "destroyed" on-screen isn't really the death of the screwdrivers in question, and they can regenerate or be retrieved from the past somehow.
| 0.888889 |
The Doctor uses his Mark One Sonic Screwdriver in the novel Alien Bodies
|
prayers ascending from Western Wall
|
I read somewhere that the Talmud says that all prayers from around the world ascend to Heaven from the Western Wall. (i.e. the kosel)
Does anyone know where in the Talmud that it says this?
|
There is no source in the Talmud for the Western Wall being the place from where prayers "ascend". (Tractate Brachot 30a says we face toward the kodesh hakadashim when praying, traditionally and archeologically identified with the site of the Dome of the Rock.)
| 1 |
There is no source in the Talmud for the Western Wall being the place where prayers "ascend"
|
Good travel games for two players, especially for playing on trains?
|
I would be interested to hear if anyone had recommendations for 2-player games that are particularly suitable for playing while travelling on trains. (I ask this as someone who mostly enjoys games like Carcassonne, Power Grid, Agricola, Pandemic, etc. around the table at home.) To be specific, the things that I think are important properties for these games are:
Needing minimal table space. Most trains have a small table you could use, but not much more.
Being quiet to play, so that other passengers won't be disturbed. For example, I imagine that games that involve repeatedly rolling dice wouldn't be appreciated.
Packing down small, so that they don't take up much luggage space.
Not requiring batteries or a power socket. (I appreciate that an iPhone or a Nintendo DS for each player might be a good solution more generally, but it's not what I'm after in this case.)
Not being so delicate to arrange that motion from the train will unduly disrupt the play.
I think it would be best to recommend one game (or class of games) per answer, if that's appropriate, and explain why you think it's particularly suitable. (Incidentally, I've read the guidance on good questions about game recommendations and hope this question meets the criteria.)
Update: Thanks for so many excellent suggestions - we certainly won't be short of games for our next long train journey :)
Update 2: Unfortunately, I can't really playtest this many great games in any reasonable time period, so I'm going to accept the top-voted answer (Cribbage) and try out the others as soon as I can. Thanks again...
|
Fluxx
Fluxx and all the variants definitely meet all the requirements. However, if you want a strategy game its definitely not a good choice, so I expect this to get voted down just for that. Its a different game with two players, and fairly quiet if you ignore the zombie fluxx card that requires you to groan whenever a zombie creeper shows up. :)
| 1 |
Fluxx Fluxx and all the variants meet all the requirements
|
Why is my MacBook Pro's screen going black for a second?
|
I have a new MacBook Pro, when I'm using it the screen goes suddenly blank for a second and comes back, it feels like as if someone unplugged my screen and plugged it back immediately.. why does this happen?
Initially I thought it was only happening when I'm running on battery, but happens even when I'm connected too.
This is very sporadic.
|
Ive had similar problem,
The inverter and screen has been replaced by warranty.
Does it happens when you change angle of your lid?
| 0.777778 |
Does it happen when you change angle of your lid?
|
Long rest regains half hit dice - round up or down?
|
When having a long rest, you regain all your hit points and half your spent Hit Dice (for use in future short rests). I know that normally when faced with fractions you round down. But then, I see no way to regain your 1 Hit Die at 1st level.
So basic question: if you are at first level, and you take a long rest, do you regain your Hit Die, or do you not because you had to halve 1 and round down?
|
The general rule is to round down, so you round down.
Unless you are told otherwise in the rules, D&D always mandates you round down. The Long rest section has no such exception (the only exception I've seen so far is for the wizard's spell recovery)
v.2 of BD&D now includes language that indicates a minimum of 1 HD is recovered during a long rest.
The character also regains spent Hit Dice, up to a number of dice equal to half of the character’s total number of them (minimum of one die). (p 67)
| 0.666667 |
v.2 of BD&D includes language that indicates a minimum of 1 HD is recovered during a long rest
|
Does Star Trek TNG show feature technology discovered by Kirk's generation?
|
Are there in universe references to technologies utilized in the Star Trek TNG series that were discovered during Star Trek TOS? For instance, android tech? Norman 1 from the "I, Mudd" episode should have been a treasure trove of data.
Spock gathering data?
Norman X?
|
No, there is no sign of any of the technologies that Kirk discovered on his legendary voyages. These missing technologies are the elephant in the room in any discussion of post-Kirk Star Trek. Consider that V'ger was at least the tenth machine intelligence Kirk encountered. Others include:
Norman and his cohort -- I, Mudd
M5 -- The Ultimate Computer
Vaal -- The Apple
Roger Corby's androids -- What Are Little Girls Made Of?
Nomad -- The Changeling
Landru -- The Return of the Archons
The Oracle -- For The World Is Hollow and I Have Touched The Sky
Losira's computer -- That Which Survives
The Guardian of Forever -- The City on the Edge of Forever
Leaving aside the cybernetics and unlimited time travel possibilities, Kirk also discovered substances that amplify psi abilities (Plato's Stepchildren), accelerate time (Wink of an Eye), and turn crones into beautiful women (Mudd's Women). There was a truth machine (Mudd's Women, Court Martial). There was the Kelvin technology, including their superfast warp drive and human-to-styrofoam-to-human encoding (By Any Other Name). There was the IQ boosting "Teacher" technology of the Eymorgs (Spock's Brain).
If we are to accept that these events are part of the Star Trek canon, then the conspicuous absence of all these technologies in the 24th century Federation must be by design. My favorite pet theory is that there is some sort of technology police like Larry Niven's ARM that quietly squirrels away the dangerous knowledge to keep it from destabilizing society. There is some support for this theory to be found in the Star Trek: Voyager episode "The Omega Directive", where Kirk-era information about warp-destroying omega particles was shown to be suppressed by Starfleet.
| 0.555556 |
What are the missing technologies that Kirk encountered on his legendary voyages?
|
Can an iphone/android cell phone communicate with RFID?
|
Is it possible for a cell phone to communicate with an RFID chip?
I'm looking for a low-powered solution to turn a device on/off wirelessly, using a cell phone.
Example: phone sends signal to RFID chip, circuit board switches on.
It really looks like Bluetooth will take too much battery, as this will be a portable device.
Any suggestions ?
|
RFID is typically Tag sending a message, usually just an ID number, to a Device, which reads it. You want the other way around, which is not how RFID is used. NFC can be used for two way transmission (Like touching the back of two NFC phones to pass data), but it's also mainly used as an ID system, Tag to Device.
You can have a NFC device act as a tag, which your circuit would then scan for. For this you need a NFC reader as well as your microcontroller.
Bluetooth, and Bluetooth LE are the way to go.
| 1 |
RFID is mainly used as an ID system, Tag to Device
|
Control Fields vs Heap "Mock" Fields for Branching Trigger Behavior
|
I've seen solutions that talk about adding control fields to allow for clever trigger branching in problems like this. I know that works, but it annoys me (feels architecturally wrong) to create such fields if it can be avoided. I've also seen solutions that have to do with using static variables for a similar purpose, but I have found occasions where one global flag is not good enough because I need the flag per record. I've tried both out and I think I want something in the middle. Something like this:
global without sharing class HeapControl {
private static Map<Id, Set<String>> recordTags = new Map<Id, Set<String>>();
public static void AddRecordTag(Id rowId, String tag) {
if (recordTags.containsKey(rowId)) {
Set<String> tagsForThisRow = recordTags.get(rowId);
if (!tagsForThisRow.contains(tag)) {
tagsForThisRow.add(tag);
}
} else {
recordTags.put(rowId, new Set<String> { tag });
}
}
public static boolean IsRecordTagged(Id rowId, String tag) {
if (recordTags.containsKey(rowId)) {
Set<String> tagsForThisRow = recordTags.get(rowId);
if (tagsForThisRow.contains(tag)) {
return true;
}
}
return false;
}
@IsTest
public static void HeapDemo() {
Account a = new Account(Name = 'Testing');
insert a;
HeapControl.AddRecordTag(a.Id, 'Control-Field-Name-1');
a.Name = 'Testing2';
update a;
// A trigger that fired on Account Update could check the HeapControl for the record like this
system.assert(HeapControl.IsRecordTagged(a.Id, 'Control-Field-Name-1'));
}
}
I'd like a pro-con analysis of using real control fields vs mock control fields on the heap (doesn't have to be my code, anything along the lines of static Map<Id, ...>, if you know of a field-tested version of this code please share).
In my not-yet-field-tested opinion, the control field concept evolved out of a workflow world, but once you decide to drop down to triggers the heap will serve you better--at least you don't have to create control fields for every little trigger branch.
I apologize this isn't standard Q&A format--but this issue has been burning in my mind for months now and I think there are a lot of Salesforce developers (writing business process triggers in particular) that wrestle with this regularly. Thanks in advance for sharing your wisdom and experience!
|
Good quesiton, but what is the real question? The key phrase from your question for me is 'business process triggers'. If I may, I think the discussion needs to start from a application layering perspective, or put more specifically 'where do we put our business process logic?'. Before I get on to that let me say this about triggers...
The thing about triggers is... they respond to data centric actions, period. If you view the top to bottom architecture of your Force.com application, its easy to forget your still dealing with the database tier when writing code at the trigger level. If you look at the rich level of API support and an native UI around this database tier. You will soon realise your effectively developing an app on a database schema that is by default open, like it or not. You have to service this way of interacting with your app. Take Salesforce Touch for example, this provides your clients a rich mobile/tablet client for free! Then the new REST API, the list goes on. You only get the benefit of these if you embrace letting your customers / developers access this tier safely and clearly (so good database design is even more important ironically). So when you look at it from this angle, its important to consider carefully any requirements that lead to design patterns, validation rules etc that might impact the use of your 'open database tier'. And don't get me wrong, there are some good reasons to, but you must design firstly for things to be open and discuss carefully what the implications are of over complicating or closing off parts of your database schema interaction.
So that all sounds good, but why do I still find it hard sometimes to implement what I want? Well, if your application is typically "data centric" in its purpose, you'll generally have an easier job. A user interactions, much like Salesforce CRM, are typically tasks surrounding the scope and lifetime of individual records. So triggers, layouts, record types really start to come into their own here. But if you have an application that is in part 'data centric' (for standing / master data) and part 'process/task centric' where does that leave you? Enter SOA...
Service Orientated Architecture and Control Fields? Unless you're solely a data centric application. Your going to have to find a place for your clients (and by 'clients' I am not just talking about human consumers here) to consume / access your business process logic. Having them tweak Control Fields at your schema level may make sense and there is scope for it, if you can work it nicely into the schema. But over use of it, along with having your clients dependent on a deeper understanding of your schema. Will introduce voodoo into your schema and increase the barrier to entry for your application interactions, developer, end user or platform wise. So to avoid users poking around trying to reverse engineer your VF logic, control fields, why not consider exposing a service layer in your applications for such logic?
So how do I do that then? REST has recently taken hold over Web Services, primarily because of the aforementioned 'barrier to entry'. It is easy to document and if done correctly is self describing, much like the 'data centric' aspects of your application utilising Custom Objects. So for business proceses, for me REST (I include JavaScript Remoting in this) gets my vote for exposing business process logic to your clients (be they human or machine). If you adhere strictly to this approach (which requires a SOA based design process for your app) then you'll end up with a rich set of API's for you and your clients to consume. Which in this day and age of Cloud computing is pretty much a must! So while you might argue this is not strictly SOA (as yes Salesforce does handle a lot of the mechanics with oAuth etc). I feel there is room for taking a SOA based design and architecture approach to designing Force.com applications.
So OK, how would I implement the code in the question above? Developing a generic Apex solution is really a solution for a problem that I don't think should be solved generically or at the Apex level (see my thoughts below). Generally to much of this approach is teaching your database tier code
about the business processes that should be implemented above it. You should let your business process tier do the driving and expose that as a service for your clients / callers to consume (in addition to those already provided by Salesforce btw!). The trick then is marketing and supporting the strict design, development and consumption internally (for your own client developers, be they VF, mobile or otherwise) and externally of them. Again don't get me wrong we should absolutely fill our triggers with great value add logic, but it should know its place.
Control Fields : Heap vs Custom Field : That said, when taking the Control Field approach, and as I describe above is valid, when it 'fits' with your schema and thus API / native UI experience sensibly. When implementing it I am in favour in the first instance of designing it in into the application schema as a field. This way everyone knows whats going on. Again the schema is open and not declaring it (by managing internally) only leads to frustration, low barrier to entry due to higher complexity (internally and externally). I've also been burnt a few times with Static, initialisation and state carry over, while I'm not 100% sure, for example, I think Batch Apex serialises statics over 'execute' invocations, which can catch you out at times.
Application Enterprise Patterns on Force.com
Here is a diagram i presented at a recent Dreamforce session about Enterprise Application patterns. The sessions slides takes a simple scenario and walks through, what might be described as a 'consolidated' or 'merged' approach typically seen when people start out or smaller applications, and again this approach has its place as well. What I followed this in my session with was a more layered approach using some Application Enterprise patterns along the way. I'm pleased to say it got quite a good reception and has since generated a steady stream of interest (I've got a draft blog posting on it in the working btw). You can find the Github repo here, with more info on the patterns. The slides are here.
NOTE: That Trigger invocation is not shown here, the SObjectDomain class takes care of routing the CRUD events from the triggers to the 'Domain' classes representing the Standard or Custom Object behaviour your application is implementing. This pattern enforces development of appropriate logic for this context. Leaving the Service layer to doing any process level orchestration.
| 0.666667 |
What is the real question about business process triggers?
|
Any omitted word in this sentence?
|
The dark guy took a week to fall down. He stumbled, caught himself, waved one arm, stumbled again. His hat fell off, and then he hit the floor with his face. After he hit it he might have been poured concrete for all the fuss he made.
I just guess the guy fell on the floor (by a gun-shot) wouldn't move like a concret cast???
Any missing word in this sentence, like a preposition?
It's a part of Red Wind by Raymond Chandler.
|
Chandler's style works to describe the scene and actions but grammatically there are several redundancies such as "fall (down)", "after he hit (it) (he)", "for all the fuss (he) made". All of these point to possible improvements. Also the floor-hitting face should be reversed to "then his face hit the floor". So, in my opinion, there are no missing words but several extra could be eliminated.
| 0.777778 |
"fall (down)", "after he hit (it)" and "for all the fuss" made"
|
Maximum magnetic strength achievable
|
What will be the maximum magnetic strength to which a piece of ferromagnetic substance can be magnetised?
What will the maximum strength possible for a piece of iron?
How would the shape of the ferromagnetic substance affect this strength?
What would be the current needed in the solenoid if this strength is to be achieved?
|
The effect you're describing is called magnetic saturation. This is the point where increasing the external magnetic field doesn't increase the magnetisation of your ferromagnet becaused all the domains are aligned and no further increase in the net alignment is possible.
Iron saturates at around 2 Tesla. This is a property of the material so the shape of the piece of iron doesn't make any difference.
The field at the centre of solenoid is $B = \mu n I$, and the graph in the linked article shows the required values of the product $nI$. For most materials it's some where in the range $nI = 50 - 100$ amp turns per inch.
| 1 |
Magnetisation of ferromagnet is called magnetic saturation
|
Simple static integer stack
|
This question is about improving my C++ coding skills. I was asked to implement a simple static integer stack in C++ as an assignment. I've come up with the following code:
class myStaticIntStack
{
int stackSize;
int storedElements;
int *elements;
public:
myStaticIntStack();
myStaticIntStack( int aNumber );
~myStaticIntStack();
int peek();
int pop();
void push( int element );
};
myStaticIntStack::myStaticIntStack()
{
this->stackSize = 1;
this->elements = new int(0);
this->storedElements = 0;
}
myStaticIntStack::myStaticIntStack( int stackSize )
{
this->stackSize = stackSize;
this->elements = new int[ stackSize ];
this->storedElements = 0;
}
myStaticIntStack::~myStaticIntStack()
{
if( this->elements != NULL )
{
if( stackSize > 1 )
delete[] this->elements;
else
delete this->elements;
}
}
void myStaticIntStack::push( int newElement )
{
if( this->storedElements == this->stackSize )
cout << "Stack is full, you must POP an element before PUSHing a new one!" << endl;
else
{
this->elements[ (this->stackSize - 1) - this->storedElements ] = newElement;
this->storedElements++;
}
}
int myStaticIntStack::pop()
{
if( this->storedElements == 0 )
{
cout << "Stack is empty, you must PUSH an element before POPping one!" << endl;
return -1;
}
else
{
storedElements--;
return this->elements[ (this->stackSize - 1) - this->storedElements ];
}
}
int myStaticIntStack::peek()
{
if( this->storedElements == 0 )
{
cout << "Stack is empty, you must PUSH an element before PEEKing one!" << endl;
return -1;
}
else
{
return this->elements[ this->stackSize - this->storedElements ];
}
}
int main()
{
myStaticIntStack aStack(3);
cout << "Popped Element: " << aStack.pop() << endl;
aStack.push(1);
cout << "Stack Top is: " << aStack.peek() << endl;
aStack.push(2);
cout << "Stack Top is: " << aStack.peek() << endl;
aStack.push(3);
cout << "Stack Top is: " << aStack.peek() << endl;
aStack.push(4);
cout << "Stack Top is: " << aStack.peek() << endl;
cout << "Popped Element: " << aStack.pop() << endl;
cout << "Stack Top is: " << aStack.peek() << endl;
cout << "Popped Element: " << aStack.pop() << endl;
cout << "Stack Top is: " << aStack.peek() << endl;
cout << "Popped Element: " << aStack.pop() << endl;
cout << "Stack Top is: " << aStack.peek() << endl;
return 0;
}
The code is compiling and running correctly, this is standard output:
Stack is empty, you must PUSH an element before POPping one!
Popped Element: -1
Stack Top is: 1
Stack Top is: 2
Stack Top is: 3
Stack is full, you must POP an element before PUSHing a new one!
Stack Top is: 3
Popped Element: 3
Stack Top is: 2
Popped Element: 2
Stack Top is: 1
Popped Element: 1
Stack is empty, you must PUSH an element before PEEKing one!
Stack Top is: -1
However I was given a B due to the following reasons:
There was a better way of implementing it.
I didn't manage well the case in which I'm trying to POP an element from an empty stack, since it's confusing that pop() returns a value even if Stack is empty.
Can you please help me understand how I could improve my code?
|
First of all, your code has a bug: You did not follow the rule of three.
Code such as myStack1 = myStack2; will cause the pointer to be deleted twice - which is undefined behavior.
int storedElements;
This seems kind of misleading. This variable doesn't hold the stored elements. It holds the number of stored elements. Perhaps storedElementsCount or something like that would be better?
myStaticIntStack( int aNumber );
Why did you call the variable aNumber here? aNumber is a terrible name. It tells me essentially nothing. Later you used stackSize which is a FAR better name. Why didn't you use it here too?
And, by the way, consider using size_t to store sizes and capacities instead of ints. This would apply to stackSize and storedElements.
myStaticIntStack::myStaticIntStack()
{
this->stackSize = 1;
this->elements = new int(0);
this->storedElements = 0;
}
Seriously? The default behavior for the stack is to create a stack with maximum size 1? That is kind of... worthless. It's OK to allow this in the myStaticIntStack(int) constructor, but as a default it just seems odd.
Consider not even allowing a default constructor.
myStaticIntStack::myStaticIntStack( int stackSize )
{
this->stackSize = stackSize;
this->elements = new int[ stackSize ];
this->storedElements = 0;
}
Can the stackSize be zero? Can it be negative? Consider adding an assertion.
By the way, if you make stackSize be a size_t, the negative case becomes impossible, since size_t is unsigned. But you'll still need to handle the "stackSize == 0" case.
A size of 0 might be acceptable. If that is the case, add a comment stating that and why it is so.
Consider declaring this constructor explicit.
myStaticIntStack::~myStaticIntStack()
{
if( this->elements != NULL )
{
if( stackSize > 1 )
delete[] this->elements;
else
delete this->elements;
}
}
Why do you need a NULL check? Are you expecting the destructor to be called with elements == NULL? If this merely defensive programming and this case is never supposed to happen, then leave it as an assertion.
Also, that whole delete vs delete[] is weird. What if I use the constructor myStaticIntStack(1)? Then you'll be deleteing something created with new[].
I'd change the code (from the constructors) so that new[] - not new - is always used and, therefore, delete[] is always the right thing to do in the destructor.
void myStaticIntStack::push( int newElement )
{
if( this->storedElements == this->stackSize )
cout << "Stack is full, you must POP an element before PUSHing a new one!" << endl;
else
{
this->elements[ (this->stackSize - 1) - this->storedElements ] = newElement;
this->storedElements++;
}
}
This is improper error handling that violates the single responsibility principle.
Your function should either throw an exception, merely assert the condition or return an error code. Printing to the command line should be done elsewhere - probably outside this class.
this->elements[ (this->stackSize - 1) - this->storedElements ] = newElement;
I'm pretty sure you could simplify this. For a stackSize=16, the first position is at index 15. Why 15? Why not 0? That'd simplify the code to just elements[storedElements] = newElement;. Just remember to also fix the pop/peek code.
Just because the stack is Last-in-first-out doesn't mean you have to fill the last indexes in the internal array first. That's an implementation detail.
it's confusing that pop() returns a value even if Stack is empty.
Then don't return a value if the Stack is empty. Throw an exception or abort with an assertion. Problem solved. Next.
As I stated before, your couts are in the wrong place. If you fix that the "Pop return" problem might just naturally go away.
If you decide to keep it like that (return -1), then consider making -1 a named constant since magic numbers are bad.
return ERROR_STACK_IS_EMPTY;
int myStaticIntStack::peek()
Same thing about cout.
Also, peek() doesn't change anything, does it? Then consider making it const.
int myStaticIntStack::peek() const
Consider splitting your myStaticIntStack in two files: myStaticIntStack.hpp and myStaticIntStack.cpp.
Your main function would be in a third file.
Some extra thoughts:
I suspect the "better way" might be to just use a vector internally. This would painlessly solve your "rule of three" problem. Bonus points since it'd make it easier to "resize" the stack after being created if you ever wanted to add that feature.
Personally, I'd uppercase the first letter of the class name, but that's just personal preference. Nothing wrong with your particular style.
Consider adding a bool empty() function, that checks if the stack is empty.
Consider adding a bool full() function, that checks if the stack is full.
Those two functions above could make your error detection code easier to understand. If your assignment forbids adding extra functions, consider adding them as private functions.
Consider adding a int size() function, that returns storedElements.
Consider adding a int capacity() function, that returns stackSize
Normally, a class like this would be implemented as a template since it's useful to have stacks for more than just integers. Not sure if you've learned about templates yet.
If you follow QuentinUK's suggestion of removing the this->, beware. There is one case that might cause you trouble.
In the constructor, this->stackSize = stackSize; is correct, but stackSize = stackSize; would not be.
To work around this issue, you could use something like this:
/*optionally add "explicit" here*/ myStaticIntStack::myStaticIntStack( int stackSize ) :
stackSize(stackSize)
{
elements = new int[ stackSize ];
storedElements = 0;
}
This is all I can think of right now. Hope this helps.
| 0.888889 |
Why did you use the variable aNumber here?
|
What should my credit limit be?
|
I have two credit cards (through the same bank). The first I got at age 18, and the 2nd I applied for while in grad school for better rewards. I use credit cards (primarily the more recent one) for routine monthly expenses and I pay them off in full every month and reap the rewards. The limits were pretty low while I was in school, but every 6 months or so they would notify me that they were raising my credit limit by a modest amount. This continued for a while, but it stopped not long after I left school (which roughly coincided with banks becoming more reluctant to offer credit).
My income has increased several hundred percent over what it was while I was in grad school, and I feel my credit limits do not reflect that. My combined credit limit between the two cards is a little over 12% of my yearly gross income. I feel this is probably low, and I might like to increase it both to increase my credit score and to easier allow for multiple large purchases (computer, furniture, etc.) in the same month without using an excessively high portion of my available credit. What guidelines should I use to determine how much of an increase, if any, to request?
|
I think it would be hard to make the decision based on your credit score, b/c there are always different answers about what affects, and how much. If you don't make big mistakes, like defaulting, I'm sure your credit score will take care of itself.
If you feel like you want more flexibility in your limits, then call and see what you can get. I have around 6 cards, at least 2 have limits over 10k, and my credit score has been over 800 for years. I've opened and closed various cards, and had limits rise over the years and haven't been constrained in getting mortgage or refinancing.
| 0.666667 |
What affects your credit score based on your defaulting?
|
Adding bold labels to two different addresses in moderncv
|
I found this link here which was what I was looking for. It allows one to add two addresses to a CV written in moderncv. But I wanted to know how to modify the code so that labels like "Present address" and Permanent address" in bold appear above the two addresses. Because otherwise it just looks like one long address.
|
Like this?
%% start of file `template.tex'.
%% Copyright 2006-2012 Xavier Danaux ([email protected]).
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License version 1.3c,
% available at http://www.latex-project.org/lppl/.
\documentclass[11pt,a4paper,sans]{moderncv} % possible options include font size ('10pt', '11pt' and '12pt'), paper size ('a4paper', 'letterpaper', 'a5paper', 'legalpaper', 'executivepaper' and 'landscape') and font family ('sans' and 'roman')
\moderncvstyle{classic} % style options are 'casual' (default), 'classic', 'oldstyle' and 'banking'
\makeatletter
\newcommand*{\addresstwo}[2]{\def\@addressstreettwo{#1}\def\@addresscitytwo{#2}}
\renewcommand*{\makecvtitle}{%
% recompute lengths (in case we are switching from letter to resume, or vice versa)
\recomputecvlengths%
% optional detailed information box
\newbox{\makecvtitledetailsbox}%
\savebox{\makecvtitledetailsbox}{%
\addressfont\color{color2}%
\begin{tabular}[b]{@{}r@{}}%
\ifthenelse{\isundefined{\@addressstreet}}{}{\makenewline\textbf{Present Address}\makenewline\addresssymbol\@addressstreet%
\ifthenelse{\equal{\@addresscity}{}}{}{\makenewline\@addresscity}}% if \addresstreet is defined, \addresscity will always be defined but could be empty
\ifthenelse{\isundefined{\@addressstreettwo}}{}{\makenewline\textbf{Permanent Address}\makenewline\addresssymbol\@addressstreettwo%
\ifthenelse{\equal{\@addresscitytwo}{}}{}{\makenewline\@addresscitytwo}}% if \addresstreettwo is defined, \addresscitytwo will always be defined but could be empty
\ifthenelse{\isundefined{\@mobile}}{}{\makenewline\mobilesymbol\@mobile}%
\ifthenelse{\isundefined{\@phone}}{}{\makenewline\phonesymbol\@phone}%
\ifthenelse{\isundefined{\@fax}}{}{\makenewline\faxsymbol\@fax}%
\ifthenelse{\isundefined{\@email}}{}{\makenewline\emailsymbol\emaillink{\@email}}%
\ifthenelse{\isundefined{\@homepage}}{}{\makenewline\homepagesymbol\httplink{\@homepage}}%
\ifthenelse{\isundefined{\@extrainfo}}{}{\makenewline\@extrainfo}%
\end{tabular}
}%
% optional picture box
\newbox{\makecvtitlepicturebox}%
\savebox{\makecvtitlepicturebox}{%
\ifthenelse{\isundefined{\@photo}}%
{}%
{%
\hspace*{\separatorcolumnwidth}%
\color{color1}%
\setlength{\fboxrule}{\@photoframewidth}%
\ifdim\@photoframewidth=0pt%
\setlength{\fboxsep}{0pt}\fi%
\framebox{\includegraphics[width=\@photowidth]{\@photo}}}}%
% name and title
\newlength{\makecvtitledetailswidth}\settowidth{\makecvtitledetailswidth}{\usebox{\makecvtitledetailsbox}}%
\newlength{\makecvtitlepicturewidth}\settowidth{\makecvtitlepicturewidth}{\usebox{\makecvtitlepicturebox}}%
\ifthenelse{\lengthtest{\makecvtitlenamewidth=0pt}}% check for dummy value (equivalent to \ifdim\makecvtitlenamewidth=0pt)
{\setlength{\makecvtitlenamewidth}{\textwidth-\makecvtitledetailswidth-\makecvtitlepicturewidth}}%
{}%
\begin{minipage}[b]{\makecvtitlenamewidth}%
\namestyle{\@firstname\ \@familyname}%
\ifthenelse{\equal{\@title}{}}{}{\\[1.25em]\titlestyle{\@title}}%
\end{minipage}%
\hfill%
% detailed information
\llap{\usebox{\makecvtitledetailsbox}}% \llap is used to suppress the width of the box, allowing overlap if the value of makecvtitlenamewidth is forced
% optional photo
\usebox{\makecvtitlepicturebox}\\[2.5em]%
% optional quote
\ifthenelse{\isundefined{\@quote}}%
{}%
{{\centering\begin{minipage}{\quotewidth}\centering\quotestyle{\@quote}\end{minipage}\\[2.5em]}}%
\par}% to avoid weird spacing bug at the first section if no blank line is left after \makecvtitle
\renewcommand*{\makelettertitle}{%
% recompute lengths (in case we are switching from letter to resume, or vice versa)
\recomputeletterlengths%
% sender contact info
\hfill%
\begin{minipage}{.5\textwidth}%
\raggedleft%
\addressfont\textcolor{color2}{%
{\bfseries\upshape\@firstname~\@familyname}\@firstdetailselementfalse%
\ifthenelse{\isundefined{\@addressstreet}}{}{\makenewline\addresssymbol\@addressstreet%
\ifthenelse{\equal{\@addresscity}{}}{}{\makenewline\@addresscity}}%
\ifthenelse{\isundefined{\@addressstreettwo}}{}{\makenewline\addresssymbol\@addressstreettwo%
\ifthenelse{\equal{\@addresscitytwo}{}}{}{\makenewline\@addresscitytwo}}%
\ifthenelse{\isundefined{\@mobile}}{}{\makenewline\mobilesymbol\@mobile}%
\ifthenelse{\isundefined{\@phone}}{}{\makenewline\phonesymbol\@phone}%
\ifthenelse{\isundefined{\@fax}}{}{\makenewline\faxsymbol\@fax}%
\ifthenelse{\isundefined{\@email}}{}{\makenewline\emailsymbol\emaillink{\@email}}%
\ifthenelse{\isundefined{\@homepage}}{}{\makenewline\homepagesymbol\httplink{\@homepage}}%
\ifthenelse{\isundefined{\@extrainfo}}{}{\makenewline\@extrainfo}}%
\end{minipage}\\[1em]
% recipient block
\begin{minipage}[t]{.5\textwidth}
\raggedright%
\addressfont%
{\bfseries\upshape\@recipientname}\\%
\@recipientaddress%
\end{minipage}
% date
\hfill% US style
% \\[1em]% UK style
\hbox{\today}\\[2em]% US informal style: "April 6, 2006"; UK formal style: "05/04/2006"
% opening
\raggedright%
\@opening\\[1.5em]%
% ensure no extra spacing after \makelettertitle due to a possible blank line
% \ignorespacesafterend% not working
\hspace{0pt}\par\vspace{-\baselineskip}\vspace{-\parskip}}
\makeatother
% moderncv themes
\moderncvcolor{blue} % color options 'blue' (default), 'orange', 'green', 'red', 'purple', 'grey' and 'black'
%\renewcommand{\familydefault}{\sfdefault} % to set the default font; use '\sfdefault' for the default sans serif font, '\rmdefault' for the default roman one, or any tex font name
%\nopagenumbers{} % uncomment to suppress automatic page numbering for CVs longer than one page
% character encoding
%\usepackage[utf8]{inputenc} % if you are not using xelatex ou lualatex, replace by the encoding you are using
%\usepackage{CJKutf8} % if you need to use CJK to typeset your resume in Chinese, Japanese or Korean
% adjust the page margins
\usepackage[scale=0.75]{geometry}
%\setlength{\hintscolumnwidth}{3cm} % if you want to change the width of the column with the dates
%\setlength{\maketitlenamewidth}{10cm} % for the 'classic' style, if you want to force the width allocated to your name and avoid line breaks. be careful though, the length is normally calculated to avoid any overlap with your personal info; use this at your own typographical risks...
% personal data
\firstname{John}
\familyname{Doe}
\title{Resume title (optional)} % optional, remove the line if not wanted
\address{street and number}{postcode city} % optional, remove the line if not wanted
\addresstwo{more streets}{more city} % optional, remove the line if not wanted
\mobile{+1~(234)~567~890} % optional, remove the line if not wanted
\phone{+2~(345)~678~901} % optional, remove the line if not wanted
\fax{+3~(456)~789~012} % optional, remove the line if not wanted
\email{[email protected]} % optional, remove the line if not wanted
\homepage{www.johndoe.com} % optional, remove the line if not wanted
\extrainfo{additional information} % optional, remove the line if not wanted
%\photo[64pt][0.4pt]{picture} % '64pt' is the height the picture must be resized to, 0.4pt is the thickness of the frame around it (put it to 0pt for no frame) and 'picture' is the name of the picture file; optional, remove the line if not wanted
\quote{Some quote (optional)} % optional, remove the line if not wanted
% to show numerical labels in the bibliography (default is to show no labels); only useful if you make citations in your resume
%\makeatletter
%\renewcommand*{\bibliographyitemlabel}{\@biblabel{\arabic{enumiv}}}
%\makeatother
% bibliography with mutiple entries
%\usepackage{multibib}
%\newcites{book,misc}{{Books},{Others}}
%----------------------------------------------------------------------------------
% content
%----------------------------------------------------------------------------------
\begin{document}
%\begin{CJK*}{UTF8}{gbsn} % to typeset your resume in Chinese using CJK
%----- resume ---------------------------------------------------------
\makecvtitle
\section{Education}
\cventry{year--year}{Degree}{Institution}{City}{\textit{Grade}}{Description} % arguments 3 to 6 can be left empty
\cventry{year--year}{Degree}{Institution}{City}{\textit{Grade}}{Description}
\section{Master thesis}
\cvitem{title}{\emph{Title}}
\cvitem{supervisors}{Supervisors}
\cvitem{description}{Short thesis abstract}
\section{Experience}
\subsection{Vocational}
\cventry{year--year}{Job title}{Employer}{City}{}{General description no longer than 1--2 lines.\newline{}%
Detailed achievements:%
\begin{itemize}%
\item Achievement 1;
\item Achievement 2, with sub-achievements:
\begin{itemize}%
\item Sub-achievement (a);
\item Sub-achievement (b), with sub-sub-achievements (don't do this!);
\begin{itemize}
\item Sub-sub-achievement i;
\item Sub-sub-achievement ii;
\item Sub-sub-achievement iii;
\end{itemize}
\item Sub-achievement (c);
\end{itemize}
\item Achievement 3.
\end{itemize}}
\cventry{year--year}{Job title}{Employer}{City}{}{Description line 1\newline{}Description line 2}
\subsection{Miscellaneous}
\cventry{year--year}{Job title}{Employer}{City}{}{Description}
\section{Languages}
\cvitemwithcomment{Language 1}{Skill level}{Comment}
\cvitemwithcomment{Language 2}{Skill level}{Comment}
\cvitemwithcomment{Language 3}{Skill level}{Comment}
\section{Computer skills}
\cvdoubleitem{category 1}{XXX, YYY, ZZZ}{category 4}{XXX, YYY, ZZZ}
\cvdoubleitem{category 2}{XXX, YYY, ZZZ}{category 5}{XXX, YYY, ZZZ}
\cvdoubleitem{category 3}{XXX, YYY, ZZZ}{category 6}{XXX, YYY, ZZZ}
\section{Interests}
\cvitem{hobby 1}{Description}
\cvitem{hobby 2}{Description}
\cvitem{hobby 3}{Description}
\section{Extra 1}
\cvlistitem{Item 1}
\cvlistitem{Item 2}
\cvlistitem{Item 3}
\renewcommand{\listitemsymbol}{-~} % change the symbol for lists
\section{Extra 2}
\cvlistdoubleitem{Item 1}{Item 4}
\cvlistdoubleitem{Item 2}{Item 5\cite{book1}}
\cvlistdoubleitem{Item 3}{}
% Publications from a BibTeX file without multibib\renewcommand*{\bibliographyitemlabel}{\@biblabel{\arabic{enumiv}}}% for BibTeX numerical labels
\nocite{*}
\bibliographystyle{plain}
\bibliography{publications} % 'publications' is the name of a BibTeX file
% Publications from a BibTeX file using the multibib package
%\section{Publications}
%\nocitebook{book1,book2}
%\bibliographystylebook{plain}
%\bibliographybook{publications} % 'publications' is the name of a BibTeX file
%\nocitemisc{misc1,misc2,misc3}
%\bibliographystylemisc{plain}
%\bibliographymisc{publications} % 'publications' is the name of a BibTeX file
\clearpage
%----- letter ---------------------------------------------------------
% recipient data
\recipient{Company Recruitment team}{Company, Inc.\\123 somestreet\\some city}
\date{January 01, 1984}
\opening{Dear Sir or Madam,}
\closing{Yours faithfully,}
\enclosure{curriculum vit\ae{}}
\makelettertitle
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis ullamcorper neque sit amet lectus facilisis sed luctus nisl iaculis. Vivamus at neque arcu, sed tempor quam. Curabitur pharetra tincidunt tincidunt. Morbi volutpat feugiat mauris, quis tempor neque vehicula volutpat. Duis tristique justo vel massa fermentum accumsan. Mauris ante elit, feugiat vestibulum tempor eget, eleifend ac ipsum. Donec scelerisque lobortis ipsum eu vestibulum. Pellentesque vel massa at felis accumsan rhoncus.
Suspendisse commodo, massa eu congue tincidunt, elit mauris pellentesque orci, cursus tempor odio nisl euismod augue. Aliquam adipiscing nibh ut odio sodales et pulvinar tortor laoreet. Mauris a accumsan ligula. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Suspendisse vulputate sem vehicula ipsum varius nec tempus dui dapibus. Phasellus et est urna, ut auctor erat. Sed tincidunt odio id odio aliquam mattis. Donec sapien nulla, feugiat eget adipiscing sit amet, lacinia ut dolor. Phasellus tincidunt, leo a fringilla consectetur, felis diam aliquam urna, vitae aliquet lectus orci nec velit. Vivamus dapibus varius blandit.
Duis sit amet magna ante, at sodales diam. Aenean consectetur porta risus et sagittis. Ut interdum, enim varius pellentesque tincidunt, magna libero sodales tortor, ut fermentum nunc metus a ante. Vivamus odio leo, tincidunt eu luctus ut, sollicitudin sit amet metus. Nunc sed orci lectus. Ut sodales magna sed velit volutpat sit amet pulvinar diam venenatis.
\makeletterclosing
%\clearpage\end{CJK*} % if you are typesetting your resume in Chinese using CJK; the \clearpage is required for fancyhdr to work correctly with CJK, though it kills the page numbering by making \lastpage undefined
\end{document}
| 1 |
BibTeX file clearpage %
|
SharePoint 2013 OData $filter seems broken with date functions
|
I am using SP2013 SP1.
I am trying to perform the following OData opertaion from a client app that contains an External Content Type. The ECT points to a ASP.Net OData service.
My Javascript code in the app makes a query call and the url looks like this:
http://xxx/_api/web/lists/getByTitle('People')/items?$filter=month(BirthDate)%20eq%201%20and%20day(BirthDate)%20eq%206
I am saying get the People that have a birthday with a month of 1 and a day of 15.
However, SharePoint returns:
The query is not valid.
at Microsoft.SharePoint.SPListItemEntityCollectionCamlQueryBuilder.SetWhereBinaryOp(XmlWriter writer, EdmParserNode parseNode)
at Microsoft.SharePoint.SPListItemEntityCollectionCamlQueryBuilder.SetViewQuery(SPQuery query, XmlWriter writer, StringBuilder sb)
at Microsoft.SharePoint.SPListItemEntityCollectionCamlQueryBuilder.BuildCamlQuery()
at Microsoft.SharePoint.SPListItemEntityCollectionCamlQueryBuilder..ctor(SPList list, RESTfulQuery restQuery, Nullable1 itemId)
at Microsoft.SharePoint.SPListItemEntityCollectionQuery..ctor(SPList list, RESTfulQuery restQuery, Nullable1 itemId)
at Microsoft.SharePoint.SPListItemEntityCollection.TryWriteAsOData(ServerStub serverStub, ODataWriter writer, RESTfulQuery query, ProxyContext proxyContext)
at Microsoft.SharePoint.Client.ServerStub.Write(Object value, Uri path, ODataWriter writer, RESTfulQuery query, ProxyContext proxyContext)
at Microsoft.SharePoint.Client.Rest.RestRequestProcessor.Process()
at Microsoft.SharePoint.Client.Rest.RestRequestProcessor.ProcessRequest()
at Microsoft.SharePoint.Client.Rest.RestService.ProcessQuery(Stream inputStream, IList`1 pendingDisposableContainer)
I checked this url out http://msdn.microsoft.com/en-us/library/office/fp142385%28v=office.15%29.aspx and its seems like what I am doing should work, but it doesnt.
But if I run the exact same $filter query directly on the OData service I get the results I am looking for. Only when I go through SharePoints ECT and use any of the date functions in the $filter to I get an error.
Is this a bug in SharePoint 2013?
Also, I noticed that if I filter with a startsWith in the $filter its not returning all the matches. Is there a row limit that it searches. So if I have a startswith that should return 2 records but the second record is at the end of the list (say at the 1500th place) it doesnt seem to return it.
|
This is a limitation on SharePoint.
REST API filter by month
The workaround
Use 2010 REST endpoint ListData.svc
Create a calculated field, and then use CAML query
| 0.777778 |
SharePoint REST API filter by month
|
IEEE two column format
|
This should be a quick answer that I can't seem to find again. A while ago, I found out that I can use a one line addition in the preamble to format the document to the IEEE standard. It wasn't a reference to a style sheet or something else, but was integrated into TexLive. What is it again?
|
IEEEtran forms part of both MiKTeX and TeX Live, and should therefore be included in your distribution by default. As such, using
\documentclass{ieeetran}
should suffice to format your document according to IEEE's standard.
For manual installation, files are also available for download on the IEEEtran homepage.
| 1 |
documentclassieeetran should suffice to format your document according to IEEE's standard
|
Why do airlines (typically?) require customers to phone for special meals, and not provide this option online?
|
When travelling on flights where meals are included, travellers who need special meals, such as vegetarian or kosher, are, in my experience, typically required to make such a request by phone.
For the traveller, this might mean a 15 minute hold, followed by a 1 minute phonecall. After all, the operator simply needs to make an entry into a database somewhere.
Why don't airlines offer seem to offer travellers the option to select their special meal request through an online interface? Or do I just have the bad luck to happen to fly with airlines where this request can only be made by phone?
Examples: Air Transat, Korean Air both require to contact the service centre by telephone.
|
Either you've been misinformed, or we're travelling on different airlines...
For a flight I have next week, I've just logged into the "Manage My Booking" section of the airline's website (BA). Once I pick the flight, I see this:
By picking the Special Requirements link, I can request a special meal, and additionally on the right hand menu of special options it offers it there too!
Next up, trying a flight with Qatar Airways for several months time. After going to Manage A Booking, there's a section there called Flight Special Requests, which currently shows my seats, and that I haven't requested any special meals. Hitting the modify button brings up a page where I can pick special meals for each flight, including a fairly good list:
Once you have booked your flight, be that with the airline, or a travel agent, or a website, you'll get a booking reference (normally 5 or 6 characters). Go to the airline's website, pick Manage My Booking or similar, and look for something like Special Requests, then from there pick your meals. As long as you're flying with a moderately decent airline, you should have no problem doing so, as shown above!
| 1 |
How to request special meals for a flight?
|
Access PDF files from 'res/raw' or assets folder programmatically to parse with given methods
|
Access PDF files from 'res/raw' or assets folder programmatically to parse with given methods
Explanation:
Right now this program accesses a file from a file manager that takes the selected files path and sets it to the 'mFilename' EditText field. The show PDF button listener below shows the String 'pdffilename' gets assigned the String contained in the 'mFilename' EditText field. The PdfViewerActivity is started and the String 'pdffilename' is passed as an Extra. In the onCreate() the intent is checked if null or not. This is where I think the change can/should be made. The String 'pdffilename' is assigned what you see below. What I want to do is store the PDF files in one of two ways... int the 'res/raw/example_folder/example.pdf' or in the assets folder. I want to assign 'pdffilename' programmatically with the path for where I am storing these PDF files. I have tried many different approaches all of which have either did not compile, caused errors, or caused a "file: res/raw/example_folder/example.pdf does not exist!".
So Basically...
I want to store PDF files in 'res/raw/folder_example/example.pdf' or the assets folder
I want to access these files from the code as in I do not need to use a file manager
Anyway that will solve this would be the biggest help, I am pretty good with Java, but I am by no means a superstar so please explain a little with your code
Thank you so much and I will be standing by to answer comments and edit this post. I hope this post will be helpful to other users so I will be posting the code for the solution. when completed. Thank you again!
Show PDF button Listener in PdfFileSelectActivity...
OnClickListener ShowPdfListener = new OnClickListener()
{
public void onClick(View v)
{
mFilename = (EditText) findViewById(R.id.filename);
String pdffilename = mFilename.getText().toString();
Intent intent = new Intent(PdfFileSelectActivity.this,
PdfViewerActivity.class)
.putExtra(EXTRA_PDFFILENAME, pdffilename);
startActivity(intent);
}
};
PdfViewerActivity's onCreate() invoked from show PDF Listener above...
Intent intent = getIntent();
if (intent != null)
{
if ("android.intent.action.VIEW".equals(intent.getAction()))
{
pdffilename = storeUriContentToFile(intent.getData());
}
else {
pdffilename = getIntent().getStringExtra(PdfFileSelectActivity.EXTRA_PDFFILENAME);
}
}
if (pdffilename == null)
pdffilename = "no file selected";
setContent(null);
setContent() called from above (if needed) ...
private void setContent(String password)
{
try {
parsePDF(pdffilename, password);
}
catch (PDFAuthenticationFailureException e)
{
System.out.println("Password needed");
}
}
parsePDF() called from above (if needed) ...
private void parsePDF(String filename, String password) throws PDFAuthenticationFailureException
{
long startTime = System.currentTimeMillis();
try {
File f = new File(filename);
long len = f.length();
if (len == 0) {
mGraphView.showText("file '" + filename + "' not found");
}
else {
mGraphView.showText("file '" + filename + "' has " + len + " bytes");
openFile(f, password);
}
}
catch (PDFAuthenticationFailureException e)
{
throw e;
} catch (Throwable e) {
e.printStackTrace();
mGraphView.showText("Exception: "+e.getMessage());
}
long stopTime = System.currentTimeMillis();
mGraphView.fileMillis = stopTime-startTime;
}
Thank you again!
|
After many many hours and quite a few cigarette breaks here is the solution. Once the readToByteBuffer has returned a ByteBuffer it is as easy as creating a new PDFFile that takes in a ByteBuffer.
Enjoy...
ShowPDF button Listener...
OnClickListener ShowPdfListener = new OnClickListener() {
public void onClick(View v)
{
Intent intent = new Intent(PdfFileSelectActivity.this,
PdfViewerActivity.class);
startActivity(intent);
}
};
In onCreate() PdfViewerActivity...
openFile2(readToByteBuffer(this.getAssets().open("test.pdf")), null);
edited readToByteBuffer() from here
public ByteBuffer readToByteBuffer(InputStream inStream) throws IOException
{
long startTime = System.currentTimeMillis();
BufferedReader in = new BufferedReader(new InputStreamReader(this.getAssets().open("test.pdf")));
StringBuilder total = new StringBuilder();
String line;
while ((line = in.readLine()) != null) {
total.append(line);
}
int length = total.length();
byte[] buffer = new byte[length];
ByteArrayOutputStream outStream = new ByteArrayOutputStream(length);
int read;
while (true) {
read = inStream.read(buffer);
if (read == -1)
break;
outStream.write(buffer, 0, read);
}
ByteBuffer byteData = ByteBuffer.wrap(outStream.toByteArray());
long stopTime = System.currentTimeMillis();
mGraphView.fileMillis = stopTime-startTime;
return byteData;
}
| 0.888889 |
ReadToByteBuffer returns a ByteBookffer .
|
How common is it for cameras to have a gyroscope?
|
How many cameras apart from the iPhone have a gyroscope for orientation?
Am I right to assume that there is a standard way to “tag” an image with the direction the camera was pointing in, as well as the GPS position?
Do any cameras have positional tracking better then a GPS?
I am thinking about a method to join photos when the subject does not have enough “random” detail for the current software.
|
The gyroscope in an iPhone doesn't actually let you track the direction the camera was facing at the time of a shot. All it does it track motion--it has no frame of reference to determine what point of the compass the camera is actually facing.
The "digital compass" in the iPhone 3G S onwards can give some idea of that, except that it's designed to be used when the iPhone is more or less flat. It would thus require a mirror to be fitted to the camera lens to be useful, and in any case compass data isn't included in the EXIF info. I would expect that any camera providing directional capabilities would be using an equivalent "digital compass" using a magnetometer.
| 0.888889 |
The gyroscope in an iPhone doesn't track the direction the camera is actually facing .
|
How do you decide when a paladin has fallen from grace in DnD 5e?
|
There does not seem to be a clear-cut way to determine when a paladin's actions have become egregious enough to justify them breaking their oath. Do a lot of minor slights eventually add up and cause an oath to be broken? Do they get some sort of warning like losing their laying on of hands ability?
|
You're right. There is no clear cut way. That's by design. How this works varies a lot by playstyle:
Some groups have a solid understanding of ethics and jurisprudence and use some limited form of said understanding adjudicate alignment in D&D. Others use their full understanding of ethics, which cumulates for them into a D&D compatible system, to perform that adjudication. These groups are very similar except that the first group tends to have less issues adjudicating alignment in difficult situations where the latter group discovers holes in their beliefs about morality. In both of these cases alignment is adjudicated according to the chosen moral/ethical system, and what constitutes oath-breaking will be adjudicated similarly according to the related principles of jurisprudence. As moral relativism becomes, unfortunately, increasingly popular, objective alignment becomes less and less so, especially amongst simulationist groups, and so these two methods of alignment adjudication are unlikely.
Some groups think alignment is stupid, meaningless, and entirely subjective. These people are very vocal. They likely also think that oathbreaking is similarly problematic. Like alignment-based powers in previous editions, in these groups if you're going to use anything that's based off alignment or alignment-like systems (like the paladin class) you should first check with your DM to find out 1) if it's allowed and 2) what it means in the context of the campaign. One common solution in the past in these kinds of groups has been just to waive the alignment restriction entirely, for the Paladin class.
Some groups think that obviously alignment is objective, because it's in the rules, but they just don't understand it yet. These groups will post difficult alignment questions as they come up on online fora. The outcome of alignment based actions in such groups will be fickle and likely a point of tension.
Some groups try and adjudicate this according to the original inspiration for the alignment system, which is a set of novels written by Michael Moorcock. This is hard because the novels are novel-y and don't explain exactly what Law and Chaos are in cut and dry terms. Such groups would probably not adjudicate the oath the same way they do alignment, because Jurisprudence is fundamentally a principle of Balance, not Law, in that system, and there's almost nothing to go on for how something like the 5e paladin oath should be dealt with.
In any case, if you are not the DM, ask your DM how the metaphysics of ethics and jurisprudence are related in their game. If they are related, seek to focus more on the adjudication of ethics than jurisprudence as the ethical component is probably dominant in most GM adjudications. If they are not related, ask about Jurisprudence in general, and the adjudication of your class abilities in particular, if necessary, focusing on what an Oath means, what it means to break it, and how reparations might be made if the oath is indeed broken.
If you are the DM, I strongly recommend you consciously decide what philosophical system of justice you will use in your campaign, as all of the other options amount to unconsciously using some system and putting some introspective thought into this choice before you start running the game is likely to make these kinds of decisions much easier and much faster during the game sessions, since you will spend much less time figuring out how to approach each specific case.
If you want a place to start looking at different approaches to the philosophy of oaths, I recommend this paper.
| 0.888889 |
How does alignment adjucate alignment in D&D?
|
Is there a non-trivial topological group structure of $\mathbb{Z}$?
|
More specificaly, is there a haussdorf non-discrete topology on $\mathbb{Z}$ that makes it a topological group with the usual addition operation?
|
Yes. Take, for example, the subgroups $p^k\mathbb{Z}$, for $k>0$ and a fixed prime $p$, as a basis of neighborhoods of the identity.
| 1 |
Subgroups $pkmathbbZ$ and a fixed prime $p$
|
Can I remove the labels from ICs?
|
In another question I asked about ways one might obfuscate the design of a system, to prevent unauthorized cloning. One suggestion was that IC manufacturers are often willing to put custom labels on their chips. The idea is interesting, but my quantities are low enough that this would not be cost-effective. How might one remove or otherwise render unreadable the labels on ICs?
|
Grinding or other abrasives is the only reliable method. I think I've seen machines that will do this for DIP components.
A dedicated reverse-engineering person can probably guess the part from the pinout, surrounding circuit, and package or simply have the epoxy removed and look at the identification numbers on the die under a microscope, so it only goes so far.
In my (somewhat) humble opinion, hiding the numbers on chips is kind of a red flag that the product is really easy to clone, has nothing proprietary in it, and is being sold for a very healthy margin, but perhaps that's just me. You won't find top tier manufacturers doing it.
You could always incorporate one of these chips.
| 0.888889 |
cloning the numbers on chips is a red flag for a product that has nothing proprietary in it .
|
How should I tell Rails which of these content types to load for a given feed?
|
I have content management system for an iOS app built with rails. Right now there a are three different types of content. The first two are just strings uploaded into a textfield by the user. One is twitter handles and hashtags, the other is URLs. The second type is photos.
The user can upload as many individual instances of these types content as he/she wants to given a feed which will is the then passed to the iOS app via an API call to display.
The current approach I am using is to have Feed, Picture, Twitter, and Webpage models. When the user crates a new Feed, they then associate the appropriate content with that feed via a one to many relationship between each Feed instance it's content instances.
When it comes time to display to content the user has uploaded, a GET request for a given stream is generated and the Feed model then does the following awful thing determine what type of content should be shown:
def Feed.get_content_for_feed(feed_id)
return self.map_type_to_class(feed_id).get_content_for_feed(feed_id)
end
private
def Feed.map_type_to_class(feed_id)
feed_type_id = Feed.find(feed_id).feed_type_id
not_yet_implemented = nil
case stream_type_id
when 1
return Webpages
when 2
return Pictures
when 3
return not_yet_implemented
when 4
return Twitter
when 5
return not_yet_implemented
when 6
return not_yet_implemented
when 7
return not_yet_implemented
when 8
return not_yet_implemented
else
return nil
end
end
Then each content class implements a get_content_for_feed method to return the content:
def Twitter.get_content_for_feed(feed_id)
tweet_urls = self.where(:feed_id => feed_id.to_i)
if tweet_urls.empty?
return []
else
return tweet_urls
end
end
So it just returns the appropriate class. This works, but I know that it is wrong, but I am not sure what I would be doing.
|
First a light review:
You've got a bug, I think. Your map_type_to_class sets a feed_type_id variable, but your case statement is looking at a stream_type_id variable that I don't see anywhere.
Second, don't use so many return statements. It's Ruby; returns are implicit. So this you don't need returns in if...else or case branches you have in your question. In idomatic Ruby, you only see return if someone specifically wants to exit a method early (and even that's rare with well-factored code).
Lastly, this bit is redundant
tweet_urls = self.where(:feed_id => feed_id.to_i)
if tweet_urls.empty?
return []
else
return tweet_urls
end
Which, to all intents and purposes is the same as simply:
self.where(:feed_id => feed_id.to_i)
It's implicitly returned, and it's array-like, so there's no need to do anything special. It's either empty or it's not. If you want something that's truly an Array instance (and not just duck-typed), you can append a .to_a.
Anyway, what you're looking for is the constantize method for strings. What you've got is a fairly simple has_many relationship, you just want something like a string item_type column on your Feed model that contains the class name (as a string) instead of your current numeric ID.
From there it's a matter of implementing a polymorphic has_many (Rails already has a polymorphic option for belongs_to but that's a to-one association).
You could simply do
def Feed
def items
klass = item_type.constantize
klass.where(feed_id: id)
end
end
(yes that could just be one line).
You won't have all the fancy collection methods, caching, and other nice stuff Rails provides for regular associations, but you can add that if you want or simply make do without it (I recommend the latter unless you find it to be bigger hassle).
So in your FeedsController (or wherever), you're looking at something like
def show
feed = Feed.find(params[:id])
render json: feed.items
end
That should work as a super-minimal implementation. The point is really just that you store the class name, which you can then turn from a string into a class name constant with constantize.
Alternatively, you could use Rails' built-in associations, but there's more setup involved and it's not as clean to look at. Again, you'll want an item_type string column.
def Feed
has_many :webpages # the class name Webpage is implicit
has_many :pictures
has_many :twitters # yuck, not a good name, but it'll imply the Twitter class
def items
association = item_type.underscore.pluralize # convert a class name to an association name
send(associtation) # call the association method (e.g. `webpages`)
end
end
The main advantage is that the items method is just a shortcut that provides the correct association object, so you have all the usual convenience methods. So you can do something like this for a webpage-type feed
Feed.find(some_id).items.create(params[:url])
Of course, the major issue is that it's not clear what's going on. Is items a collection of Picture? Of Webpage? If you just blindly try to create a Picture record from params meant for a webpage, things get messy.
So I'd stick to the first version, where items isn't an opaque alias for an association, and instead work a bit harder when adding new records and such.
| 0.888889 |
How do I use a feed_type_id variable in a web page?
|
m-element random sample being equally likely ...(CLRS 5.3-7)?
|
I am trying to understand the following solution to CLRS 5.3-7:
http://clrs.skanev.com/05/03/07.html
Question description is on the page. I understood the part where m-element subset is constructed out of m-1 element subset when the m-element subset includes the last element n. But why does the probability of randomly choosing m-1 elements from a set of n-1 elements differs in the case when we don't include the last element? Doesn't the invariant state that we choose m-1 elements at random from n-1 elements?
|
Here is the recursive algorithm for selecting a random set $S \in \binom{[n]}{m}$ (the set of all $m$-subsets of $[n] = \{1,\ldots,n\}$):
If $m = 0$, return the empty set.
Generate a random set $S \in \binom{[n-1]}{m-1}$ recursively.
Let $i \in [n]$ be chosen uniformly at random.
If $i \notin S$, return $S \cup \{i\}$.
If $i \in S$, return $S \cup \{n\}$.
To show that this works, we prove that the probability to get any set in $\binom{[n]}{m}$ is exactly $1/\binom{n}{m}$, by induction on $n$. This is clear when $m = 0$, so assume $m > 0$. Let $S \in \binom{n}{m}$ be given. We consider two cases: $n \notin S$ and $n \in S$.
Case 1, $n \notin S$. For each $i \in S$, the probability that the recursive step generates $S \setminus \{i\}$ is $1/\binom{n-1}{m-1}$, and so in that case $S$ is produced with probability $1/n$. In total, the probability is
$$ \frac{m}{n} \frac{1}{\binom{n-1}{m-1}} = \frac{1}{\binom{n}{m}}. $$
Case 2, $n \in S$. In that case, the recursive step must generate $S \setminus \{n\}$, and then $S$ is produced with probability $m/n$ (since we either hit $n$ or any element in $S \setminus \{n\}$), obtaining the same expression as above.
| 0.888889 |
recursive algorithm for selecting a random set $S in binom[n]m$
|
What does the Customer is_active flag do?
|
During a discussion today I was informed that the Customer is_active flag doesn't actually do anything.
This is a unique flag, like the customer email address, in that it's not an EAV attribute. Instead, it is a column in the customer_entity table.
I tried setting the flag to 0 for a test customer, but am still able to login. All other functionality seems to work normally.
Is this flag provided as a convenience to developers? Is it intended for some future purpose? What, if anything, does is_active do?
Edit: Here's a related stack overflow: http://stackoverflow.com/questions/3617832/disable-customer-in-magento
|
This is a legacy field, derived from Mage_Eav and present as far back as v0.7.14800 (and perhaps earlier). As such, it by far predates the earliest version of EE.
Whether the value of this field is used or not is a matter of implementation (such as it is for the catalog_category entity). I base this assertion on the fact that the Mage_Eav module does not provide any use of it as a base behavior for EAV entities.
| 1 |
Whether the value of this field is used or not is a matter of implementation
|
What does 'being' mean at the first of a sentence?
|
My question is what does 'being' mean at the first of a sentence?
Here are some examples.
Being rich doesn't mean you are happy.
What does being rich mean?
Being a successful person in life is a big challenge.
What does being successful mean?
Being a doctor doesn't mean you are smart.
What does being a doctor mean?
I appreciate your effort and I am looking forward to the answer
|
Being rich doesn't mean you are happy.
Being a successful person in life is a big challenge.
Being a doctor doesn't mean you are smart.
The sense of "being" at the start of a sentence depends on its context.
In all the sentences being has been used as a gerund. Being rich, being a doctor, and being a successful person are gerund clauses that are subjects of the sentences.
These sentences imply as follows:
If/when you are rich, it doesn't mean you are happy.
If/when you are a doctor, it doesn't mean you are smart.
It is a big challenge to be a successful person in life.
You can also use to-infinitive instead of being, but the use of the to-infinitive isn't so common.
Besides, in the construct of some sentences, being is also used to express a reason or cause as an alternative to because, since, or as. For example:
Being the youngest, Sara is her father's favourite.
| 0.888889 |
Being a successful person in life is a big challenge
|
How to find out the "serviceability" of a car?
|
One of my concerns before purchasing a car is how expensive repairs are going to be down the road. For example my car up until recently was a Volvo 850, and the air conditioner didn't work in it; the cost of getting it fixed was significantly higher than other cars because of the way the A/C unit is installed in the car, so I went on without air conditioning. Another example is the service light in the car - while the car had a standard OBD-II port which could read error messages, it required a special Volvo reader to reset the service light.
I know a lot of generalizations can be made about one make versus another, but those are obviously not allowed on this site (in fact, I hope this question is allowed at all...) - so that's not what I'm looking for. And I know there is a wide range of problems a car can encounter, and many of them are universal - replacing tires, for (a bad) example.
So, just like I can go to KBB and look up the recommended price of a car, is there someplace I can go to look up a make & model of a car and see what proprietary, extra-expensive parts are in the car? Something that, for example, I could have put in the Volvo 850 and it would have told me about those above-mentioned peculiarities alongside undoubtedly a number of other proprietary bits that I didn't have problems with.
|
Your best basic resource for a question like this is an objective publication that specializes in collecting exactly this sort of information. For example, Consumer Reports provides exactly this sort of information: be aware, it will cost money if you want full access to their website. However, there's a good chance that they have the magazine at your local library.
There's also a meta level of knowledge to be gained by people who work on a particular brand of car regularly. For example, reading what people have to say about modern Subarus was what drove me to buy the cars I have now. Aside from the AWD, the fact that all Subarus are effectively the same fundamental design layout and engines wrapped in different bodies really appealed to me. I don't find myself hunting around for a particular component: they all look the same once you pop the hood.
So, if your mechanic friend loves working on a particular type of vehicle, that's generally a good sign. If they are always cursing about the special code reader that they can only use on a particular model year, perhaps that's an "avoid" signal.
| 1 |
Consumer Reports specializes in collecting exactly this sort of information
|
Noise comparison for sensors the D800 vs the D600
|
If the main criteria of buying new FX camera for landscape photography is low sensor noise, what camera do you suggest to buy (Nikon): D800 ~2.5k, D600 ~1.7k. Does it make sense to pay extra money for this, if noise is almost the same, if it's true?
|
Considering how close the noise performance of those two cameras are to each other, I would think the very significant difference in resolution would be a more important consideration for any serious landscape photographer.
Deciding between the D600 and D800 based on noise performance at low ISO is like comparing two sports cars based on their braking performance:
The 2011 Corvette Z06 Carbon edition stops from 60 mph in 93 feet and can accelerate to 123.6 mph over one-quarter mile in 11.6 seconds
The 2010 Porsche 911 GT3 needs 94 feet to stop from 60 mph, but needs 12.2 seconds to accelerate to 116.7 mph over one-quarter mile.
At 123.6 mph, the Corvette can travel an additional 108.8 feet in the extra 0.6 seconds it takes the Porsche to reach one-quarter mile. Which is more significant? One foot of difference in braking performance or 109 feet of difference in acceleration?
Just like the two cars in the illustration above, both the D800 and D600 are high performance machines. They are both capable of taking very good landscape photos when used to their full potential. This includes both being in the right hands and having the right glass attached to them. If you are concerned over a 0.2 stop difference in noise performance at ISO 100, then surely you would see the much greater benefit of a high performing prime lens such as the Zeiss T 25mm f/2 ZE or the Nikkor 24mm f/1.4G ED over the Zoom-Nikkor 17-35mm f/2.8D IF-ED you mention in a comment to another answer.
| 0.888889 |
Difference in noise performance between the D600 and D800
|
C# Test Assembly
|
I am new to C# and am having a particularly difficult time figuring out how test assemblies work. This is my Solution directory (with a single project MyProject inside of it):
MySolution/MySolutionFile.sln -- My Solution File
MySolution/packages -- My Packages Directory
MySolution/MyProject/Properties -- My Project Properties
MySolution/MyProject/src -- My Source Code
/src/MyClass1.cs
/src/MyClass2.cs
MySolution/MyProject/test -- My NUnit Tests
/test/MyClass1Test.cs
/test/MyClass2Test.cs
MySolution/MyProject/TheMainClass.cs
Now I can run all the tests in the test folder from visual studio. However I want to run the tests from a CI system like TeamCity, in which case I need an assembly path. How do I generate just the test folder into an assembly to be run.
Do I need to add to the main class a method that runs each test in the MySolution/test folder?
|
I think you need to read about projects and solutions: http://msdn.microsoft.com/en-us/library/ee817674.aspx
And after that it all becomes more clear: Have one solution, inside of that solution create a project for your application and a project for your unit-tests. In test-project add reference to the testing framework of your choice and a reference to your application-project.
This way your application does not know about your tests and compiled into one assembly. At the same time your tests depend on your application, but compiled into another assembly, which can be used by your test-runner GUI/CI or whatever else you use.
And to answer your next question, for test-project you need to choose project type of "Library" (console application will work as well if you like)
| 1 |
Using a project type of "Library" for test-project
|
What's the first physics textbook for undergraduate self-learner?
|
I am kind of studying physics on my own now.
I choose University Physics (13th Edition) for myself,is it fine?
I am also studying Calculus using Thomas' textbook.
http://www.amazon.com/University-Physics-13th-Edition-Young/dp/0321696891/ref=sr_1_1?ie=UTF8&qid=1352260382&sr=8-1&keywords=university+physics+13th+edition
|
You can study "Modern physics" by Arthur Beiser. It is a very good book for undergraduate students. And also you can study the Feynmann Lecture series.
| 1 |
"Modern physics" by Arthur Beiser
|
which one have more importance to US PhD program ?TOEFL and GRE or publication records
|
I have got my BS and master both with honor with good GPAs. But Now I want to know which of these have more importance to US PhD program in Computer engineering.
TOEFL and GRE or publication records. What I am looking for is some case like this:
T : 107 G : x p : 0
T : 98 G : x p : 1
which case has more chance ?
|
Neither.
PhD admissions committees at strong departments are looking for clear evidence of potential for high-quality independent research.
Test scores only matter if they're low. In particular, if your math score is low, there will be serious doubts about your math ability, and if your verbal/TOEFL score is low, there will be serious questions about your communication skills. In some departments (like mine in CS), admission to the PhD requires a TOEFL Speak score above a certain minimum (in my case: 22), because all PhD students are expected to be TAs at least once while they're in the program, and the state of Illinois requires a minimum Speak score (in my case: 24) on TAs who are not native English speakers.
Publication records only matter if the papers are either good or horrible. It's utterly impossible to tell from the number of publications whether the applicant has significant promise for future independent research. High-quality papers, written in flawless English, published in well-known venues that are easily accessible online from the US, are definitely helpful. Poorly written incremental results in the Inaccessible Khazakhstani Journal of Computer Stuff is at best meaningless and at worst actively damaging.
| 1 |
if your math score is low, there will be serious doubts about your math ability . admission to the PhD requires a TOEF
|
Are questions regarding System76 hardware allowed?
|
Since System76 is the largest vendor for consumer PCs with Ubuntu pre-installed, are questions about their products allowed if they don't concern the OS in particular? That would include
What usb3 or e-stata drives actually work with their laptops
What peripherals work with particular system76 machines.
How/should I upgrade the BIOS?
|
As Jorge mentioned, it would be dependent on what the questions actually relate to.
Hardware related questions are better suited for one of the other sites. Hardware compatibility as well.
Asking "How do I upgrade the BIOS?" is one of those edge-case questions, it could be on topic, it could be offtopic. If you specify that you're wanting to update the BIOS via Ubuntu, then it becomes a non-edge-case question and is valid for here.
| 1 |
How do I upgrade the BIOS?
|
How to hide a DIV element when I click outside
|
I have a div and want to hide it when I click outside. My code is:
<div id="mydiv">The div must be above button</div>
$('#mydiv').click(function(e) {
e.stopPropagation();
});
$(document).click(function() {
$('#mydiv').fadeOut(300);
});
But it is not working for me ...
UPDATE
Full code is presented below. When I click on a button it shows a div above, so I need to hide this div when I click outside.
DEMO
<div id="but" style="text-align: right;"><button type="button">Show Div!</button></div>
<div id="mydiv" style="display:none;">The div must be above button</div>
$("#but button").click(function(){
var pos = $(this).offset(),
div = $("#mydiv");
// Make it visible off-page so
// we can measure it
div.css({
"display": "block",
"border": "1px solid black",
"position": "absolute",
"left": -10000,
"top": 0
});
// Move it where we want it to be
div.css({
"left": pos.left - 40,
"top": pos.top - div.height() - 10
});
});
$('#myDiv').click(function(e) {
e.stopPropagation();
});
$(document).click(function() {
$('#mydiv').fadeOut(300);
});
|
try .blur(), and like this:
$('#mydiv').blur(function(e) {
$(this).fadeOut(300);
});
Hope it help
| 0.666667 |
Try .blur()
|
Continuous Dice rolls
|
A dice is being rolled continuously. Suppose you roll a 3 ( or any number ). What is the probability that you will get the next "3" exactly after n rolls?
|
Well, if you do roll a $3$, then there would be a $1\over 6$ chance of rolling another $3$. So, for the next two rolls after rolling just once, if you roll two more times, then there will be a $1\over 36$ chance of rolling two $3$s. Here's a thing to help: Rolls to Get the Number | Chance the Number Will Appear Again Those Rolls$$2|{1\over6}$$$$3|{1\over 36}$$$$4|{1\over 216}$$$$5|{1\over1,296}$$
So, after one roll, the chance starts at the second roll and then multiplies by $1\over 6$ from the beginning as you go. This works for any number on a six-sided die.
| 0.777778 |
Rolls to Get Number | Chance the Number Will Appear Again
|
How prove this equation $\alpha=\aleph_{0}\alpha$
|
Question:
let $\alpha$ be a infinite cardinal , show that:
$$\alpha=\aleph_{0}\alpha$$
where $\aleph_{0}$ is the cardinality of the natural numbers is denoted aleph-null
this equation is from a book,and I can't prove it,and the author say this is important equation,and can't prove it.Thank you for you help
|
First of all take well-ordered set — every non-empty subset has a least element.
Then, for every (with the exception of the greatest element) element $x$ there is the "next" element $x+1$ — the least of all which are greater than $x$.
For some elements there may be no predecessor — let us call them limit elements (or points).
And every element of a well-ordered set has a form $x=a+n$ where $a$ is a limit element, $n$ is a natural number and $+$ means the same as above.
OK, now Zermelo's theorem, which is equivalent to an axiom of choice, every set can be well-ordered.
Also, $|\mathbb N \times \mathbb N|=|\mathbb N|$.
And we want to prove that for infinite $A:\;A\times \mathbb N$ equinumerous to $A$.
$A$ could be well-ordered, then $A$ is equinumerous to $B\times \mathbb N$ where $B$ is the set of all limit elements.
And we have $|A\times\mathbb N|=|(B\times \mathbb N)\times\mathbb N|=|B\times(\mathbb N\times\mathbb N)|=|B\times\mathbb N|=|A|$.
| 0.888889 |
Limit elements can be well-ordered .
|
No navigation links on 404 pages Drupal 7
|
When I visit a page that does not exist, I expect to still see the primary and secondary links as on any other page, but what I get is no navigation links in the 404 page. See also No navigation links on 404 pages.
I have found a solution, but I am happy if something else can fix this (possibly without using extra modules).
|
There are also good module alternatives:
Search 404
Instead of showing a standard "404 Page not found", this module performs a search on the keywords in the URL, e.g. if a user goes to http://example.com/does/not/exist, this module will do a search for "does not exist" and shows the result of the search instead of the 404 page. This should help retain visitors coming in from old URLs linked from other sites or from search indices.
Fast 404
Drupal has expensive 404 errors. On an 'average' site with an 'average' module load, you can be looking at 60-100MB of memory being consumed on your server to deliver a 404. Consider a page with a bad .gif link and a missing .css file. That page will generate 2 404s along with the actual load of the page. You are most likely looking at 180MB of memory to server that page rather than the 60MB it should take.
| 0.666667 |
Search 404 Using a standard "404 Page not found" module .
|
How do I fix a puncture?
|
I got a flat/puncture on my bike tube, how can I fix it myself without going to the nearest bike shop? What kind of equipment would I need?
|
Go buy yourself a repair kit for about £5-6 pounds. These would include the following:
1) Tyre levers - something to remove the tyre !!
2) Repair patches
3) Emery cloth - To roughen up the tube surface.
4) Tube of glue.
If you haven't got quick release wheels, make sure you take something to undue the wheels nuts. I learnt this the hard way when I first started riding my fixed wheel.
| 1 |
Buying a repair kit for £5-6 pounds
|
Buying New Electronics During the 9 Days
|
Is one allowed to buy new electronic devices during the nine days (e.g. cellphone, laptop)?
|
http://ohr.edu/1097
One should not purchase an object of joy that will be available after
Tisha B’Av for the same price.
| 0.777778 |
object of joy will be available after Tisha B’Av for same price
|
What is kvm reboot?
|
Some web hosting providers offer "kvm reboot" for their dedicated servers? What does that mean?
Does it mean the server reboots automatically after a crash or freeze?
|
Often this means that you can remotely access the console over the network (KVM standing for Keyboard, Video, Mouse) and, further, trigger a reboot remotely even if the OS has completely gone to lunch.
| 1 |
Remote access to the console over the network
|
JSP mechanism for nav bar template/module
|
I have a navigation bar and, for some pages, a sub-navigation bar as well. I'd like to make this a module so I can easily import the navigation bars on each page. Easy enough to simply put the code in a JSP file and call:
<%@include file="/WEB-INF/jsp/includes/sub_nav_bar.jsp"%>
the only issue is the links and their labels change depending on what page you're on. So my options are to create separate navigation bars for various groups of pages or pass in variables representing the links and labels. Separate navigation bars isn't attractive because there are so many variations, particularly with the sub nav bars. I'll end up with tons of navigation bars, all of which I have to maintain.
The variables approach works, but I'm hoping there's a better way to do this. It's so messy and lengthy. If I want to later have drop down menus, it's going to be even much worse. Basically, I've done something to this effect:
<c:set var="subNav" value="1"/>
<c:set var="subNavLink1" value="/"/>
<c:set var="subNavLabel1" value="Home"/>
<c:set var="subNavLink2" value="/fun"/>
<c:set var="subNavLabel2" value="Fun Stuff"/>
<c:set var="subNavLink3" value="/more"/>
<c:set var="subNavLabel3" value="More Stuff"/>
<%@include file="/WEB-INF/jsp/includes/sub_nav_bar.jsp"%>
the sub_nav_bar.jsp include file looks pretty ugly:
<ul id="sub-nav">
<li class="<c:if test="${subNav!='1'}">in</c:if>active"><a href="<c:url value='${subNavLink1}'/>">${subNavLabel1}</a></li>
<c:if test="${subNavLink2!=null}"><li class="<c:if test="${subNav!='2'}">in</c:if>active"><a href="<c:url value='${subNavLink2}'/>">${subNavLabel2}</a></li></c:if>
<c:if test="${subNavLink3!=null}"><li class="<c:if test="${subNav!='3'}">in</c:if>active"><a href="<c:url value='${subNavLink3}'/>">${subNavLabel3}</a></li></c:if>
<c:if test="${subNavLink4!=null}"><li class="<c:if test="${subNav!='4'}">in</c:if>active"><a href="<c:url value='${subNavLink4}'/>">${subNavLabel4}</a></li></c:if>
</ul>
So is there a better way?
|
Any reason for you to stick to plain JSP/JSTL? Most web frameworks would simplify this work for you. The key would be to have a templating system like tiles, sitemesh, facelet, freemarker, ...
| 1 |
How do you use JSP/JSTL?
|
OpenSSL RAND_poll 'good enough'
|
We are using OpenSSL for generating IV's and other random data. We initialize it using RAND_poll and, on Windows, RAND_screen.
The question is though, if the seed generated by those methods is good enough (RAND_screen at least sounds to me like it is). Also, I was wondering how exactly RAND_poll works, as I could not find much documentation about it ant if it does behave differently depending on platform, like RAND_screen which is only available on Windows.
|
RAND_bytes() automatically calls RAND_poll() if it has not already been done at least once. So you do not have to call it yourself. RAND_poll() feeds on what the operating system provides: on Linux, Solaris, FreeBSD and similar Unix-like systems, it will use /dev/urandom (or /dev/random if there is no /dev/urandom) to obtain a cryptographically secure initial seed; on Windows, it will call CryptGenRandom() for the same effect.
RAND_screen() is provided by OpenSSL only for backward compatibility with (much) older code which may call it (that was before OpenSSL used proper OS-based seed initialization).
So the "normal" way of dealing with RAND_poll() and RAND_screen() is to call neither. Just use RAND_bytes() and be happy.
| 0.777778 |
RAND_bytes() is a cryptographically secure initial seed .
|
How can I adjust tax withholding so that I don't get a large Tax Refund?
|
I'm a few years out of college now. I've filled out my W4 accurately and I still get a tax refund every year of a pretty sizable sum. The thing is, I have student loans and I would much rather have been paying that extra money on a monthly basis (to prevent interest charges) than have given it to the government to 'hold' for me.
I've spoken to the HR department about lowering my tax deductions and they suggest putting more exemptions on my W4. However this seems off because I would essentially be purposely filling out a form incorrectly. Also, I don't see anything on this one sheet to take into consideration my student loan interest deduction, which is a large part of where my refund comes from.
How do I pay my taxes correctly throughout the year so that I don't owe or receive any money when I file?
|
On the back of the W4 is a Deductions and Adjustments worksheet. This worksheet will give you an accurate number to enter on line 5 of your W4.
| 1 |
Deductions and Adjustments worksheet
|
Order by collection member in Neo4j
|
I have the following query for getting an actor, roles and movies from the example movie database in Neo4j like this:
MATCH (actor:Person {name:"Meg Ryan"})-[role:ACTED_IN]->(movies)
RETURN actor, collect({roles: role.roles, movies: movies}) as movies
It all works nice, but when I want to order the collection by movies release year, I'm encountering some issues.
I tried to do it like this:
MATCH (actor:Person {name:"Meg Ryan"})-[role:ACTED_IN]->(movies)
ORDER BY movies.released DESC
RETURN actor, collect({roles: role.roles, movies: movies}) as movies
but i get this error:
Invalid input 'R': expected 'p/P' (line 2, column 2)
"ORDER BY movies.released DESC"
^
How can i order the collection by the Movies release year before putting it in a collection?
|
Use WITH keyword befor ORDER BY to sort the results before collect:
Beware that the WITH part needs to contain all variables that are used later in the query (actor,role,movies in this case).
MATCH (actor:Person {name:"Meg Ryan"})-[role:ACTED_IN]->(movies)
WITH actor,role,movies
ORDER BY movies.released DESC
RETURN actor, collect({roles: role.roles, movies: movies}) as movies
Similar example is given in the documentation.
| 0.888889 |
Use WITH keyword befor ORDER BY to sort the results
|
Traveling into Brazil from Bolivia by land/bus
|
I plan on travelling from Bolivia into Western Brazil (Caceres or Cuiaba in Mato Grosso) from Santa Cruz, Bolivia. I have heard that there are a couple of border cities into which to pass over to Brazil.
Does anyone know which is the safest/easiest way to go through?
If so, is travelling by bus the only way? I've heard there's also a train that leaves from Santa Cruz to Brazil, via Corumba? Is this currently running? Does anyone have experience travelling to Brazil like this?
|
There are buses from Santa Cruz to San Matias in Eastern Bolivia, on the border to Brazil. It takes around 15-18 hours on dirt roads. Once in Mato Grosso (on your way to Cáceres) the roads are very good and modern.
You won't easily find information on buses online, just go to the bus terminal once you're there in Santa Cruz and buy your ticket. Don't plan too tight as there are often very few buses per day between destinations in Bolivia, sometimes not even every day. It might also be at 6 am or similarly unlikely times.
Get your passport stamped in San Matias (exit stamp Bolivia) and in Cáceres (entry stamp Brazil), even though it's 100 km from the border. Note that the border office in San Matias isn't always open. On weekends, the official opening hours are 7:30 to 14:30 (as of November 2014). In Brazil it's 24h at the federal police.
You are not allowed to bring certain plant and animal products into Brazil, so try to finish your food before crossing the border. I wasn't checked, but it could happen and I suppose it's better to avoid trouble.
You have to take a taxi from San Matias to the border which should be no more than 7 Reals (if shared) or 15 Reals (single) (prices as of November 2014). Of course you could also pay in Bolivianos if you still have some. But you will need Reals to pay the bus from the border to Cáceres, a single ticket is 19 Reals, so exchange some money while in San Matias. There is an exchange office in town. You can also take a shared taxi, which should be 25 Reals and is much faster and more convenient as it can bring you directly to your destination in Cáceres, rather than the bus terminal. In my case, it brought me to the federal police for immigration first, waited for me, then we went to the bus terminal for onward travel at no additional cost. (Although not every taxi driver may be as nice and friendly.)
Good luck to anyone on that route!
| 1 |
Bus from Santa Cruz to San Matias in Eastern Bolivia, on the border to Brazil
|
local AJAX-call to remote site works in Safari but not in other browsers
|
I am maintaining a website that uses Javascript. The script uses jQuery and loads some content from the server at which the site is normally hosted.
Just for convenience while maintaining the site, I run a local copy of the site on my iMac. This works perfectly fine when I use Safari. But Firefox, Opera and Chrome refuse to work. I guess it is because of cross-domain-policy. (I couldn't test this with IE, because IE has to run in a virtual machine on my iMac, so for this reason it is not possible to access any local files)
Is there a setting within Firefox and the other browsers where I can tell the browser that it is ok to ajax-load files that are located on a remote server from a local html-page with a local javascript?
In a nutshell: This my html-page:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>some title</title>
<link rel="stylesheet" type="text/css" href="../css/stylesheet.css">
<script src="../js/jquery-2.1.3.min.js"></script>
<script src="../js/myScript.js"></script>
</head>
<body>
<!-- some content with a div-container to receive the ajax-content -->
</body>
</html>
This is myScript.js:
var errorMsg = function (msg) {
//insert the message into the html-page
};
var JSONerror = function (jqXHR, textStatus, errorThrown ) {
var msg = 'JSON-answer: '+jqXHR.responseText;
msg += '<br>'+'JSON-Errorstatus: '+textStatus;
if ($.type(errorThrown) === 'string') {
msg += '<br>'+'Error: '+errorThrown;
}
errorMsg(msg);
};
var JSONreceive = function (JSONobj, StatusString, jqXHR) {
//insert the data in JSONobj into the html-page
}
var StartAJAX = function () {
$.ajax({
url: 'http://my.domain.tld/cgi-bin/myPerlScript.pl',
data: "lastID=" + lastID
+ '&qkz=' + Math.random(),
dataType: "json",
success: JSONreceive,
error: JSONerror
});
};
There is also an event-listener, that listens for page-scroll and resize and checks some other constraints (like: is there already an ajax-call in progress?). This listener calls StartAJAX.
When it calls StartAJAX on a local copy of my page (file:///User/...) within Safari, I get the Ajax-content perfectly fine inserted into my html-document. within the other browsers i get the error-message inserted into the html-page. It is:
JSON-Answer: undefined
JSON-Errorstatus: error
Error:
Why does it work in Safari but not in Firefox, Chrome and Opera?
How can I make those browsers work?
(I need to test it with all browsers, because all browsers render the same html-domument differently, but I don't want to upload all files to the server after every change just to test it.)
EDIT:
After reading some answers, I want to make something clear, that I obviously did not make clear enough:
I am searching for settings in Webbrowsers
I will NOT change the settings of my remote webserver (Apache)
I will NOT manipulate any files on my remote machine (.htaccess)
I will NOT set up a webserver on my local iMac
I will NOT change the code of the AJAX-calls in my Javascript-files
I will NOT change the code of the Perl-Scripts on my remote Server
I can tell you why:
I am just doing a short maintainance, and i am too lazy to upload every manipulated file to the remote machine after I edited it. The settings of the webserver are fine for actual operation. I don't want to change them (and maybe forget the changes before finishing my work). Same for the scripts: Those parts that some of you want to change work fine as they are now. There is no reason to touch the Ajax-Calls, because there is nothing wrong with them in the productive environment.
All I want is that those stupid browsers Firefox, Opera and Chrome behave like Safari and process the Ajax-calls correctly.
BTW:
Please can anyone explain what is so risky to call data via Ajax from an other domain in Firefox, Opera or Chrome while it seems to be harmless doing the same thing in Safari?
|
To avoid this issues, you should develop your page (in your local computer it's ok) using a webserver (like apache, nginx, ...), so, your url ajax calls starts with the protocol http or https, not "file". "File" is the path of your file but using SO path system, not a web server system.
In the other hand, browsers has "Same Origin Policy". This is a security feature but what are the "problems" in web development using ajax calls? Well, your ajax calls always be done to the same server, for example, if you have your web on domain "http://my-domain.com" then your ajax calls must be to the same domain "http://my-domain.com".
To "bypass" SOP in ajax calls, you have three solutions:
Create a proxy on your "my-domain.com" that use curl (in php for example) to retrieve the data and return it to your ajax call
Use JSON-P
Allow your domain in your webserver (.htaccess for example) setting a proper configuration to CORS: http://enable-cors.org/
BTW
I am going to answer: "Please can anyone explain what is so risky to call data via Ajax from an other domain".
(Copy & paste from mozilla MDN https://developer.mozilla.org/en-US/docs/Web/Security/Same-origin_policy)
The same-origin policy restricts how a document or script loaded from
one origin can interact with a resource from another origin.
Same-origin Policy is used as a means to prevent some of the
Cross-site Request Forgery attacks.
| 1 |
What are the "problems" in web development using ajax calls?
|
How to troubleshoot Canon Speedlites that are not firing at the same time?
|
I'm working on some studio lighting and want to have my two Canon Speedlite 580EX IIs fire simultaneously using Canon's built-in wireless communications (i.e., I want the master to trigger the slave, but also provide some fill flash). I am pretty sure I had this working at some point, but now I have noticed that the master flash fires when the shutter is pressed, but the slave flash fires a good 1 or 2 seconds after the master has fired (and after the shutter has closed and photo has already been taken). I have been poring over documentation and videos wondering what I could have missed. Surely it is a setting somewhere that I have accidentally set?
MASTER 580EXII
Set to ETTL
Channel 1
On
Ratio A:B is 1:1
SLAVE 580EXII
Channel 1
On
Group B
Notes: I have tried a couple of things:
Connecting the master and slave with the mini phone jack.
Making sure the master is directly in front of the slave's panel so there could be no interference with the signal.
I have tried it with the Master ON and the Master OFF.
I have tried it with the Master both on the camera's hotshoe and on a jotshoe adapter.
Even tried replacing all the batteries in both flashes.
Have tried both flashes in Group A.
I will try to attach pics of the LCD panels. I must be missing something obvious... please forgive me if I did. Thank you in advance!
P.S. I have the Master set for a -1 FEC but I have tried removing that as well.
|
I have found with working with a Canon 580EXII and a 430EX that you require line of sight between the flashes to fire correctly when the 580EXII is the master. A way around this is to get a 3rd party wireless flash controller or in the newer canon DSLRs have wireless control from the on body flash which can get around some minor corners as the flash lights up the area and hit the IR receiver on the flash. the on camera flash will flash before the shutter opens so it doesnt effect the photo.
| 1 |
Canon 580EXII and 430EX are master wireless flash controllers
|
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?
|
In the TOS episode "Omega Glory", it is stated the Exeter starship (like the E) has four shuttlecrafts aboard. I would presume the E 1701 would also carry four.
| 0.888889 |
Exeter starship has four shuttlecraft aboard .
|
MSSQL Select with "vertical"-where
|
I don't really know how to explain except with "vertical where".
Imagine the following table:
TAGID|PRODUCTID|SHOP_ID
59 |3418-7 |38
61 |3418-7 |38
60 |4227-4 |38
61 |4227-4 |38
Now I want to return all product IDs, that have relation to the tag IDs: 59,61. In other words, values of product ID where rows exist for both tag IDs.
So I want to return 3418-7, but not 4227-4
How do I write this as simple as possible in a SQL statement?
This is the working statement I have so far, but I feel this could be done in a much smarter way:
SELECT
productid
FROM shop_tag_relations
WHERE
productid IN (select productid from shop_tag_relations WHERE tagid=59)
AND
productid IN (select productid from shop_tag_relations WHERE tagid=61)
GROUP BY productid,shop_id
|
SELECT PRODUCTID
FROM T
WHERE TAGID IN (59,61)
GROUP BY PRODUCTID
HAVING COUNT(DISTINCT TAGID) = 2
Or
SELECT PRODUCTID
FROM T
WHERE TAGID = 59
INTERSECT
SELECT PRODUCTID
FROM T
WHERE TAGID = 61
| 1 |
SELECT PRODUCTID FROM T WHERE TAGID
|
ASP.NET membership/ automatically log existing user on
|
I have used facebook to allow users to log into a site. The page that manages the login will get the users facebook id and then look on the ASP.NET membership tables for a pre-existing user that has a matching ID.
No match: a new user is created and logged in (no problem).
A match: I want to log the user on. The problem is that I have the hashed password and I cannot use MembershipService.ValidateUser(logOn.UserName, logOn.Password) to log the user on.
If I just use FormsAuthentication.SetAuthCookie, the user doesn't appear as logged in.
I could set enablePasswordRetrieval to true in the web config and then just get the actual password, but I don't want to. I want this to be secure.
Does anyone know a way to log a user onto ASP.NET Membership just using the user name? I have looked at the MembershipProvider class for alternative methods but I cant find any.
Thanks,
Oliver
|
I think you can try to create your own authentication cookie containing a custom authentication ticket.
Refer to this msdn article on how to create your own auth ticket and cookie
http://msdn.microsoft.com/en-us/library/ff649204.aspx
| 1 |
How to create a custom authentication ticket?
|
Laravel 4 Cashier: Don't fire webhook if initiated from laravel application
|
I'm using Laravel 4 with Cashier 2.0 and its webhook controller. I want to prevent following behavior: When I create a new subscription for a user within my laravel application, this turns out to execute the method subscription.updated webhook.
However I want to prevent that the webhooks are executed if the request was made within the laravel application. The webhooks should only execute if there were initiated from the Stripe admin panel directly. Someone that can help me with this?
|
I'm not sure why you would want to do that. The point of the webhooks are to confirm actions have been received and successfully (or unsuccessfully) completed by Stripe so you know certain things have happened (i.e: A user has successfully been subscribed to a subscription, a charge has happened on a users card, etc.). All of this depends on your application successfully communicating with stripe and stripe successfully billing the card, many things could happen in that processes and the webhooks are there for you to be able to confirm what happened, and if it went wrong, what went wrong.
The behaviour you're after cannot be achieved without your application making no communications with Stripe.
| 0.666667 |
Stripe's webhooks confirm actions have been received and successfully completed .
|
Can the term "jack/jerk off" be used for female masturbation?
|
I apologize for this potentially obscene question.
Can the terms jack off or jerk off be used for female masturbation? If not (which is my intuition), what would be the not too poetic vulgar slang equivalent? By too poetic I refer to expressions such as spank the monkey, choke the chicken, etc.
I checked online dictionaries, and most of them don't expand on the usage, and some of the definitions in the Urban Dictionary imply that jack off primarily refers to male masturbation, but do not provide the female counterpart.
|
I would mention "diddle, which is mentioned as a female alternative to "masturbate" alongside "jill off". By the way, it bears an assonance to "dildo", which is normally connected with female masturbation. See http://en.wiktionary.org/wiki/diddle
| 1 |
"diddle" is mentioned as a female alternative to "masturbate"
|
Generating all keypad possibilities
|
I ran into this question on Stack Overflow. It looked like a really cool thing to try myself, being that I haven't done any recursion for ages (read at least 2 years).
var keypadPossibilities = (function()
{
var keypad_mapping = [
[],
['a','b','c'],
['d','e','f'],
['g','h','i'],
['j','k','l'],
['m','n','o'],
['p','q','r','s'],
['t','u','v'],
['w','x','y','z']
];
function getPosibilities(keypad_mapping_indexes)
{
//if only 1 keypad mapping index: simply return the characters
if ( keypad_mapping_indexes.length === 1)
{
return keypad_mapping[keypad_mapping_indexes.shift()];
}
//still multiple keypad mapping index left. lets do some magic
var currentIndex = keypad_mapping_indexes.shift(), posibilities = [],
characters = keypad_mapping[currentIndex];
var charactersToGlueAtEnd = getPosibilities(keypad_mapping_indexes);
for ( var i in characters )
{
for ( var j in charactersToGlueAtEnd )
{
posibilities.push(characters[i]+charactersToGlueAtEnd[j]);
}
}
return posibilities;
}
return function(pressed_keys)
{
return getPosibilities(pressed_keys);
}
})();
Usage would be:
keypadPossibilities([1,2,3]);
It works, so thats nice (no debugging required, that was a first). So, shoot, code remarks, performance remakrs, ... You can go full package. Everything to learn new cool stuff about JS.
|
Overall, I'd say recursion is a good way to go. Good use of an IIFE to keep things tidy as well. I do however have some concerns.
Input checking
Firstly, if I pass an empty array, I get a stack overflow, since you only check for a length of 1 - not for a length < 1. I am technically passing the correct type (an array) to the function, so it should handle it (if I pass something that's not an array, then it's my own fault).
Also, if I pass [9] (or [31415]) I just get undefined back, though an empty array would probably be more fitting.
shift() is destructive
Be careful with shift()! You're modifying the array that's been passed to the function, even though it doesn't really "belong to you". The caller might still have a use for it.
For instance,
var numbers = [1, 2, 3];
var words = keypadPossibilities(numbers);
console.log("You typed " + numbers.length + " digits, producing " + words.length + " possible words");
will print
You typed 0 digits, producing 27 possible words
Wait, zero digits? Thing is, numbers is suddenly empty; everything's been shifted out by passing it to keypadPossibilities.
This of course also happens when the function recurses, which could spell trouble. Luckily, in your case, you don't use the input array for anything after having recursed, but if you did you'd find that the recursion had truncated it down to empty.
Don't use for...in for arrays
for...in will iterate properties of an object, and with no guaranteed order. It usually works for arrays, but it's not a sure thing. It's semantically different from iterating the actual, indexed elements in the array. So use either a regular ol' for loop, or - if you're targeting modern runtimes, maybe a forEach().
However, you could also use map() and reduce() in this case (see below).
Other stuff
This function-wrapper around a call to getPosibilities is unnecessary:
return function(pressed_keys)
{
return getPosibilities(pressed_keys);
}
(Oh, and there's a typo: getPosibilities is missing an extra "s". I'll just use the corrected name from hereon out)
You could simply replace the above with just:
return getPossibilities;
and done.
However, with the point about shift() in mind, the easiest thing to do would probably be something like
return function(pressed_keys)
{
return getPossibilities(pressed_keys.slice());
}
Now, pressed_keys gets sliced (duplicated) before it's passed to getPossibilities.
You could also do the slicing in getPossibilities (and do the direct return, shown above), but - as the code's already proved - you don't really need it there. But in the interest of being thorough, it'd look something like:
var currentIndex = keypad_mapping_indexes[0]
// ... snip ...
var charactersToGlueAtEnd = getPossibilities(digits.slice(1)); // duplicate array from index 1 and up
A few notes on style
In terms of style, I'm not a fan of brace-on-new-line in JavaScript. Yes, it works, but it can bite you, since JS will sometimes do automatic semicolon insertion at newlines and break your code. So the convention is to use brace-on-same-line style.
Also by convention, all names in JS should be camelCase. You're using a bit of both; aim for consistency.
Here's a possible version incorporating the points above
var keypadPossibilities = (function() {
var keypadMapping = [
null,
['a','b','c'],
['d','e','f'],
['g','h','i'],
['j','k','l'],
['m','n','o'],
['p','q','r','s'],
['t','u','v'],
['w','x','y','z']
];
function getPossibilities(digits) {
var characters = keypadMapping[digits.shift()],
charactersToGlueAtEnd;
if(!digits.length) {
return characters || [];
}
charactersToGlueAtEnd = getPossibilities(digits);
return characters.reduce(function (memo, character) {
var words = charactersToGlueAtEnd.map(function (string) { return character + string; });
return memo.concat(words);
}, []);
}
return function (digits) {
return getPossibilities(digits.slice()); // make sure we work on a copy of the input array
};
})();
| 0.888889 |
recursion is a good way to go .
|
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?
|
It is a pebble-on-the-beach approach - how many people are going to find the room, know that there is a diadem in there that is significant (and know what a diadem is, for that matter), be able to find it, and destroy it? Voldemort was relying on the anser being no-one, at least until such a time as he was powerful enough to not be bothered.
And remember that finding the Room of Requirement is not the same as finding the Room of Hidden Things. Finding the RoR is one challenge, but finding as the RoHT - reliably, so that you can come back to it - was a one in a million chance.
And @OghmaOsiris - the fact that three schoolchildren thwarted Voldemort several times is one of the suspensions of disbelief required for the series.
| 1 |
How many people are going to find the room, find it, destroy it?
|
Dynamic Programming: find the minimal route with ten nodes from a set of 100 nodes
|
You are given 100 stations and distance between each adjacent stations. Now you have to select 10 stations(means 10 hops) among those 100 stations in such a way that maximum of distance between any 2 hops will be minimised. By default 1 and 100 stations are selected , so you need to choose only 8 more stations.
|
You are going to need to give us a question. It looks like you are being asked a question for an interview and then want us to give it to you to reiterate to an employer. It is pretty easy though, i have a similar program on my home pc implementing a few different path finding techniques.
| 0.666667 |
You are going to need to give us a question for an interview
|
On the singularity $r=0$ of the Schwarzschild metric
|
I faced following sentences:
Unlike the co-ordinate singularity at $r = 2M$, the origin of the Schwarzschild metric $r = 0$ has a true curvature singularity. It was first believed that this singularity was an artifact of spherical symmetry and that a generic collapse would evade the singularity. However, work by Hawking and Penrose showed that this was not so and that singularities were generic rather than special. The ubiquity of singularities is guaranteed by the singularity theorems by Hawking and Penrose.
Question1: What is the meaning of "generic collapse"?
Question2: When is a singularity an artifact of spherical symmetry?
|
I believe that both questions are easily answered even without a GR background. Saying that something is an artifact of spherical symmetry means, in this context, that it was expected that the singularity would not occur in cases where no perfect symmetry is assumed. Since perfect spherical symmetry only ever occurs in theory, this would solve the problem of the singularity: it would never appear in practice. The real-life case is referred to as 'generic', denoting pretty much that it does not have any special properties (like perfect spherical symmetry) associated with it.
| 0.666667 |
spherical symmetry only ever occurs in theory .
|
Add date tickers to a matplotlib/python chart
|
I have a question that sounds simple but it's driving me mad for some days. I have a historical time series closed in two lists: the first list is containing prices, let's say P = [1, 1.5, 1.3 ...] while the second list is containing the related dates, let's say D = [01/01/2010, 02/01/2010...]. What I would like to do is to plot SOME of these dates (when I say "some" is because the "best" result I got so far is to show all of them as tickers, so creating a black cloud of unreadable data in the x-axis) that, when you zoom in, are shown more in details. This picture is now having the progressive automated range made by Matplotlib:
Instead of 0, 200, 400 etc. I would like to have the dates values that are related to the data-point plotted. Moreover, when I zoom-in I get the following:
As well as I get the detail between 0 and 200 (20, 40 etc.) I would like to get the dates attached to the list.
I'm sure this is a simple problem to solve but I'm new to Matplotlib as well as to Python and any hint would be appreciated. Thanks in advance
|
import matplotlib.pyplot as plt
import pandas
pandas.TimeSeries(P, index=D).plot()
plt.show()
| 0.888889 |
import matplotlib.pyplot as plt import pandas pandas.TimeSeries
|
C#: Is it possible to have partial extension classes
|
I am looking to create Extension classes that extend Entity Framework Entities in a different assembly to the EF Entities. I also want to code gen some additional/generic methods in an extension methods class (using T4), then have the ability to create a partial extension methods class with additional custom methods. Is this possible.
|
Yes - i tried it and it worked.
There is no such thing as an "extension" class - there are only extension methods which must be inside a "static" class.
You can have static partial classes.
UPDATE: Sorry I read your heading but not the text of your question.
The answer is still yes, but why not just create new classes? I can't see how having a partial class really helps in this case.
| 1 |
Why not create static partial classes?
|
UIImage - should be loaded with [UIImage imageNamed:@""] or not?
|
I am having number of images with in my application. ( images more than 50 - approximately & it can extend according to client's need )
Each image are very large round about - 1024 x 768 & 150 dpi
Now, I have to add all this images in a scroll view & display it.
Ok, My question is as follows.
According to me there are two options of loading large images
imageNamed:@""
load asynchronously when viewDidLoad Called.
Which is more preferable ?
imgModel.image=[UIImage imageNamed:[dMain valueForKey:@"imgVal"]];
or like this.
NSURL *ur=[[NSURL alloc] initFileURLWithPath:[[NSBundle mainBundle] pathForResource:lblModelName.text ofType:@"png"] isDirectory:NO];
NSURLRequest *req=[NSURLRequest requestWithURL:ur cachePolicy:NSURLCacheStorageNotAllowed timeoutInterval:40];
[ur release];
NSURLConnection *con=[[NSURLConnection alloc] initWithRequest:req delegate:self];
if(con){
myWebData=[[NSMutableData data] retain];
} else {
}
-(void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response {
[myWebData setLength: 0];
}
-(void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data {
[myWebData appendData:data];
}
-(void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error {
[connection release];
}
-(void)connectionDidFinishLoading:(NSURLConnection *)connection {
NSLog(@"ImageView Ref From - %@",imgV);
// my image view & set image
imgV.image=[UIImage imageWithData:myWebData];
[connection release]; connection=nil;
}
|
Are you aware that the images won’t fit into memory all at once? If you want to scroll between them, you have to page them in and out to keep a decent memory footprint.
As for loading them, you should probably display a spinner, start loading the image in background and then replace the spinner with the image once it’s ready. Loading the image using NSURLConnection is overkill, you’ll probably have it easier with imageNamed:
- (void) startLoadingImage {
// You need an autorelease pool since you are running
// in a different thread now.
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
UIImage *image = [UIImage imageNamed:@"foo"];
// All GUI updates have to be done from the main thread.
// We wait for the call to finish so that the pool won’t
// claim the image before imageDidFinishLoading: finishes.
[self performSelectorOnMainThread:@selector(imageDidFinishLoading:)
withObject:image waitUntilDone:YES];
[pool drain];
}
- (void) viewDidLoad {
UIActivityIndicator *spinner = …;
[self.view addSubview:spinner];
[self performSelectorInBackground:@selector(startLoadingImage)
withObject:nil];
}
- (void) imageDidFinishLoading: (UIImage*) image {
// fade spinner out
// create UIImageView and fade in
}
The method names are spelled from memory, I might have missed a param here or there. But in principle the code is sound.
| 0.888889 |
Loading the image using NSURLConnection
|
can I use a disk larger than 320 GB with RPi?
|
I have a 500GB Toshiba 2.5' HD, which I formated using Debian Wheezy 64bit. I created 2 partitions (180GB and 320GB).
RPi would only recognize the first partition.
So, I tried creating the partitions using the raspberrypi. Here are my surprising findings:
root@raspberrypi:/home/ozn# fdisk -l
Disk /dev/mmcblk0: 4025 MB, 4025483264 bytes
4 heads, 16 sectors/track, 122848 cylinders, total 7862272 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000dbfc6
Device Boot Start End Blocks Id System
/dev/mmcblk0p1 8192 122879 57344 c W95 FAT32 (LBA)
/dev/mmcblk0p2 122880 7862271 3869696 83 Linux
Disk /dev/sda: 320.1 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders, total 625142448 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x950e3b8d
Device Boot Start End Blocks Id System
/dev/sda1 2048 625142447 312570200 83 Linux
/dev/sda2 625142448 976773167 175815360 83 Linux
First, /dev/sda is NOT recognized correctly! This disk is 500GB.
Second, mounting /dev/sda2 is not possible:
root@raspberrypi:/home/ozn# mount -t ext4 /dev/sda2 /media/usbhdd1/
mount: special device /dev/sda2 does not exist
# although fdisk -l showed this device !
Third, trying to format the disk, it really sees only the sectors until 320GB:
When I start fdisk I am warned:
Building a new DOS disklabel with disk identifier 0x6784fc4b.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
I have other USB hard drives with 320GB and they really mount fine.
Is this a limitation of RPi? Or a problem with this specific Hard Drive?
How can I use this large disk with my RPi?
update: solved the issue with help of the commentators here...
here is what I did ...
I thought I have some weired issue with Debian Wheezy & gparted. So, I reformatted the hard drive to NTFS. Before that I ERASED the partition table.
And created a new single NTFS partition.
Bingo! RPi, identified the partition. However, it claimed my Drive is now 2TB big, and recommended I will use GPT:
root@raspberrypi:/home/ozn# fdisk -l /dev/sda
Disk /dev/sda: 2199.0 GB, 2199023255552 bytes
255 heads, 63 sectors/track, 267349 cylinders, total 4294967296 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xf720f720
Disk /dev/sda doesn't contain a valid partition table
root@raspberrypi:/home/ozn# fdisk /dev/sda
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0xb7032c3f.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
WARNING: The size of this disk is 2.2 TB (2199023255552 bytes).
DOS partition table format can not be used on drives for volumes
larger than (2199023255040 bytes) for 512-byte sectors. Use parted(1) and GUID
partition table format (GPT).
whoops! That is WRONG!
So, I disconnected the hard drive again. re-connented it to my laptop. I erased the partition table again, and re-created the partition table using fdisk on RPi! not on my laptop! This time, I took a short cut, and created the disk partition with ext4 directly.
I plugged the hard-drive to RPi and BINGO!
root@raspberrypi:/home/ozn# fdisk -l
Disk /dev/sda: 500.1 GB, 500107862016 bytes
81 heads, 63 sectors/track, 191411 cylinders, total 976773168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000505b8
Device Boot Start End Blocks Id System
/dev/sda1 2048 976773167 488385560 83 Linux
Disk /dev/mmcblk0: 4025 MB, 4025483264 bytes
4 heads, 16 sectors/track, 122848 cylinders, total 7862272 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000dbfc6
Device Boot Start End Blocks Id System
/dev/mmcblk0p1 8192 122879 57344 c W95 FAT32 (LBA)
/dev/mmcblk0p2 122880 7862271 3869696 83 Linux
Disk /dev/sda: 500.1 GB, 500107862016 bytes
81 heads, 63 sectors/track, 191411 cylinders, total 976773168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000505b8
Device Boot Start End Blocks Id System
/dev/sda1 2048 976773167 488385560 83 Linux
The disk is now identified correctly on my laptop with Debian.
ozdeb@yenitiny:~$ sudo fdisk -l /dev/sdb
Disk /dev/sdb: 500.1 GB, 500107862016 bytes
81 heads, 63 sectors/track, 191411 cylinders, total 976773168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000505b8
Device Boot Start End Blocks Id System
/dev/sdb1 2048 976773167 488385560 83 Linux
conclusion (?)
My guess is that gparted in Debian Wheezy includes some nasty bug which is sometimes showing it's ugly face. I would report a bug if I had more solid evidence. But ... since I have only one 500GB hard drive, and I don't want to
risk the health of this hard drive reformatting it so many time, I will settle this with it. If you happen to bump into this post, and you have had similar problems with large SATA drives and partitioning on wheezy, I would be happy to know.
|
Basically instead of fdisk -l, you should use parted -l (install parted if you do not have it installed) to see the actual data partition and then mount the actual data partition (/dev/sdb2, etc) directly.
I wrote a short tutorial on how to do this:
http://www.zayblog.com/computer-and-it/2013/07/22/mounting-gpt-partitions-on-raspberry-pi/
I was able to mount 2 8TB partitions directly, without wiping the data/reformat the drive.
| 0.888889 |
Using parted -l to see the actual data partition
|
How to remember a trusted machine using two factor authentication (like Google's system)
|
We are developing a web application that will use two factor authentication. We are likely to try and emulate something similar to that used by google, where to login you enter a username and password, and then receive a token in an SMS message to be entered as well.
We would like to allow users to remember a client machine if they would like to so that they can login for 30 days without requiring the second authentication method. What information will we have access to (through headers of the web page requests etc.) which we can use to uniquely identify this trusted client machine?
Obviously a user can have more than one trusted client machine, and I completely expect that if they use two different browsers on the same trusted machine machine, each browser will have to be trusted independently.
Setting a cookie on the machine with some GUID which means this is trusted simply would not be good enough, as someone else could just copy the cookie, and create it on their own browser circumventing the two factor authentication.
|
I don't think that it is entirely possible with just Javascript/PHP (or some other server side language) to uniquely imprint/identify a computer.
Remember, whatever you do, someone with malicious intent can just copy the Chrome/Firefox user data directory to a similar system (same OS, etc). Indeed, that's the easiest thing to do, since you don't have to hunt for the cookies. Javascript can't read anything outside these directories, so they have just duplicated the system.
However, you can use Flash/Java to fingerprint the browser. Unfortunately, the browser fingerprint can change if the user installs fonts/etc. Besides, your users will have to allow the Flash/Java to run -- nowadays quite a few people are disabling Java due to the recent 0 Day exploit. You don't want to force your users to have to use these. Anyway, one can easily replicate a fingerprint by replicating the system (which takes time, but isn't too hard).
In the end, two factor auth is all about (a) having a password, and (b) having physical access to a device. If you are giving someone unsupervised access to your computer while logged in as you, part (b) is compromised anyway, in a different manner.
To answer your question, though:
You can put a unique GUID in a cookie
You can put another GUID in localStorage
You can associate part of the browser User-Agent request header with the account. For example, my User Agent is User-Agent:Mozilla/5.0 (X11; Linux i686) AppleWebKit/536.11 (KHTML, like Gecko) Ubuntu/12.04 Chromium/20.0.1132.47 Chrome/20.0.1132.47 Safari/536.11. From here, you can extract my browser name (which won't change), OS name and version (which will change occasionally), whether or not my computer is 32 bit, etc.
navigator.plugins -- This is an array of all the plugins installed on the browser. Maybe not a good idea for 2 factor authentication, though, since this changes often.
Note that all of these can be easily spoofed. It's just extra hoops for a would-be hacker to jump through.
Again, you can try using fingerprinting techniques that deal with reading the list of installed fonts, etc. Again, this can be circumvented, but it's much harder. You can also use Java to store cookie-like files in random places on the computer (not sure if that's a good idea)
Edit: As Joel mentions in the comments, you should also have a way of revoking "trusted computers" (simply dissociate the GUID in your database). And this should apply when the password is changed as well.
| 1 |
Using Javascript/PHP to uniquely imprint/identify a computer
|
Solution disappearance responsive navigation after open/close
|
I asked this before, but still not successful. Hope someone can help me now... In the fiddle you see a responsive menu that has 4 menu-items horizontal inline when it is larger than 1000px. Smaller than 1000px the menu shows a nav-btn (now a RED box!) that onclick shows the menu-items, but when open and close and resize to larger than 1000px the rest of the 3 menu-items don't show up. I did some tests with media queries but i think the solution must be find in the javascript part. Anyone can handle this challenge?
Here the FIDDLE
$(function() {
$('.nav-btn').click(function(event) {
$('nav ul').fadeToggle(300);
});
});
|
Well, the problem is that your fadeToggle sets your nav > ul to style="display: none". Styles set directly overrides any stylesheets, unless you use !important.
As such, and combining with NMindz answer, try this:
@media all and (min-width: 1000px) {
nav ul {
display: block !important;
top: 60px;
}
}
You could also try a pure css solution that would probably be better. Something like
nav ul.show {
display: block;
}
And for the javascript
$(function() {
$('.nav-btn').click(function(event) {
$('nav ul').toggleClass("show");
});
});
| 1 |
Styles set directly overrides any stylesheets, but not !important
|
Is there added value in having your own presentation layout and using it consistently?
|
From the perspective of a Ph.D. student, how much of an added value is it to have your own presentation slides layout, that is used consistently throughout your Ph.D. conference presentations and other talks (and possibly throughout your academic career afterwards)?
Here is one such example from the Computer Science community.
This as as opposed to using existing Beamer templates with LaTeX, or built-in PowerPoint templates, or simply preparing each presentation on its own (without a specific layout).
A couple of axes I can think along:
Creating a signature layout that distinguishes one in their community
Ease of preparation of presentations (especially over time), maybe overcoming constraints with existing templates.
Note that I am not concerned with the question of content, but just design and layout.
|
I see pros and cons; which ends up winning out depends on your skill mix.
First - designing a good layout takes effort and expertise. Graphics designers study many years to get good at it. Just because tools are provided to make it easy doesn't mean everyone is suddenly a graphical designer. The right blend of colors, fonts, space etc is not an easy thing to achieve. 99% of "I can do better" layouts look horrid.
Having said that, I have at times come across layouts that made me go "wow". This is where the layout really supported the flow of the presentation, and while I was not getting distracted by the details, I came away more impressed. This was mostly because the presentation itself was very good - the contents were impressive, the speaker was very clear, and the layout of the presentation supported the spoken words.
In those cases, the personal layout was the icing on the cake - not a substitute for good work. There is a lot you can do to improve your presentation without spending any time on the layout. Fiddling with layouts (like fiddling with LaTex) can become an easy distraction from the real issues with your presentation. I urge you to consider whether your interest in the "look" is coming at the right time: in other words, is every other aspect of your presentation skills (content, pacing, connecting with the audience) so good that layout is the only thing left to play with?
If the answer is "yes", then my answer to your question is "yes". Otherwise, I think it's a bit early to work on creating your brand through a custom layout. Many people in the scientific community - especially at the PhD level - could do with honing their presentation skills. They could learn not to confuse slides with notes. They could learn to connect with their audience. They could learn to speak at an appropriate pace, and project their voice. They could learn to focus on the essentials and not bombard the audience with details. They could learn to use slides as visual aids - not "the main course" of the presentation.
While I don't know you or your skills, I would say that I have statistics (based on 25+ years of empirical evidence) on my side when I answer "probably not" to your original title question.
| 0.888889 |
How do you improve your presentation without spending time on the layout?
|
Negatively curved metrics minimizing the length of a homotopy class of simple closed curves
|
Good afternoon everyone !
I have the following question of Riemannian geometry :
Let $M$ be a smooth closed orientable manifold of dimension at least $3$, and let $\mathcal{T} = \{ $ smooth Riemannian metric on $M$ with sectional curvature pinched between $-1- \epsilon$ and $-1$ $\}$ where $\epsilon$ is an arbitrary positive number. Assume that $\mathcal{T}$ is non-empty.
Let $\gamma $ be a simple closed curve in $M$. It is classical that for every negatively curved metric $g$ there is a unique closed curve in the free homotopy class of $\gamma$ that is length minimizing. Note $L_g(\gamma)$ the length of such a curve.
1) Is it known whether $ \inf_{g \in \mathcal{T} }{L_g(\gamma)}$ is positive or zero ?
2) Is it known whether $ \sup_{g \in \mathcal{T} }{L_g(\gamma)}$ is finite or infinite ?
3) Can one say more in specific cases, say when $M$ is hyperbolic ?
Obviously in dimension 2 Fenchel Nielsen coordinates show that $ \inf_{g \in \mathcal{T} }{L_g(\gamma)}$ is zero and $ \sup_{g \in \mathcal{T} }{L_g(\gamma)}$ is infinite. Nonetheless, the lack of topological symmetries for higher-dimensional hyperbolic manifolds make me hope that the opposite might be true.
Thanks for your attention !
|
A very partial answer: by the results of Richard Bamler, bounds on Ricci curvature (which is less than what you are requiring here) and diameter (more than you are requiring), implies that the metric is Lipschitz close to an Einstein metric. In three dimension, this means that the length of the homotopy class is close to that of the hyperbolic manifold. In higher dimension, if your manifold is (topologically) hyperbolic, then the Einstein metric is actually hyperbolic (Leung, 1997), so same as above.
PS Of course, if you have a diameter bound, then your lengths are bounded below in the two-dimensional case (by the collar lemma, if you like).
| 0.777778 |
bounds on Ricci curvature and diameter (more than you are requiring) implies that the metric is Lipschitz close to
|
Creating Sharing Rules on run-time(While opportunity is being saved/edit) using apex code
|
Is it possible to create sharing rules at run-time? If yes then please explain how can we do that in save method/trigger?
Actually i need to bypass role hierarchy setting and for that i need to create Sharing Rules at run-time to give a particular user(is a field on opportunity) to edit right on that opportunity. Actually that particular user comes below in role hierarchy than the owner of opportunity.
|
AFAIK you cannot create a sharing rule at runtime. But yes you can share the opportunity to the user (which as per you question is a field in the oppty). You can insert a record in the opportunityShare object which will give either read or write access. You can add the below code in the an after insert trigger / after update trigger of opportunity.
opportunityShare opptyShare = new opportunityShare();
opptyShare.OpportunityAccessLevel = 'Read';// other values that can be added are 'Edit' and 'All'
opptyShare.OpportunityId = opptyID; //add the oppty Id which you want to share.
opptyShare.UserOrGroupId = userId; //add the UserId which to which you want to share the oppty
insert opptyShare; // insert the oppty share records.
You can read more about it here : http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_objects_opportunityshare.htm
| 0.5 |
How to share the opportunity to the user?
|
relation between eigenvectors of $A$ and $A^TA$?
|
Is there a relation between the eigenvectors of a linear operator (Matrix) $A$ and eigenvectors of $A^TA$? This question is related to eigenvectors ans not eigenvalues. Further the size of the matrix $A$ and $A^TA$ are different if $A$ is not a square matrix. So my question has no relation to the question about eigenvalues of $A$ ans $A^T$.
|
There is no simple relation between eigenvectors of $A$ and of $A^*A$ unless $A$ is normal. For example, if
$$
A=\pmatrix{0&1\\0&0},
$$
$A$ has only one dimensional eigenvector subspace spanned by $[1,0]^T$, but $A^*A=0$ so any nonzero 2-vector is its eigenvector. Even if $A$ is diagonalizable, the eigenspaces of $A$ and $A^*A$ can be completely different.
If $A$ is normal, then $A=UDU^*$ for a unitary $U$ and diagonal $D$, so $A^*A=U|D|^2U^*$ is the spectral decomposition of $A^*A$.
However, there is a simple relation between left singular vectors of $A$ and the eigenvectors of $A^*A$ as indicated in another answer.
| 0.888889 |
Relation between eigenvectors of $A$ and $A*A$
|
Need directions regarding the learning process I should follow for learning Photoshop
|
I am starting out as a freelance website developer so I need to improve my graphics drawing skill. Up till now I'm using an open source tool GIMP to create the concepts and mock ups of the websites I design.I know that Photoshop is the Industry standard(at least as far as I know).
So,what books can help me in learning some advanced Photoshop techniques used frequently in web designing.Also I want to learn how to draw cartoon characters like this.I know it is a matter of creativity but still there must be some techniques which I can learn.Please express your views.
Just for the record, I'm basically a web developer so my graphics drawing capabilities are very limited(but I want to improve that). You can have a look at this site I designed using GIMP.
|
Personally, I find that Illustrator (with pixel preview and align to pixel grid) has been much more useful than Photoshop in a web workflow. Artboards are intuitively helpful when designing for multiple output devices, the Pathfinder panel allows you to create more nuanced objects, and the Symbols palette allows you to develop more modularity in your approach to asset creation. Modularity = rapid development = the way to go in the current industry environment. Plus, the way Illustrator handles layers and stacking order is more simple than Photoshop's Layers panel.
I apologize for slightly derailing the question, but I feel that Illustrator is a tool much better suited for web work than Photoshop—it's more maintainable and intuitive, once you've gotten past the initial unfamiliarity that comes from working with vector files instead of raster files. I think the links I've provided will serve as a pretty good primer for getting yourself situated with using Illustrator as an alternative to Photoshop for web development.
| 1 |
Illustrator has been much more useful than Photoshop in a web workflow
|
What does "to become controversial" mean?
|
As a non-native speaker, I do not fully understand the meaning of the term "to become controversial" in the following text, which I have to translate into German:
Where translators have made their presence felt they have become controversial, with those who characteristically intervene, seeking to domesticate texts, contrasted with those who foreignise, supposedly allowing other languages to alter our own.
|
I would like to expand upon their answers a bit. Let's take the German word "schadenfreude," which if you were to translate it into English would be "pleasure derived from the misfortune of another." That would be about the shortest translation you could make for it, because English doesn't have a word specific to that definition. Perhaps the shortest you could get without straying too far from the meaning would be "sadistic pleasure," but that implies a degree of maliciousness to it and that the person getting the pleasure is causing the misfortune or pain.
So, a translator translating from German to English has a choice to make when they come across the word: They can either translate the word as best they can or they can leave it as is. That's where the controversy arises. If they translate the word then they usually will change the meaning of the text in some way, and if they leave it as is then they open the door to allow "schadenfreude" into the English lexicon (which is exactly what has happened with "schadenfreude"). So, you wind up with people who argue back and forth about what the correct way to do it is, i.e. a controversy.
To more directly answer your question, "to become controversial" means "to become the source of argument or debate."
I would imagine that if this was from an article or something like that, that it's from Britain, as they tend to get all huffy about polluting the Queen's English with your foreign tongue or whatever. The other major English speaking countries don't really care that much. US English has been corrupted by other languages for as long as it's been around, Canadian English has been corrupted by pretty much every language that has also creeped into US English but especially French, and I don't even want to know what language has corrupted Australian English to come up with words like "kookaburra" and "kangaroo" or to name a place something like "Humpybong" (I know it's mostly Aboriginal).
| 1 |
German word "schadenfreude" is the shortest translation you could make for it, because English doesn't have a word specific to that
|
What Range of Source Ports do web Browsers Use to Connect
|
When my web browser connects to a website, the source port my end is a number like 27825, what range of ports can it use and how regularly does it change?
|
When you connect to a website you are connecting on port 80 which is the default port for all HTTP services, you can connect to websites that use other ports such as 8080 but you need to use http://domain.com:8080 unless they have the port 80 service redirect to another port.
Internal Loop backs
Now with this said and to answer your question, browsers establish connections on the remote host port that is setup on their server i.e port 80. Browsers do not communicate as far as I know on any other port unless the server its running on another port, if you are using a TCP monitor you will see Firefox, IE, Chrome etc operating on ports other than 80 then what your seeing is internal loop backs which these platforms use to communicate within the software. Take a look at TCP View from Microsoft you will notice that on the left side you have local port, and remote port. The local port is the internal loop back and the HTTP service is running on port 80 and that's how the data is being communicated externally.
| 1 |
Internal Loop Backs When connecting to a website
|
Change Drupal Commerce line item titles
|
I'm building a webshop with a lot of promotions in. And some articles in the shopping cart, have a linked promotion. And I want to show this promotion in the shopping cart summary (before the order completion).
Is there a way to change the title of the product in the shopping cart summary?
It's a shop without any visible prices. The total amount of the order is calculated on the servers... (it's a complicated proces). So there is nothing to worry about that...
But how can I display the pink text in a proper way? Would it be best to get this data from the database and place it as a field in a table (since the shopping cart summary is a view)? Or what other options do I have?
|
There are sevetal methods for this:
You can set the product title as you want on /admin/commerce/products page. Edit product and set your title.
You can set the product title in a moment you add it. To view this field the option 'Auto generate the product title' should be turned off on product display content type settings.
You can use the hook_commerce_cart_product_add() to set the product title automatically and (for example) depending on product type.
| 0.888889 |
How to set product title on /admin/commerce/products page
|
2D AABBs and resolving multiple collisions
|
Okay, so this is a problem I've been trying to figure out for quite some time. Mine is a 2D platformer game with a world made up of (usually) immobile tiles and mobile sprites, both of which use AABBs to represent their hitboxes. This game is NOT grid-based due to some complications with moving layers of tiles.
I can detect collisions and easily figure out the depth of the collision. I use the "shallowest axis method" to determine which way to resolve a collision between the sprite and the tile. If the sprite is deeper horizontally than vertically, the direction to resolve is either up or down. If the sprite is deeper vertically than horizontally, the direction to resolve is either left or right.
This is simple enough, and it works pretty well. That is, until you have a sprite colliding with more than one tile. As, by their nature, each collision has to be checked separately, different collisions may have different direction to resolve in. For example, if a sprite is trying to walk across a row of tiles, for one frame they will intersect the next tile such that the horizontal depth is shorter than the vertical depth. As the collision says "resolve left", it will be pushed back and will be stuck on the corner.
I've been mulling this problem over, on and off, for quite some time, and several solutions have come to me, but all have flaws. I could mark certain sides as unreachable, but without a grid-based engine, determining "unreachability" is remarkably complex, especially with moving layers of tiles always a possibility.
Another possible method would be to predict collisions before they happen and "work back" the movement to the point of the collision, I suppose, but I'm not sure how the math on that works.
I feel that I'm missing something incredibly obvious, especially since games from the 80s have already solved this problem.
|
You're overthinking the problem and conflating a couple of issues. But that's okay because, as you said, this is a very solved problem with lots of great answers out there.
Let's break it down:
Tilemaps. Your first example is of a sprite walking across a bunch of tiles laid out horizontally (or sliding down a wall of tiles laid out vertically, they're isomorphic). One very elegant solution to this is to simply not check the edges of tiles where we know a sprite can't get to, such as edges that are "underground" or edges that border another completely solid tile.
You're right that the sprite would descend due to to gravity, then move laterally, then get stuck... but the answer is to not care about the left or right edges of the tiles that are underground. That way, your collision resolution routine only moves the sprite vertically — and your sprite can go on its merry way.
Check out the Metanet tile tutorials for a step-by-step explanation of this. You say in your question that you're not using a traditional tilemap, but that's okay too: static tiles are in the tilemap and update as above, while moving platforms and such update as #2 below.
Other AABBs. You'll only run into a problem if, in a single frame, your sprite can move a distance larger than the width/height of most AABBs in your game. If it can't, you're golden: resolve the collisions one-by-one and it'll work just fine.
If the AABBs can move very fast in a single frame then you should "sweep" the movement when checking for collisions: chunk up the movement into tinier fractions and check for collisions at each step.
| 0.888889 |
Tilemaps is a very solved problem with lots of great answers out there
|
Do you keep your project code names the same in the source tree?
|
Sometimes when I start working on a project, I just can't think of a good name, or think of a good name that isn't already taken. As a result, I'll end up picking some sort of code name for the project.
My question is, how do you handle name changes in your source code once you find a real name for your project? Should you continue to refer to the code name in your source tree, namespaces, binaries, etc?
|
In my experience, it is extremely common that the name used to market a product is completely different from the name used internally for that product by the developers. Most often, because marketing has not decided on a name yet when development starts.
Whenever a project or product name is used in the internal documentation, file hierarchy, etc., it has been the practice to keep using the internal code-name, even after marketing has decided on the official product name. Only in documentation that is meant for the end-users is the product referred to with its official marketing name.
Usually, there is significant cost and no benefit in renaming everything.
| 1 |
The name used to market a product is completely different from the name used internally by the developers
|
How do you map a virtual drive letter to a local path on Windows?
|
All in the title. I'm looking for how to reference a local, not network, path, as a virtual drive letter. An innocuous example: C:\Storage as G:
|
I recently researched this subject and these are my findings.
The subst command performs this function well, and its effect ends with the user session:
subst [drive1: [drive2:]Path]
vSubst by Thomas Bigler is a GUI for subst, it can also create a permanent association by running itself at startup (HKLM), just as subst could be configured to do.
For a permanent mapping this may not be preferable as anything loaded prior won't be able to reference the mapping, for instance entries added beforehand alongside it in HKLM -> [...] -> Run, Windows services, etc.
psubst on Google Code is an excellent batch script with the interface of subst (which it uses internally) with an additional optional /p parameter for managing permanent mappings through the following key, which is loaded much earlier:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\DOS Devices
| 1 |
Subst is a GUI for subst and can create a permanent association .
|
Was Erica Albright real?
|
In the film The Social Network Mark breaks up with Erica Albright early on, this (through a series of steps) leads to him creating The Facebook.
However in real life Mark is married to Priscilla Chan who he met at Jewish fraternity at Harvard University in 2003 (Facebook was founded in 2004).
Does Erica Albright exist? If not why is she featured in the film and not Priscilla Chan?
|
The EricaAlbright.com is a hoax web site. It is just someone trying to get attention on the Internet with a "famous" name. Erica Albright is a fictitious person created for the sake of drama, because movies need a romantic plot to make them more interesting to some audience.
| 1 |
Erica Albright.com is a hoax web site
|
Can you designate your craft, perform, or profession skill even if you have no ranks in it?
|
Could you, for example, have one of your craft skills filled in as carpenter, but have no ranks in it? Being a very bad carpenter, but a carpenter nevertheless.
|
You can Craft and Perform, but you can't use Profession;
As stated here, Craft and Perform can be used without training. This means that you don't need to have ranks to use any of the Craft Skills (not limited to Alchemy, Armors, Bows, Traps, Weapons, Varies) or Perform Skills (not limited to Act, Comedy, Dance, Keyboard Instruments, Oratory, Percussion Instruments, String Instruments, Wind Instruments, Sing).
Unfortunately, this does not apply for Profession, and you'll have to get at least 1 rank in a Profession to use it.
It's worth noticing that every failure in a Perform check will give you a -2 when trying to Perform in front of the same audience (because they were not impressed by you and now have prejudices). Be aware of that and use Perform wisely when you don't have ranks in it.
Misc Bonuses
If you don't want to get ranks in these skills, there is still something we can do to improve your checks.
Artisan's Tools: You may want to get these to get a +2 on every Craft check;
Gnome Racial Trait: Gnomes get +2 to a Crafting Skill of their choice.
Masterwork Musical Instrument: If used during the performance, it will grant a +2 on the Perform check.
Skill Focus (feat): Choose a Skill; Without any rank in it, this feat gives you +3 on every check for that Skill (you can get up to +6 when you have 10 ranks, but this is not the case).
| 0.833333 |
Use Craft and Perform without training
|
How to prevent empty page after \maketitle?
|
I have a few pages that I've texed. I wanted to start the document with a title page but if I do that it produces an empty page numbered '1' between the title page and the first section. How to prevent that? I tried document classes report, article and book, \maketitle as well as \begin{titlepage}/ \end{titlepage}.
The code looks like this:
\documentclass{report}
\usepackage{amsmath}
\usepackage{amssymb}
\begin{document}
\textwidth 13cm
\title{Author: My title}
\author{a. name}
\maketitle
\hfill
\chapter{Chapter title}
\section{section title}
\end{document}
Thanks for your help.
|
Remove \hfill.
\documentclass{report}
\usepackage{amsmath}
\usepackage{amssymb}
\begin{document}
\textwidth 13cm
\title{Author: My title}
\author{a. name}
\maketitle
% \hfill
\chapter{Chapter title}
\section{section title}
\end{document}
EDIT: If you also want to align the title near the top of the page, follow Marco Daniel's advice and use the notitlepage class option. (You may still remove \hfill in that case.) Note that the page containing the title will be numbered as "1", and the first chapter will start at page 2.
| 0.666667 |
Remove hfill
|
Is the Hebrew vocabulary used in the Tanakh/(other recognized Hebrew books) the same as the what is considered Hebrew today?
|
There are many Hebrew resources available in the mainstream world, i.e. Webster's, Google, etc. Is the Hebrew used in the Tanakh/(other recognized Hebrew books, i.e. the Mishna, Rambam, etc.) considered to have the same vocab (word definitions, not necessarily grammar etc.) as what is commonly referred to as Hebrew nowadays? It is my understanding that it is, i.e. any English-Hebrew dictionary could be consulted to translate the texts for an English speaker, but how could this be verified? Is there some sort of official Rabbinical concordance of Hebrew?
|
No, Modern Hebrew, the contemporary spoken and written language, is not identical with Biblical Hebrew, the version[s] of the language in which Tanach was written. Hebrew, like all natural languages, has evolved over time from the times of Tanach until today, and on top of that, Modern Hebrew is the result of an intentional revival and modernization of the language, including a great deal of adaptations of words from other languages and re-appropriations of words that meant something slightly or drastically different in earlier forms of Hebrew.
Some examples of re-appropriations:
The word חשמל (chashmal), which means "electricity" in Modern Hebrew, refers to some esoteric property of angels in Tanach (Yechezkeil).
A more subtle example is the word דג (dag). In Modern Hebrew, it refers to the same biological class of animals that the most common sense of the English word "fish" does: "A cold-blooded vertebrate animal that lives in water, moving with the help of fins and breathing with gills." However, there's no good reason to assume that when used in Tanach, for example - famously - in Yonah, the intent of the word accorded with contemporary biological taxonomy, so it could very well have meant "whale" or some other aquatic creature that we wouldn't call a "fish." I have heard people unaware of the difference between Modern and Biblical Hebrew assuming that commentators interpreting the Bible were expressing ignorance of the true meaning of "fish" when including "whale" in the possible interpretations of an instance of "דג."
The verb "גָּר," in Modern Hebrew, means, simply "to dwell somewhere." However, in Biblical Hebrew, it means specifically "to sojourn through a strange land." A reader who is familiar with the Modern sense of the word but unaware of this nunance in the Biblical sense could miss important meaning in the text, as in Ruth 1:1: "‏... ‏וַיֵּלֶךְ אִישׁ מִבֵּ֧ית לֶ֣חֶם יְהוּדָה לָגוּר בִּשְׂדֵי מוֹאָב‏ ...‏" - "... And a certain man of Beth-lehem in Judah went to sojourn in the field of Moab ..." If this verb is read as "to dwell," then the reader misinterprets the subject's intended temporary evacuation as an intended permanent relocation.1 Thus, the dramatic change of intent hinted in the next verse's "‏... ‏וַיִּֽהְיוּ־שָֽׁם" - "... and they continued there," is also lost.
I don't know if any comprehensive dictionaries of Biblical Hebrew, consistent with Jewish tradition, exist. To be fully accurate, such a dictionary would have to deal explicitly with the fact that the same word can have different meanings in different contexts, depending on the time period the book came from as well as the actual context.
Not the same as a dictionary, but one way to read Tanach in English translation, consistent with Jewish tradition, would be to use a complete Jewish translation of Tanach. One well-regarded trandition-adherent version is that of Judaica Press, which is available in convenient form online on Chabad's website.
1. This example is at the top of my mind thanks to R' Yitzchak Etshalom having pointed it out in an excellent lecture I was fortunate to recently attend.
| 0.888889 |
Modern Hebrew is not identical with Biblical Hebrew, the version[s] of the language in which Tanach was written
|
What preposition should be used in "Moving something __ M meters"?
|
I have four guesses so far:
none, "on", "for", and "by".
|
Probably the best option will be 'by':
move something by N meters.
But I think no preposition also works:
move something N meters.
| 1 |
Moving something by N meters
|
How can I open a window on a different monitor?
|
With multiple monitors, I have so far been dragging windows manually around. Is there a way to make a window open on a specific screen in a dual-head setup? (Not to be confused with multiple X server displays.)
Something like: SCREEN=2 firefox or open-in-screen 2 firefox.
If it matters, my environment is KDE using the KWin window manager. KWin window rules can only match some properties like title, but I could not find an environment variable as filter.
The secondary display extends the primary screen:
$ xrandr -q
Screen 0: minimum 320 x 200, current 3520 x 1080, maximum 32767 x 32767
LVDS1 connected 1600x900+0+0 (normal left inverted right x axis y axis) 382mm x 214mm
1600x900 60.1*+
1024x768 60.0
800x600 60.3 56.2
640x480 59.9
VGA1 disconnected (normal left inverted right x axis y axis)
HDMI1 connected 1920x1080+1600+0 (normal left inverted right x axis y axis) 477mm x 268mm
1920x1080 60.0* 50.0 59.9
1920x1080i 60.1 50.0 60.0
1680x1050 59.9
1280x1024 75.0 60.0
1440x900 59.9
1280x960 60.0
1280x720 60.0 50.0 59.9
1024x768 75.1 70.1 60.0
832x624 74.6
800x600 72.2 75.0 60.3 56.2
720x576 50.0
720x480 60.0 59.9
640x480 75.0 72.8 66.7 60.0 59.9
720x400 70.1
DP1 disconnected (normal left inverted right x axis y axis)
|
Had a similar problem. Found the following:
Right click on the window titlebar and select "More Actions" -> "Window Manager Settings".
There choose "Focus" in the column to the left.
Toggle option "Active screen follows mouse".
If no other defaults are specified, windows appear on the currently active screen.
With the procedure described above, mouse position defines this active screen.
| 1 |
Windows appears on the currently active screen
|
What does mathematics have to do with programming?
|
I just started a diploma in software development. Right now we're starting out with basic Java and such (so right from the bottom you might say) - which is fine, I have no programming experience apart from knowing how to do "Hello World" in Java.
I keep hearing that mathematics is pertinent to coding, but how is it so? What general examples would show how mathematics and programming go together, or are reliant on one another?
I apologize of my question is vague, I'm barely starting to get a rough idea of the kind of world I'm stepping into as a code monkey student...
|
Two specific examples where a math education is important to computer science are:
1) Relational databases where relational calculus is used.
Relational calculus consists of two calculi, the tuple relational
calculus and the domain relational calculus, that are part of the
relational model for databases and provide a declarative way to
specify database queries. This in contrast to the relational algebra
which is also part of the relational model but provides a more
procedural way for specifying queries.
The relational algebra might suggest these steps to retrieve the phone
numbers and names of book stores that supply Some Sample Book:
Join book stores and titles over the BookstoreID.
Restrict the result of that join to tuples for the book Some Sample Book.
Project the result of that restriction over StoreName and StorePhone.
The relational calculus would formulate a descriptive, declarative
way:
Get StoreName and StorePhone for supplies such that there exists a title BK with the same BookstoreID value and with a BookTitle value of
Some Sample Book.
The relational algebra and the relational calculus are essentially
logically equivalent: for any algebraic expression, there is an
equivalent expression in the calculus, and vice versa. This result is
known as Codd's theorem.
The next area is artificial intelligence (AI) and machine learning.
For an example on how these are used take a look at udacity's class CS 373: PROGRAMMING A ROBOTIC CAR.
Description: This class, taught by one of the foremost experts in AI, will teach you basic methods in Artificial Intelligence, including: probabilistic inference, computer vision, machine learning, and planning, all with a focus on robotics. Extensive programming examples and assignments will apply these methods in the context of building self-driving cars. You will get a chance to visit, via video, the leading research labs in the field, and meet the scientists and engineers who are building self-driving cars at Stanford and Google.
Prerequisites: The instructor will assume solid knowledge of programming, all programming will be in Python. Knowledge of probability and linear algebra will be helpful.
WEEK 1:
Basics of probability Car localization with particle filters
WEEK 2:
Gaussians and continuous probability Tracking other cars with Kalman
filters
WEEK 3:
Image Processing and Machine Learning Finding objects in sensor data
WEEK 4:
Planning and search Determining where to drive with A* search Finding
optimal routes with dynamic programming
WEEK 5:
Controls Controlling steering and speeds with PID
WEEK 6:
Putting it all together Programming a self-driving car
WEEK 7:
Final Exam Exam testing your knowledge
| 1 |
Relational Calculus consists of two calculi, the tuple relational calculus and the domain relational calculator .
|
Superscript citations without brackets with the `revtex4-1` document class
|
Is it possible to achieve citations that are superscript and don't have brackets using the revtex4-1 document class?
An example of how they should look:
Afirmation3,4
|
This is the Phys. Rev. B citation style, so \usepackage[aps,prb,citeautoscript]{revtex4-1} is all that is needed. The [citeautoscript] is optional, but takes care of putting the citation after punctuation if necessary, as is Phys. Rev. B house style.
| 1 |
Phys. Rev. B house style
|
What is the difference between drought resistant non-succulent plants and plants that cannot be allowed to dry out?
|
What features make one plant able to withstand dry spells better than another with relatively similar structure? For instance, one of my Rudbeckias is wilting from drought at the moment, and an Oenothera next to it is not yet showing signs of dryness.
Or like jewelweed (Impatiens capensis), which wilts even while the soil is damp, in full sun, and ragweed (Ambrosia artemisiifolia), which will grow in very dry locations without being phased.
Is it caused by a faster transpiration rate in some plants than in others?
|
The difference may be related to how the plants fix carbon. While all plants convert CO₂ and H₂O to glucose and oxygen, there are at least three pathways that are used to do it. The C3 pathway is older and less efficient than the CAM and C4 pathways. Many drought tolerant plants use the CAM or C4 pathways because less water is needed. The C4 pathway is better than C3 in drier climates, hotter climates, and when CO₂ or nitrogen are limited. The hard part about this answer is that I'm not a botanist. Wikipedia lists some plants that use C4, CAM, and C3, but there is no comprehensive list, so I can't match up all the plants you mentioned in your question. In general, a higher percentage of monocots, especially grasses, use C4, but a wider diversity of dicots use C4. But you still can't draw conclusions about families of plants, because while corn and sorghum use C4, rice and barley use C3. Ragweed, a plant you say grows well in dry conditions, is a member of Asteraceae, which includes many plants that use C4. However, rudbeckias are also members of Asteraceae, but don't do as well in dry conditions. The C4 pathway has appeared and disappeared in several different plants, making any general claim hard to make. Here are some links that might help:
http://www.en.wikipedia.org/wiki/C4_carbon_fixation
http://www.en.wikipedia.org/wiki/C3_carbon_fixation
http://www.en.wikipedia.org/wiki/Crassulacean_acid_metabolism
http://www.brown.edu/Research/Edwards_Lab/reprints/sage_etal_2011jexb.pdf
If you know more about plants than me, that last link might be helpful, it's about the evolution of C4 pathway in plants and includes lists, but uses the formal species names I just don't recognize.
| 1 |
How to fix carbon in plants?
|
What is the current flowing through this switch?
|
I am looking at a circuit diagram like this:
simulate this circuit – Schematic created using CircuitLab
Switch 1 and switch 2 never are on at the same time (they alternate)
I turn on S2 and shut off S1, then after a while, I turn on S1 and shut off S2. At that point I think I can redraw the circuit like this:
simulate this circuit
But if I do that, I think the current through the switch would then be zero? And then the switch would be considered "off?" Or maybe I could arbitrarily define the current through the switch as being from either the left or right hand side circuits? But that seems to be not possible because originally the switch was shared between both of the circuits.
Can someone figure out what is wrong with my reasoning? What should the current through the circuit be in the "on" position?
Note: ignore the values of the circuit elements, they are not important.
|
Do KCL at the node between C1 and L2:
simulate this circuit – Schematic created using CircuitLab
Then the current through the switch is just the difference (or sum, depending on sign definition) of the current in each of the two LC circuits drawn in the second diagram. It is clear in diagram 1 what is going on but possibly less clear in diagram 2.
| 1 |
Do KCL at the node between C1 and L2
|
How to create properly tree-hierarchy
|
I'm using web2py to create an application
I've got 2 different roles: client and referents. Every client can have multiple referents.
Both client and referent can insert row in a table, called object.
The user table, where client and referent are registered, has a column called "client_id".
Every referent in the column_id has the id of the client to whom he reference to.
The problem is: which value should a client have in client_id?
A possible answer could be NULL or the id of the client itself.
Which one is better? Or there's something better?
|
Main reason why I'd choose NULL is a bit simpler queries - you don't need to care about self-relationship when you are querying ,for instance, number of referred users by the given. You can also save some space in case you create an index on client_id (it usually makes sense) because some RDMS, for example Oracle, don't include NULLs into index, others, like SQL server, allow filtered indexes (WHERE client_id IS NOT NULL).
| 0.666667 |
NULL is a bit simpler query .
|
Highlight Search (hls) matches of multiple search terms with different colors
|
Many times when working on code, I search for the occurrences of variables with similar names. For examples, find all matches of var1 and var2 as:
/\<var1\>\|\<var2\>
Now I really like the Highlight Search feature of Vim, b/c once I do the search, all the matching instances pop out in yellow color.
Is there a way to assign different colors to different terms in the search string? That is, all matches of var1 be yellow and of var2 be green?
|
With the 'hlsearch' option, no, they all have to appear in the same color. However, you can use the :match feature instead. For example:
:match TODO /var1/
:2match Type /var2/
:3match Comment /var3/
This, of course, is more cumbersome than straight 'hlsearch' matching, because it requires you to know what syntax coloring groups are already defined, or define your own. Also, you can only do up to three separate matches this way. If you need more, you'll have to use matchadd() instead.
See:
:help :match
:help :highlight
:help highlight-groups
:help matchadd()
| 0.888889 |
'hlsearch' option is more cumbersome than straight matching .
|
The Greatest Commandment - Loving God with all our 1) heart, 2) soul, and 3) strength
|
Jesus highlights Deuteronomy 6:5 as the greatest commandment in the law. This commandment highlights three aspects of loving God, specifically with our hearts, our souls, and our strengths.
Love the LORD your God with all your heart and with all your soul and
with all your strength. Deuteronomy 6:5 NIV
What is distinct about each of these? Specifically, what does it look like to love God with all our hearts? What does it mean to love God with all our souls? What does it mean to love God with all our strengths?
|
Mark 12:30-31 (KJV) And thou shalt love the Lord thy God with all thy heart,
and with all thy soul, and with all thy mind, and with all thy
strength: this is the first commandment. And the second is like,
namely this, Thou shalt love thy neighbour as thyself. There is none
other commandment greater than these.
From here we can see that there are two great commandments namely: loving God and loving thy neighbour.
Romans 13:9-10 (KJV) For this, Thou shalt not commit adultery, Thou shalt
not kill, Thou shalt not steal, Thou shalt not bear false witness,
Thou shalt not covet; and if there be any other commandment, it is
briefly comprehended in this saying, namely, Thou shalt love thy
neighbour as thyself.
Then according to Paul, loving thy neighbour is obeying the 5 half of the 10 commandments. If so, then when Jesus said to love God in 4 parts with all you heart, soul, mind and strength, what He really meant is obeying the first 4 of the 10 commandments. Because when you think about it, the first 4 commandments refers to God, and Jesus said that the greatest commandment is loving God. 4 parts = 4 commandments = perfect fit
Loving God with all your:
heart
Exodus 20:3 Thou shalt have no other gods before me.
soul
Exodus 20:4 Thou shalt not make unto thee any graven image... but rather "worship God in spirit" (John 4:24)
mind
Exodus 20:7 Thou shalt not take the name of the LORD thy God in vain but rather "study to shew thyself approved unto God" (2 Timothy 2:15) and "renew your minds" (Romans 12:2)
strength
Exodus 20:8-10 Remember the sabbath day, to keep it holy. Six days shalt thou labour, and do all thy work: But the seventh day is the sabbath of the LORD thy God: in it thou shalt not do any work
I learned from the Bible through this course:http://thesimpleanswers.com/2011/10/05/you-need-to-sign-up-for-the-free-bible-correspondence-course-by-mail/
| 1 |
Love God in 4 parts with all your heart, soul, mind and strength
|
Why do I have to update to the most recent iOS version?
|
I have an iPhone 4s that is still running iOS 5.1.1. Why is it not possible for me to update my device to a newer version of ios without going all the way to the latest?
|
Short answer: Because that's Apple's update policy.
Longer answer: Maintaining and supporting several major iOS versions is a lot of work, even if the older versions would just get security fixes. It's not just about the source code, any update also needs testing, dealing with apps which may break, update of various support documents etc. So you get both new functionality and security fixes by staying with the most recent version. In your case, running iOS 8 on an 4S actually works quite fine.
| 0.888889 |
Maintaining and supporting iOS 8 on an 4S works quite fine
|
Roots of this third degree polynomial
|
I've got the following polynomial
$$
x^3-6x^2-2x+40
$$
and I want to find its roots. The only option I see at the moment is to compute all the divisors of $40$ and their inverse, and manually check if it's result is $0$. This works, because $4$ is a zero and now we can divide the polynomial by the factor $x-4$, resulting in a second degree polynomial (which is easier to solve).
I was wondering if there's any other method/idea to manually find the roots of this polynomial?
|
For polynomial of degree $3$ you can use the following procedure. Assume that you guessed the solution $x_1=4$ (indeed $4^3-6\cdot 4^2-2\cdot 4+40 = 64 -96-8+40 =0)$.
You can use Horner's method to get the polynomial $p(x)=p_2x^2+p_1x+p_0$ such that $(x-4)\cdot p(x) = x^3-6x^2-2x+40$. You want to do that because $p(x)$ will be a polynomial of degree $2$ and it is easy (see here ) to find the solutions of such polynomial. In your case you have (with Horner's method)
$$\begin{array}{|c|c|c|c|c|}\hline&1&-6&-2&40\\\hline 4&0&1\cdot 4=4&-2\cdot 4=-8&-10\cdot 4=-40\\\hline&0+1=\color{blue}{\underbrace{1}_{:=p_2}}&-6+4=\color{blue}{\underbrace{-2}_{:=p_1}}&-2-8=\color{blue}{\underbrace{-10}_{:=p_0}}&40-40=\color{red}0\\\hline\end{array}$$
So your polynomial becomes $p(x) = \color{blue}1\cdot x^2\color{blue}{-2}\cdot x\color{blue}{-10}= x^2-2x-10$. The remainder, as you can see, is $\color{red}0.$ The solutions to this polynomial are
$$x_{2,3}=\dfrac{2\pm2\sqrt{11}}{2}=1\pm11$$
The solutions are therefore $x_{1,2,3}=4,1+\sqrt{11},1-\sqrt{11}$.
| 1 |
For polynomial of degree $3$ you can use Horner's method
|
The hobbit, how is it possible that 48 FPS is better than 24 FPS
|
I have a question about the movie the hobbit. People claim that the quality of the movie is way better because the movie is recorded and displayed in 48 fps. Normally this is 24 fps.
My opinion is that better frame quality only is possible with better techniques or when other settings are used. I think it can’t be because of only a frame increasement. It’s true that more frames per second makes new techniques available.
But why do they think that the screen quality is better? Is it maybe because of a higher resolution? Or do they just use other settings?
|
There is a huge difference in the feeling of the film based upon the Frames Per Second it was shot in.
There are a number of films that were shot using a digital camera, but at a higher 30FPS that were reviewed to have a "poor quality or feel" because the faster shutter rate gave it a television feeling.
Many professional digital camera now shoot at the slower 24FPS to capture that film feeling.
Many faster 30FPS digital cameras often produced a cleaner, sharper, wider range of color image that was perceived to be to different from traditional film stock. That the color space and feel of film could not be reproduced digitally. Much of this is true.
Today, many digital cameras now use all the same lens, hardware and mounts that older traditional film cameras used. The sensors are much more refined and adjusted to give a more natural color space. Post-processing has also greatly improved to reproduce many film stocks as a digital filter.
If you were speaking to someone who was not technical, but experienced in the film industry. He may have experienced producing films at 30FPS which were much sharper and cleaner then traditional 24FPS film stock. As a result. I can totally understand his perspective that 30FPS has a higher quality image.
The techniques to produce 30FPS and 24FPS films at one time was very different. Today, it's better to clarify that the difference is not frame rate, but film versus digital.
Additionally, frames per second can have a direct impact on the type of motion blur produced in an image. The higher the frame rate the less motion blur there is. Resulting in a cleaner sharper image for objects in motion.
| 0.888889 |
The difference in the feeling of film based on the Frames Per Second it was shot in
|
The Kindle app on my iPhone 4s isn't downloading books
|
I've been using the Kindle reader app on my iPhone and it was working as advertised for a while. However, yesterday for no apparent reason it has stopped being able to download books. I bought a book, went to my list of books in the Kindle app, and tapped the "download" control. The message reads "Downloading 0.0%" and just stays there. I tried downloading another recent purchase. Same deal. I tried restarting the Kindle app, and then the iPhone, but that didn't help. I tried going onto the Amazon and "sending" the books to my iPhone with no result. I made sure the iPhone is connected to my home wi-fi network.
Has anyone else seen this problem? Know of a solution?
|
Restarted the iPhone again and now it's working.
No idea why it wasn't working before.
| 0.888889 |
No idea why it wasn't working before
|
How do you prove $S=-\sum p\ln p$?
|
How does one prove the formula for entropy $S=-\sum p\ln p$?
Obviously systems on the microscopic level are fully determined by the microscopic equations of motion. So if you want to introduce a law on top of that, you have to prove consistency, i.e. entropy cannot be a postulate.
I can imagine that it is derived from probability theory for general system. Do you know such a line?
Once you have such a reasoning, what are the assumptions to it?
Can these assumptions be invalid for special systems? Would these system not obey thermodynamics, statistical mechanics and not have any sort of temperature no matter how general?
If therodynamics/statmech are completely general, how would you apply them the system where one point particle orbits another?
|
The best (IMHO) derivation of the $\sum p \log p$ formula from basic postulates is the one given originally by Shannon:
Shannon (1948) A Mathematical Theory of Communication. Bell System Technical Journal. http://cm.bell-labs.com/cm/ms/what/shannonday/shannon1948.pdf
However, Shannon was concerned not with physics but with telegraphy, so his proof appears in the context of information transmission rather than statistical mechanics. To see the relevance of Shannon's work to physics, the best references are papers by Edwin Jaynes. He wrote dozens of papers on the subject. My favorite is the admittedly rather long
Jaynes, E. T., 1979, `Where do we Stand on Maximum Entropy?' in The Maximum Entropy Formalism, R. D. Levine and M. Tribus (eds.), M. I. T. Press, Cambridge, MA, p. 15; http://bayes.wustl.edu/etj/articles/stand.on.entropy.pdf
| 0.888889 |
Shannon: Shannon (1948) A Mathematical Theory of Communication
|
GIN/GiST Full Text searches through openlayers, geoserver and postgres
|
I have a a web app that automatically maps recent tweets and allows you to search for certain keywords. it uses Postgres for the database, geoserver as the server, and openlayers as the cartographic library. Right now tweet keywords are done using the ILIKE query.
This works pretty well if the keyword i'm looking for is a commonly used word, like 'love' , 'friend', 'OMG', etc. but less common words like "geospatial" need to search through a lot more data in order to find the last n instances of the word. This is dead slow.
To combat my slowness I'm building a GIN index on my tweet field in postgres. Two days later and i'm still waiting for the index to complete. Once it's built though, I'll try a few queries using SQL view parameters and hopefully this will dramatically speed things up.
Even if this approach works though, it's not going to be all that useful if the index takes so long to create -- the maintenance of it will not be able to keep up will the incoming flood of data. I think I will try out the GiST index next and see how long it takes as I understand it is much faster to this build index.
Beyond this, what can I do next? Do options like Solr work with Geoserver?? Are there any common approaches to this type of problem and data size/rate?
|
You could also try the Full Text Search PostgreSQL capabilities and that would still match your architecture (OL, GeoServer and PostgreSQL).
Here you have a very nice resource on PostgreSQL FTS:
http://blog.lostpropertyhq.com/postgres-full-text-search-is-good-enough/
According to it, you should build a GiST (and not a GIN) index because it works better with dynamic data.
By the way, avoid LIKE/ILIKE queries if you want good search performance, they are one of the SQL Anti-patterns! See p.135: http://www.scribd.com/doc/2670985/SQL-Antipatterns Better use PostgreSQL FTS!
| 1 |
PostgreSQL FTS
|
Getting access denied on the destination drive partition. after using xcopy
|
i am wanted to copy the all the files in folder including sub-folders from one hard drive to another hard drive
for this i tried below xcopy command
C:\Documents and Settings\rakesh>xcopy "D:\Ganesh Drive\Trimax soft important" "
H:\" /E /k /x
but after executing this command i am getting access denied on the destination drive partition.
Please let me why and how rectify the same.
|
I have tried command prompt elevation, all possible switches with the xcopy command and had zero luck in copying the encrypted files (these files are highlighted in green )
After some googling, i was able to come up with a solution...the answer is robocopy and it works like a charm . This took a day's R&D
The switch that does this job is /EFSRAW . It copies all encrypted files in EFS RAW mode.
Your command would be something like
robocopy source destination /COPY:DATS /MIR /EFSRAW /R:2 /W:0 /E /ETA
Note - Robocopy is not an inbuilt feature in 2003 servers. It has to be installed separately. Also certain ESI files and certificates have to be imported to get the /EFSRAW switch to work in 2003 servers. This is not required on 2008, Vista and w7 servers.
| 0.666667 |
robocopy is not an inbuilt feature in 2003 servers
|
How do I opt-out of the Social Security system?
|
How do I opt-out of the Social Security system and give up my Social Security Number? If I do this, am I then exempt from paying Social Security income tax?
|
You can't opt out, and you can't exempt yourself from taxation. Except perhaps by permanently emigrating from the United States.
| 1 |
You can't opt out, and you cannot exempt yourself from taxation
|
Java read pptx file
|
Can someone help me how to read pptx file in java?i would prefer if this can be read with apache POI, i have been searched this tutorial but i can't find it.I've been successfully read the ppt file with this code :
try {
FileInputStream fis = new FileInputStream(file);
fs = new POIFSFileSystem(fis);
HSLFSlideShow show = new HSLFSlideShow(fs);
SlideShow ss = new SlideShow(show);
Slide[] slides=ss.getSlides();
for (int x = 0; x < slides.length; x++) {
System.out.println("Slide = " + (x + 1) + " :" + slides[x].getTitle());
TextRun[] runs = slides[x].getTextRuns();
for (int i = 0; i < runs.length; i++) {
TextRun run = runs[i];
if (run.getRunType() == TextHeaderAtom.TITLE_TYPE) {
System.out.println("Slide title " + (i + 1) + ": " + run.getText());
} else {
System.out.println("Slide text run " + (i + 1) + ": " + run.getRunType() + " : " + run.getText());
}
}
}
} catch (IOException ioe) {
ioe.printStackTrace();
}
Can someone tell me what part of this code must be modified to read pptx file?
|
According to http://poi.apache.org/slideshow/index.html you need to use a separate set of classes to read OOXML .pptx files. There's example code in the cookbook: http://poi.apache.org/slideshow/xslf-cookbook.html
| 0.777778 |
How to read OOXML .pptx files?
|
Margin and Padding of <Body> Tag
|
I am writing a very simple HTML code which is listed below. Written in notepad and opening in IE-8 and Firefox (OS: Window Vista).
<html>
<body>
<table border="1"><tr><td>test</td></tr></table>
</body>
</html>
There is nothing special in the above code, It is creating some space from top left corner.
Which can be easily removed by using the following code
<body style="margin:0; padding:0">
Now i have find out the default margin and padding, which is 4 for Firefox and different for IE-8.
<body style="margin:4; padding:4">
I have some question on this scenario.
Why this value is 4?
From where this value is coming, is it saved somewhere?
Can we modify (configurable) this default value?
How these values are different for browsers?
Thanks.
|
First of all, it's probably 4px and not 4. Second, that's just the way the browser vendor decided should be the default.
It is saved in the default browser stylesheets.
You can, but you shouldn't. It differs with each browser. Google it! How do I change default stylesheet on <insert browser here>?
There probably are slight differences, you should be able to tell... by looking at the default stylesheets :)
That difference is one of the main reasons we as designers use a CSS reset, to normalize all of the CSS awkwardness that follows different browser implementations.
| 0.777778 |
How do I change default browser stylesheet on <insert browser here>?
|
Does "surfeit" have an adjectival counterpart?
|
I’m thinking of something like surfeitous, but obviously that’s not a word.
|
The OED attests (what it calls) the participial adjective surfeited, meaning:
Fed or filled to excess; oppressed or disordered by or as by over-feeding.
The first citation is from Shakespeare, and two of the later ones are:
1842 Manning Serm. (1848) I. 22 — Take a watchful, self-denying man..and compare him with the heavy, surfeited man.
1886 H. F. Lester Under Two Fig Trees 182 — And then divide the morsel among these already surfeited gluttons.
The now rare word surfeiting is not an adjective, but a verbal noun (or “gerund”) with the same sense as surfeit itself. For example:
1821 Lamb Elia Ser. i. Grace before Meat, — Gluttony and surfeiting are no proper occasions of thanksgiving.
| 1 |
The OED attests the participial adjective surfeited, meaning: Fed or filled to excess; oppressed or
|
ListDensityPlot performance when scaling axes
|
I need to visualize 3D data having 200*200 data points.
ListDensityPlot is a good candidate, but it seems to have strange performance issues.
I created a small test that plots 40000 points. It has three cases: using 2D array as input, using array of 3D points with integer coordinates $(x,y)$ and using array of 3D points with float coordinates $(x,y)$.
TestFunction[x_, y_] := Sin[Pi/20* Sqrt[x^2 + y^2]];
testdata = Table[TestFunction[i, j], {i, -100, 100}, {j, -100, 100}];
testdataPoints =
Flatten[Table[{i, j, TestFunction[i, j]}, {i, -100, 100}, {j, -100,
100}], 1];
testdataPoints2 =
Flatten[Table[{i*0.01, j*0.01, TestFunction[i, j]}, {i, -100,
100}, {j, -100, 100}], 1];
Benchmark[d_, n_] :=
Timing[ListDensityPlot[d, ColorFunction -> "Rainbow",
PlotRange -> Full, InterpolationOrder -> n]];
TableForm[
Table[Benchmark[data,
n], {data, {testdata, testdataPoints, testdataPoints2}}, {n, 0,
2}], TableHeadings -> {{"Array", "Integer", "Float"}, {0, 1, 2}}]
It gives pretty strange result. When I simply scale axes and my coordinates are not integer anymore (the case is called "Float"). The performance drops almost 10 times (3 seconds vs 25 seconds).
Here's the output timing:
0 1 2
Array 0.834276 2.96802 3.05685
Integer 4.84968 3.42562 3.19835
Float 27.5574 26.1669 25.9262
Any explanation for such behavior?
Edit
As alternative to Michael's solution one can use ArrayPlot (as Silvia suggested) if interpolation is not important.
It can be easily scaled to look like "Float" case.
|
Too long for a comment:
Packing the data, as @0x4A4D suggests, seems to "fix" the problem, except in InterpolationOrder -> 0. See What is a Mathematica packed array? for an explanation of the importance of packed arrays.
TableForm[
ParallelTable[
Benchmark[data, n],
{data, Developer`ToPackedArray /@ N@{testdata, testdataPoints, testdataPoints2}},
{n, 0, 2}],
TableHeadings -> {{"Array", "Integer", "Float"}, {0, 1, 2}}]
This way is faster:
TableForm[
Table[
Timing[
ifn = Interpolation[data, InterpolationOrder -> n];
DensityPlot[ifn[i, j],
{i, -1, 1}, {j, -1, 1}, PlotPoints -> 101,
ColorFunction -> "Rainbow", PlotRange -> Full]],
{data, {testdataPoints2}}, {n, 0, 2}],
TableHeadings -> {{"Float"}, {0, 1, 2}}]
| 0.777778 |
What is a Mathematica packed array?
|
android tableLayout column color issue
|
I want to have a Tablelayout with following properties,
1.I want to change background color of column . Now if i am setting background for a TextView it is wraping the content and putting that color not the entire column.I want different color for my two columns.
2. change space between two columns (probably border).
Anybody have done such thing please help me . Thanks
<TableLayout
android:layout_gravity="center"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dip"
android:layout_margin="2dip"
android:orientation="vertical" >
<TableRow
android:padding="3dip"
android:id="@+id/tableRow1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dip">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:text="@string/NameLabel"
android:textColor="@color/black"
android:textSize="20sp"
android:background="#1DA43F"/>
<TextView
android:layout_marginLeft="5dip"
android:id="@+id/NameText"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:textAlignment="center"
android:layout_gravity="left"
android:text="@string/NameLabel"
android:background="@color/DarkRed"
android:textSize="20sp"/>
</TableRow></TableLayout>
|
From your original code:
Replace TableLayout and TableRow with LinearLayout (no need for table, you only have one row)
Add a android:padding to your TextViews for spaccing
Remove android:layout_gravity="right" and android:layout_gravity="left" and add android:layout_weight="1" to both TextViews
| 0.777778 |
Replace TableRow with LinearLayout
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.