You mean "ANY" browser, or just the usual suspects like Firefox, Opera or IE?
Alex Edwards commented: Wow, that is a very subtle pointer-arithmetic issue come to light. +4
Ancient Dragon commented: great suggestion :) +36
You mean "ANY" browser, or just the usual suspects like Firefox, Opera or IE?
Tell me, if the task was to implement it in Java, would you need the same amount of help?
Just do some research (I already gave you one link) and then try and implement it.
Yes, things like
- create list, add node, remove node
would seem like reasonable interfaces to the list class.
It uses 4 consecutive addresses.
All the addresses you specify are the start address, then the length modifier tells the processor whether to fetch 1, 2, or 4 bytes.
http://en.wikipedia.org/wiki/Algorithmics_of_sudoku
Y'know, try using a search engine once in a while.
Keep looking, some of them tell you how opcodes are encoded at the bit level.
Google "8086 processor reference manual"
http://www.catb.org/~esr/faqs/smart-questions.html#writewell
Most of us have got better things to do than to parse large amounts of kiddie/sms speak.
This is a forum, not a chat room.
Perhaps remove the c++ and d++ inside your for loops?
Did you initialise things to 0 before trying to add things?
There's nothing to stop you from implementing your own "adjacency linked list implementation".
How about "adjacency linked list implementation"
Then make a directed graph based on that, and implement the traversal function.
Read your book / course notes on the 'if' statement, and post an attempt.
DB DC etc also need to be char* as well.
As does your baseAddrTable, it too needs to be an array of char*
Rather than mess about with memory allocation (which is just as hard as the real problem you need to answer), start with.
const int MAX = 20;
void initsquare( int square[][MAX] ) {
for ( int r = 0 ; r < MAX ; r++ ) {
for ( int c = 0 ; c < MAX ; c++ ) {
square[r][c] = 0;
}
}
}
int main ( ) {
int square[MAX][MAX];
initsquare( square );
int n;
cout << "How big?";
cin >> n;
// check it's < MAX, then do your thing
}
When you've got the rest of the code working, then (if you want), it's a relatively painless transition to using a dynamic solution based on something you know that works.
So which ops are confusing you?
addition, multiply?
You should at least be able to string a few instructions together to attempt one of the expressions.
> No, that line was never being used in my code
You mean you weren't using str later on.
But it was still doing all the work, marching off into unknown memory and the like.
> pTemp = nnptr->link->link;
This will break if you only have 1 node in the list.
> acmetype *head;
> inputfn(head);
Does input initialise the list?
Or is the end of the list whatever junk your uninitialised variable was pointing to.
1. You want to be doing the %2 on the data in each node.
2. You need to be appending the found node to either the odd list or the even list, and NOT returing after the first match.
> how will n = a|(b<<8)|(c<<16)|(d<<24); be portable regardless of endian ? You still have > to shuffle the variables to match the endian setting.
Well you read the spec.
If the spec says a is the LSB and d is the MSB, then that is what you write, regardless of the endian of the machine which is doing the processing.
Likewise, if the spec says a is the MSB and d is the LSB, then you write
n = d|(c<<8)|(b<<16)|(a<<24);
Without that kind of information, simply saying "put these 4 bytes into a long word" is a pretty meaningless request.
> Unfortunately bit shifting is somewhat expensive from a performance stand point.
How so?
All but the most simplistic processors have these nowadays.
http://en.wikipedia.org/wiki/Barrel_shifter
It's even free on some MIPS processors IIRC.
As with all code, you should first work on making it right, before worrying about making it fast. The bit-shifting approach will ALWAYS give you a predictable answer irrespective of your machines endian, or whatever alignment restrictions which might blow up the dubious casting.
If you have >file
to redirect stdout to a file,
then adding this to the command line 2>&1
will also redirect stderr to the file as well.
You can have as many awk commands as you like
Eg
awk '
/Exception happened/ { print }
/Argument missing/ { print "19878 Static Fixed known error" }
{ print }' file.txt
> but removing the str = idNode + "\t"; seems to have fixed the segfault.
Yeah, idNode is an int, and "\t" is a string constant.
Which basically means a char at "\t"[idNode]
Which is perfectly valid (if obscure) code, so long as idNode is actually zero, but would be increasingly way off the end of the array until (inevitably) you stepped off the end of valid memory and got a segfault.
Didn't you see lots of random garbage instead of the "nnn\t" you were expecting whilst testing this code?
Or without casts and tricky subscript maths
char (*st2)[133] = new char[st.size()][133];
for(int i = 0; i < st.size(); i++)
strcpy(st2[i], st[i].c_str());
fn(st2, st.size());
When you hit the segfault, use the "up" command a couple of times so you're looking at this frame
#2 0x000171f8 in Compressor::compress ()
Then list the source code lines so you know exactly where you are.
Then start examining variables (in particular, whatever string you're trying to assign) to see if it's valid.
Maybe your parser returned rubbish.
> The program seems to stop at line 96212. Any ideas?
Use a counting breakpoint at some point where a whole line is read, and make it run for 96211 times. Then start single stepping until you discover something new.
Read up on ncurses if you want advanced control of a terminal environment.
> while( fread(mybigbuff, 1024, 1, fp) )
> {
> char* p = strtok(text,",");
You're not tokenising what you read.
You're not using the fread result to work out where the end of the buffer is
You're not appending a \0 to stop strtok() from going into the weeds (see previous posts)
Including maintenance effort for the next how many years (say 20), that's exactly what I'm saying (and that's probably very light).
The author leaves, some undiscovered bug lies hidden for a couple of further years and then some poor maintenance guy is left with "WTF!!!???" and the hours tick by....
Sure, you could probably lash something together in about 10 minutes, but that's nowhere near the total cost.
Every time someone reads the code, rather than skipping over some intuitive and familiar fgets() call, they spend a few seconds or minutes wondering whether the tricky fread() and buffer manipulation is doing what it's supposed to (more time on the clock).
So you're saying that the topic is basically wrong and it should have been "help to display a menu", and all that stuff about Gauss and coefficients was just a red herring to throw everyone off to thinking about a completely different issue.
Have you tried Chewie-DK's answer?
Whilst 80 to 8 seems like a good win with minimal effort, I'm not sure that 8 seconds down to 1 or 2 is of any further benefit, given the sudden jump in code complexity (time to write, time to debug, time to maintain).
If it takes you 8 hours to do that, that's 28800 seconds.
At a saving of say 6 seconds a run, that's 4800 runs before you break even.
So did you open the file in binary mode then?
Not being able to test things at the moment, I would have thought something like this may have been useful.
FILE* fp = fopen(fname, "r");
char buff[BUFSIZ]; // for fgets
int x = setvbuf(fp, (char *)NULL, _IOFBF, BUFSIZ*10); // underlying reader reads large amounts
while ( fgets( buff, sizeof buff, fp ) != NULL ) {
// do something with a line
}
On a byte for byte basis, fgets() is more expensive than fread() because it is parsing the stream looking for newlines. But if you decide to fread(), then you need to replicate some of that behaviour yourself (for the split last line I mentioned previously).
How is that any different from calling fgets(buffer, sizeof buffer, stdin )
How are you reading the files?
Because "ΓΏ" is char 255, which is the same (typically) as (char)EOF
That is, you reached the end of the file, but did not detect EOF properly, but instead cast it to a char.
> what is ISO C++ forbids comparison between pointer and integer?
Or ISO C++ forbids comparison between elephant and battle ship.
The fact that both are large, grey and heavy doesn't mean that they are in any way the same thing.
In the same way that pointers and integers are represented by something similar (ie, bits), doesn't make the whole entities comparable.
Whilst you can compare any integer with any other integer, the same is not true of pointers. Pointer comparison is only allowed where the two pointers point to members of the same object (say for example, two elements of an array). Picking two pointers at random (say the result of two malloc calls) and trying to compare them is undefined.
> running the following code with fgets the 162 mb file is read in 8 secs
> running with fread it is read in 2 secs.
Careful, make sure the second one isn't benefitting from the first one causing information to be cached somewhere.
The problem with using fread() for line oriented data is that you have a hell of a repair job with the last line.
Eg, suppose the two consecutive fread() calls look like this red/green
Monday,1.1,1.2,1.3,1.4,1.5,1.6,1.7
Tuesday,1.1,1.2,1.3,1.4,1.5,1.6,1.7
Wednesday,1.1,1.2,1.3,1.4,1.5,1.6,1.7
Nor (as your example so aptly shows the lack of) will fread() automatically append a \0 to the buffer to stop things like strrok from wandering off into the weeds.
> if you can than pls send me some ideas with details.
Could do, but I'm not.
I've made plenty of suggestions on other forums on this site, but they just get ignored. So I really don't give a toss about "suggest a project" threads anymore.
Imagine this scenario in a few years time, at your first job interview (with your nice glossy degree in your hands). The interviewer asks
"So, what motivated you to choose this project and what problems did you face along the way?"
Now, if you actually get off your ass and get down to some self motivation, you'll be able to come up with a pretty good answer.
Otherwise your "Umn, some dude on the net suggested it and I did some googling" is NOT going to get you a job.
If you go into the device manager, is the USB subsystem working properly, or does it have any yellow warning triangles.
Could be a driver problem as you say.
"Higher language Vs. Assembly language. "
That's the title of a thread on this forum.
Which is basically what you just asked.
Maybe this linux based tool?
http://home.eunet.no/pnordahl/ntpasswd/bootdisk.html
> the administrator won't let me use illegal software.
So hand the machine over to them, and let them earn their keep for a day or two while you get on with something else.
Have you tried other memory cards in your PC?
Have you tried your memory card in another PC?
So nothing in the past few years of study have ever prompted you to think "hey, this would make a great final year project".
What, were you just along for the ride and hope the magic piece of paper will guarantee you fame and fortune?
Even if we give you topics, the next inevitable question would be "how would I do it", because you've just demonstrated that you can't think for yourself simply by asking the question.
http://www.rocketaware.com/man/man2/rename.2.htm
IIRC, the MacOS is a POSIX compliant OS (or close enough anyway) that functions like this should be available to you as well
Since you said "mobile", I take it we can't assume that you're talking about a windows desktop environment.
In other words, be specific!
list in my example was a file, not a command.
> I want to loop through the dir to cat the last 21 lines of each file and put all the output to another file for i in *; do tail -21 $i; done
Or begin with for i in *; do echo $i; done
just to see what the for loop would use for filenames
http://www.adrianxw.dk/SoftwareSite/Consoles/Consoles1.html
Skip ahead a few pages to where it deals with win32 console input functions.