default

Changing default python to another version

社会主义新天地 提交于 2019-11-30 10:46:40
Currently when I use "python" command, it points to python2.6. I have installed python3.1 and I want the "python" command point to python3.1. How it is possible? mahmood@mpc:~$ which python /usr/bin/python mahmood@mpc:~$ ls -l /usr/bin/python lrwxrwxrwx 1 root root 9 2010-11-24 16:14 /usr/bin/python -> python2.6 mahmood@mpc:~$ uname -a Linux orca 2.6.32-24-server #39-Ubuntu SMP Wed Jul 28 06:21:40 UTC 2010 x86_64 GNU/Linux Since you have Linux, and if you want to simply type "python" instead of "python3" in order to run Python programs, a solution is simply to define an alias in you shell

How to default a null JSON property to an empty array during serialization with a List<T> property in JSON.NET?

风格不统一 提交于 2019-11-30 09:36:30
Currently I have JSON that either comes in via an HTTP call or is stored in a database but during server processing they are mapped to C# objects. These objects have properties like public List<int> MyArray . When the JSON contains MyArray:null I want the resulting property to be an empty List<T> instead of a null List<T> property. The goal is that the object will "reserialize" to JSON as MyArray:[] , thus either saving to the database or responding out via HTTP as an empty array instead of null . That way, no matter what, the C# class is basically scrubbing and enforcing an empty array for

Default Struct Initialization in C++

*爱你&永不变心* 提交于 2019-11-30 09:28:47
Say I have a struct that looks like this (a POD): struct Foo { int i; double d; }; What are the differences between the following two lines: Foo* f1 = new Foo; Foo* f2 = new Foo(); The first one leaves the values uninitialised; the second initialises them to zero. This is only the case for POD types, which have no constructors. I suppose nothing at all. Foo() is allowed, even if it makes no sense... I've tried to change struct into class and tried a diff on the generated exe, and they resulted to be the same, meaning that a class without method is like a struct from a practical and "effective"

How do I change the default author for accessing a local SVN repository?

岁酱吖の 提交于 2019-11-30 08:59:23
问题 I use TortoiseSVN to access file based local repo. In all my commits an author is my Windows login name. Is it possible to use different name? I know how to change author after commit but how to change before? Installing apache/svnserver is not an option. 回答1: Yes, it's possible. TortoiseSVN and the svn command line client share the same settings location in your profile folder. So you may simply checkout one version using svn.exe : $ svn co --username different_user_name file:///C:/path/to

Django: field's default value from self model's instances

被刻印的时光 ゝ 提交于 2019-11-30 08:27:53
How can I make default value for a field to be taken from existing objects of a model? I tried these and it didn't worked: 1) class ModelA(models.Model): fieldA = models.CharField(default=self.get_previous()) def get_previous(self): return ModelA.objects.all()[0].fieldA NameError: name 'self' is not defined 2) class ModelA(models.Model): fieldA = models.CharField(default=ModelA.get_previous()) @staticmethod def get_previous(): return ModelA.objects.all()[0].fieldA NameError: name 'ModelA' is not defined 3) class ModelA(models.Model): fieldA = models.CharField(default=get_previous()) def get

default value of GUID in for a column in mysql

此生再无相见时 提交于 2019-11-30 08:16:39
问题 I want a column to default to a GUID, so if I am doing an insert and I don't explicitly set the value, I want it to default to a new GUID value. how can I do this? 回答1: Being that UUID() isn't accepted as a DEFAULT constraint, you need to use a trigger. This one sets the value for the NEW_TABLE.uuid column: delimiter $$ CREATE DEFINER=`root`@`localhost` TRIGGER `example`.`newid` BEFORE INSERT ON `example`.`new_table` FOR EACH ROW BEGIN SET NEW.`uuid` = UUID(); END $$ 回答2: Previous answer is

default value of a variable at the time of declaration in C# and VB?

人盡茶涼 提交于 2019-11-30 08:15:40
Can anybody tell me what is the default value of a variable at the time of declaration in C# and vb?? In c# you can use the default keyword to determine default values. For example: default(bool) default(int) default(int?) Do you mean a (method) variable? or a field (on an instance or type)? For a method-level variable (in C# at least) it is irrelevant, since "definite assignment" means that you must give it a value before you can read it. Fields default to the bitwise zero state: for reference types (including string) that means null for Nullable<T> ( int? etc) that means null for numerics

How can I do Java annotation like @name(“Luke”) with no attribute inside parenthesis?

感情迁移 提交于 2019-11-30 07:51:22
How I can do custom Java annotation with no attribute name inside parentheses? I don't want this: @annotation_name(att=valor) . I just want like in Servlets, i.e: @WebServlet("/main") Define the annotation with an attribute named value , then the attribute name can be omitted: @interface CustomAnnotation { String value(); } This can be used like so: @CustomAnnotation("/main") // ... You specify an attribute named value: public @interface MyAnnotation { String value(); } This doesn't have to be the only attribute if they have default values: public @interface MyAnnotation { String value(); int

Mess with the shared preferences of android - which function to use?

北慕城南 提交于 2019-11-30 07:37:26
问题 Here's a standard task: store some values in the application's shared preferences in order to be able to retrieve it later on. But one will discover that there are 3 functions to store a value in there: //1. public static SharedPreferences PreferenceManager.getDefaultSharedPreferences(Context context) {} //2. public SharedPreferences Activity.getPreferences(int mode) {} //3. public SharedPreferences ContextWrapper.getSharedPreferences(String name, int mode) {} So now here's the question:

Change the default location of Pycharm Project

跟風遠走 提交于 2019-11-30 06:20:49
I am using PyCharm 3.4.1 on Ubuntu 14.04. For new project it suggests ~/PyCharmProjects for storing project folders. Is it possible to change the location and name of this proposed folder? (I couldn't find any reference to changing it in the interface, on the JetBrains site, or in the settings files. Either it isn't possible or (I hope) I missed something.) Note, it is not a duplicate of Can I change the location/name of PyCharmProjects? - I am aware that it is possible to change proposed path for every created project - but I want defaults that I like. In fact, this is possible. In the IDE