761 Posted Topics
Re: You might look here: [url]http://wiki.python.org/moin/BeginnersGuide[/url] [url]http://pytut.infogami.com/node11-baseline.html[/url] My own basic take on classes: A class is a description of a data holder along with the things you might want to do to the data, or find out about the data. In Python, you have to be explicit so when you define … | |
Re: This is a pencil and paper exercise at first. You have to look at it and think about how you would do the work if you were the computer. "Someone tells me they make 19,500, and I have to decide how much deduction, then do the rest of the problem … | |
![]() | Re: I have a kind of off the wall question... but there's a point to it later. So: Did you always build things as a kid? Lego? Models? Tree house or fort? Were you the kind of kid that took apart the alarm clock or the washing machine? Did you work … |
Re: And some use Forth, Ruby, Lisp, Fortran, C++ ... There are good reasons to choose a particular language, and they [B]all[/B] are about matching the needs of the project to the language(s) best suited to the problem and the team. There are bad reasons too, but lets not go there. | |
Re: What to return:[LIST] [*]Option one: Instead of returning "East" or "South", return an index into an array of direction strings. That index is an int. [*]Option two: You are using std::string, so just return it by value. The library takes care of dealing with storage space. [/LIST]The considerations are: [LIST=1] … | |
Re: Most times there is a datetime or date column when you need to keep track of when something happens. It is almost never a good idea to store the month, particularly as some char type. You can order by or group by month(date or datetime column) | |
Re: What Teme64 said, except I see very little need for math in a large fraction of what programmers do; and in fact among the programmers that I personally know and respect, only maybe half or so even "like", much less "do" math. (I happen to be in the "like" camp … | |
Re: You don't mention why you cannot go to school. Are you immobile? Too busy working? Too far away? Unable to afford the tuition? The answers to these and similar questions will make a difference. However, generally, the best way to meet people is to volunteer your time.[B][I][/I][/B] | |
Re: Shell is probably not the ideal tool for an interactive (right click to choose) program. Shell is better suited to a command line interface, where for instance, you would type in (maybe with auto-completion) the name of the .sql file. In this case, I'd likely create a temporary sql file … | |
Re: To restate the problem: Given a word as input, find all "legal" words that can be made by selecting letters from that word in any order, where "legal" words are those defined in a file. As an example, if the file contains words "a", "bear", "bee", "cat", "have" then given … | |
Re: Umm. You are programming in Java and don't understand how to do a cast? Try looking for [B]cast[/B] or [B]typecast[/B] in the index of your text. This will be the fastest fix because it is the easiest to understand. "Generifying" your collection would be the better long term fix, if: … | |
Re: It appears to me that you have an incorrect understanding of your problem. As I see it: each test has some questions (test has 1->N with question) each question has some answers (question as 1->N with answer) So: A question object has answers and a test object has questions. Like … | |
Re: Looks to me as if poor Grep is stuck in a Microsoft environment. Clue one: he uses 'batch' instead of 'script'. Clue two: "@echo" ... I seem to recall something about a leading '@' in dos batch files. Alas, I no longer remember enough about such things to be helpful. | |
Re: What OS are you using? What programming tools are available to you? | |
Re: Are these "some queries" the same every time or are you doing them interactively? If the same every time, then a script (or shell function) would be reasonable. Otherwise, I recommend the mysql command line tool. | |
Re: [url]http://www.sqlteam.com/article/uniqueidentifier-vs-identity[/url] | |
Re: There are a lot of ways. First question: [B]Why do you want the index?[/B] Stop and think about what you want to use it for, and maybe you can go directly to the need instead of by steps. Do you want everything to the left (or right) of the ':'? … | |
Re: You need to flush the buffer of the opened file before you try to transfer it. Or else you are accidentally transferring an empty file of the same name (but different path). I had that happen to me one time. Took a [B]long[/B] time to find it because you don't … | |
![]() | Re: There is not (#include is often considered to be one of the ugly warts in C). You can probably refactor your code so you have three files: [ICODE]main.py[/ICODE], [ICODE]external.py[/ICODE], and [ICODE]used_by_both.py[/ICODE], then import used_by_both into main and into external. If you cannot find a way to refactor the code, then … |
Re: You might also want to think about your user input [ICODE]name = raw_input("Please enter customer's name: ") if name == "quit":[/ICODE] which will fail if the person enters a leading or trailing space around the 'quit'. Instead, I suggest [ICODE]if 'quit' == name.strip()[/ICODE] | |
Re: noteId might be nice to have in the future as a foreign key. Right now not needed as pointed out by tesuji. Varchar(500) will take a little over the number of bytes needed to store the datum, with a maximum of a little over 500 bytes as karol33 mentions (he … | |
Re: INPUT tag has a variety of types. One is hidden: [url]http://www.htmlhelp.com/reference/wilbur/form/input.html[/url] [QUOTE]TYPE=hidden Allows you to embed information in the form which you do not want changed. This can be useful if the document is generated by a script and you need to store state information. NAME and VALUE of this … | |
Re: I suspect line 73. You have not checked that the parameter [ICODE]char *string[/ICODE] is non-NULL. I agree with detrix42 that the best option here is to examine the failed call stack, which of course is most easily done in an IDE, but can be done in a variety of other … | |
Re: It is almost always better to use the column type that is 'natural'. In this case, consider using the "month" function: [ICODE]month(date_column)[/ICODE] | |
Re: [LIST=1] [*][ICODE]SQ(a+2) == a+2*a+2 == a+(2*a)+2[/ICODE] you can fix this by protecting the macro and its args: [ICODE]#define SQ(x) ((x)*(x))[/ICODE]. The outer parentheses are not strictly needed here, I think, but are a good habit. For instance think about this: [ICODE]#define DBL(x) (x)+(x) printf("%d\n",3*DBL(2)) /*8 or 12?*/[/ICODE] [*]Parameters are not … | |
Re: The join bit can be done like this:[ICODE]line = ''.join(line.split())[/ICODE] I assume you can read and write to text files. If the inputs are not all text, it is slightly more complicated. Search for "list comprehension". | |
Re: This is an insufficient description of the problem, and it probably needs to be in the Access/Filemaker forum. | |
Re: In a shell environment, doing arithmetic on various columns, awk is your friend. (Well, I guess it isn't really friendly, but it is efficient and useful). You [B]can[/B] use expr, but awk is easier (once you understand it) and faster, if that matters. I don't understand your 'need to find … | |
Re: Have you considered just using a "standard" CMS? There are lots of them already written and in daily use... | |
Re: achadya is right. You will want to have at least three states: (default), (minutes gt 20), (area not local). You may want one or several more states. You should think about which transitions, which order, and final states. | |
Re: A linked list is some nodes each of which has a link to the next node (singly linked) or both the next and previous nodes (doubly linked). Each list has a head node, doubly linked lists have a tail node too. Search for an element must proceed from one end … | |
Re: Skill is something you [B]get[/B] from your education. Talent, ability, "raw horsepower" is something you have [B]before[/B] you get the education. You aren't looking for skill, but ability, if I understand your intent; so I think that skill assessment is probably not to the point. A good assessment tool would … | |
Re: Goretix - Extremely boring, very good at energy management, sometimes drops a long running process. | |
Re: In general, the OO way of getting what you want is a [B]Factory[/B] pattern: Something external to the class instance (it can be a static class method, a method in a WhateverFactory class, or a free function) that accepts the appropriate input parameters and returns an instance of the appropriate … | |
Re: What happens when you compare the float i with the int n? That seems to be the only place where it could be going wrong. I suggest that you instrument after line 26 with [ICODE]printf("m=%d, n=%d, i=%f, p = %f\n",m,n,i,p);[/ICODE]. You might also want to print out the boolean that … | |
Re: please use the CODE tags around your code (you can highlight than choose the '#' button in the message box). | |
Re: You will want to use readlines() unless you have huge files. Once you have the array of lines in, say lines: [CODE] tpos = [] hohs = [] aces = [] others = [] for line in lines: if 'TPO' in line: tpos.append(line) elif 'HOH' in line: hohs.append(line) # elif … | |
Re: what is the specific problem that translates to "not working correctly"? | |
Re: Just as a minor suggestion: Get used to zero-based indexing. Your cout << ... i+1 ... makes me itch. For debugging purposes, it is good to use a fixed set of data so you can easily see what changes when you modify your code. I suggest this: {5,1,9,2,3,4,8,0,7,6} which is … | |
Re: What about duplicate entries? I think I'd probably prefer to read the file and parse it into a map, then update the map, and write it back out. Is it time to think about using pickle? | |
Re: "Similarity" is kind of vague, and I'm not willing to think my way through all your code to understand what you mean by it. So: * Are you looking for the greatest common substring (and then some arithmetic on its length versus the length of (which?) primary string? * Are … | |
Re: You all seem to be missing what I think is DaveSW's main point: It is a bad idea to actually store credit card info, even if you are being careful and correct. No, using a certificate doesn't [B]ensure[/B] safety, it only [B]allows[/B] it. This kind of thing (credit card handling) … | |
Re: You need two kinds of tables: [LIST=1] [*]informational (holds some kind of "raw" data) [*]association (holds foreign keys and may have associated data) [/LIST] you need info tables for: lawyer, deal, organization, as you have done You also need an association table that has [LIST] [*]lawyer_id foreign key, [*]organization_id foreign … | |
Re: This will get you the oldest 5 files: [CODE]find . -type f -print0| xargs -0 stat -t '%s' | awk '{ print $9 "\t" $16 }' | tr -d '"' | sort -n | tail -5|awk '{print $2}'[/CODE]annotation: find . -type f : Show all the files below current directory … | |
Re: [url]http://wapedia.mobi/en/Logical_shift[/url] and [url]http://wapedia.mobi/en/Arithmetic_shift[/url] It helps a lot to treat the numbers as binary. You can also think about dividing by 2 (right shift) or multiplying by 2 (left shift) | |
Re: Using the Gnu compiler: [QUOTE]1745% cc ook.c # C compiler ook.c: In function ‘main’: ook.c:11: warning: passing argument 1 of ‘scanf’ from incompatible pointer type ook.c:11: warning: format not a string literal and no format arguments 1746% cc ook.cpp # C++ compiler ook.cpp:4: error: redefinition of ‘int a’ ook.cpp:3: error: … | |
Re: You could just use the random shuffle thing you already have. Or you could decide how long the slowest horse would take for each segment, and call random.random()*intervalMax for each horse for each interval. Add the intervals so far, and show the horses in reverse sorted order. | |
Re: Welcome to C (not C++) where arrays and pointers are [B]almost[/B] synonymous. Consider an STL [ICODE]vector<tuple<int,int,int> >[/ICODE] instead? | |
Re: It isn't terribly difficult. Go to spamgourmet.com and read about what they do and (a little) how they do it. The basic bit is that there is a database that maps "what the sender sees" emails to an actual email; and a forwarder that uses that map. Spamgourmet also handles … | |
Re: What Girbouillis said. In addition, we have evidence that defining operators sometimes leads to brittle or even chaotic programs: C++ allows operators to be overloaded, both for your own types and others. The results, when done very carefully are both useful and powerful, but when done without enough thought about … |
The End.