safety

Is safe ( documented behaviour? ) to delete the domain of an iterator in execution

I wanted to know if is safe ( documented behaviour? ) to delete the domain space of an iterator in execution in Python. Consider the code: import os import sys sampleSpace = [ x*x for x in range( 7 ) ] print sampleSpace for dx in sampleSpace: print str( dx ) if dx == 1: del sampleSpace[ 1 ] del sampleSpace...

How do I make a defaultdict safe for unexpecting clients?

Several times (even several in a row) I've been bitten by the defaultdict bug: forgetting that something is actually a defaultdict and treating it like a regular dictionary. d = defaultdict(list) ... try: v = d["key"] except KeyError: print "Sorry, no dice!" For those who have been bitten too, the problem is evident: when d has ...

Storing encrypted personal information - common sense?

Hi everybody, We're in the middle of developing a e-commerce application that will be used by our customers on a pay-monthly-plan. We have thought a bit about offering encryption of all personal data that is stored in the database, to make our application a notch safer to the final consumers. The encryption would be handled completely ...

Thread safety in Python (Question how it works)

I've read through the documentation on threading for python and as I've pereceived it the following should hold true: You can access (read) any PoD or python specific object (such as an array) without causing failure in a multi-threaded program trying the same thing at the same time, but you can not change them and accept thread integrit...

Is python-openid not reasonably safe?

My hoster has refused installs python-openid module motivated by the fact that its not reasonably safe. "This package works as a Web server, which listens to its port on a virtual server." Is it true? ...

Exception free tree destruction in C++

I have recently managed to get a stack overflow when destroying a tree by deleting its root 'Node', while the Node destructor is similar to this: Node::~Node(){ for(int i=0;i<m_childCount;i++) delete m_child[i]; } A solution that come up into my mind was to use own stack. So deleting the tree this way: std::stack< Node* >...

python: changing dictionary returned by groupdict()

Is it safe to modify a mutable object returned by a method of a standard library object? Here's one specific example; but I'm looking for a general answer if possible. #m is a MatchObject #I know there's only one named group in the regex #I want to retrieve the name and the value g, v = m.groupdict().popitem() #do something else with m...

what is typesafe in vb.net?

What is Type Safety? How does Type Safety affect us? Why is Type Safety Important? Writing Type-Safe Code. in what scenario we can achieve type safety? ...

How do you mark a Ruby Binding as trusted?

From this article http://www.stuartellis.eu/articles/erb referring to thread safety levels: "At this level, the specified binding must be marked as trusted for ERB to use it." I've searched high and low and haven't found a way to "mark" a Binding as "trusted". Will somebody please enlighten me? ...

Formal guidelines to follow when maximising the accessibility of software for people with disabilities

Are there formal guidelines for the development of software that help minimise health risk from software, covering issues (mainly related to GUI design) such as: How to minimise RSI Minimising risks to people with color blindness Considering the effects software might have on causing various nervous system related conditions (e.g. e...

Can dereferencing of pointer throw?

I'm teaching myself techniques of programming with exception safety mode of ;) and I wonder if dereferencing a pointer could ever throw an exception? I think it would be helpful for all C++ programmers to know all operations that are guarantied to not throw so I would be very grateful if someone could compose such list. ...

Decide if a Folder should not be deleted (e.g. because it is special)

Suppose I wish to make a preliminary decision on whether to delete a folder (using a recursive algorithm that will probably manage to delete some files even if the user stupidly tries to delete c:\windows). This is more as a shield for user stupidity rather than some form of automated deletion. I don't care if it disallows deleting stu...

How to test thread safety of adding to a hashtable?

We're using a hashtable to store sessions in a web service. I want to test thread safety of adding to this session. I wrote a Console App which generates lots of threads and adds to this session. But I am neither getting an exception nor losing any data. Am I doing anything wrong or isn't this much of operation a threat to hashtable?! ...

Can I limit PHP to just the file it's in (stop abuse?)

I'm making a small file editor and the only kicker is I don't want the people who have access to it do use dangerous functions like unlink chdir exec and I'm sure there's 100 more they shoudln't be able to use. I was thinking of just making an array of dangerous functions I don't want them to be able to use and when they save the file j...

C# anonymus delegates efficiency/safety

Hello I have progress form which delegate: // in ProgressForm thread public delegate void executeMethod(object parameters); private executeMethod method; public object parameters; // ... private void ProgressForm_Shown(object sender, EventArgs e) { method.Invoke(parameters); } Which way ...