First coding question ever!
So I'm totally new at coding and I'm taking a course in Lynda.com
The course is for swift 4 but there are certain commands that are not working or I have to write it different in order for it to work.
For example
Course says: activeQuest.sorted() Does not work
activeQuest.sort() Does work
Course says: activeQuest.intersection(completedQuests) Does not work
activeQuest.intersect(completedQuests) Does work
.symmetricDifference does not work and couldn't find any other way to write it
Why is this? Thank you!
Why is this?
It’s because the course is for Swift 4 but you are using an earlier version of Swift.
Related
I've been trying to find Swift examples for FMDatabaseQueue.
All I have been able to find is Objective-C here: https://ccgus.github.io/fmdb/html/Classes/FMDatabaseQueue.html
Im not familiar with Objective-C and I'm new to Swift so I'm not sure how to port the code.
I've found what I was looking for here https://github.com/ccgus/fmdb/issues/291
There exists Swift wrappers for SQLite that may be a better fit that fmdb which can run in Swift but does not use Swift features such as type safety or error handling. See for example my GRDB.swift https://github.com/groue/GRDB.swift which was heavily influenced by ccgus/fmdb.
Being new to coding I have a few newbie questions I'm hoping someone could confirm for me.
in xCode is the Playground just for testing code. Whatever I decide to actually be used needs to be copied to somewhere else to actually use it?
ViewController.swift - How do I decide what should go here or when to make a new "file"?
Yes, playgrounds are for playing with code and experimenting and getting immediate feedback without the usual build and run cycle. However, coding in them is slightly different to normal app programming. One thing you'll notice is that everything is top down, so you have to declare something above where it is used first, which you don't have to do in normal swift apps.
What you should put in ViewController.swift... such a broad question. You might be better off reading an iOS programming beginners book or guide, than asking that here. You should become familiar with MVC for what you put in a view controller. Potentially, you could put everything in ViewController.swift if you desired - but it wouldn't be very nice to work with. The only thing I would put in ViewController.swift, is the code for the ViewController class. I'd create a new file per class I create, new file for a protocol (most of the time), new file for defining constants usually. It's up to you, but at least a new file per class.
I am new to iOS development and apologies for a basic question. I am trying to convert an image to grayscaled and threshold it using openCV in iOS. So far, I have imported and setup the framework on xcode. What I am trying to do now is to implement the following features:
http://www.youtube.com/watch?feature=player_embedded&v=Ko3K_xdhJ1I
at 0:24 and 0:53
I tried to follow the tutorial which points to the above youtube video :
http://docs.opencv.org/doc/tutorials/ios/image_manipulation/image_manipulation.html
and wasn't sure where to paste the above code and in which file?
Many thanks.
Kind Regards.
These are helper methods and best written in a separate file. Quite simply,
http://answers.oreilly.com/topic/631-how-to-get-c-and-objective-c-to-play-nicely-in-xcode/
Put all that image manipulation code in say ImageManipulationHelper.mm and create a header file for the same
Create a nice little category for UIImage.
http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/ProgrammingWithObjectiveC/CustomizingExistingClasses/CustomizingExistingClasses.html
which can call these methods in turn to create any image manipulation you might want.
Easy does it. And yeah, read up a bit more on using C++ in objectiveC, if you get into trouble and also about categories. They are some of the niftier features of objectivec
I achieved the same,using the help of this awesome link
Let me know if you need any further help.
Cheers!!
Edit :
Check this out ImageFiltering
i was wondering about where Zends functionality comes from when inside of a controller i call
$this->getRequest()->isPost()
It works, but i do not find where this "isPost()" function comes from.
I just noticed it because i don't have intellisense for that.
Question is:
Is this merely some fallback function that "newbie users" use apart from a better alternative?
Or is it perfectly valid using it?
Thanks :)
It is the official way to go, you can use it. Check the source code of Zend_Controller_Request_Http::isPost() to see what it really is doing, if you'd like :)
i am trying to use the goTo function to switch between different divs.
but in the function goTo(id,animation)
it is not going to that id.
Can anyone please help me with this problem.
Thanks,
Devan
This is difficult to diagnose without looking at your code. I have a few ideas, but it would be best if you were to share the problematic section of your code for others to investigate.
A few questions/ideas:
1) Check to ensure you have not used the same div ID more than once.
2) Have you been able to successfully use the goTo function at all?
3) Can you create a basic HTML page that uses this function successfully?
4) What version of jQTouch are you using? Does the goTo function work once, and then freeze every time afterwards? I reported a bug regarding this behavior a while ago. Not sure if it's been resolved yet, but you could see if an older version of jQTouch might help.
Again, without examples of your code... I'm taking wild guesses. Consider sharing the problematic section and someone might be able to pinpoint the issue.
Don't put animation, without animation worked for me...
eg..
jQT.goTo('#rest');