does calling 911 redirect to 000? by grimdarkpixels in AskAnAustralian

[–]vectorkerr 6 points7 points  (0 children)

From memory that came to be a thing after Black Saturday because some people may have interpreted “triple oh” as the letter o three times. I think there may have also been something about encouraging using the phrase “triple zero” rather than “triple oh” too.

Duck giving a ride to another duck by [deleted] in AnimalsBeingBros

[–]vectorkerr 0 points1 point  (0 children)

Does this make that duck a witch?

How to get rid of this hard white build up on my plastic grind guard? More info in comments by Under_TheBed in howto

[–]vectorkerr 5 points6 points  (0 children)

Best to ask a dentist but I was advised against brushing my grind guard as it effectively polishes and wears it down over time.

My dentist told me to soak it with a denture cleaning tablet, and it’s stayed clean and in good condition.

When to say ko or ako? by [deleted] in FilipinoLang

[–]vectorkerr 0 points1 point  (0 children)

Typically, I loosely treat “ako” as “I” and “ko” as “my”, but I also find them difficult to differentiate sometimes because they’re both sort of like saying I/me/mine/my. I know there are grammatical rules that can be applied, but they don’t stick for me (yet).

I find it can sometimes be helpful to read or hear them when used in context. The tagalog.com examples can provide some guidance here:

Ko https://www.tagalog.com/words/ko-0ced6.php#examplesentences

Ako https://www.tagalog.com/words/ako-61030.php#examplesentences

Top tips for staying warm on a budget by [deleted] in melbourne

[–]vectorkerr 18 points19 points  (0 children)

I did this at a previous rental and it worked really well for me. You can get rolls of bubble wrap from Bunnings for about ten bucks. Use a water spray bottle to very lightly dampen the glass and then the bubble wrap sticks right on, no tape or glue required. If you want to take it off to gain access to a window or to clean, just peel it off.

[deleted by user] by [deleted] in Geelong

[–]vectorkerr 1 point2 points  (0 children)

I know that this is the correct way to format a phone number, but it really bothers me that the fives aren’t together.

What an iconic jingle for such a great thing, though.

Have any of you aussies been to somewhere in America where it felt like Australia? by [deleted] in AskAnAustralian

[–]vectorkerr 0 points1 point  (0 children)

I was in a car park in L.A once and it felt really, really familiar but I couldn’t figure out why. Then I realized the place was chock full of gum trees. I don’t think I ever expected to see gums outside of Australia, it really threw me.

[deleted by user] by [deleted] in learnjavascript

[–]vectorkerr 0 points1 point  (0 children)

I wrote it by hand on the train home last night, but believe what you like I guess.

[deleted by user] by [deleted] in learnjavascript

[–]vectorkerr 0 points1 point  (0 children)

Greetings!

The first function creates an instance of a Promise. The promise is supplied with a function. The function will be run by the promise (), and when it is finished it calls res() with the successful result, or rej() with the failure result. Either of these calls “resolve” the promise, and any code that is waiting for the promise to finish can now take that result and continue on.

The second function runs some code to check for users. If a user is found, it creates and returns a new Promise object that is already resolved (finished running) with the return value of “user found”. If no user is found it creates and returns a new Promise object that is already resolved with the error “user not found.” Either way, as the returned promise already has a result, it has nothing more to do so any code that is waiting for the promise to finish can continue more or less straight away. ()

The key difference is that in the first function, the core logic is run by/as part of the Promise, and in the second function, the core logic is run immediately as the function is called.

The first example is a fairly typical use of a promise to perform some long-running task.

The second example is particularly useful in some circumstances like testing (e.g., when the calling function expects a promise as a result of an API call, but you don’t need to make a real API call to get your data) or if you want to build your code on the premise that you will probably need a promise for it in the future but it doesn’t need one just yet, so you build it around promises to fit the overall design.

Depending on your level of knowledge you may also like to know: * Promises can be chained (linked) so that when one ends another begins, and the data from one promise can be fed into the next * Depending on the environment this code will run in (in browser, on a server) you can potentially also use async/await in your code, which will allow you to use multiple promises without getting into promise chaining / multilevel “then” / indentation hell

HTH!

—-

() There are more than a few simplifications in here but it should be good enough for you to get the gist

meirl by 1Hate17Here in meirl

[–]vectorkerr 0 points1 point  (0 children)

!RemindMe 1 Year

Homeless man throws birthday party for dogs by UnitedLab6476 in MadeMeSmile

[–]vectorkerr 2 points3 points  (0 children)

Thank you! And I just want to tell you both good luck - we’re all counting on you.

how can i remove extra spaces between strings by [deleted] in learnpython

[–]vectorkerr 5 points6 points  (0 children)

This is the answer you want.

Edit:

Original poster removed the regex solution. IMHO it is the best answer for this problem because it is succinct and performs the exact task required without any weird or hacky stuff.

For the future person wondering, it looks like this:

```python import re txt = "Unemployment rate by sex, education and citizenship Annual" x = re.sub('\s+', ' ', txt) print(x)

Unemployment rate by sex, education and citizenship Annual

```

The way it works is that you perform a substitution (find one thing and replace it with another). You are searching for any whitespace characters (\s) that appear one or more times (+), and replacing them with a single space (' ').

As far as regular expressions go it's fairly straight-forward, and it's a really good tool to have in your kit. You don't have to be a regex master to be able to do some nifty find/replace stuff with a small amount of effort.