How to run a Linux/C program in a customized way? [closed] - linux

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 11 years ago.
I need to write a program that is to be run as follows: <program_name>_ <space> _<file_name>_ <space> _<stuff to be written into the file>. I am new to Linux/C/Unix programming and so I need your help. From what I can understand, I need to write a program titled <program_name>, pass two parameters in the main function which are <file_name> and <stuff to be written in the file>, and then go through the code as usual, writing all the required lines. Am I going about this the right way? Also, it is mentioned that I am to create a make file out of the program. As I am thoroughly unfamiliar with Linux, I would like to know if that this would change anything. That is, would my approach to the program change because I am to make a make file out of it? Thanks for the help! :)

You should search for "beginning linux" to get some web sites that will give you the basics of navigating around in Linux, notably on the command line.
Then I'd search for "beginning vi" to learn the basics of the vi editor. If you're using a GUI, then you can simply use their simple GUI text editor.
Then I would search on "Beginning C programming linux". That will give you several links, and will get you through the basics of creating a C program and compiling it with GCC.
That should keep you in enough trouble for the short term until something clicks or you learn enough new terms to keep searching for.
Good luck!

Related

Non-deterministic CSP programming tool? [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.
Hi i need a non deterministic constraint satisfaction problem tool, because i need different solutions with the same input of the problem. Someone knows about a tool with this characteristic?
I only know tools like Gecode (c++), Choco (Java) and Curry (Haskell) that i think work in deterministic way.
If what you want is to get some random solution, most CP tools have some support for using randomised heuristics. For example, the standard Gecode branchers have options for this, for example INT_VAR_RND and INT_VAL_RND for integer variables. To get a different search each time, make sure to set the seed uniquely.
Note that using random heuristics will not give you any guarantee of the distribution. For example, your problem might have only two solutions, but almost all random choices might lead to one of the solutions giving a very skewed distribution.
Are you trying to do Pareto optimization (aka multi-objective optimization) and let the user choose one of the pareto optimal solutions?
People have done this with Drools Planner (java, open source) by simply replacing the BestSolutionRecaller class. See this thread and this thread. Planner 6.0 or 6.1 will provide out-of-the-box pareto support.
Similar to what Zayenz said, you can try Minion with the flag -randomiseorder.

Bash conceptual questions [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 new to linux & bash, and I am working on some different scripts, but I have a few conceptual questions I need answered to help me find the best approach to what I want to do.
What is the most efficient way to store data in a bash script, and save it as a file, that another script can speedily parse?
What are some good examples of colorful bash menu's? How can I have a multi-column menu's in bash?
Can I display images in bash or would it be better to send the image info to, let's say a notify-send, and have it to display any images?
Thank you.
That's quite a potpourri of questions :-)
Firstly, the most efficient way to store data in a bash script depends entirely on the data and the processing you want done to it. If the processing will be done by bash itself, it'll probably be faster in a bash variable (size permitting). If external programs like grep, sed or awk will be processing it under the direction of bash, a file may be better.
But that's a very general guideline - you need to analyse both the data and the use of it, especially since how it's stored in the file is also important. By way of example, I wouldn't store fixed length records as an XML file if I was processing it in bash alone, since that means I'd have to write a whole lot of XML processing code for the shell. I'd probably just store it as fixed length records in a flat file.
Secondly, I have no examples for you, as bash tends to either be a command-line driven thing or, at most, a very simple menu-based thing. It's not generally used for fancy UI work.
And you can quite easily have multi-column menus, the simplest form being something like:
echo "1. Enter new contact. 4. Find contact"
echo "2. Edit contact 5. Exit"
echo "3. Delete contact"
Lastly, bash itself has no support for displaying images any more complicated than ASCII art:
|\_/|
/ # # \
( > º < )
\__V__/
/ O \
So, if you need something more complex than that, you'll probably be passing it off to an external program.

How difficult is to develop a text editor in windows? [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 11 years ago.
How difficult is to develop a text editor in windows?
edit: something like this for a target: http://intype.info/home/index.php
That depends on what sort of text editor you want. For a really simple editor, you can just host an EDIT control (or RICHTEXT control), in which case you have a working editor in well under an hour. If you want to write a full-blown programmer's editor, you'd probably want to measure the time in months or years instead of minutes.
Depends on what tools you use. To develop something offering basic functionality (like Notepad) using C# and WPF or Windows Forms (or VB if that's your poison) would be pretty easy if you knew the language and the API well. Doing something similar with Python, Ruby, or something else and Tk, GTK, Qt, etc. wouldn't be terribly hard either. Same goes for Java and AWT or Swing. Any graphics toolkit with a high level language is going to give you most of the scaffolding that all you really need to do is define the layout and add some logic (opening files, saving, etc.) Developing with C or C++ (unmanaged) and the Win32 API would be much more difficult, but still relatively simple.
You could probably put together a working Notepad clone rather quickly. It gets harder as you add features. I know that with my language and toolkit of choice (Python + Tkinter) I could probably do a feature for feature clone of Notepad in a few hours, right down to appearance and UI.
Pretty easy actually:
use whatever GUI toolkit you want
add a multi line textbox control
add load/save options
compile/build/link
and you just made a poor man's notepad :)
Now seriously, what do mean with a text editor? What kind of features are you looking for? Do want something simple like notepad, something totally awesome like notepad++, or something enormous like word?

C## -- with two pound signs? [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 13 years ago.
Visual Basic .NET
C##
etc
C#? With two pound signs?
It's on so many of these programming résumés we're getting -- from random people -- listed as a qualification.
Any ideas what these folks are talking about? Is this convention an accidental holdover from C++, or something?
EDIT/ANSWER: Turns out the corporate résumé management system converts the "C#" that applicants specify to "C##". That is just fantastic.
My guess is you shouldn't hire them.
Looks like a recruiter who doesn't know what he is talking about is trying to impress you.
That résumé speaks for itself - little attention to detail. Not good for a programmer...
If it's on "so many" I'm willing to bet that the candidates don't know what they are talking about. Similarly, I have seen 'C+' listed as a language as well.
It's not uncommon for people to list as many languages on their resume as they can, because the Bad Ones think that even knowing the name of the language gives them a foot ahead of someone who doesn't. This is obviously a flaw in logic.
I can't remember exactly where I heard this story before (someone's blog, maybe someone will remember) but the exact situation is described. A candidate comes in with a resume listing all of these languages. As the interviewer asks the candidate to demonstrate their knowledge of the language by writing some code, the candidate freezes. When the interviewer asks why, the candidate responds with "I didn't say I knew how to write in those languages, just that I know of them!"
I received a resume before has this line in the list of experiences
C \ C+ \ C++ \ C#
:)
C Sharp - now even sharper!

Am I the only one who makes spelling and grammar mistakes when programming? [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 13 years ago.
I don't know if I am a bad programmer because I often make mistakes when outputting information on a site, things like "thanx for subscribing to our service" instead of "Thanks for subscribing to our service".
I think this is because I usually don't concentrate on the spelling, my main focus is to get the functionality running perfectly. Please give me your opinion, do you concentrate on the spellings or the functionality?
If I'm writing a message which will be visible to users, I'll make sure it's clear and correct. If I'm writing a message which will only be visible to other developers, I'm slightly less careful - in particular, typos aren't really a problem, so long as I express myself clearly.
Fortunately my spelling/typing/grammar is reasonably good anyway, so I don't need to think too hard about this, but I think it is important for customer-facing text.
Developers often aren't very good at writing messages for users. It can be hard to put yourself in the position of someone who really has no idea about what's going on in the background: they just want to get their email (or whatever it is) working. If you're lucky, you may be able to get a technical writer to help compose appropriate text.
IMO attention must be paid to both. Cool logic and reliability are no excuse for crappy texts.
You could separate checking the resource from changing the source. When you do changes first change the code, test everything, then proofread the resources.
The CTO at my last job was dyslexic, and a completely brilliant programmer and manager. Every now and then I would go and make a spelling correction to one of his method or variable names (C# handles the refactoring pretty well) and it didn't really matter that much.
When there's user interface work it's much more important to spell things correctly coz it looks very shabby to have a misspelled UI.

Resources