How to show the Logged Messages window in Xcode - cocoa

I'm a very new Cocoa user and running into all sorts of problems...
I'm trying to get the content of an Array and found this code to do this.
NSLog(#"array : %#",collection);
The problem is, I'm not getting any console or tracer window that shows this 'echo'
Is there another command I should use, i've tried opening all windows but I don't see the message that should show. I know the function that this call is in is executed, so the reference is right.
Thanks and sorry for these beginner questions... Using stackoverflow is way faster than reading through all the documentation apple has regarding the subject.

Update for 2023 : It's Command + Shift + C
Old answer : It's shift + cmd + R. Or go to View -> Debug Area -> Activate Console

From the 'Run' menu, choose 'Console' - keyboard shortcut is Shift-Cmd-R.

When Xcode runs your project, the editor changes to show a little black button with the letters "GDB" in it. Click on that to see the Debugger which has the console in it.
Good luck!
Oh, and I would read Apple's documentation. It's not that bad.

In Xcode 12, go to View > Debug Area > Activate Console

In the Xcode menu hit Run - Console. This is where NSLog / print / printf etc statements output.
The key command is Command + Shift + R.
The cocoa toString() method is called description as well.
NSLog(#"array : %#",collection);
Will execute
NSLog(#"array : %#",[collection description]);
Which will then call description on each of the collections elements.

If you want to see it every time you run your application select the "Debugging" tab from the preferences window and change the box that says "On Start" to "Show Console".
Additionally i like to check the "Auto Clear Debug Console" checkbox which will clear out the text of the output on starting your application.

Related

Command "File.AddexistingItem" is not valid

I am curious about why wouldn't this command work?
File.AddExistingItem
Since it's stated in MSDN library and it has its own chapter about it!
https://msdn.microsoft.com/en-us/library/6h4c0t7y.aspx
I am using VS2015
1. Open the IDE's command window by View->Other Window->Command Window
(or simply by shortcut key: CTRL + ALT + A
2. Type File.AddExistingItem Whatever_Valid_CSHARP_Filepath
(As you can see there is no auto-completion for File.AddExistingItem)
3.It comes out "Command "File.AddexistingItem" is not valid."
But the similar command File.AddExistingProject works adding *.csproj
(using File.AddExistingProject works, and no "Command xxx is not valid" coming out)
Does anyone know why it doesn't work?
And How can I fix it? If it's possible.
I added a bug report about this to Microsoft Developer Community (aka User Voice)
https://developercommunity.visualstudio.com/content/problem/536640/fileaddexistingitem-does-not-appear-visual-studio.html

Visual Studio 2010 suddenly stops displaying Debug output

So there I am, working on a Silverlight app, and between one build & run and the next, my debug output goes away. Where before I had dozens of lines of Debug.Writeline text, I now have only the module load and thread messages.
Yes, I'm in debug mode (vs. release mode).
Yes, my Output window says "Show output from: Debug".
Yes, when I right-click on the output window, every option is checked.
No, my Tools > options > debugging > general > "Redirect all output text to the immediate window" is not checked.
All I can figure (and it's a wild guess) is that for some reason, the VS debugger isn't attaching to the Silverlight app like it should.
What's weird is this has been happening for the last couple of days, out of the blue. And just as suddenly, all my debug messages start showing up again.
This is VERY frustrating.
EDIT: Of course, after returning to the project after the weekend, all Debug messages are back. No idea what was causing the issue, so I'm sure it will happen again.
Now the question is: should I leave this question open in case the problem arises again in the near future? What happens to an unawarded bounty?
I found the same problem and just by setting options → debugging → output window → Thread Exit Messages to true the output windows was begin to send the right messages !?
I had exactly the same issue. Out of the blue, debug.print stopped working. In my case, it used to go to the Immediate Window. Nothing there. Nothing in the Output window. I followed several suggestions to no avail until I found this one at http://www.experts-exchange.com/questions/26894732/Debug-Print-and-Debug-Write-no-longer-work-in-Visual-Studio-2010.html
There is a context menu in the Output/Debug pane. The "Program Output"
menu item was accidentally cleared.
Checked the item and it started working again (even though my output was the immediate window). What a relief...
Ensure that the DEBUG conditional compilation symbol is defined. The Debug class suggests that you "add the /d:DEBUG option to the compiler command line when you compile your code using a command line, or add #define DEBUG to the top of your file".
Did you create or modify an Application config? If yes: the initial created configuration by VS does contains the necessary wiring configurations to enable the debugging at all. Not sure what and if there are counterparts in Silverlight, but in WPF environments simply replacing the app.config will have the same effect as you expierience.
Check the Immediate Window. Check the options. There is a general setting that says "send Debug output to Immediate Window"

Where my log statement is printing on Mac?

I have an firefox extension with the name myjavascriptfile.js,As I am new to this addon concepts,just I want to debug this script.So I am using the following statements in this file like
function LOG(text)
{
var consoleService = Components.classes["#mozilla.org/consoleservice;1"].getService(Components.interfaces.nsIConsoleService);
consoleService.logStringMessage(text);
}
observe: function(subject, topic, data)
{
LOG("observe called ");
}
I know this observe is getting called but I dont know where to see my log message.can some one tell me Where it is printing?
Please help.
That text goes to the Error Console. You might need to go to about:config and change devtools.errorconsole.enabled preference to true - the Error Console was removed from the menus by default while ago (strangely enough, I could still see it even without this pref). I think that on OS X you can still open the Error Console via Tools / Web Developer menu, on Windows you have to click the Firefox button and choose Web Developer menu there. Alternatively, Command-Shift-J should do as well.

xcode 3.2 c++: how can i enable a proper code completion?

I have snow leopard and I'm building a cpp Application with xcode.
I would like to be able to get proper code completion with xcode, and by that i mean the following:
std::string f;
f.
just when I type f. i would like to see all the relevant functions to that string class. is it possible in xcode ?
You just need to press the ESC key to get the code completion menu to show.
It may seem counterintuitive but press the ESC key after the period.
If you want the completion menu to display automatically, you can also set that in your preferences:
Code Sense -> Code Completion -> Automatically Suggest

Problem with Pop-up Windows using Selenium

I'm new to the testing world, so my question might seem a lil' bit too naive and stupid. At risk of looking/sounding stupid, my question is this:
I've been trying to test the contents in a pop-up window on my company's web app. I've figured out how to detect the pop-up window for now, but i can't get selenium to 'click' on the link inside of that pop-up window. there are multiple pop-ups in this web app so it's really difficult for a newbie like to create a test case.
I tried the click, clickAndWait, mouseDown and mouseKey as an option but it is still not working. can somebody guide me through this?
TIA,
Angela
When the popup appears you will need to move the context of the script over to the window.
You can do this by using the selectWindow | window_ID_from_the_link and then do the clicking.
If that doesn't work you may need to use the openWindow command to create the popup and then start testing against that.
Use getConfirmation/getassert/getprompt according to the type of the pop up you use .....By default they will be clicked with ok option by the server and you have to consume the message from the pop up for the other selenium commands to work correctly.............
The above suggestion is given from my experience in working with selenium RC used with perl..........
Perhaps you can try the FireFox Plugin. You can click through your application and record your steps. After recording the steps you can easily save it as some sort of file or unittest.
I'm not sure about the command you should use for the popups, maybe the firefox plugin will help in this manner (it will create your commands).
If you created the popup with a div tag, U can use following code to stop the selenium server until the popup opens.
int second = 0;
while(!selenium.IsElementPresent(mylink))
{
if(second >= 5)
break;
Thread.Sleep(1000);
second++;
}
After a popup opens, Now you can click on any link inside the popup.You have to use the below code.
selenium.click("id=popup_link"); (popup_link is the id of the link present on the popup)
Good Luck.
Not sure if this is what you are looking for, but if you want to click on something specific that Selenium is not able to handle - like browser pop-ups or other pop-ups, you can use Sikuli Script. Sikuli does an image comparison and clicks on the same - this is very powerful.
Here is the link: http://www.sikuli.org/

Resources