How to type a text very fast? - sikuli

Im trying to type a text detected by OCR very fast. At the moment the typing is kinda fast but I would like to type it instantly if possible. I heard of Settings.TypeDelay but it does the opposite of what Im looking for cause I would like to reduce the time it takes to type, not increase it :(
I also found a post of Raiman talking about a write() command that could potentialy fix my issue but I can't find any documentation about it.

Try with
paste(text)
RaiMan from SikuliX

Related

Trying to understand JSON better: Load/Dump vs Encoder/Decoder, how are they different?

So looking through the similar questions section there seems to be a lot of similar questions but none that are helpful in understanding what I need to understand or I'm just generally not getting what they are putting down. I'm studying python and up to the JSON part of it however as I do understand most of it loading, dumping, etc. I am having issues understanding the proper encoding/decoding part of it "json.encoder", etc.
Reading over the python documents, the information there is a little hard for me to understand therefore I can't write my own notes on it. Every site or video I've seen doesn't explain the terms json.encoder and json.decoder but simply just go over loads and dumps.
I have understood everything else till this point, but can't continue till I fully understand it so any help is greatly appreciated.
So my question is:
What are the differences exactly between encoding/decoding using loads/dumps and encoder/decoder?

Google-Apps-Script editor not suggesting function? (auto completion)

Sometimes when I'm writing a script in google docs, the environment just stops suggesting functions when I type a ".". Any one know what this might happen? I can not pinpoint anything I am doing to cause it, and can not replicate the problem, it just happens randomly.
This happens sometimes when you try to save a version with a syntax error but also for no apparent reason. I remember the subject has been discussed on SO already and that a few people commented on this but I just can't remember when nor find the related post. Anyway, there is no really efficient way to make it work again...
When it happens to me I usually create a new project and copy/paste the code in it... not very smart but at least it works.
I'd be glad if someone could suggest an better way to fix it or knows the exact origin so I could avoid to let it happen (since I use A LOT the autocompletion feature :-).
PS : this is not really an answer, I know but it was definitely to long to fit in a comment.

Error Creating "Large" mediawiki Post

I recently installed the latest version of mediawiki, and it's more or less running fine. However, whenever I try and post what I might consider a "large" entry, I get an error that says I cannot write to index.php, and so the post fails. I have looked though a lot of the documentation, including the variables settings, and cannot seem to nail down the issue or solution. Is it possible that some of the characters in the post are preventing the post? Or, is there a limit to the amount of text content (characters or total size)? Any help would be greatly appreciated!
Mark
For starters, check that $wgMaxArticleSize is greater than what you are trying to post. Even in this case, though, you should get an error message, not an outright failure. The content of the post is unlikely to cause problems, MediaWiki is UTF-8 safe.
Run through the checklist here as well: http://www.mediawiki.org/wiki/Manual:Errors_and_symptoms
Have you tried writing the text in a text editor and then pasting it into mediawiki in smaller chunks, saving the page then pasting another piece? As long as you don't want to do this too often this could be significantly easier than trying to solve the problem.

What's a good approach to writing error handling?

I hate writing error condition code. I guess I don't have a good approach to doing it:
Do you write all of your 'functional'
code first then go back in and add
error handling or vice versa?
How stupid do you assume your users
are?
How granular do you make your
exception throws?
Does anyone have sage advice to pass on to make this easier?
A lot of great answers guys, thank you. I had actually gotten more answers about dealing with the user than I thought. I'm actually more interested in error handling on the back end, dealing with database connection failures and potential effects on the front end, etc. Keep them coming!
I can answer one question: You don't need to assume your users are "stupid", you need to help them to use your application. Show nice prompts for things, validate data and explain why, so it's obvious to them, don't crash in their face if you can't handle what they've done (or more specifically, what you've let them do), show a nice page explaining what they can do instead, and so on.
Treat them with respect, and don't assume they know everything about your system, you are here to help them.
In respect to the first part; I generally write most error-handling at the time, and add a little bit back in later.
I generally don't throw that many exceptions.
Assume your users don't know anything and will break your system any way that it can possibly be broken.
Then write your error handling code accordingly.
First, and foremost, be clear to the user on what you expect. Second, test the input to verify it contains data within the boundaries you expect.
Prime example, I had a form with an email field. We weren't immediately using that data so we didn't put any checking on it. Result: about 1% of the users put in their home address. The field was labeled "Email Address" Apparently the users were just reading the second word and ignoring the first.
The fix was to change the label to simply say "Email" and then test the input. For kicks we went ahead and logged what the users were initially typing in that field just to see if the label change helped. It did.
Also, as a general practice, your functions should test the inputs to verify they contain the data you expect. Use asserts or their equivalent in your language of choice.
When i code, there will be some exceptions which i will expect, i.e. a file may be missing, or some xml serialisation may fail. Those exceptions i know will happen ahead of time, and i can put in handling for them.
There is a lot you cannot anticipate though, and nor should you try to. Put in a global error handler and logger, so that ultimately everything gets caught and logged. Then as your testers and/or users find situations that cause exceptions (i.e. bad input) then you can decide whether you want to put further handling in specifically for it, or maybe leave it as it was.
Summary: validate your input, but don't try to gaze into the crystal ball too much, as you will never anticipate every issue that the user may come up with. Have a global handler and logger, and then refine as necessary.
I have two words for you: Defensive Coding
You have to assume your users are incredibly stupid. Someone will always find a way to give you input that you thought would never happen.
I try to make my exception throws as granular as possible to provide the best feedback when something goes wrong. If you lump everything together, you can't tell which error case caused the problem.
I usually try to handle error cases first (before getting functional code), but that's not necessarily a best practice.
Someone has already mentioned defensive programming. A few thoughts from a user experience perspective, though.
If the user's input is invalid, either (a) correct it if you're reasonably sure you knew what they meant or (b) display a message in line that tells them what corrective action they should take.
Avoid messages like, "FATAL SYSTEM ERROR CODE 02382981." Users (a) don't know what this means, even if you do, and (b) are intimidated and put off by seeing things like this.
Avoid pop-up messages for every—freaking—possible—error you can come up with. You shouldn't disrupt user flow unless you absolutely need them to resolve a problem before they can do anything else.
Log, log, log. When you show an error message to the user, put relevant information that might help you debug in either (a) a log file or (b) a database, depending on the type of application you're creating. This will ease the effort of hunting down information about the error without making the user cry.
Once you identify what your users should and should not be able to do, you'll be able to effectively write error handling code. You can make this easier on yourself with helper methods/classes.
In terms of your question about writing handling before/after/during business logic, think about it this way: if you're making 400,000 sandwiches, it might be faster to add all the mustard at the same time, but it's probably also a lot more boring than making each sandwich individually. Who knows, though, maybe you really like the smell of mustard...

How can I improve the subjective speed of my application?

Today my co-worker noticed that when adding a decimal place to a progress indicator leads to the impression that the program is running faster than without. (i.e. instead of 1,2,3... it shows 1, 1.2, 1.4, 1.6, ...) I checked it and I was surprised that I got the same impression even though I knew it was faked.
That makes me wonder: What other things are there to create the impression of a fast application?
Of course the best way is to actually make the application faster, but from an algorithmic point of view often there's not much you can do. Additionally I think making a user less frustrated is a good thing, even though it is more or less a psychologic trick.
This effect can be very dramatic: doing relatively large amounts of work to give users a correct and often updating status of progress can of course slow down the actual running time of the application (screen updates, progress display needed calculations, etc) while still giving the user the feeling it takes less time.
Some of the things you could do in GUIs:
make sure your application remains responsive (resizing the forms remains possible, perhaps give a cancel button for the operation?) while background processing is occurring
be very consistent in showing status messages/hourglass cursors throughout the application
if you have something updating during an operation, make sure it updates often (like the almost ridiculous showing of filenames and registry keys during an install), or make sure there's an option to make it do this for users that like this behavior
Present some intermediate, interesting results first. "We've found 2,359 zetuyls matching your request, we're just calculating their future value".
I've seen transport reservation systems do that sort of thing quite nicely.
Showing details (such as the names of files being copied in an installation process) can often make things seem like they're going faster because there's constant, noticeable activity (as opposed to a slowly-creeping progress bar).
If your algorithm is such that it generates a list of results, and you have some way of displaying results as they're generated (as opposed to all at once at the end), do so - the sooner the user has something else to look at besides a spinner, the better.
Allow the user to do something else, while your application is processing data or waiting for a result. In application-scope you could allow to do some refinement of a search query or collect information for preparing next steps. Or just present some other "work" necessary to do or just some hints, documentation, statistics, entertainment..
Use one of those animated progress bars which look like they are doing something even when they aren't progressing. Also, as peSHIr said - print each filename that you copy and update it really fast - you could even fake it by cycling through a large string array N times a second.
I've read somewhere that if the process seems to be speeding up, it seems to be faster than when it's progressing at a steady pace. I can't find the reference right now, but it should be simple to implement.
(10 minutes later...)
A further look down Google lane unearthed the following references:
http://www.azarask.in/blog/post/hacking-memory/
http://blogs.msdn.com/time/
Here is an article about "Expressing time in your UI" and user perception of time. I do not know if it is exactly what you expect as an answer, but it is definitely worth the read.
Add a thread sleep at critical points. With each passing version, reduce the delay.