Are there well-established design patterns on implementing a user prompt? [closed] - c

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 6 years ago.
Improve this question
I'm working on a embedded project which reads a joystick and moves an actuator within a 3d space accordingly. Now I would like to provide a user prompt available over serial line as an alternative option as user input. User input will be G-Code.
https://en.wikipedia.org/wiki/G-code.
I'm not unexperienced with creating C code, however, I never had to deal with text input before. Are there any well established design patterns on how software of this kind is implemented in a easy-to-read/maintanable way?

No, there is no "design pattern" for a user prompt.
Design patterns are of marginal value, at best. They were created in arm-flapping response to the evident catastrophe that most programmers are unable to think for themselves. Consequently, they are given a lengthy catalogue of previous thoughts, along with finely detailed instructions about how to map their thoughts to these cast-in-stone homologues.
Here's a brilliant example of a "design pattern": it's somehow EVIL to use a global variable. So, instead, instantiate a Singleton class (which--if you're not careful--will require you to employ the brokered services of a SingletonFactory [but I digress]) and provide "getter" and "setter" methods that access the encapsulated datum. Result: instead of one line of code that's out there, on the ledge, provide fifteen lines of code that are out there, on the ledge. HOGWASH!
Many will take offense at this statement. If they but thought about it, they would realize that they have fallen victim to a sham. Design patterns are like rubrics in a "Common Core" English essay assignment: assume that the student is utterly unable to generate creative, properly structured English by himself, and so provide ridiculously detailed "guidance" on just what to say and just how to say it.
Think for yourself. That's the best advice anyone can give you, anywhere, ever.

Related

How to detect pro-sex behavior on an open chat platform? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 8 months ago.
Improve this question
Many chat channels (e.g. Omegle, mIRC) produce the the following conversations when engaging a person one doesn't know.
M
asl?
F 25
wonna sexchat?
This behavior is extremely prevalent. Detection of nudity in videos or images is an open research problem. What I am listing here should be simpler to accomplish. Any off-the-shelf solutions? Any language and any open and free library is fine(including papers on how to do it)!
There is a library on Python that name is profanity. Link: profanity-check
With machine learning algorithm I'm super sure that we can handle it easily. For that you should collect whole words as that. After collecting, you can add a label line, like 0 if acceptable, 1 if not. Then, with some successful machine learning algorithms, you can associate the data with the euclidian, manhattan type distance criteria and create a decision mechanism about whether the content is bad or not. It is difficult to predict how much the success rate will be, but I think that with such an approach, a success rate close to 90% can be achieved. I would like to share with you an academician whose work I trust on this subject. Yılmaz Kaya

How to create distributed file system [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
Just for self education I decided to implement "hello world" distributed file system. The simplest one. And decide to read about theory under this subject.
But... when I asking google about this it shows answers like "how to configure hdfs" or "how to set distributed fs on windows" what is not what I interested in...
Could someone please point me on some good articles or books on this subject.
Thanks a lot!
Well, if you really decided to implement such a file system, you must start with distributed systems. I recommend reading the Tanenbaum reference book http://www.distributed-systems.net/index.php?id=distributed-systems-principles-and-paradigms
Careful, the subject is really complex and distributed systems are all but simple to implement.
If you want to have a look to some already implemented distributed file systems, you may have a look to GFS/GFS2 (from RedHat). You may also have a look to ocfs2 from oracle.
You may also have a look to gluster https://fr.wikipedia.org/wiki/GlusterFS
You may also be able to find some white papers on the google file system (when it was still a university work).
The main problem of such distributed system is the failure detection (detect when a node crashes while writing on the file system => need to make sure there are no corruptions). There are multiple strategy, one may be to implement a journal which is protected by a distributed lock.
Another great (classical) problem is the 'split brain' problem, when the cluster is split in two groups because of a network failure (imagine a switch that is broken). Both groups 'think' that the other one is dead (they cannot communicate with it) but there is no way to make sure that the distant group is not writing data causing the data to diverge.
Hope you find what you want with all this.
Edit:
Now GFS is deprecated, redhat is using and developing 'Ceph'

Generator of "mind map" from files.c [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 8 years ago.
Improve this question
I started a while ago to learn the C language, and has spent several hours I search THE miracle software.
I am looking for software that import sources of software in C (files.c) and generates a "mind map" of the code with all files, functions, variables, etc ...
Do you know if it exists? It'll help me a lot to understand the architecture of complex software.
Thank you very much for all your answers.
Take a look at the "call graph". This sort of visualization should get you started.
As the comment suggests, Doxygen is a good open-source tool. Take a look at some output here. Doxygen is straight-forward to configure for call-graph generation under *nix. It's a little more complex for Windows. First, check out this SO post: how to get doxygen to produce call & caller graphs for c functions. Doxygen's HTML output provides a number of nice cross-referencing features (files, variables, structs, etc.) in addition to caller/callee graphs.
On the commercial side, Understand for C/C++ has first-rate visualization features. Google "c call graph diagram" for other commercial and open-source options.
Finally, there are some older SO posts, like this one Tools to get a pictorial function call graph of code. Take a look at it.
Look into the program ctags. It is an indexer of names and functions based on the structure of the programming language.
It is quite mature, and has integration with a number of other tools. I use it with an older (but very nice) text editor called vi, but it can be used independently from the command line.
It does not generate a graphical view of the connections. However, in my estimation there are probably too many connections in most C programs to display visually without creating a large amount of information overload.
This answer differs from Throwback's answer in some interesting ways. A call graph can mean a few things. One thing it can mean is the path a running program took through a section of code, and another is the combination of all paths a running program might take through the code, and another is the combination of all paths in the code (whether they can be reached or not).
Your needs will drive which tool you should use.

FUSE - detailed documentation [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 6 years ago.
Improve this question
trying to get my own filesystem working using fuse (filesystem in user space, linux) im really curious on where to get detailed up to date documentation of the operations used?
most time i search for other file system implementations and see what they do, but some operations seem to be not widely used like poll/ioctl or bmap.
and the documentation of the fuse api doesnt help much, cause e.g. the parameters and return values of the operations are not documented thus i have to guess how to use em
so the question is where do i get better information about how such exotic operations are supposed to be implemented?
thx
Yes, you are right, many places you can read that comment saying there is little documentation on FUSE. Perhaps that's because there is so little to document. Or perhaps the implementation is only meant for those who understand the tradeoff of userspace filesystem well enough. So perhaps you can refer to the following documentation, tutorials, slides or even sample codes for more information:
FUSE Design Document (original documentation from Sun?):
http://www.youblisher.com/p/31627-fuse/
http://wr.informatik.uni-hamburg.de/_media/research/labs/2008/2008-03-michael_kuhn-container_library_and_fuse_container_file_system-report.pdf
http://www.oug.org/files/presentations/losug-fuse.pdf
http://sar.informatik.hu-berlin.de/teaching/2013-w/2013w_osp2/lab/Lab-4-FUSE/lab-FUSE_.pdf
http://www.cs.hmc.edu/~geoff/classes/hmc.cs135.201001/homework/fuse/fuse_doc.html (tutorials)
http://www.cs.cmu.edu/~./fp/courses/15213-s07/lectures/15-filesys/index.html
http://www.cs.nmsu.edu/~pfeiffer/fuse-tutorial/
Sample code:
http://fuse.sourceforge.net/helloworld.html
And perhaps this is more research-oriented:
http://www.msrsas.org/docs/sastech_journals/archives/May2011/2.pdf
https://code.google.com/p/s3fs/wiki/FuseOverAmazon
But generally there is a lot of problems/issues (which may be solved through some complex algorithm) with implementing filesystem in userspace, which is why Linus has commented it as "toy":
https://ceph.com/dev-notes/linus-vs-fuse/
15Apr2015 update:
I just found this (and many other slides - just look at the right hand side of this webpage):
http://www.slideshare.net/adorepump/fuse-developing-fillesystems-in-userspace

Where to get a Database of Spanish <-> English Translations? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 5 years ago.
Improve this question
for a program I am writing I would need a dictionary between Spanish and English words. I googled a while, but I could not find any database freely available. Does anybody know where or how to get such a database (preferably a simple CSV or XML file)?
So far my best idea to create such a dictionary is to create a little program that looks up an English word on Wikipedia, and uses the language links to extract the correct translation. But I don't want to want to make a million requests to Wikipedia just to generate this database...
I don't need anything fancy, just a mapping from one word to one or possibly multiple translations for this word. Just like a regular dictionary.
Ask around on the Omega Wiki, formerly known as the Ultimate Wiktionary or Wiktionary Z. They collect translations from all languages into all languages, and their data is available in a relational database.
Do you need to translate on the fly at runtime, or is this a one-time translation of labels and messages for a UI?
I'd say that runtime translation will be remarkably difficult, because you'll need more than a dictionary of words. Natural language processing is difficult in any language. Most languages need to know something about context to translate smoothly.
If it's a one-time translation of UI elements, I've had good luck using Google Translate to go from Japanese to English.
To answer your question, I don't have a database like that, sorry.
The problem with natural languages is that they are very context dependent, so the same word in English can mean many things in French. Take the English verb 'to know'. This can be translated into French as either 'savoir' (to know a fact), or connaitre (to know a person, or a town).
I'd be very interested to know if there exists such a database, but I doubt if it exists.
Sites like http://www.reverso.net hedge their bets by showing both results.

Resources