761 Posted Topics

Member Avatar for ryan461

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 …

Member Avatar for ryan461
0
127
Member Avatar for saima.H

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 …

Member Avatar for goshe17
-1
1K
Member Avatar for brazentongue

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 …

Member Avatar for griswolf
0
219
Member Avatar for moroccanplaya

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.

Member Avatar for griswolf
0
361
Member Avatar for Leppie

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] …

Member Avatar for daviddoria
0
149
Member Avatar for andydeans

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)

Member Avatar for andydeans
0
568
Member Avatar for muldrok

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 …

Member Avatar for mmanceli2010
0
206
Member Avatar for lewashby

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]

Member Avatar for Ancient Dragon
0
137
Member Avatar for kbrill

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 …

Member Avatar for kbrill
0
2K
Member Avatar for avarionist

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 …

Member Avatar for NathanOliver
0
376
Member Avatar for blue6dImension

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: …

Member Avatar for bbman
0
183
Member Avatar for runit

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 …

Member Avatar for ultimatebuster
0
261
Member Avatar for Grep

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.

Member Avatar for Grep
0
189
Member Avatar for becker
Member Avatar for griswolf
0
76
Member Avatar for akand

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.

Member Avatar for griswolf
0
63
Member Avatar for upstream
Member Avatar for upstream
0
195
Member Avatar for War_Archer

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 ':'? …

Member Avatar for akand
0
142
Member Avatar for prashanth s j

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 …

Member Avatar for prashanth s j
0
145
Member Avatar for CobRalf

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 …

Member Avatar for griswolf
0
643
Member Avatar for vulcano224

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]

Member Avatar for griswolf
0
107
Member Avatar for andydeans

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 …

Member Avatar for andydeans
0
5K
Member Avatar for SoulMazer

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 …

Member Avatar for SoulMazer
0
196
Member Avatar for btml

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 …

Member Avatar for Banfa
0
173
Member Avatar for andydeans

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]

Member Avatar for andydeans
0
242
Member Avatar for urbangeek

[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 …

Member Avatar for urbangeek
0
163
Member Avatar for elvis1

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".

Member Avatar for elvis1
0
332
Member Avatar for 12"tool

This is an insufficient description of the problem, and it probably needs to be in the Access/Filemaker forum.

Member Avatar for griswolf
0
46
Member Avatar for xsach

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 …

Member Avatar for cfajohnson
0
184
Member Avatar for dsmush

Have you considered just using a "standard" CMS? There are lots of them already written and in daily use...

Member Avatar for dsmush
0
181
Member Avatar for SD91

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.

Member Avatar for griswolf
0
147
Member Avatar for tennis

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 …

Member Avatar for griswolf
0
83
Member Avatar for beforetheyknew

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 …

Member Avatar for Bluefox815
0
710
Member Avatar for khess
Member Avatar for griswolf
0
707
Member Avatar for alphaOri

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 …

Member Avatar for alphaOri
0
151
Member Avatar for ramy89

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 …

Member Avatar for ramy89
0
113
Member Avatar for mhopper

please use the CODE tags around your code (you can highlight than choose the '#' button in the message box).

Member Avatar for mhopper
0
8K
Member Avatar for kelokely

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 …

Member Avatar for baki100
0
119
Member Avatar for mahle

what is the specific problem that translates to "not working correctly"?

Member Avatar for tyson.crouch
0
102
Member Avatar for gfx

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 …

Member Avatar for griswolf
0
106
Member Avatar for kurtiskain

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?

Member Avatar for griswolf
0
139
Member Avatar for ihatehippies

"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 …

Member Avatar for TrustyTony
0
2K
Member Avatar for Jimmy Giles

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) …

Member Avatar for peter_budo
0
330
Member Avatar for Jessie21

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 …

Member Avatar for griswolf
0
94
Member Avatar for abhelp

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 …

Member Avatar for griswolf
0
641
Member Avatar for sanagopi

[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)

Member Avatar for sanagopi
0
130
Member Avatar for niyujin

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: …

Member Avatar for gusano79
0
201
Member Avatar for radioflyer1

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.

Member Avatar for griswolf
0
154
Member Avatar for frenchie4111

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?

Member Avatar for frenchie4111
0
181
Member Avatar for jayreis

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 …

Member Avatar for jayreis
0
153
Member Avatar for TrustyTony

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 …

Member Avatar for TrustyTony
0
338

The End.