Thread: Programming software for my job

  1. #16
    Registered User
    Join Date
    May 2009
    Posts
    4,183
    I strongly suggest using a database!

    Maybe SQLite would work. SQLite Home Page


    Tim S.
    "...a computer is a stupid machine with the ability to do incredibly smart things, while computer programmers are smart people with the ability to do incredibly stupid things. They are,in short, a perfect match.." Bill Bryson

  2. #17
    Registered User
    Join Date
    Oct 2006
    Posts
    3,445
    Quote Originally Posted by James Longoria View Post
    They are not using the classic natural Marijuana, now days they are smoking Synthetic Marijuana. The Synthetic Marijuana is just a herbal incense with a lot of other chemicals that actually fry there brain.
    isn't it their brain to fry, if they choose to do so?

    what right do you have to try to protect people from their own stupidity? it's a lost cause. give it up and go after real criminals, like thieves (especially politicians), murderers, rapists, and child molesters.
    What can this strange device be?
    When I touch it, it gives forth a sound
    It's got wires that vibrate and give music
    What can this thing be that I found?

  3. #18
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    The issue of whether marijuana, in whatever form, should or should not be a banned substance in any particular jurisdiction is not within the topic of this forum. Neither is the issue of whether the notion of banned substances should be legal/enforced in any particular jurisdiction within the topic of this forum. Please refrain from discussing these out of topic issues here.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  4. #19
    Registered User
    Join Date
    Jan 2014
    Posts
    13
    I strongly suggest using a database!

    Maybe SQLite would work. SQLite Home Page


    Tim S.
    Thanks, a lot of the input on here expands my horizon on ways to approach the program!
    Last edited by James Longoria; 01-29-2014 at 10:00 AM.

  5. #20
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Anyway, when I mentioned "database engine" in post #2, SQLite was what I had in mind. However, this means that besides learning C, you would also need to learn some relational database design.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  6. #21
    Registered User MutantJohn's Avatar
    Join Date
    Feb 2013
    Posts
    2,665
    Wait... Does this mean that I'm not the only stoner on these forums?

    On topic though, do you think something like Python would also be more suiting to the OP's needs? It's more simple and because Python can weave C code in and out, SQLite will still work, via Introduction to SQLite in Python | Python Central

  7. #22
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    You're welcome, James. Welcome to the forum, btw.

    I'd suggest NOT using a database for this. You should be able to poke around and find a copy of the state statutes already on line. Once you have that, you just need to enter the changes made each year - which in Texas, are minimal. And again, somebody will have made those changes on-line, if you look hard enough and have a bit of luck.

    Mutant John:

    Is Python so simple that we should avoid using strstr(), in C?

    If he goes the database route, he has a TON of work to do. If he uses an on line text version of the state statutes, he can probably find it already done for him, every year.
    Last edited by Adak; 01-29-2014 at 10:47 AM.

  8. #23
    Registered User
    Join Date
    Oct 2006
    Posts
    3,445
    Quote Originally Posted by MutantJohn View Post
    Wait... Does this mean that I'm not the only stoner on these forums?
    I highly doubt that you're the only stoner on the forums, but I'm not one. What I am is a supporter of personal liberty and the right of people to live their lives as they choose, so long as they do not harm others.
    What can this strange device be?
    When I touch it, it gives forth a sound
    It's got wires that vibrate and give music
    What can this thing be that I found?

  9. #24
    Registered User MutantJohn's Avatar
    Join Date
    Feb 2013
    Posts
    2,665
    Quote Originally Posted by Adak View Post
    You're welcome, James. Welcome to the forum, btw.

    I'd suggest NOT using a database for this. You should be able to poke around and find a copy of the state statutes already on line. Once you have that, you just need to enter the changes made each year - which in Texas, are minimal. And again, somebody will have made those changes on-line, if you look hard enough and have a bit of luck.

    Mutant John:

    Is Python so simple that we should avoid using strstr(), in C?

    If he goes the database route, he has a TON of work to do. If he uses an on line text version of the state statutes, he can probably find it already done for him, every year.
    Well, others were mentioning using SQL (or some flavor of, I'm not sure; lol what's a database?) and I figured that Python would be more, shall we say, friendly than just using raw C with no experience in programming.

    I looked up strstr() and it's very nice but Python doesn't have to teach him pointers.

    I do like your idea though.

  10. #25
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    Quote Originally Posted by Elkvis View Post
    I highly doubt that you're the only stoner on the forums, but I'm not one. What I am is a supporter of personal liberty and the right of people to live their lives as they choose, so long as they do not harm others.
    Your political discussion, is not topical in this forum, or in this thread, whatever your beliefs.

    Python can hide pointers, but "under the hood", computers use addresses - and LOTS AND LOTS of 'em. The program could be changed to "hide" the pointer, even in C, if it was desired.

    Python is a fine language, but I get confused when people refer to "raw" C. WTH is "raw" C? (We need to BBQ it now?).
    Last edited by Adak; 01-29-2014 at 11:12 AM.

  11. #26
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Quote Originally Posted by MutantJohn
    On topic though, do you think something like Python would also be more suiting to the OP's needs? It's more simple and because Python can weave C code in and out, SQLite will still work
    Part of the aim is to learn C, so using Python (or any other programming language) would not meet that goal. "Weave C code in and out" should not be a point of consideration: James Longoria is a beginner to programming general. Being able to use SQLite is not particularly important: if SQLite were used, one could just use a database viewing tool and thus skip writing a program entirely, but that would miss the point that this is also a learning exercise for programming.

    Quote Originally Posted by Adak
    I'd suggest NOT using a database for this.
    I think a database is fine. Not using a database is also fine.

    Quote Originally Posted by Adak
    If he goes the database route, he has a TON of work to do. If he uses an on line text version of the state statutes, he can probably find it already done for him, every year.
    I don't see how that is so. As I noted in post #2: "The time consuming part would presumably be the typing out of the text from say, the hardcopy book, or copying it from a state website and reformatting it for printf (and/or storage with respect to your program). Unfortunately, no matter what you do, you cannot avoid this part of getting the text into a form usable by your program."

    An "on line text version of the state statutes" does not magically appear in a usable format for what James Longoria wants to do. If it does, then adding it to a database would be just as easy. Thus, the decision of whether or not to use a database route should depend on the requirements and whether James Longoria wants to learn about them in addition to learning to program in C.

    EDIT:
    Oh, but I note that James Longoria mentioned searching by statute number alone in post #13. In that case, if the statutes were available on a single webpage, then I would concede that a simple copy and paste into a text file would certainly be possible and easier than transcribing them into a database since no keyword tagging would be required.

    On the other hand, such an approach means that the C program is entirely unnecessary for actual use: just copy the webpage and access it offline in a web browser.
    Last edited by laserlight; 01-29-2014 at 11:12 AM.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  12. #27
    Registered User
    Join Date
    Jan 2014
    Posts
    13
    Quote Originally Posted by Adak View Post
    You're welcome, James. Welcome to the forum, btw.

    I'd suggest NOT using a database for this. You should be able to poke around and find a copy of the state statutes already on line. Once you have that, you just need to enter the changes made each year - which in Texas, are minimal. And again, somebody will have made those changes on-line, if you look hard enough and have a bit of luck.

    Mutant John:

    Is Python so simple that we should avoid using strstr(), in C?

    If he goes the database route, he has a TON of work to do. If he uses an on line text version of the state statutes, he can probably find it already done for him, every year.
    Adak, that is exactly what I did. I retrieved my data from the online state statutes, which is already formatted for my program purpose. You can download each section in a text file,PDF or HTML. As for the updates, minimal are made each year. We are mandated to take the update class each year, which will allow me to update the program. I am going to continue studying C and I will later implement a menu and reference section for each code such as Penal Code,Property, etc.
    Last edited by James Longoria; 01-29-2014 at 11:17 AM.

  13. #28
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    Sounds good, James.

  14. #29
    Registered User
    Join Date
    Jan 2014
    Posts
    13
    Oh, but I note that James Longoria mentioned searching by statute number alone in post #13. In that case, if the statutes were available on a single webpage, then I would concede that a simple copy and paste into a text file would certainly be possible and easier than transcribing them into a database since no keyword tagging would be required.

    On the other hand, such an approach means that the C program is entirely unnecessary for actual use: just copy the webpage and access it offline in a web browser.
    It is a big hassle to read through hundreds of laws, while out in the field. The program that I am making is to make the overall arrest procedure more time efficient by providing the Officer with an easy interface to use. For example if an Officer makes an arrest for Possession of controlled substance Penalty Group 1. All the Officer would do is open the program and select the Health and Safety Section, once the section is selected he will have a statute reference guide for the selection. The Officer would then take a quick glance at the " Possession of controlled substance Penalty Group 1" reference that has the statute number. Enter the number and the offense code is generated. The reason it is time consuming for the offline webpage is because a lot of Officers do not have access to basic internet because of department policies and when you open the text file there are several similar word phrases and numbers that make it hard to find what you are looking for.

  15. #30
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Quote Originally Posted by James Longoria
    The reason it is time consuming for the offline webpage is because a lot of Officer do not have access to basic internet and when you open the text file there are several similar word phrases and numbers.
    Since the webpage is offline, no Internet connection is required. The fact that there are similiar word phrases and numbers is of no concern because the officer can search by statute number using the web browser in the same way that your program would do with a text file containing the statutes. An advantage is that if an officer really wanted to search by some phrase, that could be done too.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 9
    Last Post: 05-05-2012, 09:36 PM
  2. TCP/IP sockect programming software
    By simona in forum Networking/Device Communication
    Replies: 4
    Last Post: 12-18-2011, 01:50 AM
  3. Replies: 9
    Last Post: 02-27-2006, 04:45 AM
  4. New Ms Programming Software!!!
    By sean in forum A Brief History of Cprogramming.com
    Replies: 7
    Last Post: 10-25-2002, 05:40 AM
  5. Software Testing to Programming
    By stratovarius519 in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 02-23-2002, 01:05 PM