How do i use the with statement in this case?
f_spam = open(spam,'r')
f_bar = open(eggs,'r')
...
do something with these files
...
f_spam.close()
f_bar.close()
It looks like Django does not update last_login field in auth_user model when a visitor is authenticated by saved session.
So in this case, how can I implement a similar feature like the "seen" field on very SO user's profile page.
public class Test {
public static void main(String[] args){
if (5.0 5) // (5.0<5) for both case it is going to else
System.out.println("5.0 is greater than 5");
else
System.out.println("else part always comes here");
/another sample/
if (5.0 == 5)
System.out.println("equals");
else
System.out.println("not equal");
}
}
can any one explain the first "if statement" why it always come to else part
What does “Moving Forward” mean to you?
“Moving Forward”:
A.To acknowledge the past but in essence, encourage a positive, professional environment to do our personal best in relation to issue that was criticized.
B.To acknowledge the past and learn from case examples to develop continually updated and open sources of information. Specifically, policies and procedures or best practices.
C.To dismiss the past to put behind fears of retribution.
D.Combination of above choices
E._____< Open Answer
in java, you can use File.listRoots() to get all drives in the system. I'm looking to get only the external drives, i.e. USB drives, external hard disks, optical drives, floppy etc'.
is there any way to do it in java? if not, native c++ code would be good as well. in that case, i need both windows and linux code
thanks
We are using bcrypt for passwords and data that never needs to be decrypted.
What should do to protect other user information that does. For this example lets say that we didn't want a users real name to be in plain text in case someone was to obtain the db.
This is somewhat sensitive data but also needs to be called from time to time and displayed in plain text. Is there a simple way to do this?
const int t=5;
char buf[t+5];
When I compile this gives error in C but not in C++!!
Can anybody please explain me the reason?
Note: I know the const defaults to internal linkage in 'C++', where as in 'C' it defaults to external linkage. Does it has any relation to the above case??
Hi All,
I am using display tag for pagination ,i am reading the list from request scope and displaying it,i have kept the page size as 1 and the list hast 4 values,if i press next i get nothing to display this is the case with request scope but not with session scope how can i tackle this problem?
Quick beginner's question:
Do I have to initialize simple class member variables, or are they guaranteed to get assigned their default values in any case?
Example:
class Foo {
int i;
// is i==0 or do I need the following line for that?
Foo() : i(0) {}
};
Thanks!
I am using SimpleMembership for user login stuff in my web application. I wrote a console that actually access my web application classes to avoid duplicate code. However, since my console application doesn't have anything related to user sessions the Login method doesn't work.
But is there a way to validate a user only using the SimpleMembership? In case i have to do it manually.. how can i do it ?
What is the best way to have every request be sent to a single ViewResolver - specifically in this case a JsonView?
Was thinking this:
<bean id="viewResolver" class="org.springframework.web.servlet.view.UrlBasedViewResolver">
<property name="viewClass" value="org.springframework.web.servlet.view.json.MappingJacksonJsonView" />
<property name="prefix" value="*" />
</bean>
but, is there something better/easier?
We have to install Windows SDK along with .NET Framework. Why do we need the SDK if we have the framework?
EDIT:
This isn't just the case for .net development. Also, if you want to develop Silverlight apps, you have to install additional sdk. Why?
Is there a way in IE Browsers to access the Flash object? In this case it is made with mootools swiff. It´s working fine in all other browsers, because they can wrap this object correctly. But it does not work in IE.
Here is the script:
var swfObj = $('mbImage').getElement('object');
swfObj.get('data'); <--- Thats not working in IE
In C++, Is it possible to enumerate over an enum (either runtime or compile time (preferred)) and call functions/generate code for each iteration?
Sample use case:
enum abc
{
start
a,
b,
c,
end
}
for each (__enum__member__ in abc)
{
function_call(__enum__member__);
}
Plausible duplicates:
C++: Iterate through an enum
Enum in C++ like Enum in Ada?
Hello;
Why can't I start a line using a parenthesis followed by the keyword new?? For example:
(New <custom_obj>).foo(var)
In that case is obvious that I'm trying to avoid creating a named instance of the the <custom_obj> because I know that I'll only be using it at that sentence.
Note that actually creating a named instance is not a problem for me... I just wanna know the reason why this is not possible.
var exampleURL = '/example/url/345234/test/';
var numbersOnly = [?]
The /url/ and /test portions of the path will always be the same.
Note that I need the numbers between /url/ and /test. In the example URL above, the placeholder word example might be numbers too from time to time but in that case it shouldn't be matched. Only the numbers between /url/ and /test.
Thanks!
I want to use dup2 to read from input file and redirect it to the input of exec function. but my problem is i have three running process all of them have to open same input file but they do different jobs. what your suggest in such case? i don't know if it is possible to use "cat data.txt" to feed the input for the three other process but i don't know the way to do that.
Is it possible to get the source of the current HTML document, exactly as it was loaded, in text form? (i.e. not the "Generated source" after parsing and DOM manipulation.)
Note: Issuing an extra AJAX request to retrieve the HTML page again is not an option in this case: The document could have changed.
Hi:
I am using mysettings to save user settings.
This config file is saved in this path:
c:\ Documents and
Settings \ \ [Local
Settings] Application
Data\\\
Is possible to change this path? For example, in my case I save app data in "ProgramData" folder (Vista & W7) and I would like save this config file in the same folder. Is possible?
Thanks in advance
On Unix, is there any way that one process can change another's environment variables (assuming they're all being run by the same user)? A general solution would be best, but if not, what about the specific case where one is a child of the other?
Edit: How about via gdb?
Trying to convert this tax-like IRS function http://stackoverflow.com/questions/1817920/calculating-revenue-share-at-different-tiers to SQL. The assumption is the table would be one column (price) and the tiers will be added dynamically.
My first attempt has some case statements that didn't work out well. I have since scrapped it :) Thanks for the help!
Normally all validation methods is connected to a field, radiobuttons, dropdowns etc. In my case I would like to do a general custom validation that depends on many fields in my form.
I dont want one field of them to become highlighted like a normal "required", i would rather just show a message in the errorcontainer.
Is there a simple way to do this I have overlooked?
This is my template matrix class:
template<typename T>
class Matrix
{
public:
....
Matrix<T> operator / (const T &num);
}
However, in my Pixel class, I didn't define the Pixel/Pixel operator at all!
Why in this case, the compiler still compiles?