default

Localization of Default.png is not working

谁说胖子不能爱 提交于 2019-11-27 02:56:36
问题 I wonder if anyone has encountered the same problem and how they solve it. I want to localize Default.png so I do the following steps which from what I understand should be the correct way (please correct me if I'm wrong). Select Default.png in xcode Command-I to Get Info Click on Make File Localizable Go back to General Tab (why Apple, why?) Click on Add Localization Enter es for Spanish according to this: In finder I replace the Default.png in the es.lproj folder I have tried in both the

Why is a C++ bool var true by default?

巧了我就是萌 提交于 2019-11-27 02:16:00
问题 bool "bar" is by default true, but it should be false, it can not be initiliazied in the constructor. is there a way to init it as false without making it static? Simplified version of the code: foo.h class Foo{ public: void Foo(); private: bool bar; } foo.c Foo::Foo() { if(bar) { doSomethink(); } } 回答1: In fact, by default it's not initialized at all. The value you see is simply some trash values in the memory that have been used for allocation. If you want to set a default value, you'll

How to use a member variable as a default argument in C++?

拜拜、爱过 提交于 2019-11-27 02:03:19
问题 I want to make an argument for one of the member functions optional. When no argument is provided, it would use an member variable. However, when I tried to compile it it shows " error: invalid use of non-static data member 'Object::initPos' " Just to isolate the problem, I tried defaulting an int type and it compiled fine. I wonder what is the problem with my code and how I could use a member function as default value. Thank you for your help! Object.h class Object { public: ... void MoveTo

Force telnet client into character mode

不问归期 提交于 2019-11-27 02:01:32
I have an application where I accept a socket connection from a telnet client and put up a simple, keyboard driven character GUI. The telnet client, at least on Linux, defaults into line-at-a-time mode, so I always have to do ^]mode char manually. A skim of the relevant RFCs suggests that if my application simply sent the characters IAC DONT LINEMODE (\377\376\042) as soon as the client connects, the client should be forced into character mode. However, it doesn't make any difference. What's the simplest bit of code that would do the job? Ideally just a string to be sent. My application can

Why is default required for a switch on an enum?

大城市里の小女人 提交于 2019-11-27 01:55:37
Normally, default is not necessary in a switch statement. However, in the following situation the code successfully compiles only when I uncomment the default statement. Can anybody explain why? public enum XYZ {A,B}; public static String testSwitch(XYZ xyz) { switch(xyz) { case A: return "A"; case B: //default: return "B"; } } The reason that you have to uncomment the default is that your function says that it returns a String , but if you only have case labels defined for A and B then the function will not return a value if you pass in anything else. Java requires that all functions that

Why do I have to assign a value to an int in C# when defaults to 0?

为君一笑 提交于 2019-11-27 01:52:39
问题 This works: class MyClass { int a; public MyClass() { int b = a; } } But this gives a compiler error ("Use of unassigned local variable 'a'"): class MyClass { public MyClass() { int a; int b = a; } } As far as I can tell this happens because in the first example, technically, the compiler doesn't know that 'a' is not assigned. In the latter example, 'a' is defined locally, and therefore is easy to track. But why does the latter example not work? Don't integers default to 0? Is this something

WPF ControlTemplate: How to provide a default value for TemplateBinding?

∥☆過路亽.° 提交于 2019-11-27 01:51:16
问题 I am writing a WPF control that subclasses a Button. I then provide a default style in Themes\generic.xaml, that looks like this (simplified): <Style TargetType="{x:Type WPFControls:MyButton}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type WPFControls:MyButton}"> <Button x:Name="PART_Button" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" /> </ControlTemplate> </Setter.Value> </Setter> </Style> I would like the user to

stl vector and c++: how to .resize without a default constructor?

放肆的年华 提交于 2019-11-27 01:46:45
问题 How do I tell STL, specifically for the method resize() in vector, to initialize objects with a constructor other than default, and with which parameters? For example: class something { int a; something (int value); } std::vector<something> many_things; many_things.resize (20); More generally, how do I force STL to use my constructor when it needs to create objects, and pass parameters to that constructor? In my case adding a default constructor is not an option, and I'd prefer not to use an

Oracle setting per user default scheme (not altering a session)

让人想犯罪 __ 提交于 2019-11-27 01:37:47
问题 is there a way to change an oracle user's default schema? I found it in the FAQ that I can alter it in the session, but it's not what I want. E.G. the user at log on always sees another schema as default. Thanks in advance. 回答1: I believe a logon trigger should work: CREATE OR REPLACE TRIGGER db_logon AFTER logon ON DATABASE WHEN (USER = 'A') BEGIN execute immediate 'ALTER SESSION SET CURRENT_SCHEMA = B'; END; 回答2: For some reason Tony's trigger did not work for me. However, a slightly

Clang and the default compiler in OS X Lion

。_饼干妹妹 提交于 2019-11-27 01:25:22
问题 In OS X Snow Leopard (10.6) I used the following lines in ~/.bashrc to force compilation with clang instead of standard gcc: # Set Clang as the default compiler for the system export CC=clang export CFLAGS=-Qunused-arguments export CPPFLAGS=-Qunused-arguments I also (occasionally) had to use the following lines to use llvm-gcc when clang would fail to compile certain things (PostgreSQL was guilty of this for a long time): # Set LLVM GCC as the default compiler for the system export CPP='llvm