In Python, I want to make selected instance attributes of a class be readonly to code outside of the class. I want there to be no way outside code can alter the attribute, except indirectly by invoking methods on the instance. I want the syntax to be concise. What is the best way? (I give my current best answer below...)
...
Does there exist any way in .Net to check before opening if a file (on a local network drive) is already in use?
...
I have a class that defines a read-only property that effectively exposes a private field, something like this:
public class Container
{
private List<int> _myList;
public List<int> MyList
{
get { return _myList;}
}
public Container() : base ()
{
_myList = new List<int>();
}
// some method tha...
I need to delete a directory that contains read-only files. Which approach is better: using DirectoryInfo.Delete(), or ManagementObject.InvokeMethod("Delete")? With DirectoryInfo.Delete, I have to manually turn off the read-only attribute for each file, but ManagementObject.InvokeMethod("Delete") doesn't appear to need to. Is there an...
After reading the faq's and everything else I can find, I'm still confused. If I have a char pointer that is initialised in this fashion:
char *s = "Hello world!"
The string is in read-only memory and I cannot change it like this:
*s = 'W';
to make "Wello world!". This I understand, but I can't, for the life of me, understand how to...
How to set tree node 'read only' in windows C#? Should not us disable, default.
...
Hi all,
in my workpsace i do have SVN checkout classes and SVN export classes.
I seperate the classes into two working sets. The exported classes are members of another feature based project and i am not allowed to change this classes inside my workspace.
When i want to fix a bug or implement new features i want to be sure, that the ex...
I have a class in C# that contains a Dictionary, which I want to create and ensure nothing as added, edited or removed from this dictionary as long as the class which contains it exists.
readonly doesn't really help, once I tested and saw that I can add items after. Just for instance, I created an example:
public class DictContainer
{
...
I have some .csv files which I'm using as part of a test bench. I can open them and read them without any problems unless I've already got the file open in Excel in which case I get an IOException:
System.IO.IOException : The process cannot access the file 'TestData.csv' because it is being used by another process.
This is a snippe...
Arrays are a fast way to iterate through an unordered set of items, and it's often nice for them to be read-only. While exposing arrays with the `readonly' keyword is useless because the contents of the array can still be altered, a ReadOnlyCollection<T> wrapper solves this. The problem is it's 4 times slower than a plain array in test...
I'm using a simple web-based PHP application that outputs a table as a spreadsheet
header("Content-Disposition: attachment; filename=" . $filename . ".xls");
header("Content-Type: application/vnd.ms-excel");
//inserts tab delimited text
But I'm finding the downloaded spreadsheet opens as a read-only file and must be saved locally and...
How do I make a foreign key field in a form read only but still allow this field to be recognized as valid once the form is submitted? According to W3C, disabled fields are left out once the form is submitted....using the code below, I can set the field as disabled, thus readonly, but my form doesn't go through
def __init__(self, ...
Setting RichTextBox as “ReadOnly” doesn't prevent embedded objects (like equations) from being edited by double-clicking them. I could disable the control but then there is a gray background (can't be just changed with BackColor) and no way to scroll. I tried to override OnDoubleClick in a derived class but no success.
...
I need to give read only permission to a couple of users on the database so that they can get an understanding of the schema, logic in SPs, etc. But I do not want them to modify anything. I tried assigning the db_datareader role but it doesn't allow viewing SP name or code. What is the right role-combination to do this or do I need to wr...
I'm part of a team tasked to revamping our old VB6 UI/COBOL database application to modern times. Before I was hired, the decision was made (largely on sales, I'm sure) to redo the UI before the database. So, now we're using WPF and MVVM to great effect, it's been amazing so far, especially using CSLA as our Model layer.
However, beca...
Many library classes in AS3 have "read only" properties. Is it possible to create such properties in custom as3 classes? In other words, I want to create a property with a public read but a private set without having to create a complex getter/setter system for every property I want to expose.
...
The following code gives an error message:
#!/usr/bin/perl -w
foreach my $var (0, 1, 2){
$var += 2;
print "$var\n";
}
Modification of a read-only value attempted at test.pl line 4.
Is there any way to modify $var? (I'm just asking out of curiosity; I was actually quite surprised to see this error message.)
...
I need a field that can be assigned to from where ever I want, but it should be possible to assign it only once (so subsequent assignments should be ignored). How can I do this?
...
I have some git repositories accessed remotely through SSH and I want to make some of them read-only to prevent more pushes. Some people have remotes pointing to these repositories.
These bare repositories were initialised --shared=group, so is setting file permissions to 660 for all files good enough to still allow SSH access, but disa...
I heard that in c, if I do:
char *s = "hello world".
The "hello world" is actually stored in read-only memory.
I am not so clear about read-only memory. Can anybody explain? Is that like a flag to compiler that tells compiler that do not write into that section?
...