Window setBackGround: causes runtime errors - runtime-error

I added a background color to the window of a well-running simple draw project and build succeeded. Then the fun began: runtime errors appeared in the console window. I found no help in Apple docs and Google. When the same happened in another draw project, I knew I had to ask for help.
Here's what happened each time I did a build & debug and stop -- runs 1) through 4). "continue" means I clicked the Continue icon. It kept on erring in no consistent order.
1)Program received signal:“EXC_BAD_ACCESS". spinning ball. paths OK.
continue. “EXC_BAD_ACCESS. spinning ball. paths disappear. background appears.
2)continue, 6 times. “EXC_BAD_ACCESS”. spinning ball. paths disappear. background appears.
3)immediately:
2012-12-26 09:53:18.265 bezier triangle[388:a0f] -[NSCFArray stroke]: unrecognized selector sent to instance 0x1005184f0
2012-12-26 09:53:18.268 bezier triangle[388:a0f] -[NSCFArray stroke]: unrecognized selector sent to instance 0x1005184f0
2012-12-26 09:53:37.846 bezier triangle[388:a0f] -[NSCFArray stroke]: unrecognized selector sent to instance 0x1005184f0
2012-12-26 09:53:37.847 bezier triangle[388:a0f] -[NSCFArray stroke]: unrecognized selector sent to instance 0x1005184f0
no continue icon. paths OK. no background.
4)continue, 6 times. “EXC_BAD_ACCESS”. spinning ball. no paths. no background.
The NSWindow class creates a couple of Bezier paths in initWithRect: and draws them in drawRect:. It ran well.
I got the setBackGround: code from Apple's Window Programming Guide and pasted it into the previously empty AppDelegate.
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
// Background color
[window setOpaque:NO]; // YES by default
NSColor *semiTransparentBlue =
[NSColor colorWithDeviceRed:0.0 green:0.0 blue:1.0 alpha:0.5];
[window setBackgroundColor:semiTransparentBlue];
window.backgroundColor = NSColor.blueColor;
}
Setting breakpoints showed that the runtime errors occur after this code finishes.
Thinking that the problems might have something to do with the timing of its execution, I moved this code to initWithRect and then into awakeFromNib. These didn't work. I wish I could find some example that shows how to implement this. All help will be appreciated.

No, setBackground: did not cause the runtime errors.
In the paths code, the paths weren't being allocated and inited properly, although the project ran correctly until the setBackground: code was added. Strange!
I'm sorry I didn't enclose the paths code in my question because it was too long.
I found my mistakes by starting a new project and building it up slowly, a piece at a time.

Related

Code Composer Studio MSPFR6989 variables&expressions won’t come up

I am using CCS to program a MSPFR6989 and I’ve debugged and the code is working but I can’t get variables or registers to come up. It remains blank. enter image description here
use double click onto your variables and choose watch expression. You can find your variables under expression from now. If it shows you its name but a red error message try step by step debugging, works for me everytime.

Unity 5 NetUI - How do I fix this error?

This error message keeps showing everytime I test the game:
NullReferenceException: Object reference not set to an instance of an object
SetupLocalPlayer.Start () (at Assets/Scripts/SetupLocalPlayer.cs:12)
and I'm trying to figure out how to enable my Wheeldrive script when I am the local player (When I spawn in) and it doesn't seem to be working, The Network Id is on the player prefab but the controller script is on the Sedan gameobject, since the Network identity is on the player prefab the disable script also has to go on it, so I don't think the script is able to find the controller script since its not on the same Gameobject. (Picture Below)
Any help is really appreciated :)
The Project + Code Picture
If the SetupLocalPlayer script is on the player prefab, You should be able to find the WheelDrive component using GetComponentInChildren<WheelDrive>() instead of GetComponent<WheelDrive>() (in line 12 of the SetupLocalPlayer.cs file)
Because the WheelDrive component is not enabled, GetComponent is unable to find it. Thus GetComponent<WheelDrive>() returns null, and you get the error in the console.

Ruby/Selenium/Watir-Webdriver: "path is not absolute" error for absolute path

document_name ='TestDoc'
document_path = ("/Users/Me/QA/Project/Documents/#{document_name}")
File.new ("/Users/Me/QA/Project/Documents/#{document_name}") # => File is created
filename_field.send_keys("#{document_path}")
filename_field.send_keys :tab # => To Trigger event but where error occurs
filename_field = browser.file_field(:name, 'file') declared in a module elsewhere.
As far as I can tell, I have provided an absolute path for the filename to upload the file but when the tab key is sent, an error occurs of:
Selenium::WebDriver::Error::UnknownError: unknown error: path is not absolute:
With an odd squiggly symbol in RubyMine that I've never seen before. Any ideas?
Update:
I added
puts filename_field.value
# => C:\fakepath\TestDoc
Spoke to one of the developers and she said "Browser does it to fake things out, so the filesystem isn't exposed". Not sure if that helps solve my issue or I'm SOL?
That error comes from Chromedriver, and comes from sending an incorrect path string to a file element. Since :tab is not a path, it is correctly raising an error.
You shouldn't need to send a tab; just sending the path of the file should accomplish what you need.
I see many small strange things in your code.
Why
document_path = ("/Users/Me/QA/Project/Documents/#{document_name}")
Not
document_path = "/Users/Me/QA/Project/Documents/#{document_name}"
Why
filename_field.send_keys("#{document_path}")
Not
filename_field.send_keys(document_path)
But the main question is why you are using send_keys instead of set?
I failed to reproduce your problem. Maybe it will be possible if you will provide your html. But i suggest you to try:
filename_field.set(document_path)
Because you can easily check it even with irb send_keys is acting differently in firefox and in chrome for example. So maybe problem with it.
Another suggestion
That is a much more weak idea. But...
Try to clear value before changing it. You can do it with javascript:
b.execute_script("arguments[0].value=''", field)
I had the same issue with Chromedriver 2.26.436421 and it was solved when I removed the code which was sending the tab key.
With previous Chromedriver sending tab key was required to trigger the change event on the file input but with latest one it seems like it is only causing issues and the change event gets triggered without it.

Xcode AppDelegate wont link to textfields

I am following along in a book to learn swift and I am building a basic loan calculator for OS-X using XCode. I am getting two errors in my code and it wont allow me to attach the Outlets to my textfields. The errors are:
Line 16 - Use of Undeclared type "NSTestField" but I changed it to NSTextField and it still shows an error under the mistyped var name.
Line 35 - Postfix "." is reserved. The error carrot is on the dot between loanAmountField and doubleValue.
Also, it wont allow me to drag the outlets into my app. I am guessing I did not attach the appdelegate file to the right window since the window option is not marked but I cant figure out how to do that. The book just says it should already be marked.
My code showing errors
(Sorry, I tried using the "code sample" button when posting this but even after indenting 4 spaces and pasting my code it continued to tell me I did not indent.)
The appdelegate showing that "window" isnt marked

No Way to get the console handle (Dev-Pascal)

I've tried the simple program for my exercise but if i compiled, it turned give a message "No Way to get the console handle" (Dev-Pascal).
Here's my code:
program square;
uses crt;
var
side,circumference,broad:real;
begin
write('Input the side value of the square: ');
readln(side);
circumference := 4 * side;
broad := side * side;
writeln('The circumference value of the square = ', circumference);
writeln('The abroad value of the square = ', broad);
writeln();
write('Press any key...');
readkey();
end.
thank you for helping and teaching me
i would appreciate
Dev-pascal comes with a 10+ years old Free Pascal version. I really have no idea. Try to run the example on the cmdline to see if dev-pascal is the cause or something else. Temporarily disable security software might also be something to try.
I suppose, you've created a Window Skeleton project.
It has it's description: A Windows skeleton application (no window).
In this case you'll get this error though you code compiles (I've got this error too with your code).
Try to create Console Application project which has it's own description: A standard console-based (MS-DOS) application (Your code has compiled and the program worked as well).
P.S. Can't say what exactly happens -- couldn't find any documentation about errors in Dev-Pas (1.9.2).
My assumption is that skeleton program doesn't imply console window for execution program while console application does.
just close the project and then re-open the pascal source file (.pas). And maybe put "readln;" just before "END.".

Resources