How can I increase the recurrence of a question in a quiz? - swift

I am developing a quiz based app on Swift and the questions repeat several times within a set time limit. If the user gets a specific question wrong I would like the app to increase the recurrence of this question.
Any help would be appreciated greatly!
Many thanks,
Jonny

Not really a Swift question - more about what approach to take to solve your problem. There are many ways to achieve this and which one is right for you will probably depend upon how precise you want to be with the probabilities of a particular question being asked and your own coding ability.
The simplest approach would probably be to have an array of questions and use array.randomElement() to choose a question randomly from that array. If the user gets the question wrong you add that question to the array again. That's definitely not the best approach but if you are having trouble with this yourself it may be the best for you.

Related

How should I go about testing first solution strategies?

I am trying to solve a large vehicle routing problem with many pickup and delivery constraints and time windows and demands. There are so many first search strategies and I am a novice user that does not know which one to try first and how to set it up. Is there a brute force solve method that tries one solver after the other? Which first solution strategies should I definitely try?
The way I did it was one by one and checked the answers, there are not that many first solution strategy. "PathCheapestArc works the best based on my experience.

permutations and variations for chatbot user intents

(first time posting, be nice. Also, I'm learning how to code, so I may not ask this question in the right way, be nice) I'm designing a chatbot and I'm having trouble finding a solution that creates all the possible permutations and variations for how a user would ask a question or make a request. For example, if a user wants to know the weather they could ask "Wha't the weather?" or "Will it be sunny tomorrow?" or, or, or. Any resources you could point me to will be appreciated.
This is called natural language processing and is not trivial. I wouldn't recommend working on something as complex as this for a beginner. https://en.wikipedia.org/wiki/Natural_language_processing
I found a couple threads where people wanted to do the same thing.
Any tutorials for developing chatbots?
https://softwareengineering.stackexchange.com/questions/132165/programming-a-chatterbot-understanding-language
But yeah, this isn't easy.

How to Access Multiple Classes data in One MainClass? [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I am working on one of big project.so that's why my application contains a lot of coding. Interesting thing about this project is that it contains only one mainview and this mainview contains 25 subviews, each subview contains UITableview.so problem for me is that if I declare all these subview and uitableview in mainview along with different function which I need for every subview it create confusion. Now to make it easy I want to create separate class for each subview, but I am not familiar with how to access all these classes in my mainviewviewcontroller. Still if some one not able to understand my problem then please visit this link. http://chris-software.com/index.php/2009/05/02/passing-data-between-classes/
It seems from your comment that you already have coded something like you have mentioned in your problem, and now, you trying to make your code scalable and making it separate as zoul has suggested.
As zoul has mentioned, There isn't any exact solution to your problem, as your problem is also not exact, or say specific.
Unfortunately, It is not fully possible what you are trying to achieve, as you have mentioned in your comment. But, Let me try to give you some hint that you may find useful when refactoring your code.
Decide what data needs to be shared among the different classes.
Decide View Controllers for your application. By saying this I mean, number of View Controllers, as your application might need. It also may be possible that you can accomplish the task with less number of view controllers.
If size of shared data is considerably large then, I would suggest that you would SQLite or CoreData for that, whichever suits your need.
Specific query is welcome.
Best of luck :)
Additional Note: Try to follow the design pattern provided by Apple, most importantly in the initial phase of SDLC.
First, certainly do split the code into separate controllers or views, otherwise you would enter the world of pain. Second, it's hard to answer your current question here on Stack Overflow, because this is a question about architecture and answering it properly requires a longer discussion about your problem; there is no ready solution.
Generally, in such cases you want to build the individual screens or views as separate controllers with interfaces that allow them to be connected together as needed. (Try hard to design the individual controllers to know as little about the others as possible.) Then you can have one class that will create all the components and connect them together. There are many particular tools that can help with that, especially the UIViewController containment API introduced in iOS 5.
Going by your problem of using the same code in a new/different class time to time, re-usability is the key.
But to get this correct you must follow the "Loose Coupling and High Cohesion" principle.
Essentially, you need create each sub-view like a component by itself, which performs a specific task and is not aware or dependent on external factors like its parent etc.
Lastly, I feel the main problem you are facing trying to resuse code is because you are using IB for wiring up function to UI events.
I would suggest using target and selector properties for wiring as this will ease resuability and also keep your code discreet and cleaner.
You can read more about coupling and cohesion here Loose Coupling and High Cohesion

matlab object detection and tracking

I m doing a research project on "Object detection using my a digital camera".
Some suggestion on how to build and program the Matlab code.
In particular, I have a picture of one object, say a screen of my laptop. Than I rotate the laptop and I shot a new picture. I would like to know the difference on the position of the screen. I think I can use the edge detection after a subtraction of the two images but... it is quite difficult for me to implement it.
Some suggestion on how to build and program the matlab code.
That largely depends on the goal you want to achieve. Can you be more specific? Are you streaming the frames or are you tracking offline?
In particular, i have a picture of one object, say a screen of my laptop. Than i rotate the laptop and i shot a new picture. I would like to know the difference on the position of the screen.
There are many ways to do this, and an extensive litterature on the subject. I don't believe anyone would write up the equivalent of a survey paper on the subject as an answer on StackOverflow. Why don't you get started with an object tracking survey paper and then ask a more precise question?
hi, I m doing a reasearch project on "Object detection using my a digital camera". [...] I think i can use the edge detection after a subtraction of the two images but...is quite difficult for me to implement it.
What is your question? Are you asking us if this is a good way to track objects? Are you asking us if this is a new approach and has never been done? Are you asking someone to implement it for you?
Object tracking is a hard problem. I doubt that technique would succeed in any but the most basic scenarios. However, if you look at a survey paper, you might be pointed to a paper that already implemented this an presents results. Finally, I think you should brush up your programming skills because most (successful) object tracking techniques are not trivial to implement. If you don't want to program it yourself, there are online services where you can hire people. StackOverflow is not one of those places.
EDIT: I could deduce that you're new to both programming (in MATLAB) and in object tracking, hence in my answer. Don't mis-understand me, I'm trying to help. Let me re-phrase my suggestions as list:
Your question is far too general. You will get a lot more help from the SO community if you ask more precise questions for two reasons: A) general question result in general answers; and B) the way you asked your question could easily be interpreted as "someone, please do my work for me" even if that's not what you think you're asking.
Get acquainted with the problem domain. To ask more precise questions, you must be close to your answer. For good knowledge on the "object detection and tracking", find a good survey paper. If you're starting off on a research project, people in your lab should be of help to point you to a good one.
Learn to program simple things first. All of the most proficient (effective and efficient) programmers I've ever met struggled with the bubble sort when they were introduced to sorting. None of them would have been able to program an object detection algorithm as a first assignment. Get yourself a good image processing book that has exercises in MATLAB, go through execises one by one. If you can't do them all, choose those that are relevant to what you're trying to accomplish.

What methods do programmers prefer to use when learning new subjects or technologies

When you are learning a new subject or technology what ways do you use to remember your achievements ?
In the past I have used a variety of methods including some of the following :-
Paper-based Journal (A4 paper cut in half with a guillotine, and bound with a plastic spine.) I keep this chronologically, and frequently reorder the pages to group continuations or similar pages together.
Emails - I frequently email snippets of code to myself
Test programs - Short self-contained snippets of project code.
ProtoPage.com - web based repository of notes.
Memory - frequently the least reliable method, but occasionally it's better.
Finally :-
Stack overflow - I previously asked a question on here as I was working on the solution. Then came back to provide my own answer. Is this an acceptable use of Stack overflow ? Banging in questions as I think of them, and then coming back to provide an answer an hour, few hours, or maybe days later whn I've worked through it. Maybe coming back in the meantime to see what answers I'm getting, maybe providing me with new directions to try.
I was tempted to create a blog where I can store all these kinds of voyages of discovery I have but I think there may be greater value putting it on here.
Thoughts, opinions, and your methodologies girls and guys please.
If you build a core library for all your applications, you can use that for reference/commenting etc. You dont need to remember the full implementation of code, you just need to rememeber a reference to where it is (which is naturally/structurally categories by your code)
The thing is a Blog is exactly the means to achieve what you are wanting to. Its an online reference, allows for collaboration and you won't get shot to pieces when you post "random" questions on SO all day long, and answer them in a week when you find the answers.
SO is basically Q&A whereas a blog is a running counter of your problems and solutions to your coding problems.
It doesn't hurt either, can get some nice recognition from your blog, and gain yourself some reputation/followers in a community.