compatibility

how to run python script with os.fork on windows?

梦想的初衷 提交于 2019-11-30 07:55:55
问题 os.fork() command is not supported under windows, and gives the following error: AttributeError: 'module' object has no attribute 'fork' So the general question is How to run a script that contain a call to os.fork() under Windows? . I don't mind using something that only mocks up the behavior and runs much slower, it's only for testing. I also prefer not to change the script as it is a 3rd party module. To give you a wider perspective, I'm trying to use the module rq a.k.a redis queue on

android-support-v4.jar isn't importing correctly in Eclipse

爱⌒轻易说出口 提交于 2019-11-30 06:40:23
I'm trying to get an app to compile that uses the android-support-v4.jar and the Fragmentation classes it contains, but I keep getting messages whenever I try to compile that there are errors in the code. All of the errors have to do with different Fragmentation classes that are in the .JAR . I have tried ctrl-clicking the project folder and then selecting Android Tools -> Add Compatibility Library and I keep getting this error: [2011-12-20 11:55:31 - Android Compatibility JAR not found:] /Applications/eclipse/Eclipse.app/Contents/MacOS/v4/android-support-v4.jar Why would it be looking for the

println vs System.out.println in Scala

我怕爱的太早我们不能终老 提交于 2019-11-30 05:35:32
I always thought that Predef.println was merely a shortcut for System.out.println , but apparently I am mistaken, since it doesn't seem to use System.out at all. Why is that so? And how can I do the "redirecting" of System.out below in Scala? scala> val baos = new java.io.ByteArrayOutputStream baos: java.io.ByteArrayOutputStream = scala> val ps = new java.io.PrintStream(baos) ps: java.io.PrintStream = java.io.PrintStream@6c5ac4 scala> System.setOut(ps) scala> println("hello") hello scala> new String(baos.toByteArray) res2: java.lang.String = "" scala> System.out.println("hello") scala> new

How can I deploy a C++11 program (with dependencies) on CentOS 6, whose GCC is C++03?

蓝咒 提交于 2019-11-30 04:52:12
GCC is great with ABI-compatibility as long as you use the same C++ standard [ 1 ]. But it strikes me that if a shared library compiled by GCC 4.3 in C++03 mode exposes, say, a std::string , this is going to be a different std::string than that understood by an executable compiled by GCC 4.8 in C++11 mode. The reason I ask is that I am planning to deploy a program compiled by GCC 4.8 in C++11 mode on CentOS 6, whose maximum packaged GCC is 4.3... and some of the shared libraries (be they third-party C++ libraries or more system-level stuff) will presumably therefore all be C++03. But if that

Android ActionBar compatibility: MenuItem.setActionView(View)

风流意气都作罢 提交于 2019-11-30 04:48:17
问题 I'm using the appcompat7 lib for ActionBar backwards compatibility. Now I have a MenuItem that I retrieve, and then want to set an ImageView myView as its icon. The way how to do it from API level 11 is: MenuItem menuItemRefresh = menu.findItem(R.id.refresh); menuItemRefresh.setActionView(myView); For API levels lower than 11 this doesn't work, the second line will show an error. Is there an option to do this in compatibility mode? 回答1: Look at MenuItemCompat : http://developer.android.com

whats the equivilent of getCheckedItemCount() for API level < 11?

扶醉桌前 提交于 2019-11-30 03:41:16
问题 I am using this method to check how many items on a list a checked and I get this error that this method is not available for any SDK older than 11. What is the equivalent this in API level 8 回答1: getCheckedItemIds().length seems to do the trick 回答2: The accepted answer didn't work for me (always returns 0), I had to use the following code: public static int getCheckedItemCount(ListView listView) { if (Build.VERSION.SDK_INT >= 11) return listView.getCheckedItemCount(); else { int count = 0;

Forward or Backward Compatibility in Android?

穿精又带淫゛_ 提交于 2019-11-30 02:54:40
问题 I would like to know whether the Android provides any sort of compatibility i.e either forward or backward. It means as in Blackberry if develop an Application with JDE 4.2 then that application will work on any handset with OS 4.2 or higher which means it has forward compatibility. Is there anything similar in Android? Suppose I develop application with Android SDK 1.5 then will that application work on any handset having OS 1.5 or higher. Hope to get a reply soon. Thanks & Regards Sunil 回答1

Theme not applying to DialogFragment on Android

时间秒杀一切 提交于 2019-11-30 01:13:58
I'm switching my old Dialogs to DialogFragment, but the themes and styles don't seem to be working. I'm using the DialogFragment from the compatibility library v4, and in the onCreate method I've tried calling setStyle(style, theme); with a lot of different themes, but the dialog always shows as an "old" dialog in the emulator running Android 4.0.3 (i.e., it does not shows in Holo theme). Is there anything else that I should be doing? Does using the compatibility library disables the Holo theme or anything? If this is the case, should I create two DialogFragments, one for older versions and

Is sizeof(size_t) == sizeof(void*) always true?

北战南征 提交于 2019-11-30 00:55:27
问题 Does the C99/C++11 standard guarantee that sizeof(size_t) == sizeof(void*) is always true? size_t f(void* p) { return (size_t)(p); // Is it safe? } void* f(size_t n) { return (void*)(n); // Is it safe? } 回答1: No, that is not guaranteed. Use intptr_t or uintptr_t to safely store a pointer in an integer. There are/were architectures where it makes sense for that to be false, such as the segmented DOS memory model. There the memory was structured in 64k segments - an object could never be larger

Build for Windows NT 4.0 using Visual Studio 2005?

血红的双手。 提交于 2019-11-30 00:42:30
问题 An MFC application that I'm trying to migrate uses afxext.h , which causes _AFXDLL to get set, which causes this error if I set /MT : Please use the /MD switch for _AFXDLL builds My research to date indicates that it is impossible to build an application for execution on Windows NT 4.0 using Visual Studio (C++, in this case) 2005. Is this really true? Are there any workaround available? 回答1: No, there are many applications built with VS2005 that have to support Windows XP, 2000, NT, the whole