I just found that my AudioSessionSetActive(false) call in my "shutdown" code never returns noErr. There are some undocumented code like (OSStatus) 803204036, which corresponds to none of the listed return codes:
http://developer.apple.com/library/ios/#documentation/AudioToolbox/Reference/AudioSessionServicesReference/Reference/reference.html
And I went through all listed Xcode sample codes that are relevant to AudioSessionSetActive() and found absolutely no calls with "false" argument.
All the samples just call AudioSessionSetActive(true) under various scenarios. The samples are:
iPhoneExtAudioFileConvertTest
iPhoneMixerEQGraphTest
iPhoneMultichannelMixerTest
MusicCube
oalTouch
aurioTouch
aurioTouch2
GLAirplay
iPhoneACFileConvertTest
iPhoneMixerEQGraphTest
SpeakHere
Is that we are not supposed to call AudioSessionSetActive() with false ourselves?
Is it that the deactivation is handled implicitly?
Ok, I've found the issue myself.
I tried to set it to false before calling AudioOutputUnitStop() and AudioUnitUninitialize().
I was able to fix it by calling AudioSessionSetActive(false) after those calls have succeeded.
Related
I have created a system, within which I am instancing kinematic bodies (2D). These have scripts attached. When I call the functions within these, all is GENERALLY okay. However randomly, with wildly different wait times for it to happen (sometimes it never does), the system will crash, saying that the function, that has been working fine, is does not exist within Area2D. I have no clue why this can happen, can anyone give me any help with this.
The actual error code Invalid call. Nonexistent function 'move' in base 'Area2D'
Thanks
Add check for method existence before you call method.
Let's say you call move method for obj variable (replace it with your own).
Now call to the move method should look like this:
if obj.has_method("move"):
obj.move()
Docs
I'm adding a call to the SetProcessDpiAwareness windows function as the first thing in my Delphi XE7 application (after dynamically loading the shcore DLL). I know it is preferable to use a manifest to set the DPIAware value and I've got that working separately and will use it eventually. However during development I want to use a command line parameter to set DPIAwareness value, otherwise I have to rebuild the app to change this status.
The problem is that SetProcessDpiAwareness returns the error code $800700A0.
That is not documented in the function description, what does the code mean?
Ah I've found it, thanks to the answer to look at the parameter, I had declared the function type wrong, I had:
TSetDPIFunc = function (const PROCESS_DPI_AWARENESS) : HRESULT; stdcall;
but PROCESS_DPI_AWARENESS was not defined as an enum.
Changed to the following and it now works fine:
TSetDPIFunc = function (const x: Integer) : HRESULT; stdcall;
0x8007XXXX is a Win32 error code encapsulated in a COM HRESULT using HRESULT_FROM_WIN32(). WIN32_FROM_HRESULT(0x800700A0) gives 0xA0, i.e. error code 160, which is ERROR_BAD_ARGUMENTS ("One or more of the input parameters are not correct").
It makes no sense for me though that you get this error, since this function doesn't even take any arguments!
So the only thing I can think of would be that it has something to with the issue described here, assuming you changed the DPI settings yourself for testing and it failed then:
So it seems that in order for SetProcessDPIAware (and the related approaches: SetProcessDpiAwareness() and manifest with true) to work correctly, one has to log out and login again after changing the DPI setting and before running the program.
By the way, in case this is helpful: For testing manifests without totally rebuilding, you could use mt.exe to attach a manifest to your application from the command line.
Going from Joomla 2.5 to 3.0 with my extension, I'm struggling with how to do the DB error handling (since GetErrorNum is deprecated, see also Joomla! JDatabase::getErrorNum() is deprecated, use exception handling instead).
The way that seems to be the one to go according to the question linked above, is to add the following code for each db->query() code:
if (!$db->query()) {
throw new Exception($db->getErrorMsg());
}
In my opinion, that makes DB error handling more awkward than it was before. So far, I simply called a checkDBError() function after a DB call, which queried the ErrorNum and handled any possible error accordingly.
That was independent from how the DB query was actually triggered - there are different ways to do that, and different results on an error: $db->loadResult() returns null on error, $db->query() returns false. So there will now be different checks for different DB access types.
Isn't there any generic way to handle this, e.g. a way to tell Joomla to throw some exception on DB problems? Or do I have to write my own wrapper around the DatabaseDriver to achieve that? Or am I maybe missing something obvious?
Or should I just ignore the deprecation warning for now and continue with using getErrorNum()? I'd like to make my extension future-proof, but I also don't want to clutter it too much with awkward error handling logic.
Just found this discussion: https://groups.google.com/forum/#!msg/joomla-dev-general/O-Hp0L6UGcM/XuWLqu2vhzcJ
As I interpret it, there is that deprecation warning, but there is no proper replacement yet anyway...
Unless somebody points out any other proper documentation of how to do it in 3.0, I will keep to the getErrorNum method of doing stuff...
Get getErrorNum() function will solve your problem....
$result = $db->loadResult();
// Check for a database error.
if ($db->getErrorNum())
{
JFactory::getApplication()->enqueueMessage($db->getErrorMsg());
return false;
}
I want to know how i can trace program execution using xcode
I want to know which method being called right now as when you add break point in method
Is there any way to do such alike thing without adding breakpoints??
There are a couple of Debugger-related WWDC 2012 videos, one of which shows you how to add a breakpoint that continues automatically after running a debugger command. This is preferred to adding logging as there is no need to keep doing the write-compile-debug loop.
You can add an action to the breakpoint that calls:
expr (void)NSLog(#"self=%p Method1", self);
Having said that I still use log calls, but I use my own logging framework which prints the name of the class and method automatically (using __FUNCTION__ string generated by the compiler).
after search i found that the easiest solution is to put the following code in your methods:
NSLog(#"<%#:%#:%d>", NSStringFromClass([self class]), NSStringFromSelector(_cmd), __LINE__);
NSLog(#"Check 1 - 2 !");
will show you a log trace ;-)
I just migrated my language service from VS2008 to VS2010. Everything works fine except for one important thing: I no longer get LanguageService.ParseSource invoked for ParseReason.Check. It do get a single invoke after opening a file. But after editing code, it no longer gets invoked.
Any ideas what could be causing that?
I also migrated a language service from 2008 to 2010. Can you check if you've fallowed all of these steps?
http://msdn.microsoft.com/en-us/library/dd885475.aspx
I didn't have to do anything else, which I verified by diffing the important files in our depot before and after the change.
I don't know if you ever figured your question out, but have you tried making sure that your Source class' LastParseTime is set to 0 when creating it? I seem to recall some issues with Check not happening unless you manually set LastParseTime to 0 when creating your Source object.
Protip: If you use .NET Reflector, you can disassemble all of the base classes for the LanguageService framework and get a pretty good understanding of how it all works under the hood. The classes you'd be interested in live in Microsoft.VisualStudio.Package.LanguageService.10.0.dll, which should be installed in the GAC. I've found this to be unimaginably helpful when trying to figure out why things weren't working in my own Language Service, and being able to step through the source code in the debugger mitigates almost all the pain of working with these frameworks!
When your Source object is initialized, it starts off with a LastParseTime of Int32.MaxValue. The code that causes fires off a ParseRequest with ParseReason.Check checks the LastParseTime value to see if the time since the last change to the text is less than the time it takes to run a parse (or the CodeSenseDelay setting, whichever is greater).
The code that handles the response from ParseSource is supposed to set the LastParseTime, but as far as I can tell, it only does that if the ParseReason is Check.
You can get around this issue by setting Source.LastParseTime = 0 when you initialize your Source. This has the side-effect of setting CompletedFirstParse to true, even if the first parse hasn't finished yet.
Another way to fix this issue is to override Source.OnIdle to fire off the first call to BeginParse() This is the way I would recommend.
public override void OnIdle(bool periodic)
{
// Once first "Check" parse completes, revert to base implementation
if (this.CompletedFirstParse)
{
base.OnIdle(periodic);
}
// Same as base implementation, except we don't check lastParseTime
else if (!periodic || this.LanguageService == null || this.LanguageService.LastActiveTextView == null || (this.IsCompletorActive) || (!this.IsDirty || this.LanguageService.IsParsing))
{
this.BeginParse();
}
}