When to use .then, .done, .fail

If I limit myself to the .ajax method (and NOT to the shortcuts like .get and .load), then should I use the deferred object methods .then, .done, .fail, .when, .reject, .resolve, .always, .promise or the Global Event Handlers: .ajaxSuccess, .ajaxComp

Python Scope Error

this code gives an 'Unbound Error' (discussed in this query Python variable scope error) x=3 def f(): print x x+=3 The reason for this (as given in the answer) is that once assignment operator has been used 'x' become a local variable and since 'x' d

Determine whether the absolute or relative URL

I have a relative or absolute url in a string. I first need to know whether it is absolute or relative. How do I do this? I then want to determine if the domain of the url is in an allow list. Here is my allow list, as an example: string[] Allowed =

How to throw a controlled exception from a java thread?

Hey, I'm writing a network application, in which I read packets of some custom binary format. And I'm starting a background thread to wait for incoming data. The problem is, that the compiler doesn't let me to put any code throwing (checked) exceptio

How to make a parent item appear above the child

I have two nested CSS elements. I need to get the parent to be on top, that is, above in z-axis, of the child element. Just setting z-index is not sufficient. I can't set a negative z-index on the child, that'll set it to below the page container on

Regex comma separated numbers

I am trying to validate a comma separated list for numbers 1-8. i.e. 2,4,6,8,1 is valid input. I tried [0-8,]* but it seems to accept 1234 as valid. It is not requiring a comma and it is letting me type in a number larger than 8. I am not sure why.[0

wget to parse a shell web page

I am trying to extract URLS from a webpage using wget. I tried this wget -r -l2 --reject=gif -O out.html www.google.com | sed -n 's/.*href="\([^"]*\).*/\1/p' It is displaiyng FINISHED Downloaded: 18,472 bytes in 1 files But not displaying the we

Excel data export contains small boxes with question marks

I have exported one of my website data files as a CSV.. In the descriptions column, the apostrophes (') in the text have been replaced with "small boxes with question marks". Can you please advise how we replace these characters back to apostrop

How to find the disk that contains a given partition in C #?

Does anyone know a way to find out programatically which physical disk holds a given partition? Manually, I can find this info using Start->Run->diskmgmt.msc , where I can see that (on my computer) that partitions C: and D: are on disk 1, E: & F

T4MVC or MvcFutures for strongly typed links in views

I am trying to reduce/eliminate "magic strings" from my MVC3 project and was wondering which approach would be better: use MvcFutures and do something like: var title = "Create New Customer"; Html.ActionLink (c => c.Create(), title

R data.table to the list of lines; better ways?

I want to convert an R data.table into a list of rows (each row being represented by a list). So far I have found two ways of doing this: library(data.table) x.dt = data.table(x = seq(1, 10), y = c("a", "b", "c", "d"

Creating screenshots on CentOS using PHP

Are there any free utilities that can be used to take screenshots of webpages and websites on centos and that can be run through php. ThanksThere are various commandline utilities available. Most start one of the browser engines in headless X11 and t

Adding Text to a JTextArea After Using a DocumentFilter

I am a having problem with appending a text to a JTextArea after Using a DocumentFilter, I need to append a string on the JTextArea after the text has been uploaded from a file and also return a string from a JTextArea of another JFrame to the specif

Playframework: what about Gedit excerpts and external tools?

I am an ubuntu user and gedit is my preferred editor. Eclipse is my preferred editor for java project, but in the specific case of play framework, RAD java oriented, i'll prefer to use a light editor like gedit. So the question is: Is there a plan to

Problems Installing Phlegmatic

I'm trying to install Flagmatic on Mac OS X Yosemite, a software package used to solve problems in extremal graph theory using the "flag algebras" developed by Razborov. I'd like to use Flagmatic to help with a research problem I'm working on, b

Managing C ++ exceptions does not work as expected

I'm trying to understand exception handling, and I'm testing this simple code: #include <iostream> #include <vector> #include <stdexcept> using namespace std; int main() { vector<int> v(4); try { v[v.size()] = 100; } catch(const ex

Subtitles are not deleted

Can someone tell me why this code isn't removing the subview that's being animated? The views are stacking up and the second time I dismiss the view, it won't animate and there are now two instances of subView with tag 99. It wasn't released the firs

What is the advantage of this coding style?

Recently I came across this Objective-C coding style: - (NSFetchedResultsController *)fetchedResultsController { NSFetchRequest *fetchRequest; NSEntityDescription *entity; NSSortDescriptor *sortDescriptor; NSArray *sortDescriptors; NSError *error; if

Missing color code in Visual Studio 2008

Hi i am missing the color code of my web.config files in Visual studio 2008 SP1 how do i get it back you can se it here link textIt'll be in Tools > Options > Text Editor, in one of those settings. Probably "XML" or "XAML". I'll

Specialized member function lost after link through

Consider the following minimal example which reproduces a problem in a much bigger project: spec.h: #include <iostream> class A { public: template<typename T> T test(const std::string& a) { std::cout << "DEFAULT CALLED WITH &quo

File system listening system

I would like to know if it is possible to have a listener in my application for notifying events when a file is added to the file system. Can someone kindly guide me with this. Thanks in advance.You should use a FileObserver to monitor for changes to

Huge Networks Throw Memory Out of Memory

Using the -Xmx1G flag to provide a heap of one gigabyte, the following works as expected: public class Biggy { public static void main(String[] args) { int[] array = new int[150 * 1000 * 1000]; } } The array should represent around 600 MB. However, t

How to view map annotations by zooming in?

I have a map with a lot of annotations, which are pinned on whole country. Now I would like to show annotation automatically, when somebody zooming in the map. Do you have any idea how to start with it? Now I have a few lines of code: Annotation Clas