How can I save breakpoints in Gupta 6? When i refresh libraries after inserting some code into another .apt, my breakpoints in main program are lost. Is there any trick how to prevent from it?
Breakpoints will be saved if you save the file as TYPE binary ( i.e. save as file type = 'Normal' ) , not if saved as Text ( i.e. file type = 'TEXT' or 'INDENTED TEXT' ). This is regardless of what file extension you have . p.s. only save as binary if you're in debug mode. Otherwise difficult to fix if code becomes corrupt. If saved as Text - much easier to fix.
Related
I would like to be able to redirect my logging statements to a file so that I can retrieve them when my app runs standalone (i.e. is not attached to Xcode). I have discovered (thank you Stackoverflow) that freopen can be used to accomplish this.
If I create a new Xcode project and add the code to redirect stderr then everything works as expected.
However, when I add the redirection code to my existing, bluetooth project I am having trouble. The file is being created and I can retrieve it using iTunes or Xcode's Devices window, but it is of size 0. If I explicitly close the file then the text that I wrote actually makes it into the file. It is as though iOS is not flushing the file when the app is terminated. I suspect that the trouble stems from the fact that I have enabled background processing. Can anyone help me to understand this?
Here is my code:
let pathes = NSSearchPathForDirectoriesInDomains(.DocumentDirectory, .UserDomainMask, true);
let filePath = NSURL(fileURLWithPath: pathes[0]).URLByAppendingPathComponent("Test.log")
freopen(filePath.path!, "a", stderr);
fputs("Hello, Samantha!\r\n", stderr);
struct StderrOutputStream: OutputStreamType {
static let stream = StderrOutputStream()
func write(string: String) {fputs(string, stderr)}
}
var errStream = StderrOutputStream.stream
print("Hello, Robert", toStream: &errStream)
fclose(stderr) // Without this the text does not make it into the file.
I'd leave this as a comment, but have you looked into NSFileHandle? It sounds like you just need a way to append data to the end of a text file, correct?
Once you have a handle with something like NSFileHandle(forWritingToURL:), you can use .seekToEndOfFile() and .writeData(_:). As a side note, you'll need to convert your String to Data before writing it.
Admittedly, this will probably end up being more lines of code, and you'll almost certainly need to take threading into consideration.
I get binary array then convert it and save in Documents folder and then showed in QLPreviewController. I have seen the right button on the tool bar of QLPreviewController.
I want to print that is in the preview right now. But when i tab error occurs
*** Assertion failure in -[UIDocumentInteractionController setURL:], /SourceCache/UIKit_Sim/UIKit-2380.17/UIDocumentInteractionController.m:960
Also please guide me about printing that document. I have read about UIPrintInteractionController.
Why this Error occurs because you have set the URL wrong.
You are setting url like that;
/Users/akrama2/Library/Application%20Support/iPhone%20Simulator/6.1/Applications/59356D13-C021-431F-A5D2-B8CD16E2B301/Documents/Application_Report.pdf
Where as UIDocumentationController task URL as:
file://localhost/Users/akrama2/Library/Application%20Support/iPhone%20Simulator/6.1/Applications/59356D13-C021-431F-A5D2-B8CD16E2B301/Documents/Application_Report.pdf
This minor mistake will made you mad ;)
I got a dictionary to store SoundEffects in, like:
public static Dictionary<string, SoundEffect> Hangok = new Dictionary<string, SoundEffect>();
I load sounds from files (normal .wav format), like:
GStatic.Hangok.Add(Azonosító, SoundEffect.FromStream(File.OpenRead(Azonosító)));
, where Azonosító was the filename.
All is just fine, files are loaded, except one; an exception is created:
Operation is not valid due to the current state of the object.
, what is not much of information for me. Could anyone explain this error message OR tell me why SoundEffect.FromStream fails to read? Why? When? Workaround?
Thanks in advance:
Péter
I use the ContentManager to load in SoundEffect's. Place the wav file in the content project and it should just load in.
E.g.
SoundEffect s = Content.Load<SoundEffect>("name");
Not a complete, but working solution to this problem. "Answering my question" only, because it may be useful for other developers, who also have no idea what the problem may be.
try
{
GStatic.Hangok.Add(Azonosító, SoundEffect.FromStream(File.OpenRead(Azonosító)));
}
catch
{
GStatic.Hangok.Add(Azonosító, new SoundEffect(File.ReadAllBytes(Azonosító), 11025, AudioChannels.Mono));
}
And well: I got no idea WHY you can not load that file in the normal way and why you can load the way like in the exception handler. Having a file in mono should not be that big problem. If someone knows, please drop a note/comment.
I have read most all of the documentation and questions related to preferences I could find but I have an error that is always coming up no matter what method I try and I do not understand it.
js file loaded in browser overlay xul
var prefs = Components.classes["#mozilla.org/preferences-service;1"].
getService(Components.interfaces.nsIPrefService).
getBranch("extensions.{my-guid-id}.");
var value = prefs.getBoolPref("firstrun");
defaults/preferences/prefs.js:
pref("extensions.{my-guid-id}.firstrun", true);
The error message in the error console says uncaught exception: "compenent returned failure code 0x8000ffff" on line 27 which is right at getBoolPref() call.
Your code looks correct.
Are you sure that you did not put the word true in quotes or accidentally already set it as a non boolean preferences?
I would suggest going into about:config and verifying that your firstrun preference is showing up as a Boolean.
That's the most common cause of the problem you are seeing.
Having recently downloaded and installed XCode 4.3 from the App Store, I find a serious and unexpected problem when reading image-files (large JPEG files) previously stored in the application User Documents. The issue is as follows:
(i) The files derive from the user's photo-library and the UIcropped original image ( UIImagePickerControllerOriginalImage) is correctly stored to User Documents. Inspection of the User Documents folder shows the image file correctly stored. Copying this file to my user-account creates a copy that can be loaded (for example) into the Preview application or else iPhoto. The expected image is loaded by Preview and iPhoto and can be seen to be visually correct.
(ii) On attempting to read the stored file with the standard method
UIImage * image = [ UIImage imageWithContentsOfFile: file ]
method (where file is the full path-name of the stored file) the image returned is nil. nil is also returned on attempting an NSData load via
NSData * data = [ NSData dataWithContentsOfFile: file options:
NSDataReadingMappedIfSafe error: & error ];
In this case the full NSError * error object is reported as follows:
CODE= 260, DOMAIN= NSCocoaErrorDomain,
USERINFO =
{ NSFilePath = "<User Documents>/<filename>.jpeg";
NSUnderlyingError = "Error Domain=NSPOSIXErrorDomain
Code=2 \"The operation couldn't be completed. No such file or directory\"";
}
(iii) Examining the copied file in Finder shows that the "Kind" of the previousl;y written image-file is now "Document" wheras previously it was (as expected) "JPEG Image". This is the ONLY evident problem with the file.
(iv) Replacing the previous written file with an externally created JPEG image file WITH EXACTLY THE SAME NAME results in a successful loading of the file via [ UIImage imageWithContentsOfFile: file ]!
THIS LOOKS, THEREFORE, TO BE A PERMISSIONS PROBLEM RATHER THAN A JPEG-DATA PROBLEM. New with XCode 4.3 installation is the Kind= "Document" replacing the previous (and working) Kind = "JPEG Image". CAN ANYONE PLEASE THROW LIGHT ON THIS MATTER AND IF POSSIBLE ADVISE A SOLUTION? The matter is urgent & frustrating for me as it breaks a PDF design tool under urgent development!
Best Wishes,
Negative Entropy
Can you debug and "po file" from the console? I've not seen a permission problem before, so I suspect the path. Also, we have seen issues with case sensitivity (iOS is case sensitive, whereas your Simulator may not be). Need to see the full path variable contents.