In monotouch, how can I write to the console which the iPhone Configuration Utility displays.
This is the console I am referring to:
You can just use
Console.WriteLine("Hello World");
and with Monotouch's magic, this gets output to the console.
Related
I'm trying to use sqlite with sqlcipher for unity ios game.
I get an sqlite unity example https://github.com/takezoux2/unity-orm
I added a method for unity to call function set key:
[DllImport("__Internal", EntryPoint = "sqlite3_key")]
private static extern int sqlite3_key(IntPtr stmHandle, string key, int len);
I compiled sqlcipher to static library (libsqlcipher.a). Add it to Assets/Plugins/iOS with header sqlite3.h, sqlite3ext.h
In Unity editor, it works without encryption. It's ok. I just want encryption work on ios devices.
I keep moving on export Xcode project, config OPENSSL_SRC in Source trees, add C flag -DSQLITE_HAS_CODEC, add search header "sqlcipher", add Security framework then run on device.
It works! There is no issue. I get the database encrypted in Document folder (i tested it with hexdump -C, SQLiteManager)
The problem only occurred after I archive the app to ipa file (using enterprise provisioning profile). I Use iFunbox to install app to device. The app crash immediately on launch.
This is what i get from crash log:
Exception Type: EXC_BAD_ACCESS (SIGABRT)
Exception Subtype: KERN_INVALID_ADDRESS at 0x00000000
I try to replace sqlite3_key with PRAGMA key='123456';
No more crash, everything works but the output database is not encrypted.
I don't know what different between Archive and Build mode. My example works if i build directly to device (with both sqlite3_key and PRAGMA key='123456';), but archive mode does not.
I also try to import sqlcipher xcode project to unity xcode project (remove libsqlcipher.a from Plugins/iOS), set all architectures to armv7 (also try with/without -mno-thumb), add C flag -DSQLITE_HAS_CODEC, add search header "sqlcipher", add Security framework then run directly on device. It work!!!
Then i try to archive app, install app with iFunbox. Again, i get crash on launch.
I'm not sure if i'm setting something wrong with my project (https://github.com/tamhv/unity-orm-with-encrypt). Please someone take a look on this and give me advice. Thank you so much!
I can't tell you why you are crashing, but you can switch your app to Release mode and then debug it to find out.
In XCode, On the top toolbar next to the play/stop button press on the Project name to bring up the context menu and select Edit Schema.
Under Run/Debug change the Build configuration to Release.
Now run the app from XCode and hopefully you'll see the same crash but have a stack trace.
I'm doing an app with QML that uses LocalStorage to store some informations.
It's working fine when I run in debug mode.
My storage.js that access the database is like that.
.import QtQuick.LocalStorage 2.0 as Sql
// First, let's create a short helper function to get the database connection
function getDatabase() {
return Sql.LocalStorage.openDatabaseSync("MyApp", "0.1", "StorageDatabase", 100000);
}
My Qt .pro file contains the Sql module:
QT += sql
And at first moment it runs fine in Release mode either.
But when I try to deploy on OSX, running macdeployqt like that:
macdeployqt MyApp.app -dmg -qmldir=../MyApp/qml/
First I got one error, but I think that's ok because I don't use MySQL: ERROR: no file at
"/opt/local/lib/mysql55/lib/libmysqlclient.18.dylib"
I'm using sqlite via LocalStorage.
Then trying to run in Release mode it doesn't work anymore, the database access doesn't work, not even the in the deployment it works... now when I try to run the app I got the error:
storage.js:5: ReferenceError: Sql is not defined
The line 5 is this one:
return Sql.LocalStorage.openDatabaseSync("MyApp", "0.1", "StorageDatabase", 100000);
And the Sql name is defined in the first line:
.import QtQuick.LocalStorage 2.0 as Sql
Looking for this error in the internet I found some places telling to do exactly what I did, like here: https://qt-project.org/forums/viewthread/28371
Any clue about this?
I'm using Qt5.2, Quick 2.0, Qt Creator 3.01
The problem was related to this Qt bug that is here since Qt5.1
https://qt-project.org/forums/viewthread/29805/
I've used the script and custom macdeployqt linked in the post to make this work.
Script: https://gist.github.com/lasconic/5965542
Custom macdeployqt: https://github.com/MaximAlien/macdeployqt
It seems that Qt is not giving much attention to desktop development, only that explains a bug like that not fixed yet.
Firstly, I am not using visual studio, I am using notepad and csc. What I am trying to do is create exe's like visual studio's Windows Applications, that is, that do not open any console window at all when you double click the exe. I have found this:
[DllImport("kernel32"]
public static extern IntPtr GetConsoleWindow();
IntPtr window = GetConsoleWindow();
if(window != IntPtr.Zero) ShowWindow(window, 0);
and similar snippets, which work but the console still shows up for a split-second. I want it to not show up at all.
Also, using the Process class does not help because the exe is standalone and is to be double-clicked by hand, it is not launched from an already-running program.
I am also aware of using a vbs script to launch a bat that opens the exe, and other workarounds, but they do not suit my needs.
How can I compile the exe to merely open without any console window at all? It must be possible because visual studio's Windows Applications do it. To clarify I don't even want a form, I just want the program to run in the background, I only am referring to Windows Applications for the sake of comparison since they show no console.
Please don't give me any stupid answers like "use visual studio" or respond with a question instead of an answer. Thank you for your help!
you may want to use the unmanaged library kernel32.dll and the FreeConsole function. Here is an example:
[DllImport("kernel32.dll")]
static extern bool FreeConsole();
static void Main(string[] args)
{
FreeConsole();
// Do other stuff
}
Let me know if this is what you're looking for!
You can go only one way.
Create your (own) application as GUI subsystem, rather CONSOLE subsystem.
When you run compilers - use CreateProcess or ShellExecute (C++) with SW_HIDE (CmdShow). Can't remember, is there corresponding argument in C# function, thought - must be. If not - use WinAPI to start compiler.
This method will completely obscure console window.
I'm in the early stages of creating a MFT to decode a "new" container format video. I'm using the MPEG1Source sample from the Media Foundation SDK, and I have a mpeg1 sample. I changed the extensions in both to ".test" and registered the dll.
Windows Media Player can open the file (my breakpoints are hit and the video plays), but Windows Media Center doesn't- opening from the command line works when the file is .mpg, but not as .test. My breakpoints aren't hit; it doesn't look like it even tries to load the dll (Visual Studio doesn't report my dll being loaded in the output window).
This is 64-bit Windows 7; the dll is native 64-bit.
Is there some additional registration that needs to happen before Media Center will understand a new file type?
I tried using MFTrace to trace the Media Foundation calls- nothing
I tried using Event Viewer to trace Media Foundation- nothing
Finally, I tried Process Monitor- great success! Media Center does a registry scan of HKCU\Software\Classes\.test, HKCR\.test, etc, and looks for a key called "PerceivedType"- if it's "video", then it will play.
So I added the registry key HKEY_CLASSES_ROOT\.test\PerceivedType = video and it works!
I am developing a Flex + AIR application. While debugging using Flash Builder sometimes I get runtime errors dialog with 'continue' & 'dismiss all' buttons. But when I release a build(.air) & run the application after installing. Then I don't get the same dialog in the release build.
I need to track these types of runtime errors for that I am trying to write them to a file as logs.
I tried using try catch & writing to file in catch block, but I am not able to get any wayout for unhandled exceptions or runtime errors.
Is there any way to achieve it?
Thanks in advance.
The error dialog is displayed only if you use the debugger version of Flash Player.
You could register an UncaughtErrorEvent handler and log the errors with trace or with the logging API:
private function onApplicationComplete():void
{
loaderInfo.uncaughtErrorEvents.addEventListener(
UncaughtErrorEvent.UNCAUGHT_ERROR, onUncaughtError);
}
private function onUncaughtError(event:UncaughtErrorEvent):void
{
trace(error);
}
You can't debug compiled AIR application with the Flash debug player because the debug information is removed when you make a release build. You can use something like De MonsterDebugger to output error information, but generally it's a bad idea to show error info in a release build. You should be testing prior to releasing.
In Flash 11.5+ it is now possible to get the stack trace at runtime using error.getStackTrace() see http://renaun.com/blog/2012/09/getting-the-stack-trace-in-a-release-flash-player/
It is working for me in an Air application.