conio linux and decisions

This is a discussion on conio linux and decisions within the A Brief History of Cprogramming.com forums, part of the Community Boards category; For those of you that care I haven't done much coding since dropping out at the Univsity so I am ...

  1. #1
    Registered User
    Join Date
    Jul 2003
    Posts
    450

    conio linux and decisions

    For those of you that care I haven't done much coding since dropping out at the Univsity so I am really rusty. Are final project was a beverage(beer) rating program which I turned into some type of command interpreter as my final entry.

    Recently I have gone totaly linux and refuse to deal with windows.
    I was looking into a simple program in C++ that only accepts number inputs, does not buffer any letters not echoed.

    Its funny because in Qt you can set up rational expressions but there is no means to do this in standard C++.

    So without a gui I thought use conio and getch but it was not included in my linux distro. I just read the faq and there is an alternative lib, but I wonder why conio is not included.

    Anyhow bare with me I hope I can crawl back into programming and hope eventualy I can make some useful contribution.

  2. #2
    Even death may die... Dante Shamest's Avatar
    Join Date
    Apr 2003
    Location
    Malaysia
    Posts
    970
    <conio.h> is not standard. It was provided in early Borland compilers (Turbo C/C++) for the DOS/Windows Console only. Nobody should use them today, especially not for Linux.

  3. #3
    Nonconformist Narf's Avatar
    Join Date
    Aug 2005
    Posts
    174
    but I wonder why conio is not included.
    Because *nix systems already had curses. The conio library--even if you consider the full conio library from Borland--was weaker than curses, so there was no point in porting it.
    Just because I don't care doesn't mean I don't understand.

  4. #4
    Registered User
    Join Date
    Jul 2003
    Posts
    450
    Thanks that answers my question. I new conio was not standard but questioned the alternative and did not even think of ncurses.

    I guess if your going to do console programming it is important to isolate these nonstandard functions for cross platform programming. The problem is easier said than done for noobs like me.

    I am dealing with this exact question with QT. Isolating the GUI from the core of the program.

    It may seem stupid but my program is just a simple enter integer the only thing I haven't done is connecting the signals to slots in my main program.

    Thats easy enough but what happens if I strip out the GUI. Whack I have to deal with posix threads to get non blocking input.

    So I ask your advice, continue on learning QT. Or go back to console programming with ncurses and try to learn posix threads at the same time.

  5. #5
    Registered User Jaqui's Avatar
    Join Date
    Feb 2005
    Posts
    416
    QT is cross platform itself.
    it's the core of borland's delphi and builder widgets.
    the default look for qt is the same look as xp has.
    Quote Originally Posted by Jeff Henager
    If the average user can put a CD in and boot the system and follow the prompts, he can install and use Linux. If he can't do that simple task, he doesn't need to be around technology.

  6. #6
    Registered User
    Join Date
    Jul 2003
    Posts
    450
    Sure its cross platform but you have to buy a Developers license for window and I can't not afford this.

    The point I'm trying to make is that it is not good to intermingle your functional code in the same class or file as you have for displaying the gui, but this can cause tightly coupled communication(function calls) and classes as I experinced with my beverage program.

    As I think of this in my simple getinteger program I also need to check for overflow
    so do I assert the responsibity of the GUI to give a integer in acceptable range.

    Do I use exceptions in the GUI section recieving the integer.

    Do I do simple error checking.

    My answer is all of these but the call back function should do this as well imo at least the assertion that this class expects a valid integer.(design by contract Meyers, also assertions are discussed in Code Complete)

    This is great practice if I need wrappers, and is also a good time to use the Adapter pattern to simplify the function calls where I will actually do somthing with the integer.

    Well I stray but this is general discussion so thank you for discussing.

  7. #7
    Registered User Jaqui's Avatar
    Join Date
    Feb 2005
    Posts
    416
    you make a good point.
    most gui apps in linux are gui wrappers for console apps. the gui only passes console arguments to the executable.
    so it's the core of the application that does 95% of the work. The gui is only to make it pretty.

    ~wandering to read comment that may fit from another board~
    Quote Originally Posted by Jeff Henager
    If the average user can put a CD in and boot the system and follow the prompts, he can install and use Linux. If he can't do that simple task, he doesn't need to be around technology.

  8. #8
    Registered User Jaqui's Avatar
    Join Date
    Feb 2005
    Posts
    416
    here it is.. a wonderfull explanation of the architectural differences between windows and linux.

    two points

    1. I think jmgarvin's statement that Linux is "easier to use in the long run", or whatever the exact phrasing might have been, was perhaps not very precisely phrased. I can understand and appreciate his perspective on it, and tend to agree with it: I'm thoroughly familiar with both Windows and Linux quirks of interface style, and for my purposes I find Linux to be much easier to use in the long run.

    When I say it's easier to use "in the long run", though, what I'm saying isn't that with familiarity it gets easier. Rather, I'm saying that, once I'm familiar with both, I find that the same ease of use yields more flexibility and range of use with the Linux system. In other words, I get used to a greater functionality, and achieving the same results on a Windows system is typically much more difficult, if not effectively impossible, which makes me look at the task at hand and say something like "This is SO much easier with Linux!" It's not because of greater familiarity with Linux (I've only been using it basically for this century, whereas I've been using Microsoft OSes pretty much since they were first marketed): it's because I can achieve what I want to do without having to jump through far more hoops.

    2. With a decent package management system like Debian's apt and the unixy one tool one job well philosophy of development, your statement "Maybe that's why I don't understand why you'd want to install multiple applications and another app to tie them together, instead of installing one "do it all" app from a single source and reducing the possibility of conflicts" doesn't make a whole lot of sense. I realize this is a matter of not being familiar with the way Linux distros tend to work, so I'll try to explain what's going on with that small pile of utilities so that conflicts aren't even on the radar:

    Because of the necessary monolithic cohesiveness of interface design in GUI environments to reduce clutter, and the uselessness of back ends for applications that consist of a multitude of command-line utilities when your OS is designed from the GUI down rather than from the kernel up, Windows applications are monolithic not only in interface design but in software architecture as well. As such, all the functionality of a given application suite is an indivisible part of the whole.

    This means that when additional applications are made that overlap a given application in functionality, such as when you have on one hand a music production suite complete with CD burning and labelmaking featuress, and on the other hand a small-office backup system that allows periodic backups for offsite that can be done to tape, removable hard drive, or optical disk (such as a CD), the two separate application suites' developers reinvent the CD-burning wheel, each in their own manner. Both of them must use the same CD burner on the same computer, and thus both must configure the CD burner for their own uses. Each might also demand a certain amount of attention from the CD burner by way of sending it occasional "pay attention to me" messages, just sorta pinging the IRQ for the device. All of this has the potential to develop problems of the sort you describe: conflicts.

    Meanwhile, with the CD burning software and its attendant utilities that I described in my earlier post, none of these things actually controls the CD player at all. Only one thing controls the CD burner on a Linux system, and that's the kernel module (driver) for it. The cdrecord utility basically just puts ducks in a row and fires off a user instruction to the driver, which then executes the instruction if it's not otherwise engaged. No conflict. At worst, you might have to enter the command again when a previous burn is done. Applications don't crash spectacularly, taking out large chunks of the OS, because they aren't fighting for control of resources: they just say "Hey, may I use this resource?" and if told no, they sit down and shut up. Tiny little utilities that just do one thing and do it well don't have the room in the code for resource management routines necessary to create huge, complex tasks of the sort that are going on in a monolithic application like Roxio or Nero. Instead, there's a string of one-shot utilities, each doing one small job in turn and passing on the results to whoever or whatever called the utility. The K3B application calls mkisofs and cdrecord, in that order, to create and burn a CD recording task, and at each step of the journey if something fails to happen the utility in action at that time just spits out its error message and clicks off. The "glue code" scripting of K3B then handles the error message as it was designed to do, and typically this means it asks if you want to try again from where the process stopped, possibly passing information on to the user to correct something if, for instance, user permissions aren't properly set. Roxio or Nero, on the other hand, gets to part of the process, finds out it can't do something, and locks up because it's not divided into discrete parts: it's one contiguous whole, and if part of it fails, the whole thing fails. This makes every step of the process a single point of failure for the ENTIRE process, which is a magnified problem when you consider that each one of these things is trying to get direct control of the CD burner all for itself.

    Posted by: apotheon Date: 09/07/05

    original posting can be found here
    Quote Originally Posted by Jeff Henager
    If the average user can put a CD in and boot the system and follow the prompts, he can install and use Linux. If he can't do that simple task, he doesn't need to be around technology.

  9. #9
    Registered User
    Join Date
    Jul 2003
    Posts
    450
    That was a very interesting essay. It brought up many things that are important.
    The article makes the case that linux has more robust software, but this is a generalization. The kernel is certainly more robust, but other software is subject to similar errors as a program in windows would.

    There has been much depate about the open source development model. I feel there is much we can learn from these different devopment modules.

    In the end we are working with people and no person is infailable, we make mistakes. I personaly like the open source development model on a purely philisophical level.

    I have not worked with a team on any opensource project, so I wonder wether this form of development is ultimately more satisfying.

    Finally to realy understand your quote from a programmers point of view you need to understand aspects of the operating sytem that at times seem overwhelming.

    If we continue are education of these aspects, the eventually come second nature.

    Your reply is appreciated.

    Thanks,

    Curlious

  10. #10
    Registered User Jaqui's Avatar
    Join Date
    Feb 2005
    Posts
    416
    Yes, it's a generalisation. until you start to compare specific applications that do the same job on different operating systems any comparison will be a generalisation.

    the difficulties in writing cross platform applications really stem from the differences in the core development models of the operating systems. I personally do prefer the model used by the open source operating systems. It does provide for a much easier means of avoiding things like the infamous bsod ( with Windows Vista getting renamed to Red Screen of Death )

    learning any os to the point of effective programming is a steep curve. learning for multiple os just makes it steeper. ( and costs more )

    I personally use a linux from scratch workstation for programming in linux. my workstation is 100% lsb compliant in partition structure, and starts with only those libraries required for lsb compliance. any additional libs needed go into the projects directory tree under dependancies. this allows a simple listing of what dependancies there are, that may not be on a users system. I do include these libs with the apps, so that people don't have to hunt down the dependancies.
    ( my opinon on good practices in application development and release )LSB can be a fun read, but it does give a good foundation on what is where and why.


    curses itself isn't in use anymore, ncurses ( New Curses ) is an updated and ported version that is used instead.
    from my ( limited ) reading on it, ncurses is linux only, not cross platform.
    Quote Originally Posted by Jeff Henager
    If the average user can put a CD in and boot the system and follow the prompts, he can install and use Linux. If he can't do that simple task, he doesn't need to be around technology.

  11. #11
    Registered User
    Join Date
    Jul 2003
    Posts
    450
    Thank you, I took a quick look at the LSB website and will definately consider joining.

    I live in Missoula, Mt. and have a dream project I would like to develop with help.
    The idea is creating a simulation for fish hatcherys here in Montana. One that may be accessed via the web. It would include information on breeding, selective release, populations etc. It would also be a complete simulation of watersheds and natural fish in the indigenous rivers and lakes.

    Missoula is a University town. We are often granted research money for projects.

    As I say this is just a dream.

    The alternative is open sourcing are wast disposal (garbage) methods and using modern technology to assist in tracking, and maximal effeciency.

    Anyway I've bookmarked your site.

    I must say goodbye, this has been a good discussion and it has helped me solidify some of my decisions!

  12. #12
    c n00b
    Join Date
    Sep 2005
    Location
    Fort Collins, CO
    Posts
    7
    Quote Originally Posted by curlious
    That was a very interesting essay. It brought up many things that are important.
    Thanks. Yeah, I wrote it.

    Quote Originally Posted by curlious
    The article makes the case that linux has more robust software, but this is a generalization. The kernel is certainly more robust, but other software is subject to similar errors as a program in windows would.
    You're absolutely correct: it's a generalization, as written. The fact of the matter is that ultimately, quality of code is the responsibility and fault of the guy writing it. While certain environments (unix/Linux) provide "safer" structures upon which code operates than others (Windows), a sloppy programmer can turn the most stable platform into a nightmare of problems and a real master can turn the most flaky into something truly enjoyable.

    On the other hand, there are distinct environmental pressures involved when coding for a given platform. Because Linux is filled with open-source utilities that do almost everything under the sun already, and Windows is not, one is forced to reinvent the wheel daily when creating new applications in Windows, and one is freely able to crib from better programmers than oneself when creating new applications in Linux, incorporating elegant utilities in a framework of functionality. True, there's nothing inherently requisite about the manner in which applications are written for Linux, but it takes a distinct effort to swim against the tide to write monolithic buggy monstrosities of the sort that are all too common on the Windows platform.

    Again, I'm generalizing, but I'm generalizing about observable trends, and not about unobservable intrinsic qualities. As such, I don't think it's really an invalid generalization.

    Quote Originally Posted by curlious
    There has been much depate about the open source development model. I feel there is much we can learn from these different devopment modules.
    Agreed. There's always something to be learned from another way of doing things -- even euphemized marketing slogan methodologies like "egoless programming". I'm increasingly of the opinion that open source is the way to go if at all possible in a given instance. Clearly, it's not always possible, however. While I could go on about why I believe so strongly in the efficacy of open source software development, I think I've strayed far enough from the original topic for a new guy to the forum without chasing that tangent.

    EDIT: Thanks to Jaqui for providing me a Post Number Zero introduction to this forum.

  13. #13
    Registered User
    Join Date
    Jul 2003
    Posts
    450
    WOW I need an editor!

  14. #14
    Registered User Jaqui's Avatar
    Join Date
    Feb 2005
    Posts
    416
    check your post, before a reply is posted.
    there is an edit button.
    and the advanced reply gives a bit more control over the reply.
    ( unless you have bbcode memorized )

    edited for spelling.
    Last edited by Jaqui; 09-09-2005 at 12:51 PM.
    Quote Originally Posted by Jeff Henager
    If the average user can put a CD in and boot the system and follow the prompts, he can install and use Linux. If he can't do that simple task, he doesn't need to be around technology.

  15. #15
    Registered User
    Join Date
    Jul 2003
    Posts
    450
    lol?
    unless you have bbcode memorised )
    memorized

Page 1 of 2 12 LastLast
Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21