default

Setting default interpreter for a python script

淺唱寂寞╮ 提交于 2019-12-14 01:47:44
问题 I am using a module that can only be found in python 2.7, so when I run my script I have to specify python2.7 script instead of just script . I know there are bigger issues out there, but still I was wondering - is it possible, when writing a python script, to set the interpreter to 2.7 by default? Maybe by setting #! /usr/bin/env python for example? 回答1: Most unix environments will have the python2.7 executable, such that you can write: #!/usr/bin/env python2.7 Obviously this doesn't help

How to set a conditional DEFAULT value to a column in oracle without using triggers?

被刻印的时光 ゝ 提交于 2019-12-13 18:07:15
问题 How to set a conditional DEFAULT value to a column in oracle without using triggers? I want to achieve following needs: If "flag1"=1 then Default value to column Newfield must be "4". If "flag1"=2 then Default value to column Newfield must be "5". 回答1: That's what triggers are for. Use them. 回答2: A column DEFAULT is not allowed to reference another column, so this is not possible. You could perhaps just let the default remain as NULL, and then have a view to adjust it like: create view

Getting default printer change notification using c++ in Windows service

橙三吉。 提交于 2019-12-13 18:00:15
问题 I need to tap default printer change notification, is it possible? My scenario is that I want to execute a command whenever default printer is changed in window. What my command does is, it just takes default printer information from registry and save it in HKLM. So, I have a service for this. Using this service, how can i tap notifications whenever a default printer is changed. I am using C++. 回答1: From a regular application, I would listen for a WM_SETTINGCHANGE message and then call

Change default null value in JSON.NET

不羁的心 提交于 2019-12-13 12:45:59
问题 Is there some way to set what the default representation for null values should be in Json.NET? More specifically null values inside an array. Given the class public class Test { public object[] data = new object[3] { 1, null, "a" }; } Then doing this Test t = new Test(); string json = JsonConvert.SerializeObject(t); Gives {"data":[1,null,"a"]} Is it possible to make it look like this? {"data":[1,,"a"]} Without using string.Replace. 回答1: Figured it out. I had to implement a custom

Default values for varchar and int mysql data types

杀马特。学长 韩版系。学妹 提交于 2019-12-13 12:06:05
问题 The screenshot show 3 typical definitions of data type: id (autoincrement), a title and a number. 1.- Which are differences between: none and NULL ? 2.- Do I must choose as defined: '' for varchar types when I want an empty string? 3.- Do I must put an as defined: 0 default value for autoincrement int types? 回答1: Default none means there is no default value. If a value is not provided on an insert, the query will fail with a "no default value error". NULL is the actual NULL value meaning if

How to make a new default argument list every time [duplicate]

你说的曾经没有我的故事 提交于 2019-12-13 10:29:07
问题 This question already has answers here : “Least Astonishment” and the Mutable Default Argument (31 answers) Closed 6 years ago . I have the following setup: def returnList(arg=["abc"]): return arg list1 = returnList() list2 = returnList() list2.append("def") print("list1: " + " ".join(list1) + "\n" + "list2: " + " ".join(list2) + "\n") print(id(list1)) print(id(list2)) Output: list1: abc def list2: abc def 140218365917160 140218365917160 I can see that arg=["abc"] returns copy of the same

Change default xib view in xCode 4.5 to 3.5“ and not 4”

余生颓废 提交于 2019-12-13 07:36:19
问题 Since updating to xCode 4.5, and with the release of the iPhone 5 with the 4" display, each time I create a new ViewController with a xib file, the xib defaults to a 4" display size. At the moment I'm working through Aaron Hillegass's excellent iOS Programming text. All the examples assume a 3.5" Xib. How do I get new views to be 3.5" instead of the taller skinny 4" default xib views? 回答1: Found the answer here: How to make a uitableview in interface builder compatible with a 4 inch iPhone

Vagrant Up by Non-Sudo Vagrant User fails

别说谁变了你拦得住时间么 提交于 2019-12-13 06:47:00
问题 I created a new non-sudo user(user1) in vagrant(Ubuntu 12.04 OS), and added the insecure public key to the user1 authorised key file. In vagrant file, added the default user as "user1" : config.ssh.default.username = "user1" Now vagrant up is failing with following error message: The following SSH command responded with a non-zero exit status. Vagrant assumes that this means the command failed! mkdir -p /vagrant Stdout from the command: Stderr from the command: sudo: no tty present and no

Default action on JSF pages (ie pressing enter on input fields)

情到浓时终转凉″ 提交于 2019-12-13 06:29:58
问题 A HTML page is created using JSF and facelets (xhtml). There are 2 h:forms that goes to different places. The user enters data on one form and presses the "Enter" key. Here is where it gets tricky. On IE 6 and above, either the forms action gets submitted (which usually points to the page you are on) which then just reloads the page, or the first h:commandbutton/link that is on the page. Its totally random, but its consistant on that page. Here is what I have tried, I tried placing the

reset to default sorting in jquery datatable

故事扮演 提交于 2019-12-13 04:29:18
问题 I have a page on which one dropdown as Report1 and Report2 is there. If I select Report1 it will populate startdate and enddate. I will select startdate and end date then cliick on view report it will do ajax call and fetch the data and displaying in table, I am using datatable for this. I have default sorting of the second coulmn and also I can able to sort other column. If I sort other column and then select the other report Report2 and then select startdate adn end date and then hit the