Tumgik
#runningtotal
majorwoody1976 · 6 years
Photo
Tumblr media
Trying to make a difference... #wishicoulddomore thanks to the @britishlungfoundation you really helped it what was a big year #myyearofrunning . https://uk.virginmoneygiving.com/JoeWood2 . #whyirun #ealingeagles #keeponrunning #globalrunningday #shinewalk #shine18 #shinewalk2018 #keeponwalking #teambreathe #brightonmarathon2018 #brightonhero #keeppushing #myyearofrunning #runningtotal #keeponrunning #CRUKchallengers #ealingfeeling @ealinghalfmarathon @runthroughuk @soar_running @cr_uk @britishlungfoundation @trailrunningmag #RUN1000MILES @palacehalfmarathon @brightonmarathonweekend @palacehalfmarathon @virginsport @richmondrunfest #hackneyhalf https://www.instagram.com/p/Bus8z_wHpqN/?utm_source=ig_tumblr_share&igshid=1vhgjxguyvovw
0 notes
thedisastergalv2 · 4 years
Text
I know what I’m supposed to do for this fucking swift project its ridiculously easy. I just can’t do it for some reason. It’s a program that takes in numbers and outputs the min, max, average, and standard deviation. It stores all the numbers in an array until it’s time to output them and then does the calculations and outputs. It’s not hard. However I just can’t get it to work or to code it at all and I don’t know what to do. I’m having a break down over here because I can’t even program an input function to get the first number needed.
Like here’s what I’ve got so far maybe one of you knows swift and can tell me what the fuck I’m doing wrong.
*/ Declerations *\ (I don’t actually have the word delerations so don’t worry about it not being commented out incorrectly)
var minimum:Double = 0.0
var maximum:Double = 0.0
var average:Double = 0.0
var standardDev:Double = 0.0
var runningTotal:Double = 0.0
var count:Double = 0.0
*/ Calculations */
fund get_num() -> Double {
if let num = readLine() {
if let num = num(Double) {return num}
}
return 0
}
print(”Please enter Test Scores”)
print(”enter -1 when you are done entering numbers”)
let num = get_num()
if num = -1 {
minimum = 0
maximum = 0
average - runningTotal/count
standardDev = 0
}
else {
print (”Please enter another score”)
num = get_num()
runningTotal =+ num
count += count
}
*/ output */
print(”Minimum:\(minimum)”)
print(”Maximum:\( maximum )”)
print(”Average:\( average )”)
print(”Standard Deviation:\(standardDev)”)
I know I’m missing the array and the standard dev stuff, I don’t remember why I have so many 0s either. I think they were just placeholders. I can do c++ , c#, some HTML, visual basic, some css, but swift is kicking my ass.
1 note · View note
Text
HackingWithSwift Day 7
Closures Part 2
Attempt to pass a closure as a parameter with the closure accept parameter as well
travel { (place: String) in    print("I'm going to \(place) in my car") }
func travel(action: (String) -> Void) {    print("I'm getting ready to go.")    action("London")    print("I arrived!") } ============================= Practical example
To give you a practical example, imagine you were building a car. The car needs to know what engine it has, what steering wheel it has, how many seats it has, and so on. Sure, the engine could just be a string of information, but really it should be able to actually accelerate or decelerate to a certain speed.
let changeSpeed = { (speed: Int) in    print("Changing speed to \(speed)kph") }
And now we can create a buildCar() function that accepts any sort of closure for the engine, as long as that closure can be told to accelerate or decelerate to a specific integer value:
func buildCar(name: String, engine: (Int) -> Void) {    // build the car } =============================
Attempt to pass a closure as a parameter with the closure accept parameter and return value as well
func travel(action: (String) -> String) {    print("I'm getting ready to go.")    let description = action("London")    print(description)    print("I arrived!") }
travel { (place: String) -> String in    return "I'm going to \(place) in my car" }
https://www.hackingwithswift.com/quick-start/understanding-swift/when-would-you-use-closures-with-return-values-as-parameters-to-a-function The sudden introduce of “reduce” might be a bit too sudden for the example
Create an array of [10, 20, 30], then summarise it to single value
func reduce(_ values: [Int], using closure: (Int, Int) -> Int) -> Int {    // start with a total equal to the first value        var current = values[0]
   // loop over all the values in the array, counting from index 1 onwards    for value in values[1...] {        // call our closure with the current value and the array element, assigning its result to our current value        current = closure(current, value)    }
   // send back the final current value        return current }
let numbers = [10, 20, 30]
let sum = reduce(numbers) { (runningTotal: Int, next: Int) in    runningTotal + next //if just 1 line of code, ,and it’s inside closure, no need to write “return” }
print(sum)
//Most simplify version let sum = reduce(numbers, using: +)
=================== Shorthand parameters
Just when I thought swift already make everything “simple” (can be very complicated when read it the first time) and still there’s shorthand params…..geezzzzz
func travel(action: (String) -> String) {    print("I'm getting ready to go.")    let description = action("London")    print(description)    print("I arrived!") }
travel { (place: String) -> String in    return "I'm going to \(place) in my car" }
Then chop some more - removed data type for pass in param
travel { place -> String in    return "I'm going to \(place) in my car" }
And…..continue chopping - removed the need to indicator need return param
travel { place in    return "I'm going to \(place) in my car" }
And chopped - removed “return”
travel { place in    "I'm going to \(place) in my car" }
And chopped - no more param name but just $0 travel {    "I'm going to \($0) in my car" }
It can be $0, $1, $2, depends on how many params are there and the param sequence, in this case, there’s only 1 param, name “place” and since it’s the “first param” to pass in, so by normal index, it will be $0
Don’t overuse it because it may helps or screwed up the readability at the same time.
================== I made passed the THE BASIC
Now it’s the INTERMEDIATE LEVEL SHIT XD
func travel(action: (String, Int) -> String) {    print("I'm getting ready to go.")    let description = action("London", 60)    print(description)    print("I arrived!") }
travel {    "I'm going to \($0) at \($1) miles per hour." }
So here is the example of $0 and $1, $0 will be the string, which is London, $1 is 60
================== Returning Closure from Function
“The syntax for this is a bit confusing a first, because it uses -> twice: once to specify your function’s return value, and a second time to specify your closure’s return value.” The author is RIGHT! NOT JUST A BIT, BUT VERY CONFUSING XD
func travel() -> (String) -> Void { //return a closure that return a string    return {        print("I'm going to \($0)")    } }
let result = travel() result("London")
Cheat Sheet http://goshdarnclosuresyntax.com/
====================== Capturing value
func travel() -> (String) -> Void {    return {        print("I'm going to \($0)")    } }
let result = travel() result("London")
func travel() -> (String) -> Void {    var counter = 1
   return {        print("\(counter). I'm going to \($0)")        counter += 1    } }
Counter create inside the closure, it’s like a static variable , so if I call travel 3 times, the counter will keep increase instead of stay at 1 or 2
————— Up to this part, I think out of these 2 parts, I can only confident says that I understand maybe 50% of it. Maybe more practice at later chapter will helps
0 notes
kgcodes · 4 years
Text
Tweeted
Concise code can often be worse than more verbose code: const t = l => l.reduce((t, c) => t + c, 0); VS const sumArray = arr => arr.reduce( (runningTotal, currentValue) => runningTotal + currentValue, 0 ); Both code does exactly the same thing, yet the second is better.
— Well Paid Geek 🚀💻 JavaScript (@WellPaidGeek) August 7, 2020
0 notes
yonascustomtech · 6 years
Text
runningtotal Oracle
SELECT BAL.*,      SUM(AMOUNT_BALANCE) OVER(PARTITION BY COMPANY, ACCOUNTING_YEAR,ACCOUNT ORDER BY COMPANY, ACCOUNTING_YEAR,ACCOUNT, ACCOUNTING_PERIOD RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) ACUM_AMOUNT_BALANCE FROM (    SELECT COMPANY, ACCOUNTING_YEAR, ACCOUNT, ACCOUNTING_PERIOD,SUM(AMOUNT_BALANCE) AMOUNT_BALANCE    FROM ACCOUNTING_BALANCE_AUTH WHERE ACCOUNT LIKE ('1500000%0')    AND COMPANY = 'CI'    AND ACCOUNTING_YEAR = 2018 AND ACCOUNTING_PERIOD <= 8    GROUP BY COMPANY, ACCOUNTING_YEAR, ACCOUNTING_PERIOD, ACCOUNT    ORDER BY 1,2,3,4) BAL
Tumblr media
0 notes
Hayley has raised: £0
Money left to go: £3890
Tyler has raised: £0
Money left to go: £3890
2 notes · View notes
majorwoody1976 · 6 years
Photo
Tumblr media
Finally... 15 days after finishing #myyearofrunning I just wanted to send a Big Thank you to all those who have supported and helped me throughout 2018. Your amazing generosity will help make a difference and I just wanted to thank every one of you. Me, I just went for a run but you've made it count and helped me push to the end #muchlove #youcandoit #forthemums @britishlungfoundation @cr_uk . https://uk.virginmoneygiving.com/JoeWood2 . #whyirun #ealingeagles #keeponrunning #globalrunningday #shinewalk #shine18 #shinewalk2018 #keeponwalking #teambreathe #brightonmarathon2018 #brightonhero #keeppushing #myyearofrunning #runningtotal #keeponrunning #CRUKchallengers #ealingfeeling @ealinghalfmarathon @runthroughuk @soar_running @cr_uk @britishlungfoundation @trailrunningmag #RUN1000MILES @palacehalfmarathon @brightonmarathonweekend @palacehalfmarathon @virginsport @richmondrunfest #hackneyhalf https://www.instagram.com/p/BsqjeXTHWcg/?utm_source=ig_tumblr_share&igshid=1gfodgmsd1jo4
0 notes
majorwoody1976 · 6 years
Photo
Tumblr media
Finally got round to hanging this up.... just a small reminder of some of my most memorable runs over the years and some of the key runs in #myyearofrunning #keeponrunning . https://uk.virginmoneygiving.com/JoeWood2 . #whyirun #ealingeagles #keeponrunning #globalrunningday #shinewalk #shine18 #shinewalk2018 #keeponwalking #teambreathe #brightonmarathon2018 #brightonhero #keeppushing #myyearofrunning #runningtotal #keeponrunning #CRUKchallengers #ealingfeeling @ealinghalfmarathon @runthroughuk @soar_running @cr_uk @britishlungfoundation @trailrunningmag #RUN1000MILES @palacehalfmarathon @brightonmarathonweekend @palacehalfmarathon @virginsport @richmondrunfest #hackneyhalf https://www.instagram.com/p/BslVe1Onc8c/?utm_source=ig_tumblr_share&igshid=dnhqkz4qfasu
0 notes
majorwoody1976 · 6 years
Photo
Tumblr media
It's now been 11days since I finished #myyearofrunning and despite the typo I just wanted to say the biggest thank you I can!!!!to everyone and all the support. It's you, who will help make a difference with your generosity. Me, I just went for a run, so here's to you!!!!#youarethebest . https://uk.virginmoneygiving.com/JoeWood2 . #whyirun #ealingeagles #keeponrunning #globalrunningday #shinewalk #shine18 #shinewalk2018 #keeponwalking #teambreathe #brightonmarathon2018 #brightonhero #keeppushing #myyearofrunning #runningtotal #keeponrunning #CRUKchallengers #ealingfeeling @ealinghalfmarathon @runthroughuk @soar_running @cr_uk @britishlungfoundation @trailrunningmag #RUN1000MILES @palacehalfmarathon @brightonmarathonweekend @palacehalfmarathon @virginsport @richmondrunfest #hackneyhalf https://www.instagram.com/p/BsgUhZmHEWo/?utm_source=ig_tumblr_share&igshid=o80mknrhfd78
0 notes
majorwoody1976 · 6 years
Photo
Tumblr media
So my journey comes to end.... getting to 2019miles, forward into the New Year!!! #myyearofrunning #runningtotal #ontothenextchallenge . https://uk.virginmoneygiving.com/JoeWood2 . #whyirun #ealingeagles #keeponrunning #globalrunningday #shinewalk #shine18 #shinewalk2018 #keeponwalking #teambreathe #brightonmarathon2018 #brightonhero #keeppushing #myyearofrunning #runningtotal #keeponrunning #CRUKchallengers #ealingfeeling @ealinghalfmarathon @runthroughuk @soar_running @cr_uk @britishlungfoundation @trailrunningmag #RUN1000MILES @palacehalfmarathon @brightonmarathonweekend @palacehalfmarathon @virginsport @richmondrunfest #hackneyhalf https://www.instagram.com/p/BsDG14FnejS/?utm_source=ig_tumblr_share&igshid=1fir5quiyikgb
0 notes
majorwoody1976 · 6 years
Video
As I came to the end of my final run it hadn't quite sunk in what #myyearofrunning has meant to me and the journey I've been on, I still don't think I do but for now, thanks to everyone who has helped me along the way, the support, advise it has all helped so much and most importantly peoples generosity... I'll be following up throughout the day with a few stats and pics that has made this year so special... thanks again #keeponrunning . https://uk.virginmoneygiving.com/JoeWood2 . #whyirun #ealingeagles #keeponrunning #globalrunningday #shinewalk #shine18 #shinewalk2018 #keeponwalking #teambreathe #brightonmarathon2018 #brightonhero #keeppushing #myyearofrunning #runningtotal #keeponrunning #CRUKchallengers #ealingfeeling @ealinghalfmarathon @runthroughuk @soar_running @cr_uk @britishlungfoundation @trailrunningmag #RUN1000MILES @palacehalfmarathon @brightonmarathonweekend @palacehalfmarathon @virginsport @richmondrunfest #hackneyhalf https://www.instagram.com/p/BsC-9SoH6oQ/?utm_source=ig_tumblr_share&igshid=1gzj5cg39bykm
0 notes
majorwoody1976 · 6 years
Photo
Tumblr media
After pushing past 2000miles this morning in #myyearofrunning it's been amazing to see I'm nearly at 75% of my overall target, which is absolutely fantastic and will hopefully make such a difference to @britishlungfoundation and @cr_uk I'll be heading out tomorrow for my final run of the year so if you were thinking of sponsoring and still haven't done so, now is the time, every little helps.... your support has meant so much and kept me going and why I'll be getting back out there tomorrow!!! . #keeponpushing #gettingthere #keeponrunning my fundraising page is now open until the end of the year . https://uk.virginmoneygiving.com/JoeWood2 . #whyirun #ealingeagles #keeponrunning #globalrunningday #shinewalk #shine18 #shinewalk2018 #keeponwalking #teambreathe #brightonmarathon2018 #brightonhero #keeppushing #myyearofrunning #runningtotal #keeponrunning #CRUKchallengers #ealingfeeling @ealinghalfmarathon @runthroughuk @soar_running @cr_uk @britishlungfoundation @trailrunningmag #RUN1000MILES @palacehalfmarathon @brightonmarathonweekend @palacehalfmarathon @virginsport @richmondrunfest #hackneyhalf https://www.instagram.com/p/BsBuIMSnAWS/?utm_source=ig_tumblr_share&igshid=gjvl51oqva0j
0 notes
majorwoody1976 · 6 years
Photo
Tumblr media
It was a cold and foggy morning but with only two days left of the year I thought I better get out there!!!!still one more day of running left, seems I waste not to use it #madeit #keeponrunning #thefinalpush . https://uk.virginmoneygiving.com/JoeWood2 . #whyirun #ealingeagles #keeponrunning #globalrunningday #shinewalk #shine18 #shinewalk2018 #keeponwalking #teambreathe #brightonmarathon2018 #brightonhero #keeppushing #myyearofrunning #runningtotal #keeponrunning #CRUKchallengers #ealingfeeling @ealinghalfmarathon @runthroughuk @soar_running @cr_uk @britishlungfoundation @trailrunningmag #RUN1000MILES @palacehalfmarathon @brightonmarathonweekend @palacehalfmarathon @virginsport @richmondrunfest #hackneyhalf https://www.instagram.com/p/BsAkWGjHp5m/?utm_source=ig_tumblr_share&igshid=m68bp6rn4k9v
0 notes
majorwoody1976 · 6 years
Photo
Tumblr media
I've made it!!!!passing 2000miles... #whatafeeling but it's not over yet, theres still one day left of the year #thefinalpush #keeponrunning . https://uk.virginmoneygiving.com/JoeWood2 . #whyirun #ealingeagles #keeponrunning #globalrunningday #shinewalk #shine18 #shinewalk2018 #keeponwalking #teambreathe #brightonmarathon2018 #brightonhero #keeppushing #myyearofrunning #runningtotal #keeponrunning #CRUKchallengers #ealingfeeling @ealinghalfmarathon @runthroughuk @soar_running @cr_uk @britishlungfoundation @trailrunningmag #RUN1000MILES @palacehalfmarathon @brightonmarathonweekend @palacehalfmarathon @virginsport @richmondrunfest #hackneyhalf https://www.instagram.com/p/BsAiEZ1HOs4/?utm_source=ig_tumblr_share&igshid=1c354c88xg7xi
0 notes
majorwoody1976 · 6 years
Photo
Tumblr media
Despite feeling a it under the weather I'm so close now and wanted to get #upandout #sweatitout #tiredbutstillpushing #myyearofrunning #runningtotal #chasing2000miles . https://uk.virginmoneygiving.com/JoeWood2 . #whyirun #ealingeagles #keeponrunning #globalrunningday #shinewalk #shine18 #shinewalk2018 #keeponwalking #teambreathe #brightonmarathon2018 #brightonhero #keeppushing #myyearofrunning #runningtotal #keeponrunning #CRUKchallengers #ealingfeeling @ealinghalfmarathon @runthroughuk @soar_running @cr_uk @britishlungfoundation @trailrunningmag #RUN1000MILES @palacehalfmarathon @brightonmarathonweekend @palacehalfmarathon @virginsport @richmondrunfest #hackneyhalf https://www.instagram.com/p/Brurz01n72a/?utm_source=ig_tumblr_share&igshid=14iqa50ra2rea
0 notes
majorwoody1976 · 6 years
Photo
Tumblr media
Getting there... #tiredbutstillpushing #myyearofrunning #runningtotal #chasing2000miles . #whyirun #ealingeagles #keeponrunning #globalrunningday #shinewalk #shine18 #shinewalk2018 #keeponwalking #teambreathe #brightonmarathon2018 #brightonhero #keeppushing #myyearofrunning #runningtotal #keeponrunning #CRUKchallengers #ealingfeeling @ealinghalfmarathon @runthroughuk @soar_running @cr_uk @britishlungfoundation @trailrunningmag #RUN1000MILES @palacehalfmarathon @brightonmarathonweekend @palacehalfmarathon @virginsport @richmondrunfest #hackneyhalf https://www.instagram.com/p/BrpKxhxndnx/?utm_source=ig_tumblr_share&igshid=1pqsvn3r2f4fw
0 notes