annoying Xcode autocompletion #string and #selector? - ios

Lets say you go to enter in a parameter and it's a string, so you go # and with a press of the return key Xcode fills the template of a string for you #"String". This is the "first option" on the popup suggestions.
Next you want to enter in a #selector for a performSelector: method, when you type in #
the default is a string so you have to go down on your keypad, that's okay.
The next time you want to enter in a string, the default is #selector now when you hit the return key after typing #
I know I am being a little bit pedantic but as the quote goes:
The three chief virtues of a programmer are: Laziness, Impatience and Hubris.
So to my question is there a way to always make the #string "default" or an even quicker shortcut other than #"?
ty.

what XCode does is , in the suggestion box,what ever you selected the last time it comes selected now.What you selected now has more chance of using it next time, so xcode suggest the same the next time. I don't think you can set something as default.

Related

UITextView, with spell checking, how to use `ignoreWord`?

Regarding the spell checking in iOS, it's possible to tell the checker to ignore a word (or learn a word),
https://developer.apple.com/documentation/uikit/uitextchecker
func ignoreWord(String)
Tells the receiver to ignore the specified word when spell-checking.
- Apple doco
Say I have a UITextView which opens. I want spell checking On.
I know the user may type "fattie" which would get the red underline.
How do I tell that text view in that instance, to, ignore "fattie" ?
An obvious use case ...
User is typing in "#tag" type friends; in our data of course we know what all the tags are, it's absurd they get marked as spelling errors.
It seems incredible one can't just say "don't underline these words - - list".
Code example ....
So we have
var t: UITextView
and then, there must be "some way" to:
yourTextView.something->something.textChecker.ignoreWord("fattie"
.. some way to get to the text view's textChecker instance! How ?!?!
Partial answer: I just stumbled on to that, bizarrely, you can just call
UITextChecker.learnWord("fattie")
UITextChecker.learnWord("blahdee")
from, apparently, just anywhere in an app.
However this raises many issues,
• How to call the 'ignore' one, which seems better
• That one still makes the user tap the annoying, stupid, "in quotes" OK box in the suggestions bar - it seems to have not really "learned" anything
• Disturbingly, I think this goes for the "WHOLE PHONE". I only want it in that instance of the user using that text view.
A mystery!

How can I set a hotkey in atom (using their keymap perhaps) to print a string?

I am coding and there is a long string that i cant be asked to type out every time i need to. How could I set a shortcut?
example_coding.bla(bla.bla) *starts typing long string*
Then it recognises the start of my long string so gives me the option to press tab and auto insert the rest of it?
This is using LaTeX in Atom, but would be great if it could be for any coding language.
I know you're asking for how to create a command, but it sounds like what you really want is a snippet. Since you haven't provided any information about your use case, I can't tell you what to put in your snippets.cson, but the Flight Manual has all the necessary information.

Alter Xcode 7 autofill behaviors

With the latest build, or maybe including the builds prior to beta 7.5 I just never noticed, I'm getting annoyed with a little autofill feature Apple implemented for substitute tokens and their objects when creating log messages. I haven't really noticed this with class methods or instance methods or autocompleting anything else really, so far.
Before, in Xcode 6, this would display:
Ahhhhh, nice & crisp. As you can see, everything suffixing the user input is opportunity for autofill. All I had to do was press tab[enter] once to autofill 'error' and include the closing parenthesis, then it would automatically place my cursor after the closing parenthesis, hence ALL I had to do was type a ; for that statement to be complete and I was happy :)
Now, this displays :
Ehhhhh, troublesome & redundant. As you can see in this example, it includes an additional quotation mark. Now when I press tab to autofill 'error', it just autofills 'error' and places the cursor before the closing parenthesis. So it looks like this:
NSLog(#"%#", error|)
And if I were to press tab to go to the next sub word that needs autocomplete it will just indent the closing parenthesis:
NSLog(#"%#", error )
So essentially, I have to either move it with my mouse or press → and then and only then, I'll be able to enter a ;. Side note - pressing ↵ to autofill results in the same behavior as described.
I am a fast typer, don't want to say my speed because I don't want it to rub off the wrong way but it's 70+wpm, so this irritates me, especially since I've been used to a way for so long. Any way to correct the behavior?
I have tried turning off Enable type-over completions in the Xcode preferences pane, but it still places the cursor before the closing parenthesis.
printf resorts to the same behavior with Xcode 7.5

What happens inbetween clicking the button Submit and the method create in Rails?

I ask this because I have a form with a radio button set to nil :
= f.radio_button :estimate_type, nil
I have debugger right at the beginning of my method call :
def create
debugger
When I hit the debugger, I check out my params, and they say the value is on not nil.
Enter Insanity wolf. Somehow this is getting converted on click. And I've scoured the entire app looking for possibly a leaky javascript file, or anything closely resembling the word 'on'. I've checked all my bases. Defaults in schema.rb, jquery click events, model validations, you name it. Nothing with the word "on" anywhere.
So the real question is, is there a way I can throw a debugger in a place in which if I were to click submit, the debugger would appear before the model validation, and then hopefully where the params are still what they are in the form. And then I can follow it down the trail and see where it goes wrong.
It doesn't have anything to do with your JavaScript. This is something that I've experienced before as well, but I'm not sure why it converts nil to 'on'. I do know that passing in :nil as a symbol returns a null string, as well as just simply passing in false.
A better approach to trying to solve your problem may be to put the debugger in the validation callback itself.
Nothing to do with rails - you could verify this by using your browser's network inspector to see that the browser is actually sending the parameter value "on".
By trying to set the value to nil (which doesn't really make sense - parameter values are always strings) you're suppressing the value attribute entirely from the generated HTML.
The standard says that in this case the default value for the input shall be "on" and so that is what your browser submits.

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