default

Get default user email in iOS Device

孤人 提交于 2019-11-29 09:56:49
Is it possible to retrieve the user email associated with the default email account directly from an app? Screenshot: Thanks. I can't prove a negative, but I am fairly certain this is not possible. You can use MFMailComposeViewController to allow the user to send an email from the default account, but you cannot directly access information about the default account. If you need the user's email address, you either have to ask for them to type it in, or have them select it from their contacts. In addition to @woz answer, this is a gist that can help you. In my app, I have a feedback form to let

What is the C++/CLI equivalent to C#'s default(T)?

怎甘沉沦 提交于 2019-11-29 09:17:05
I'm working with some C++/CLI code (new syntax) and am trying to declare a generic type and want to set a member variable to it's default. In C#: class Class<T> { T member = default(T); } What's the equivalent in CLI? generic<typename T> public ref class Class { public: Class() : member(default(T)) // <-- no worky { } private: T member; }; Interestingly enough the syntax makes it looks like this: T() . It does require the addition of a copy constructor. generic<typename T> public ref class Class { public: Class() : member(T()) { } Class(Class^ c) { member = c->member; } private: T member; };

Can I set up a default method argument with class property in PHP?

你离开我真会死。 提交于 2019-11-29 09:16:49
I'm using PHP 5.2.6. I want to have a default value for an argument in a method, but it seems I'm getting a bit too clever. The class property blnOverwrite is defaulted and settable elsewhere in the class. I have a method where I want to have it settable again, but not override the existing value. I get an error when I try this: public function place( $path, $overwrite = $this->blnOverwrite ) { ... } Must I do something like this? public function place( $path, $overwrite = NULL ) { if ( ! is_null($overwrite) ) { $this->blnOverwrite = $overwrite; } ... } Yes, you have to do it this way. You

Setting Default NetBeans Options (-std=c99, -Wall) for C programs

戏子无情 提交于 2019-11-29 09:10:58
I have NetBeans 6.9 installed and working fine on Ubuntu Linux 11.10. My goal is to set compiler options like -Wall and -std=c99 to be used by default. Currently, I have to right click on my project -> Properties -> C Compiler -> Warning Level to " More Warnings " and add -std=c99 to Additional Options . This is obviously a pain when creating many projects, and I'm sure there is a way to make all of this the default . I found this thread which relates closely to my question. However, the only answer involves installing Code::Blocks and MSYS 1.0.11, which doesn't make much sense to me. I don't

WPF button textwrap style

前提是你 提交于 2019-11-29 09:04:21
How do I change the default textwrapping style of a button in WPF? The obvious solution of: <Style x:Key="MyButtonStyle" TargetType="{x:Type Button}"> <Setter Property="TextWrapping" Value="Wrap"></Setter> </Style> doesn't work, because Textwrapping isn't a settable property here, apparently. If I try: <Style x:Key="MyButtonStyle" TargetType="{x:Type Button}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type Button}"> <TextBlock Text="{Binding}" Foreground="White" FontSize="20" FontFamily="Global User Interface" TextWrapping="Wrap"/> </ControlTemplate> </Setter

Android Intent defaults - detect and clear

試著忘記壹切 提交于 2019-11-29 08:46:37
Is there a way to detect that a phone has a default application chosen for an intent such as android.intent.action.SEND ? Is there a way to clear the default application via code? I'd like to give the user an option to remove the default or at least show a screen telling them how to do it manually, if I can detect it. Take a look at PackageManager . With it, you can determine how an Intent will be handled with resolveActivity(intent). It looks like the method for clearing the preference (clearPackagePreferredActivities) only works on your own package. Use 2-step detection of defaults:

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

隐身守侯 提交于 2019-11-29 08:31:50
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: which one to choose and which one is better or there's a different purpose for each of them? Here's the

Understanding how Lambda closure type has deleted default constructor

落花浮王杯 提交于 2019-11-29 07:52:30
From 5.1.2 [19] The closure type associated with a lambda-expression has a deleted (8.4.3) default constructor and a deleted copy assignment operator. It has an implicitly-declared copy constructor (12.8) and may have an implicitlydeclared move constructor (12.8). [ Note: The copy/move constructor is implicitly defined in the same way as any other implicitly declared copy/move constructor would be implicitly defined. —end note ] I'm reading through C++ Primer 14.8.1 which explains lambda expressions being translated by the compiler in to an unnamed object of an unnamed class. How is it I can I

Changing the DefaultValue of a property on an inherited .net control

ε祈祈猫儿з 提交于 2019-11-29 06:32:00
In .net, I have an inherited control: public CustomComboBox : ComboBox I simply want to change the default value of DropDownStyle property, to another value (ComboBoxStyle.DropDownList) besides the default one specified in the base class (ComboBoxStyle.DropDown). One might think that you can just add the constructor: public CustomComboBox() { this.DropDownStyle = ComboBoxStyle.DropDownList; } However, this approach will confuse the Visual Studio Designer. When designing the custom Control in Visual Studio, if you select ComboBoxStyle.DropDown for the DropDownStyle it thinks that the property

default value of GUID in for a column in mysql

最后都变了- 提交于 2019-11-29 06:15:16
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? 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 $$ pospi Previous answer is not quite right - you've got to be careful with triggers... they will actually overwrite any default value