• Member Avatar for vegaseat
    vegaseat

    Replied To a Post in A taste of Swift part 4

    In Swift structures are a value type. A note from the tutorial: "Structures are always copied when they are passed around in your code, and do not use reference counting."
  • Member Avatar for vegaseat
    vegaseat

    Replied To a Post in There is an elephant on the loo!

    The jobs in demand in the USA for 2015 ... 1. Skilled trade workers 2. Drivers 3. Teachers 4. Sales representatives 5. Administrative professionals 6. Management/executives 7. Nurses 8. Technicians …
  • Member Avatar for vegaseat
    vegaseat

    Edited A taste of Swift part 1

    The Swift computer language is the brainchild of a number of Apple associates. In my humble opinion it shows some nice features, but also some warts. Part 1 (constants, variables, …
  • Member Avatar for vegaseat
    vegaseat

    Replied To a Post in A Taste of Swift part 2

    var mixed: [Any] = [12, 12.34, "Frank", (4, 7)] // use "as" operator to allow for different types in switch/case for mix in mixed { switch mix { case let …
  • Member Avatar for vegaseat
    vegaseat

    Created A taste of Swift part 4

    In part 4 of tasting Swift, we explore structures. Swift has added some interesting features to structures like defaults, methods, multiple init(). This way struct objects come close to class …
  • Member Avatar for vegaseat
    vegaseat

    Replied To a Post in What are you eating/drinking right now?

    A slice of Little Caesar's pizza that somebody brought to a picknick, absolutely the worst stuff!
  • Member Avatar for vegaseat
    vegaseat

    Replied To a Post in A taste of Swift part3

    Note that the NS prefix comes in from Objective C. Also note that most Swift objects are by value, but class instances are by reference.
  • Member Avatar for vegaseat
    vegaseat

    Replied To a Post in A Taste of Swift part 2

    Apple is going in the right direction with Swift. Now they have to work improving the Cocoa GUI toolkit and the UIKit for iOS.
  • Member Avatar for vegaseat
    vegaseat

    Replied To a Post in A Taste of Swift part 2

    // use enumerator to give switch/case a more readable syntax enum Planet { case Mercury, Venus, Earth, Mars, Jupiter, Saturn, Uranus, Neptune } var myPlanet = Planet.Earth // change it …
  • Member Avatar for vegaseat
    vegaseat

    Replied To a Post in A Taste of Swift part 2

    I am just learning Swift on my new Mac computer. Coming from a C/C++/Python background, Swift is manageable. If I would be forced to use Objective C, I would have …
  • Member Avatar for vegaseat
    vegaseat

    Replied To a Post in A Taste of Swift part 2

    // Python-like console user input func input(prompt: String) -> String { print(prompt) var keyboard = NSFileHandle.fileHandleWithStandardInput() var dataIn = keyboard.availableData // convert to a String, use ! to remove option() …
  • Member Avatar for vegaseat
    vegaseat

    Replied To a Post in A taste of Swift part 1

    // simpler array creation (infer type string) var mynames2 = ["Larry", "Jean", "Ronald"] println(mynames2) // [Larry, Jean, Ronald] // replace name at index 0 mynames2[0] = "Peter" println(mynames2) // [Peter, …
  • Member Avatar for vegaseat
    vegaseat

    Replied To a Post in Nature's Temper

    The smoke is thick in the valley from all the forest fires in California.
  • Member Avatar for vegaseat
    vegaseat

    Edited A taste of Swift part3

    Part 3 of the taste of Swift explores class objects in Apple's Swift language. A class allows you to group methods (class functions) together that belong together. Class Person groups …
  • Member Avatar for vegaseat
    vegaseat

    Replied To a Post in A taste of Swift part 1

    // split a string into an array at spaces let s = "one two three" let arr = s.componentsSeparatedByString(" ") println(arr) // [one, two, three]
  • Member Avatar for vegaseat
    vegaseat

    Replied To a Post in A taste of Swift part 1

    Some date/time handling ... println(NSDate()) // 2015-06-24 21:33:44 +0000 let format = NSDateFormatter() format.dateFormat = "ddMMMyyy" println(format.stringFromDate(NSDate())) // 24Jun2015 format.dateFormat = "MM/dd/yy" println(format.stringFromDate(NSDate())) // 06/24/15 format.dateFormat = "EEE MM/dd/yy" println(format.stringFromDate(NSDate())) …
  • Member Avatar for vegaseat
    vegaseat

    Replied To a Post in A taste of Swift part 1

    An example of a named tuple, actually an array of named tuples. With a named tuple you can use index numbers or more meaningful names ... // create an empty …
  • Member Avatar for vegaseat
    vegaseat

    Edited A taste of Swift part3

    Part 3 of the taste of Swift explores class objects in Apple's Swift language. A class allows you to group methods (class functions) together that belong together. Class Person groups …
  • Member Avatar for vegaseat
    vegaseat

    Replied To a Post in Dictionary problem

    This is a tough piece of homework! As a hint, I used something like this ... for ix, line in enumerate(textList): # change to lower case and strip newline char …
  • Member Avatar for vegaseat
    vegaseat

    Edited A taste of Swift part3

    Part 3 of the taste of Swift explores class objects in Apple's Swift language. A class allows you to group methods (class functions) together that belong together. Class Person groups …
  • Member Avatar for vegaseat
    vegaseat

    Created A taste of Swift part3

    Part 3 of the taste of Swift explores class objects in Apple's Swift language. A class allows you to group methods (class functions) together that belong together. Class Person groups …
  • Member Avatar for vegaseat
    vegaseat

    Replied To a Post in Who else misses "Save as..."?

    Clicking Duplicate and then saving it with a different filename isn't that far off. You can also just click Export. I agree, "save as" is more intuitive!
  • Member Avatar for vegaseat
    vegaseat

    Marked Solved Status for file name as a string parameter

    Trying to create function called parseExtension that takes a file name as a string parameter and returns the file extension. Going to ask users to input a filename ie. Python.exe …
  • Member Avatar for vegaseat
    vegaseat

    Replied To a Post in file name as a string parameter

    Best to use module os ... ''' file_splitext.py get a given file's extension ''' import os filename = "myfile.exe" name, extension = os.path.splitext(filename) print("name = {} extension = {}".format(name, extension)) …
  • Member Avatar for vegaseat
    vegaseat

    Revoked Solved Status for file name as a string parameter

    Trying to create function called parseExtension that takes a file name as a string parameter and returns the file extension. Going to ask users to input a filename ie. Python.exe …
  • Member Avatar for vegaseat
    vegaseat

    Marked Solved Status for file name as a string parameter

    Trying to create function called parseExtension that takes a file name as a string parameter and returns the file extension. Going to ask users to input a filename ie. Python.exe …
  • Member Avatar for vegaseat
    vegaseat

    Revoked Solved Status for file name as a string parameter

    Trying to create function called parseExtension that takes a file name as a string parameter and returns the file extension. Going to ask users to input a filename ie. Python.exe …
  • Member Avatar for vegaseat
    vegaseat

    Replied To a Post in Jokes

    A new business was opening and one of the owner's friends wanted to send him flowers for the occasion. They arrived at the new business site and the owner read …
  • Member Avatar for vegaseat
    vegaseat

    Replied To a Post in A Taste of Swift part 2

    One more function example tested on the Swift playground ... // recursive function ... // n changes so use var n func factorial(var n: Int) -> Int { // use …
  • Member Avatar for vegaseat
    vegaseat

    Replied To a Post in A Taste of Swift part 2

    Some experiments in the Swift playground ... String(255, radix: 2) // "11111111" String(255, radix: 16) // "ff" String(format:"hex 255 = %X", 255) // "hex 255 = FF" var binValue = …
  • Member Avatar for vegaseat
    vegaseat

    Replied To a Post in A Taste of Swift part 2

    Apple's Xcode IDE gives you access to the playground where you can test out short segments of Swift code and see the results as you type. Similar to the Python …
  • Member Avatar for vegaseat
    vegaseat

    Replied To a Post in Is Privacy Important?

    Laws are just a bunch of words left open to the interpretation of hired experts. After all, torture is against the law, yet it was conveniently interpreted by some hired …
  • Member Avatar for vegaseat
    vegaseat

    Replied To a Post in My campervan is not a cyber security risk

    Cars and appliances of the future will sense and transmit information to the manufacturer. This most likely will become a two way information street. So, if you drive an old …
  • Member Avatar for vegaseat
    vegaseat

    Replied To a Post in A factorial one-line function (Python)

    @MIOCUNARD, let's hope you are not building yourself up to be a signature spammer.
  • Member Avatar for vegaseat
    vegaseat

    Replied To a Post in Star expression in for loop

    @MIOCUNARD, let's hope you are not building yourself up to be one of those signature spammers.
  • Member Avatar for vegaseat
    vegaseat

    Replied To a Post in learn c++

    I recommend ... http://www.tutorialspoint.com/cplusplus/cpp_tutorial.pdf
  • Member Avatar for vegaseat
    vegaseat

    Replied To a Post in need help!!

    Start thinking and coding, when stuck ask a question.
  • Member Avatar for vegaseat
    vegaseat

    Replied To a Post in Star expression in for loop

    You can't solve what?
  • Member Avatar for vegaseat
    vegaseat

    Replied To a Post in Polynomial functions stores

    You could store it as a string and design a little parser to pick it appart.
  • Member Avatar for vegaseat
    vegaseat

    Replied To a Post in A taste of Swift part 1

    // using formatted values string via % specifier var avgTemp = 66.844322156 // Objective-C NSString and Swift String are interchangeable var sf = String(format:"average = %.2fF", avgTemp) println(sf) // average …
  • Member Avatar for vegaseat
    vegaseat

    Replied To a Post in Use a mac as a programmer?

    My Mac came with Python3 and the IDLE IDE. For scientific work I downloaded the free Anaconda3 package (Python with many modules preinstalled, the Spyder IDE and IPythonNotebook). Apple's Xcode …
  • Member Avatar for vegaseat
    vegaseat

    Marked Solved Status for How to transfer my photos from iPad to computer

    Over the summer I started downloading photographs directly to our iPad. In the past I had first loaded them onto our laptop and then transferred them to the iPad. Now, …
  • Member Avatar for vegaseat
    vegaseat

    Replied To a Post in How to transfer my photos from iPad to computer

    I simply share my photos via email.
  • Member Avatar for vegaseat
    vegaseat

    Marked Solved Status for Turbo C++ thru DosBox for Mac not working

    We started learning C++ in our class at school a few months ago, and hence, we have to download and use Turbo C++ 3.0 (90s software, ugh), as we don't …
  • Member Avatar for vegaseat
    vegaseat

    Replied To a Post in Turbo C++ thru DosBox for Mac not working

    Apple's **Xcode IDE** (free download) comes with 4 languages ... C C++ Objective C Swift When you start a new project it will ask which of these you want to …
  • Member Avatar for vegaseat
    vegaseat

    Replied To a Post in Polynomial functions stores

    `9x^6+2x^4+2x+5` would be ... `9*x**6 + 2*x**4 + 2*x + 5`
  • Member Avatar for vegaseat
    vegaseat

    Replied To a Post in There is an elephant on the loo!

    Zimbabwe is phasing out its local currency (the Z$). The exchange rate is Z$35 quadrillion (35,000,000,000,000,000) to one US$. Foreign currencies like the US dollar and the South African rand …
  • Member Avatar for vegaseat
    vegaseat

    Replied To a Post in My campervan is not a cyber security risk

    There is still room on the roof for stickers!
  • Member Avatar for vegaseat
    vegaseat

    Replied To a Post in A Taste of Swift part 2

    Swift was made to replace Objective C used with Apple's Cocoa GUI toolkit for apps, including touch sensitive apps. Apple's free Xcode IDE makes building GUI applications with Cocoa fairly …
  • Member Avatar for vegaseat
    vegaseat

    Edited A taste of Swift part 1

    The Swift computer language is the brainchild of a number of Apple associates. In my humble opinion it shows some nice features, but also some warts. Part 1 (constants, variables, …

The End.