Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I'm trying to write a small dictionary Ruby app where I can look up existing entries, add and remove entries (ALL ENTRIES ARE PUT INTO A HASH). So right now I'm creating a Dictionary class and I'm not quite sure what exactly should be 'initialized' method.
I'm still pretty new to Ruby, so if someone could explain what should be initialized at the beginning of a class I'd be extremely grateful.
How do you know what to initialize?
Time and experience. In general, #new should:
Initialize instance variables.
Configure any object defaults.
Register itself with observers.
Housekeeping tasks needed to reach a minimal "ready" state.
Sometimes an object needs to do a lot more work to be "ready" (whatever that means for your class), and #new can just as easily do too little as too much. Finding the right balance for your application is what matters, so feel free to open new questions here or on Code Review Stack Exchange with more concrete questions and some actual code.
Related
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 3 years ago.
Improve this question
For example, if I update a global variable in one goroutine, then read the variable in another goroutine, can I get the newest value?
Another question is, can "atomic.Load*" and "atomic.Store*" ensure visibility?
Without explicit synchronization between goroutines, there is no guarantee that you will see the latest value of a shared variable. The Go memory model describes this:
https://golang.org/ref/mem
Atomic load/store have memory barriers, and they do guarantee you will see the latest value, though the Go memory model does not explicitly state this.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 3 years ago.
Improve this question
I just started my college "adventures", and one of them is subject called operating systems. I must admit that the subject is the most boring ever. Last week, we got our first homework, and i do not know what to do as this is the first time ever i come up with Windows API functions or this topic in general. The task is very simple, we need to write very basic code in C that shows how does GetCurrentThread() work!!!???? I tried looking for solution online, but I could not find anything and our professor is not doing anything to help us. I found the use of functions like GetCurrentThreadID() but that is not what i need. Can somebody write simple program ( 20-30 lines of code ) which contains the use of this function (in C)?
Operating systems courses tend to suck because they take the simplest of concepts and try to make them convoluted.
Documentation for the GetCurrentThread () function is
https://learn.microsoft.com/en-us/windows/desktop/api/processthreadsapi/nf-processthreadsapi-getcurrentthread
What it does not explain is that the return value for the function is a "handle." Windoze uses handles somewhat as pointers to objects but where you cannot access the object directly.
So you call GetCurrent() thread and it returns a "Handle to the Thread." That handle can then be used to do things with the thread.
Here are the things you can do:
https://learn.microsoft.com/en-us/windows/desktop/ProcThread/process-and-thread-functions
Some of these function pages have short examples.
So you could do:
print ("Thread ID: %d\n", GetThreadID (GetCurrentThread())) ;
and have the ID of the current thread.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I am trying to take a look at the status of r7rs large but I cannot find any information
in scheme reports page, etc, just a talk from 2013. I searched around with google without success as well.
Is it still alive?
Where can I find information?
What would be the tentative date?
What is the progress at this point?
Thanks.
You can read about the R7RS process on the R7RS working group wiki. R7RS-large is listed under the "Working Group 2" section of the front page.
In particular, look through the StandardDocket and ConsentDocket sections. Standard docket is for stuff that's under discussion (and eventual voting). Consent docket is for generally-uncontroversial stuff that's likely to get into R7RS-large without having to be voted on.
There is no firm timeline that I am aware of (though I'm not part of the working group and do not speak for them). The standard docket is quite long, though, and they will have to process through most/all of it before you have anything that you can call R7RS-large.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
I have an app which tests students' knowledge. After each unit, it transitions to an overall level view controller which I would like to keep score of how many units are complete. What would be the best way of doing this? I would like to present the results in a table view if possible.
Any help would be much appreciated.
Your question, as the commenters have said, is rather vague, so I will only offer general advice. In the class (or classes) where you test the students knowledge, you need to have some method that passes the name of that unit, and presumably a score, to the overall level view controller. There are a bunch of ways that this could be done. One way would be to post a notification with the NSNotificationCenter method postNotificationName:object:userInfo:. The userInfo could include the name of the unit, the score, and any other info you want. The overall level controller would register as an observer of that notification. The same notification could be sent from other classes, if you have a different class for each unit. The controller would then take the info in the notification and add it to an array which would be the data source for your table view.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
Where do you draw the line between functional requirements and aspects of design?
If i can illustrate, one function of my system is that it must implement a user hierarchy.
In this instance would the definition of what those hierarchies are come under requirements (assuming you already know what the user hierarchies are) or would they come under the design aspect of a project?
Where do you draw the line between functional requirements and aspects of design?
Requirements is what the code needs to do. Design gets into how it will do it, with class hierarchies, design patterns used, etc.
Requirements:
There must be A, B, and C types of
user. Type A is only able to edit
their own account, type B can edit
their own account and post to hidden
forums, type C can edit all accounts
and post to all forums. The application must have a small memory footprint because blah blah blah....
Design:
Each instance of the user class will
contain a member variable of a
permissions object. The permissions
object is a wrapper for a bit field
because memory is tight, but has
several convenience methods, called
foo, bar, and baz. foo does XXX and is
public, (eventually design gets very low level and is turned
into code).
I'm not saying that would be the actual design, but that's how the design should analyze the requirements and eventually become a working implementation.