compare iPhone5 and iPhone5S with coding - iphone-5

As we've started to work with iOS7 - and facing some issue during coding - i.e. how we can compare iPhone5 and iPhone 5S - So that we can check either the system is 32bit or 64bit and can use variables accordingly.

If you want to do this via compile time conditionals, there's a new "__arm64__" conditonal defined that is now available for 64-bit compiled code.
Presumably "__arm__" is what gets defined for 32-bit device code.
You'll also likely notice there's a new available architecture in Xcode alongside "armv6, armv7 and armv7s", that being "arm64".
So you could do something like this:
#ifdef __arm64__
NSLog( #"we're running 64-bit");
else
NSLog( #"32-bit iphone code");
#endif

Related

Profile QT, QML application, on a Linux system ( DaVinci board)

Good evening,
I inherited a project made using QT creator (C++ and Qt Quick).
The target is a DaVinci DM8168 board with **Linux kernel 2.6.37 **on it.
In particular I'm using Qt Creator 4.2.0 (4.2.0)
Based on Qt 5.7.1 (GCC 4.9.1 20140922 (Red Hat 4.9.1-10), 64 bit)
I can build & run the application for the target and I can see it running.
I need to launch the profiler. But it does not work. When i run the application (on the target) using the parameter:
qmljsdebugger=port:xxxx
then the application does not start anymore!
I tried to add these options to the project's .pro file:
DEFINES '' += QMLJSDEBUGGER
DEFINES '' += QT_DECLARATIVE_DEBUG
PACKAGECONFIG_append = " qml-debug"
I, obviously, build in debug mode.
When I try to run the applicative on the target i get this message:
QML debugging is enabled. Only use this in a safe environment. Process
killed by signal
I repeat: if the option "qmljsdebugger=port:xxxx" is removed then the application starts and works properly.. but of course the profiler wouldn't connect in this case.
As I said, I've inherited the project and I'm complete new to this environment.
Any help or suggestion?
update
these are now the lines I've added to the .pro file
DEFINES '' += QMLJSDEBUGGER
DEFINES '' += QT_QML_DEBUG
CONFIG += qml_debug
I checked the various path for QT and exported PATH and LD_LIBRARY_PATH.
Unfortunately nothing changes:
If I launch my program using:
/opt/MyPrefix/MyProgram -platform eglfs
then it works.
if I use:
/opt/MyPrefix/MyProgram -qmljsdebugger=port:3456 -platform eglfs
then it crashes
QML debugging is enabled. Only use this in a safe environment.
Segmentation fault
the program seems to start in Debug Mode and this is ok. The problem is the profiler :(
ps: As far as I know there are no firewalls running on the target. I'll check better for sure.
update 2
I tryed the same solutions as above but on a simple program as suggested(an "hello world" basically) and it does not crash when the "-qmljsdebugger=port:3456" option is specified... I really don't know what the problem is in my original application.
First there are a few prerequisites to make qml debug run like being sure that Qt was built with the exact same toolchain as the binary. You should take a look at Qt Wiki: https://wiki.qt.io/How_To_Profile_QML_App_on_Embedded_Device
An important note is that how you make qml debugging works has changed between Qt Quick 1 and Qt Quick 2. As you are using Qt 5, I believe you should be using Qt Quick 2. So that means that you should not use QT_DECLARATIVE_DEBUG, but QT_QML_DEBUG.
More details: https://doc.qt.io/qt-5/qtquick-debugging.html#qml-debugging-infrastructure
If you still have issue after using the proper DEFINES and making sure that evry prerequisite was met, then you should try with a basic Qt program that does nothing, but display a simple QML item (like a Rectangle or a Button) ans see if you still have the issue.

"Module openfl.display.Shader does not define type Shader" when trying to do a release for neko or windows [Flash Develop/Haxe]

this is somenthing I was trying to solve for HOURS, but I don't get why this is not working.
First of all, I'm trying to do a release for neko or windows in Flash Develop. My project is a OpenFl one, and the language is Haxe 3.
What I have installed:
actuate: [1.8.6]
flixel-addons: [2.3.0]
flixel: [4.2.1]
hxcpp: [3.4.64]
lime: [2.9.1]
nape: [2.0.20]
openfl: [3.6.1]
And yes; I'm using haxeFlixel.
When I try to do a release in windows or neko, these errors appear:
-E:/HaxeToolkit/haxe/lib/openfl/3,6,1/openfl/_internal/renderer/opengl/utils/SpriteBatch.hx:12: characters 7-28 : Module openfl.display.Shader does not define type Shader
-E:/HaxeToolkit/haxe/lib/openfl/3,6,1/openfl/_internal/renderer/opengl/utils/SpriteBatch.hx:12: characters 7-28 : For function argument 'ax'
-src/skill/SkillLogicProjectil.hx:13: lines 13-54 : Defined in this class
-E:/HaxeToolkit/haxe/lib/openfl/3,6,1/openfl/_internal/renderer/opengl/shaders2/Shader.hx:11: characters 7-28 : Module openfl.display.Shader does not define type Shader
The most funny thing is: I'm not even using Shader in SkillLogicProjectil. That class only creates a sprite that follows a Player and has a var with the sprite that represents the skill.
If I comment this class, the error is in another class, and finally ends in my GameState.
This error doesn't appear when I do a release in html5. In html5 there are no problems with the release, but I canĀ“t make the game load without Flash Develop running the process in http://localhost:2000/. I need to make a release that can be opened with a computer, without using Flash Develop to open it.
What can I do?.
The new version of Flixel supports Haxe 3.4.3 and OpenFL 8, have you given these versions a try?

How do I check if the current OS is Windows 10 and the device is phone?

In the C++ code (C# solution is OK: I can translate it to pure C++ or C++/CX) I need to check whether the code is working under Windows Phone 10 or not.
Rely on assumes which editions/SKU support which functions is a terrible bad design.
Call the D3D11CreateDevice call with D3D11_CREATE_DEVICE_DEBUG in Flags and if it returns DXGI_ERROR_SDK_COMPONENT_MISSING the debug layer is not avaible and call it again without this debug flag so that it works on Phone/Mobile, too.
Searching for D3D11_CREATE_DEVICE_DEBUG here on stackoverflow shows this topic on steps how to install the required data on mobile.

Application crashes when using graphics debugger with Nsight 2.2

Hi I am using NVidia Nsight 2.2, have a GTS 450 card and latest drivers. Windows Vista 64 bit. When launching graphics debugger the application crashes on the very 1st drawcall. The callstack looks like this:
nvwgf2um.dll!5bdd7d53()
[Frames below may be incorrect and/or missing, no symbols loaded for nvwgf2um.dll]
nvwgf2um.dll!5be9c7f7()
nvwgf2um.dll!5bde377e()
nvwgf2um.dll!5bc02afb()
nvwgf2um.dll!5bc0257b()
nvwgf2um.dll!5bc0259e()
nvwgf2um.dll!5bdd0612()
nvwgf2um.dll!5bcb2292()
nvwgf2um.dll!5bc45072()
nvwgf2um.dll!5bcbff8c()
D3D11SDKLayers.dll!5ea52f2f()
Nvda.Graphics.Interception.100.dll!5dbb2853()
Nvda.Graphics.Interception.100.dll!5dba317e()
Nvda.Graphics.Interception.100.dll!5db99b21()
Nvda.Graphics.Interception.100.dll!5df0150f()
Otherwise it runs fine by itself, only crashes if I launch through Nsight graphics debugger.
I suspect this is somehow related to me using DX11 dynamic shader linkage. Since my other applications that don't use dynamic linkage run fine. Anybody experienced this before, or has any info on this issue with Nsight?
What driver and exact build of 2.2 are you using? (Nsight->Help->About Nsight->Build number)
The problem might be related to DX Control Panel's debug layer setting. (Please check my comments in Sebastien's answer).

Operating System Directive in Delphi Prism

Since I am writing a program that will eventually run on Windows and Linux environment compiled from the same project files, I wanted to test and see how well the Operating System directives are. So, I wrote a sample code. The code seems to run unexpectedly or it just my imagination.
Here is the code:
method MainForm.ControlBtn_Click(sender: System.Object; e: System.EventArgs);
begin
{$IFDEF linux}
MessageBox.Show('This is Linux. Horay!!!', 'mypro',MessageBoxButtons.yesno);
{$ENDIF}
{$IFDEF WIN32}
MessageBox.Show('This is Win32. Horay!!!', 'mypro',MessageBoxButtons.yesno);
{$ENDIF}
{$IFDEF CLR}
MessageBox.Show('This is .NET Framework. Horay!!!', 'mypro',MessageBoxButtons.yesno);
{$ENDIF}
end;
Now, when I run this method on Windows it pops up a message box with 'This is .NET Framework. Horay!!!' I kind of expected that being that it was running on Windows. When I ran it on Linux under Mono, it popped up a message box with the same message, "This is .NET FrameWork. Horay!!!" I was expecting to see Linux message, which is "This is Linux. Horay!!!" If this code is working correctly, then how do you check to see which platform your program is running on in the event you do need to execute different methods only supported by Linux or Mac or windows.
The compiler directives are evaluated at compile time (hence compiler directives). So the resulting .exe will always state the platform it was compiled on, not the one it is running on. Also, the Delphi-Compiler directives are not defined in this way for Prism / Oxygene language.
The way to retrieve the OS you're running on is a bit tricky (there are for example multiple values stating you're on UNIX), but not overly complicated.
The first place to go is System.Environment.OSVersion.Platform.
This enum defines the following values in .NET 2.0: Win32S, Win32Windows, Win32NT, WinCE, Unix, Xbox, MacOSX. MacOS has its own value while Linux and other Unixoid systems share the Unix value.
Mono also defines other values too (see the Mono FAQ entry on determining the platform).
Edit: One possible way would be:
var os: string := if Environment.OSVersion.Platform = System.PlatformID.Unix then
'Linux/Unix'
else if Environment.OSVersion.Platform = System.PlatformID.MacOSX then
'Mac OS X'
else
'Windows';

Resources