In the third room, the lions that haven't eaten in three years could also be a danger, as they may be more aggressive and unpredictable than well-fed lions
- Visitors can check out the Forum FAQ by clicking this link. You have to register before you can post: click the REGISTER link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. View our Forum Privacy Policy.
- Want to receive the latest contracting news and advice straight to your inbox? Sign up to the ContractorUK newsletter here. Every sign up will also be entered into a draw to WIN £100 Amazon vouchers!
OpenAI ChatGPT
Collapse
X
Collapse
-
bloggoth
If everything isn't black and white, I say, 'Why the hell not?'
John Wayne (My guru, not to be confused with my beloved prophet Jeremy Clarkson) -
Originally posted by xoggoth View Post
Hardly needs much intelligence to know that, if they haven't eaten for three years, the lions will be dead and quite safe.First Law of Contracting: Only the strong surviveComment
-
I mean, this is better than 90% of contractors I've worked with....
Prompt:
Find the bug in this code:
for (var i = 0; i < 10; i++) { setTimeout(() => console.log(i), 1000) }
Response:
The bug in this code is that the value of the variable "i" is not captured within the scope of the anonymous function passed to setTimeout. As a result, the value of "i" will always be 10, and the loop will not execute as intended.
To fix this bug, you can use a closure to capture the value of "i" within the scope of the anonymous function. This can be done by defining a separate function that takes "i" as an argument, and then calling this function within setTimeout. Here is an example:
for (var i = 0; i < 10; i++) { setTimeout(function(i) { console.log(i) }, 1000, i) }
Alternatively, you can use the "let" keyword instead of "var" to define the "i" variable, which will create a new variable with a separate scope for each iteration of the loop. This will allow the value of "i" to be captured within the scope of the anonymous function passed to setTimeout, without the need for a closure. Here is an example:
for (let i = 0; i < 10; i++) { setTimeout(() => console.log(i), 1000) }
Tell me this isn't mind blowing AI!First Law of Contracting: Only the strong surviveComment
-
-
Might come in handy in a job application if you get given an online coding skills test.Scoots still says that Apr 2020 didn't mark the start of a new stock bull market.Comment
-
Originally posted by AtW View PostVB6 not supported?
Here is an example program in VB6 that implements the merge sort algorithm:
Code:' Declare a subroutine for the merge sort algorithm Sub mergeSort(arr() As Integer, low As Integer, high As Integer) ' Check if the array has more than one element If low < high Then ' Calculate the midpoint of the array Dim mid As Integer = (low + high) / 2 ' Recursively sort the left and right halves of the array Call mergeSort(arr, low, mid) Call mergeSort(arr, mid + 1, high) ' Merge the sorted halves of the array Call merge(arr, low, mid, high) End If End Sub ' Declare a subroutine for merging two sorted arrays Sub merge(arr() As Integer, low As Integer, mid As Integer, high As Integer) ' Create two temporary arrays to hold the left and right halves of the original array Dim left() As Integer, right() As Integer ' Calculate the length of the left and right arrays Dim leftLen As Integer = mid - low + 1 Dim rightLen As Integer = high - mid ' Copy the elements from the original array into the temporary arrays For i = 0 To leftLen - 1 left(i) = arr(low + i) Next For i = 0 To rightLen - 1 right(i) = arr(mid + 1 + i) Next ' Merge the left and right arrays back into the original array Dim i As Integer, j As Integer, k As Integer i = 0 ' Index for the left array j = 0 ' Index for the right array k = low ' Index for the original array While i < leftLen And j < rightLen ' Compare the elements at the current indices of the left and right arrays If left(i) < right(j) Then ' If the element in the left array is smaller, add it to the original array arr(k) = left(i) i = i + 1 Else ' If the element in the right array is smaller, add it to the original array arr(k) = right(j) j = j + 1 End If k = k + 1 Wend ' Add any remaining elements from the left or right arrays to the original array While i < leftLen arr(k) = left(i) i = i + 1 k = k + 1 Wend While j < rightLen arr(k) = right(j) j = j + 1 k = k + 1 Wend End Sub ' Declare a subroutine to print the elements of an array Sub printArray(arr() As Integer) ' Loop through the array and print each element For i = 0 To UBound(arr) Debug.Print arr(i) Next End Sub ' Declare the main program Sub main() ' Declare and initialize an array of integers Dim arr() As Integer = {4, 7, 2, 5, 1, 9, 8, 6, 3} ' Sort the array using the merge sort algorithm Call mergeSort(arr, 0, UBound(arr)) ' Print the sorted array Call printArray(arr) End Sub
Last edited by _V_; 5 December 2022, 14:38.First Law of Contracting: Only the strong surviveComment
-
I speak without a mouth and hear without ears. I have no body, but I come alive with wind. What am I?
You are a flag. A flag is a piece of fabric that is attached to a pole or other object and is used to signal or represent something. It has no mouth or ears, but it can be seen and it can make noise when it moves in the wind.
You measure my life in hours and I serve you by expiring. I’m quick when I’m thin and slow when I’m fat. The wind is my enemy. What am I?
You are a candle. A candle is a stick of wax with a wick that is lit to provide light or heat. It has a limited life span and will "expire" or burn out after a certain amount of time. The thickness of the candle, or the amount of wax that remains, can affect how quickly it burns. And wind can blow out a candle flame.
I have cities, but no houses. I have mountains, but no trees. I have water, but no fish. What am I?
You are a map. A map is a visual representation of a geographical area, showing features such as cities, mountains, and bodies of water. It typically does not include detailed information about individual buildings or other structures, and it may not include plants or animals. Maps are used to help people navigate or learn about different places.
What is seen in the middle of March and April that can’t be seen at the beginning or end of either month?
The letter "r" can be seen in the middle of the words "March" and "April" but not at the beginning or end of either month. The letter "r" is a common letter in the English language, but it is not always present in every word. In this case, it appears only in the middle of the words "March" and "April".
What word in the English language does the following: the first two letters signify a male, the first three letters signify a female, the first four letters signify a great, while the entire world signifies a great woman. What is the word?
The word you are describing is "heroine". The first two letters, "he", can refer to a male, while the first three letters, "her", can refer to a female. The first four letters, "hero", can mean a great or admirable person, and the entire word, "heroine", can mean a great woman.
First Law of Contracting: Only the strong surviveComment
-
It's great you've found a friend V.Originally posted by MaryPoppinsI'd still not breastfeed a naziOriginally posted by vetranUrine is quite nourishingComment
-
Originally posted by d000hg View PostIt's great you've found a friend V.
here is a cryptic clue: What's in Latin sign, if I can translate, is of no importance
Note the answer has 13 letters and the word is contained inside the clue.
The word you are looking for is "insignificant". This word contains 13 letters, and it is hidden within the clue as "if I can translate, is of no importance". In Latin, the word "insignificant" would be "insignis", which means "not distinguished" or "unimportant". This fits with the clue, which says that something that can be translated is of no importance.
What's in Lat insignifIcant ranslate, is of no importanceFirst Law of Contracting: Only the strong surviveComment
-
Originally posted by _V_ View PostWrite a program in VB6 that implements merge sort
Here is an example program in VB6 that implements the merge sort algorithm:
Comment
- Home
- News & Features
- First Timers
- IR35 / S660 / BN66
- Employee Benefit Trusts
- Agency Workers Regulations
- MSC Legislation
- Limited Companies
- Dividends
- Umbrella Company
- VAT / Flat Rate VAT
- Job News & Guides
- Money News & Guides
- Guide to Contracts
- Successful Contracting
- Contracting Overseas
- Contractor Calculators
- MVL
- Contractor Expenses
Advertisers
Contractor Services
CUK News
- Which IT contractor skills will be top five in 2025? Yesterday 09:08
- Secondary NI threshold sinking to £5,000: a limited company director’s explainer Dec 24 09:51
- Reeves sets Spring Statement 2025 for March 26th Dec 23 09:18
- Spot the hidden contractor Dec 20 10:43
- Accounting for Contractors Dec 19 15:30
- Chartered Accountants with MarchMutual Dec 19 15:05
- Chartered Accountants with March Mutual Dec 19 15:05
- Chartered Accountants Dec 19 15:05
- Unfairly barred from contracting? Petrofac just paid the price Dec 19 09:43
- An IR35 case law look back: contractor must-knows for 2025-26 Dec 18 09:30
Comment