backwards-compatibility

PHP date_parse_from_format( ) alternative in PHP 5.2

江枫思渺然 提交于 2019-11-30 15:25:56
Since date_parse_from_format( ) is available only in PHP 5.3, I need to write a function that mimics its behaviour in PHP 5.2. Is it possible to write this function for PHP 5.2 and make it work exactly the same way that it does in PHP 5.3? Example: For this input: <?php $date = "6.1.2009 13:00+01:00"; print_r(date_parse_from_format("j.n.Y H:iP", $date)); ?> I need this output: Array ( [year] => 2009 [month] => 1 [day] => 6 [hour] => 13 [minute] => 0 [second] => 0 [fraction] => [warning_count] => 0 [warnings] => Array ( ) [error_count] => 0 [errors] => Array ( ) [is_localtime] => 1 [zone_type]

Is it OK to have so many deprecated methods in backward-compatible code?

假装没事ソ 提交于 2019-11-30 14:07:20
问题 I'm writing an Android application which is targeted to API level 15 but I also want to keep backward-compatibilty with older API levels (min-sdk 7). I'm going to reach this by putting conditions deciding which code to use according to current API level (as shown below). I suppose this is a good approach, I just want to ask if it's OK to have so many deprecated methods (like display.getWidth() ), because there is quite many changes between API level 8 and 15. And if so, if it's a good use of

Check for availability of blocks at runtime on iOS

岁酱吖の 提交于 2019-11-30 13:43:47
I need to test for the availability of blocks at runtime, so I can handle backwards compatibility with iOS 3. Any tips? edit: So far I'm doing if (!NSClassFromString(@"NSBlockOperation")) {...} Seems to be working... martineno You will also need to make sure to weak link the libSystem.B.dylib , set your base SDK to 4.0 and deployment target to 3.1.3, as described here . A good overview on how to deal with iOS versioning issues can also be found in this this Cocoa with Love article: Tips & Tricks for conditional iOS3, iOS3.2 and iOS4 code 来源: https://stackoverflow.com/questions/4231965/check

Visual Studio won't open solution file

余生长醉 提交于 2019-11-30 12:11:22
问题 I have a VS project (made by someone else), and when I try to open it on Visual Studio 2008, I get the following error message: "The selected file is a solution file, but was created by a newer version of this application and cannot be opened" I would have thought VS was backwards compatible. Is there any way I can open this? 回答1: VS is backwards compatible, yes - you can open a VS 2005 solution file in VS 2008, for example. It's not forward compatible though - presumably that solution has

Usable case of pointer to array with unspecified bounds in C++ (not in C)

和自甴很熟 提交于 2019-11-30 11:19:48
问题 Consider following code: int main() { int (*p)[]; // pointer to array with unspecified bounds int a[] = {1}; int b[] = {1,2}; p = &a; // works in C but not in C++ p = &b; // works in C but not in C++ return 0; } In pure C you can assign a pointer to this type of address of an array of any dimension. But in C++ you can't. I found one case when compiler allows assign value to such pointer: struct C { static int v[]; }; int main() { int (*p)[] = &C::v; // works in C++ if 'v' isn't defined (only

Backwards compatibility in .NET with BinaryFormatter

隐身守侯 提交于 2019-11-30 09:08:13
We use BinaryFormatter in a C# game, to save user game progress, game levels, etc. We are running into the problem of backwards compatibility. The aims: Level designer creates campaign (levels&rules), we change the code, the campaign should still work fine. This can happen everyday during development before release. User saves game, we release a game patch, user should still be able to load game The invisible data-conversion process should work no matter how distant the two versions are. For example an user can skip our first 5 minor updates and get the 6th directly. Still, his saved games

Running .NET 3.5 apps on .NET 4 only systems

守給你的承諾、 提交于 2019-11-30 08:31:59
问题 This question has been asked before perhaps multiple times, but I can't get the typical solution to work for me. The proposed solution is to put this in the "app.config" file: <configuration> <startup> <supportedRuntime version="v4.0"/> </startup> </configuration> But with a simple "Hello World" program, I still get the error: "Unable to find a version of the runtime to run this application.". For some background, I'm using Windows XP (through Windows Virtual PC on Windows 7), and only

Is HTTP/1.0 still in use?

依然范特西╮ 提交于 2019-11-30 07:47:39
问题 Say one is to write an HTTP server/client, how important is it to support HTTP/1.0? Is it still used anywhere nowdays? Edit: I'm less concerned with the usefullness/importance of HTTP/1.0, rather the amount of software that actually uses it for non-internal (unit testing being internal use, for example) purposes in the real world (browsers, robots, smartphones/stupidphones, etc...). 回答1: As of 2016, you would think that the prominence would decline even more since 1.1 was introduced in 1999

Are android apps backwards compatible?

拟墨画扇 提交于 2019-11-30 07:02:36
Should I build an app that targets Android 2.2 and release it on the Android Marketplace; Would the app be available for download and use on devices running a version of Android OS lower than the targeted version of the app? - Let's say Android OS version 1.6. What would happen if a user (with an Android OS version 1.6 powered device) were to attempt to run the app? Would they be prompted to update their OS or just receive an error message? Graham Borland It depends what you have in the minSdkVersion field in your AndroidManifest.xml . If it is set to 4 or lower, then it will be visible to

Alert that can work on iOS 7 and iOS 8

元气小坏坏 提交于 2019-11-30 06:57:19
I'm getting dyld: Symbol not found: _OBJC_CLASS_$_UIAlertAction when I'm trying to get this monstrosity to run. How do I weaklink 8.0 stuff? var device : UIDevice = UIDevice.currentDevice()!; var systemVersion = device.systemVersion; var iosVerion : Float = systemVersion.bridgeToObjectiveC().floatValue; if(iosVerion < 8.0) { let alert = UIAlertView() alert.title = "Noop" alert.message = "Nothing to verify" alert.addButtonWithTitle("Click") alert.show() } else { var alert : UIAlertController? = UIAlertController(title: "Noop", message: "Nothing to verify", preferredStyle: UIAlertControllerStyle