Display console in uiview, uitextfield - ios

Is it possible to display my console output (in xcode) to iphone ?
For example: if in my code I write NSLog(#"hello\n"); I will be able to see it in the device
in the same way I see it in console. (and of-course next time next nslog should not erase the previous one ) some sort of redirect the console.

Use this macro
#define YourLog(PR) {NSLog(#"%#",PR); yourTextFld.text=[NSString stringWithFormat:#"%#%#",yourTextFld.text,PR] ; }
Remember you have to change with your txt field name if this macro dosent work use this idea with some tweaks wrote in hurry

Create a file that will keep on appending your logs.
Show this file in textfield or textview.

Related

Going back up a line in psql shell

Does anyone know a short cut to going back up a line in psql? I've tried ending with ); and then hitting the up arrow. I can retrieve the line of code that I want and then correct it, but then what? The initial mistake prevented me from CREATING A TABLE, so do I recreate the remaining lines of code from this point forward to finish creating the table. I'm trying to avoid retyping 10 lines of information. I'm using the postgres database and the instructor accomplishing this with very little effort; however, I cannot see the commands he is using to recreate several lines of text which a appear to use only one key. If you look at 52:00 - 53:00 on the instructional video timeline you will see what I mean. After he ends the code with ); He immediately recreates the previous block of code. How does he do this?
Video Link
https://www.youtube.com/watch?v=qw--VYLpxG4
They just cut out parts of the video. No big magic there.
But you could use \e to start your default editor containing the last command you sent. That may be the most efficient way to do this.

How to disable iOS console filtering out same messages?

I'm doing NativeScript work, using the iOS console.
When I debug, I usually console.log(something).
However, subsequent triggers of the same event will be blocked on the console.
According to https://docs.nativescript.org/angular/tutorial/ng-chapter-3
The iOS
console will filter out similar messages and will show them only once.
That is why when you keep on clicking the button, you will see hello
only printed on the console once. Replace the string "hello" with the
following back-tick string hello ${new Date()} to verify that the tap
event does work. Printing the current time will make sure the string
is different every time and the console will have to show it.
Is there a way to disable this "feature" of iOS console?
As a workaround for this case, you can also print two lines of console.log instead one.
e.g.
console.log(something);
console.log("...");
And now even if the logs are identical it will print them each time even on subsequent triggers.
As an alternative to Nick's workaround, you could force the console logs not to be the same:
console.log(Date.now(), "My duplicate thing");
console.log(Date.now(), "My duplicate thing");

UIPrintInteractionController set minimum number of copies

I'd like to know if there's a way to set a minimum number of copies to be printed via code, because I need a document to be printed by duplicate.
I read the documentation on Apple developers page but I couldn't find anything.
I know you can set the number of copies from the printer dialog, but I need the minimum to be 2 by default.
Thanks in advance!
EDIT:
I tried this and it didn't work for me, at least in Xamarin.
There is nothing exposed via UIPrintInteractionController or its delegates that allows you to change/override the number of copies.
The way I approach this is to write my own UIController that defines the properties that the user is allowed to change and then use UIPrintInteractionController.PrintToPrinter to directly print the content.
Another approach is to disable the number of copies display:
UIPrintInteractionController.ShowsNumberOfCopies = false;
And then provide a two element array to PrintingItems vs. PrintingItem that just contains two copies of your print object.
Another approach just allow the user to select the printer via UIPrinterPickerController, save the UIPrinter to skip it in the future and then call PrintToPrinter twice.

AirPrint - Make number of copies default to 2 and not just 1 copy

When I open the print options using AirPrint, I want to make it default to 2 copies and not just 1 copy.
Couldn't find any methods that could change the number of copies. Wondering if anyone has any ideas if this is possible since it seems that this printing option is pretty limited.
So I found my own solution. Basically under the UIPrintInteraction Controller there is a method called printItems. What I did is make an NSArray and put two copies of the object I wanted to print and used that method instead of printItem.
However, since my application used the printFormatter I was unable to use this method since in the IOS developer documentation it says
"If you set this property (printFormatter), UIPrintInteractionController sets the printingItems, printingItem, and printPageRenderer properties to nil. (Only one of these properties can be set for a print job.)"
So what I did was just doubled the html page I was formatting and I trusted that the formatting was correct for it to print two pages.
Another way would be to add the same printFormatter to page 1 and page 2 in a printPageRenderer.

special character coming when i am using & and p

I dont know what exactly i have to type in title for this ,i tried my best
anyway coming to topic
I am making one acc checker for that purpose ,i am sending user and pass from my bsskinedit1 and bsskinedit2
here is my code
s:='http:\\site.com..premlogin='+bsskinedit.text+'&password='+bsskinedit2.text
but it giving some error ,then i used showmessage whats wrong with it then i came with strange result
see below
observer after 4 & and p combining together and appearing as a some new symbol :(
can any one tell me why its coming like this ?
Your code (where you build the URL) is most likely correct (I guess the above has some typos?!), but when you display the URL in a label for instance, the & character is treated as indicator for an accelerator key.
By Windows design, accelerator keys
enable the user to access a menu
command from the keyboard by pressing
Alt along the appropriate letter,
indicated in your code by the
preceding ampersand (&). The character
after the and sign (&) appears
underlined in the menu.
If you want to display the & character itself, you have to set your string variable to &&.
By placing two ampesands together - you state that the character following the first one is not used as the accelerator - rather you actually want to get it (only one) displayed.
Just use your debugger if you want to see the real value that your string variables have, don't output them to a message box or the like... It may have side effects, as you can see.
Regarding the URL you build: I can't possibly know how it has to be correctly, but at least you should use the right slashes!
s := 'http://site.com...'
(All quotes from delphi.about.com)
In addition to what Mef said, you can use OutputDebugString to add your string to the event log in its raw form, so you don't need to modify it before displaying it. Delphi should capture those strings automatically if you're running from the debugger. If you aren't running it from Delphi you can use DebugView instead, which captures the messages from any running applications.

Resources